Browse Source

MorkTM

样式分支
NXX 2 years ago
parent
commit
a000f4cb97
100 changed files with 5258 additions and 2410 deletions
  1. +79
    -37
      BPASmartClient.AGV/AGVHelper.cs
  2. +2
    -2
      BPASmartClient.AgvApi/Factory.cs
  3. +3
    -0
      BPASmartClient.AgvApi/PersonHub.cs
  4. +1
    -1
      BPASmartClient.AgvApi/Program.cs
  5. +9
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  6. +76
    -0
      BPASmartClient.CustomResource/Converters/ToastIconConverter.cs
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs
  13. +27
    -0
      BPASmartClient.CustomResource/Pages/Model/TextToImage.cs
  14. +2
    -1
      BPASmartClient.CustomResource/Pages/Model/UserManager.cs
  15. +2
    -1
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  16. +5
    -4
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  17. +1
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
  18. +2
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  19. +1
    -1
      BPASmartClient.CustomResource/Themes/Generic.xaml
  20. +125
    -75
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  21. +69
    -0
      BPASmartClient.CustomResource/UserControls/Bottle.xaml
  22. +94
    -0
      BPASmartClient.CustomResource/UserControls/Bottle.xaml.cs
  23. +81
    -0
      BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml
  24. +137
    -0
      BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml.cs
  25. +1116
    -1109
      BPASmartClient.CustomResource/UserControls/DosingSystem.xaml
  26. +17
    -0
      BPASmartClient.CustomResource/UserControls/Enum/ToastIcons.cs
  27. +31
    -0
      BPASmartClient.CustomResource/UserControls/Enum/ToastLocation.cs
  28. +27
    -27
      BPASmartClient.CustomResource/UserControls/IcoButton.cs
  29. +39
    -0
      BPASmartClient.CustomResource/UserControls/Model/ToastOptions.cs
  30. +67
    -0
      BPASmartClient.CustomResource/UserControls/MotorBottle.xaml
  31. +69
    -0
      BPASmartClient.CustomResource/UserControls/MotorBottle.xaml.cs
  32. +63
    -0
      BPASmartClient.CustomResource/UserControls/Pipeline.xaml
  33. +59
    -0
      BPASmartClient.CustomResource/UserControls/Pipeline.xaml.cs
  34. +68
    -0
      BPASmartClient.CustomResource/UserControls/Toast.xaml
  35. +480
    -0
      BPASmartClient.CustomResource/UserControls/Toast.xaml.cs
  36. +1
    -0
      BPASmartClient.HubHelper/BPASmartClient.HubHelper.csproj
  37. +5
    -3
      BPASmartClient.HubHelper/HubHelper.cs
  38. +10
    -4
      BPASmartClient.KLMCoffee/CoffeeMachine.cs
  39. +5
    -5
      BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs
  40. +29
    -29
      BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs
  41. +11
    -11
      BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs
  42. +8
    -8
      BPASmartClient.Model/咖啡机/Enum/DrinkType.cs
  43. +58
    -0
      BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs
  44. +1
    -1
      BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs
  45. +1
    -0
      BPASmartClient.Model/订单/MorkTSimOrder.cs
  46. +1
    -2
      BPASmartClient.MorkF/Control_MorkF.cs
  47. +0
    -1
      BPASmartClient.MorkS/Control_Morks.cs
  48. +0
    -13
      BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj
  49. +0
    -317
      BPASmartClient.MorkTJuicer/Control_MORKJC.cs
  50. +0
    -8
      BPASmartClient.MorkTJuicer/GVL_MORKJC.cs
  51. +0
    -15
      BPASmartClient.MorkTM/Alarm.cs
  52. +1
    -0
      BPASmartClient.MorkTM/Control_MorkTM.cs
  53. +1
    -0
      BPASmartClient.MorkTM/GVL_MorkTM.cs
  54. +0
    -31
      BPASmartClient.MorkTM/Model/Alarms.cs
  55. +1
    -5
      BPASmartClient.MorkTM/OrderLocInfo.cs
  56. +0
    -16
      BPASmartClient.MorkTM/Properties/AssemblyInfo.cs
  57. +0
    -63
      BPASmartClient.MorkTM/Properties/Resources.Designer.cs
  58. +0
    -101
      BPASmartClient.MorkTM/Properties/Resources.resx
  59. +0
    -26
      BPASmartClient.MorkTM/Properties/Settings.Designer.cs
  60. +0
    -6
      BPASmartClient.MorkTM/Properties/Settings.settings
  61. +5
    -5
      BPASmartClient.MorkTM/View/Debug.xaml
  62. +1
    -4
      BPASmartClient.MorkTM/View/Debug.xaml.cs
  63. +0
    -50
      BPASmartClient.MorkTM/View/Monitor.xaml
  64. +0
    -27
      BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs
  65. +16
    -0
      BPASmartClient.MorkTSingle/BPASmartClient.MorkTSingle.csproj
  66. +315
    -0
      BPASmartClient.MorkTSingle/Control_MORKJC.cs
  67. +23
    -0
      BPASmartClient.MorkTSingle/GVL_MORKJC.cs
  68. +20
    -0
      BPASmartClient.MorkTSingle/OrderLocInfo.cs
  69. +28
    -15
      BPASmartClient.MorkTSingle/PolymerBatching.cs
  70. +39
    -0
      BPASmartClient.MorkTSingle/View/DebugView.xaml
  71. +5
    -11
      BPASmartClient.MorkTSingle/View/DebugView.xaml.cs
  72. +47
    -0
      BPASmartClient.MorkTSingle/ViewModel/DebugViewModel.cs
  73. +1
    -1
      BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
  74. +2
    -2
      BPASmartClient.MorkT_Container/GVL_MorkT.cs
  75. +9
    -1
      BPASmartClient.SerialPort/SerialPortClient.cs
  76. +2
    -2
      BPASmartClient/App.config
  77. +2
    -2
      BPASmartClient/BPASmartClient.csproj
  78. +10
    -8
      DosingSystem/App.xaml.cs
  79. +27
    -0
      DosingSystem/Model/DeviceCurrentStatus.cs
  80. +8
    -0
      DosingSystem/View/DeviceListView.xaml
  81. +295
    -3
      DosingSystem/View/HardwareStatusView.xaml
  82. +4
    -2
      DosingSystem/View/NewRecipeView.xaml
  83. +81
    -7
      DosingSystem/View/RecipeControlView.xaml
  84. +159
    -5
      DosingSystem/View/RecipeSettingsView.xaml
  85. +20
    -0
      DosingSystem/View/RecipeSettingsView.xaml.cs
  86. +16
    -0
      DosingSystem/ViewModel/HardwareStatusViewModel.cs
  87. +16
    -0
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  88. +3
    -1
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  89. +13
    -4
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  90. +1
    -0
      FryPot_DosingSystem/AGV/WhichCart.cs
  91. +9
    -3
      FryPot_DosingSystem/App.xaml.cs
  92. +539
    -276
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  93. +27
    -0
      FryPot_DosingSystem/Control/GlobalVariable.cs
  94. +7
    -0
      FryPot_DosingSystem/FryPot_DosingSystem.csproj
  95. +1
    -0
      FryPot_DosingSystem/Model/RecipeManage.cs
  96. +12
    -1
      FryPot_DosingSystem/Model/RecipeModel.cs
  97. +391
    -0
      FryPot_DosingSystem/Resources/fonts/demo_index.html
  98. BIN
     
  99. +191
    -52
      FryPot_DosingSystem/View/AgvView.xaml
  100. +26
    -2
      FryPot_DosingSystem/View/AgvView.xaml.cs

+ 79
- 37
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)
@@ -47,7 +48,7 @@ namespace BPASmartClient.AGV
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.Headers["header"] = head;
//request.Proxy = new WebProxy("192.168.1.12",80);
request.Proxy = null;
byte[] bytes = Encoding.UTF8.GetBytes(body);
request.ContentType = "application/json; charset=UTF-8"; ;//窗体数据被编码为名称/值对形式
//request.ContentType = "application/json";
@@ -55,7 +56,7 @@ namespace BPASmartClient.AGV
Stream myResponseStream = request.GetRequestStream();
myResponseStream.Write(bytes, 0, bytes.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);//解码
string retString = myStreamReader.ReadToEnd();
myStreamReader.Close();
myResponseStream.Close();
@@ -71,10 +72,28 @@ namespace BPASmartClient.AGV
return retString;//返回响应报文
}
/// <summary>
/// MD5哈希摘要转16进制
/// </summary>
/// <param name="body"></param>
/// <returns></returns>
public string MD5Deal(string body)
{
//如果启用签名 用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++)
{
build.Append(bte[i].ToString("X"));
}
return build.ToString();
}
/// <summary>
/// AGV去1号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineOneLoadRoller(string robotJobId)
public string AgvToLineOneLoadRoller(string robotJobId)
{
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
@@ -85,7 +104,7 @@ namespace BPASmartClient.AGV
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
@@ -100,7 +119,8 @@ namespace BPASmartClient.AGV
//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(','));//格式处理,看需求
//// string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求

////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
@@ -110,11 +130,13 @@ namespace BPASmartClient.AGV
////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)
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -157,11 +179,13 @@ namespace BPASmartClient.AGV
////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)
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -204,11 +228,13 @@ namespace BPASmartClient.AGV
////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)
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -251,11 +277,13 @@ namespace BPASmartClient.AGV
////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)
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -298,11 +326,13 @@ namespace BPASmartClient.AGV
////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)
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -345,11 +375,13 @@ namespace BPASmartClient.AGV
////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)
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -392,11 +424,13 @@ namespace BPASmartClient.AGV
////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)
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -439,11 +473,13 @@ namespace BPASmartClient.AGV
////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)
//if (objData != null && objData is HttpResponseBodyModel response)
//{
// return response.Body?.code;
// return response.code;
//}
return "Analysis Error";
}
@@ -465,11 +501,13 @@ 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)
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.Body?.code;
return response.code;
}
return "Analysis Error";
}
@@ -490,12 +528,14 @@ 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)
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.Body?.code;
return response.code;
}
return "Analysis Error";
}
@@ -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,14 +558,16 @@ 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)
if (objData != null && objData is HttpResponseBodyModel response)
{
return response.Body?.code;
return response.code;
}
return "Analysis Error";
}


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


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

@@ -32,6 +32,7 @@
<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" />
@@ -120,6 +121,7 @@
<None Remove="Image\智慧城市科技风登录页面边框.png" />
<None Remove="Image\有告警.png" />
<None Remove="Image\标题背景.png" />
<None Remove="Image\浅色背景.jpeg" />
<None Remove="Image\环形切图\内圈\未选中.png" />
<None Remove="Image\环形切图\内圈\选中.png" />
<None Remove="Image\环形切图\占位.png" />
@@ -162,6 +164,7 @@
<None Remove="Image\窗体样式\Tab\Tab_SelectBJ.png" />
<None Remove="Image\窗体样式\Tab\Tab_SelectWZBJ.png" />
<None Remove="Image\竖线.png" />
<None Remove="Image\纹理背景.jpeg" />
<None Remove="Image\维护.png" />
<None Remove="Image\背景.png" />
<None Remove="Image\背景2.png" />
@@ -184,6 +187,7 @@
<None Remove="Image\表格\表格顶右.png" />
<None Remove="Image\表格\表格顶左.png" />
<None Remove="Image\表格标题背景2.png" />
<None Remove="Image\调味品.jpeg" />
<None Remove="Image\边框效果2.png" />
<None Remove="Image\边角.png" />
<None Remove="Image\退出.png" />
@@ -238,6 +242,7 @@
<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" />
@@ -263,14 +268,17 @@
<Resource Include="Image\工艺流程.png" />
<Resource Include="Image\智慧城市科技风登录页面.png" />
<Resource Include="Image\智慧城市科技风登录页面边框.png" />
<Resource Include="Image\浅色背景.jpeg" />
<Resource Include="Image\界面2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Image\圆角矩形 30 拷贝.png" />
<Resource Include="Image\登录界面背景.jpg" />
<Resource Include="Image\登录界面背景1.jpg" />
<Resource Include="Image\纹理背景.jpeg" />
<Resource Include="Image\背景2.png" />
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\调味品.jpeg" />
<Resource Include="Image\边角.png" />
</ItemGroup>

@@ -294,6 +302,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


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

@@ -9,8 +9,8 @@ namespace BPASmartClient.CustomResource.Pages.Model
public class AlarmInfo
{
public AlarmInfo()
{
{
}
/// <summary>
/// 1 号滚筒线故障


+ 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/Model/UserManager.cs View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -8,6 +9,6 @@ namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserManager
{
public List<UserInfo> userInfos { get; set; } = new List<UserInfo>();
public ObservableCollection<UserInfo> userInfos { get; set; } = new ObservableCollection<UserInfo>();
}
}

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


+ 5
- 4
BPASmartClient.CustomResource/Pages/View/MainView.xaml View File

@@ -442,10 +442,12 @@
</Border>

<ScrollViewer
Name="scroll"
Grid.Row="1"
Margin="10"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
VerticalScrollBarVisibility="Hidden"
>
<ItemsControl ItemsSource="{Binding menuModels}">
<ItemsControl.ItemTemplate>
<DataTemplate>
@@ -550,9 +552,8 @@
FontSize="18"
Foreground="#1A8ADE"
Text="{Binding TimeVisible}" />

<ContentControl Grid.Row="1" Content="{Binding MainContent}" />

<ContentControl Grid.Row="1" Width="auto" Height="auto" Content="{Binding MainContent}" />
</Grid>

<!--#endregion-->


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

}
}

+ 2
- 1
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());
@@ -94,7 +95,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
/// <summary>
/// 开机自启
/// </summary>
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }
public RelayCommand<object> NavChangedCommand { get; set; }

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


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


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

@@ -176,7 +176,7 @@
<Style.Setters>
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
</Style.Setters>
</Style>

@@ -184,10 +184,10 @@
<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" />
@@ -373,17 +373,17 @@
<!--#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">
@@ -396,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>
@@ -419,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>
@@ -444,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" />
</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/炒锅.png" />
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/炒锅2.png" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -458,13 +471,13 @@

<Style x:Key="border碗" TargetType="Border">
<Style.Setters>
<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="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>
@@ -472,13 +485,13 @@

<Style x:Key="border菜" TargetType="Border">
<Style.Setters>
<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="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>
@@ -488,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>
@@ -498,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>
@@ -965,7 +998,7 @@
</Style.Setters>
</Style>
<!--#endregion-->
<!--#region Button-->
<Style x:Key="TitleBarStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
@@ -1843,11 +1876,11 @@
<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="FontFamily" Value="楷体" />
<Setter Property="Foreground" Value="#FFFCD5B5" />
</Style>

<Style TargetType="TextBlock">
<Style.Setters>
@@ -1956,10 +1989,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" />
@@ -1979,7 +2012,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">
@@ -2000,9 +2033,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" />
@@ -2012,19 +2045,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>
@@ -2034,10 +2084,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)));


}
}

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


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

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

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

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="6.0.6" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>

</Project>

+ 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();


+ 10
- 4
BPASmartClient.KLMCoffee/CoffeeMachine.cs View File

@@ -61,6 +61,8 @@ namespace BPASmartClient.KLMCoffee
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}


}

/// <summary>
@@ -102,6 +104,8 @@ namespace BPASmartClient.KLMCoffee

private void ResolveMsg()
{
status["CoffeeIsConnected"] = OnLine;
IsConnected = OnLine;
List<byte> temp = new List<byte>();
//一系列解包
while (dataStorage.GetSize() > 0)
@@ -170,12 +174,11 @@ namespace BPASmartClient.KLMCoffee
protected override void InitStatus()
{
status["CoffeeStatus"] = K95SysTemStatus.空闲状态;
status["CoffeedrinkType"] = DrinkType.意式;
status["CoffeedrinkType"] = DrinkType.意式咖啡;
status["CoffeeAppStatus"] = TaskIndex.无任务;
status["Coffeeprogress"] = 0;
status["CoffeeWarning"] = new FaultMessage(0x00, 0x00).dataFault();
status["CoffeeKeep"] = new UpkeepMessage(0x00).dataFault();

}

public override void Init()
@@ -189,9 +192,12 @@ namespace BPASmartClient.KLMCoffee
try
{
free = true;
Thread.Sleep(200);
byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode));
Thread.Sleep(300);
K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode;
//byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode));
byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString());
commProxy.SendData(data);
MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成");
Thread.Sleep(200);
free = false;
}


+ 5
- 5
BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs View File

@@ -89,12 +89,12 @@ namespace BPASmartClient.KLMCoffee.Protocal
{
switch (me)
{
case DrinkType.意式: return "01";
case DrinkType.美式: return "02";
case DrinkType.意式咖啡: return "01";
case DrinkType.美式咖啡: return "02";
case DrinkType.热水: return "03";
case DrinkType.卡布: return "04";
case DrinkType.玛朵: return "05";
case DrinkType.拿铁: return "06";
case DrinkType.卡布奇诺: return "04";
case DrinkType.玛琪雅朵: return "05";
case DrinkType.拿铁咖啡: return "06";
case DrinkType.热牛奶: return "07";
case DrinkType.热奶沫: return "08";
default: return "01";


+ 29
- 29
BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs View File

@@ -11,34 +11,34 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// </summary>
public enum K95deFaultCoffeeEnum
{
意式咖啡,
美式咖啡,
咖啡意式咖啡,
卡布奇诺,
玛琪雅朵,
拿铁,
白咖啡,
芮斯崔朵,
意式玛奇朵,
奶油咖啡,
双杯意式咖啡,
双杯卡布奇诺,
双杯拿铁,
双杯玛琪雅朵,
双杯白咖啡,
双杯咖啡,
双杯芮斯崔朵,
双杯意式玛奇朵,
双杯奶油咖啡,
热水,
牛奶,
奶沫,
大壶咖啡,
取消制作,
放杯确认,
清洗冲泡器,
清洗奶沫器,
清洗奶沫器确认,
状态查询
意式咖啡 = 1,
美式咖啡 = 2,
咖啡意式咖啡 = 9,
卡布奇诺 = 4,
玛琪雅朵 = 5,
拿铁 = 6,
白咖啡 = 14,
芮斯崔朵 = 10,
意式玛奇朵 = 13,
奶油咖啡 = 12,
双杯意式咖啡 = 51,
双杯卡布奇诺 = 55,
双杯拿铁 = 57,
双杯玛琪雅朵 = 56,
双杯白咖啡 = 59,
双杯咖啡 = 52,
双杯芮斯崔朵 = 53,
双杯意式玛奇朵 = 58,
双杯奶油咖啡 = 54,
热水 = 3,
牛奶 = 7,
奶沫 = 8,
大壶咖啡 = 11,
取消制作 = 200,
放杯确认 = 201,
清洗冲泡器 = 202,
清洗奶沫器 = 203,
清洗奶沫器确认 = 204,
状态查询 = 205
}
}

+ 11
- 11
BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs View File

@@ -63,7 +63,7 @@ namespace BPASmartClient.KLMCoffee.Protocal

public RecipeModel()
{
饮品类型 = DrinkType.意式;
饮品类型 = DrinkType.意式咖啡;
咖啡量 = 0;
咖啡温度 = TempEnum.低;
咖啡浓度 = CoffeeConcentration.清淡;
@@ -125,22 +125,22 @@ namespace BPASmartClient.KLMCoffee.Protocal
{
switch (drink)
{
case DrinkType.意式:
case DrinkType.意式咖啡:
return GetItalian(60);
break;
case DrinkType.美式:
case DrinkType.美式咖啡:
return GetAmerican(60,450);
break;
case DrinkType.热水:
return GetHotWater(194);
break;
case DrinkType.卡布:
case DrinkType.卡布奇诺:
return GetCabo(60,17);
break;
case DrinkType.玛朵:
case DrinkType.玛琪雅朵:
return GetMacChiato(60,8,17);
break;
case DrinkType.拿铁:
case DrinkType.拿铁咖啡:
return GetLatte(60,8,17);
break;
case DrinkType.热牛奶:
@@ -166,7 +166,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_咖啡量">15-240</param>
public string GetItalian(int _咖啡量)
{
饮品类型 = DrinkType.意式;
饮品类型 = DrinkType.意式咖啡;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -187,7 +187,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_热水量">25-450</param>
public string GetAmerican(int _咖啡量,int _热水量)
{
饮品类型 = DrinkType.美式;
饮品类型 = DrinkType.美式咖啡;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -228,7 +228,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_奶沫时间">5-120</param>
public string GetCabo(int _咖啡量,int _奶沫时间)
{
饮品类型 = DrinkType.卡布;
饮品类型 = DrinkType.卡布奇诺;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -250,7 +250,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_奶沫时间">5-120</param>
public string GetMacChiato(int _咖啡量,int _牛奶时间,int _奶沫时间)
{
饮品类型 = DrinkType.玛朵;
饮品类型 = DrinkType.玛琪雅朵;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;
@@ -272,7 +272,7 @@ namespace BPASmartClient.KLMCoffee.Protocal
/// <param name="_奶沫时间">5-120</param>
public string GetLatte(int _咖啡量,int _牛奶时间,int _奶沫时间)
{
饮品类型 = DrinkType.拿铁;
饮品类型 = DrinkType.拿铁咖啡;
咖啡量 = _咖啡量;
咖啡温度 = TempEnum.中;
咖啡浓度 = CoffeeConcentration.适中;


+ 8
- 8
BPASmartClient.Model/咖啡机/Enum/DrinkType.cs View File

@@ -11,13 +11,13 @@ namespace BPASmartClient.Model.咖啡机.Enum
/// </summary>
public enum DrinkType
{
意式,
美式,
热水,
卡布,
奇朵,
拿铁,
热牛奶,
热奶沫
意式咖啡=0,
美式咖啡=1,
热水=2,
卡布奇诺=3,
琪雅朵=4,
拿铁咖啡=5,
热牛奶=6,
热奶沫=7,
}
}

+ 58
- 0
BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs View File

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

namespace BPASmartClient.Model.咖啡机.Enum
{
public enum KLMDrinkFaultType
{
意式咖啡 = 1,
美式咖啡 = 2,
咖啡意式咖啡 = 9,
卡布奇诺 = 4,
玛琪雅朵 = 5,
拿铁 = 6,
白咖啡 = 14,
芮斯崔朵 = 10,
意式玛奇朵 = 13,
奶油咖啡 = 12,
双杯意式咖啡 = 51,
双杯卡布奇诺 = 55,
双杯拿铁 = 57,
双杯玛琪雅朵 = 56,
双杯白咖啡 = 59,
双杯咖啡 = 52,
双杯芮斯崔朵 = 53,
双杯意式玛奇朵 = 58,
双杯奶油咖啡 = 54,
热水 = 3,
牛奶 = 7,
奶沫 = 8,
大壶咖啡 = 11
}
/*意式咖啡 = 1,
美式咖啡 = 2,
咖啡意式咖啡 = 9,
卡布奇诺 = 4,
玛琪雅朵 = 5,
拿铁 = 6,
白咖啡 = 14,
芮斯崔朵 = 10,
意式玛奇朵 = 13,
奶油咖啡 = 12,
双杯意式咖啡 = 51,
双杯卡布奇诺 = 55,
双杯拿铁 = 57,
双杯玛琪雅朵 = 56,
双杯白咖啡 = 59,
双杯咖啡 = 52,
双杯芮斯崔朵 = 53,
双杯意式玛奇朵 = 58,
双杯奶油咖啡 = 54,
热水 = 3,
牛奶 = 100,
奶沫 = 101,
大壶咖啡 = 11*/
}

+ 1
- 1
BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs View File

@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model
{
/// <summary>
@@ -22,6 +21,7 @@ namespace BPASmartClient.Model
/// 饮品类型
/// </summary>
public DrinkType DrinkCode { get; set; }
public KLMDrinkFaultType KLMDrinkFaultCode { get; set; }
}

/// <summary>


+ 1
- 0
BPASmartClient.Model/订单/MorkTSimOrder.cs View File

@@ -11,6 +11,7 @@ namespace BPASmartClient.Model
{
public int OrderNum { get; set; }
public DrCoffeeDrinksCode DrinkCode { get; set; }
public KLMDrinkFaultType KLMDrinkFaultCode { get; set; }
public int JuiceList { get; set; }
public string JuiceMakeID{ get; set; }
}


+ 1
- 2
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -845,7 +845,7 @@ namespace BPASmartClient.MorkF
/// </summary>
private void SingleProcess()
{

//主流程出餐完成,相应变量复位
if (morkF.MainOutMealComplete)
@@ -1950,7 +1950,6 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
}
}

}
if (morkF.MinorProessStatus)
{


+ 0
- 1
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -88,7 +88,6 @@ namespace BPASmartClient.MorkS
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");

}

public override void ResetProgram()


+ 0
- 13
BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj View File

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

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

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

</Project>

+ 0
- 317
BPASmartClient.MorkTJuicer/Control_MORKJC.cs View File

@@ -1,317 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading.Tasks;
using BPASmartClient.Device;
using BPA.Message.Enum;
using BPA.Message;
using BPASmartClient.Helper;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Model;
using BPASmartClient.EventBus;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.Model.PLC;
using BPASmartClient.Model.单片机;

namespace BPASmartClient.MorkTJuicer
{
/*
* 冰淇淋咖啡机组合套装
* 物料位置:
* 1:冰淇料
* 2:冰淇淋杯
* 5:咖啡
* 6:咖啡杯
* 9: 茶
* 10: 茶杯
*/
public class Control_MORKJC : BaseDevice
{
GVL_MORKJC mORKD = new GVL_MORKJC();
//物料存放位置
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>();
//容器位置
private string holderLoc;
//主料位置
private string mainMaterialLoc;
//子订单ID
private string subOrderId;

private bool enableFunny = false;
private DateTime lastRecvdOrder = DateTime.Now;
private bool working = false;
/// <summary>
/// 果汁机做法,true:热饮,false:冷饮
/// </summary>
private bool GuMake = false;

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}

//private SerialPortClient commProxy;
public void ConnectOk()
{

}
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>();
public void Init()
{
//构建所有商品物料信息
batchings = PolymerBatching.BuildAll();
Main();
ReadData();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
while (morkOrderPushes.Count > 0)
{
while (enableFunny) { Thread.Sleep(10); }
DeviceProcessLogShow("当前非自嗨模式,允许开工");
working = true;
if (morkOrderPushes.TryDequeue(out MorkOrderPush order))
{
DeviceProcessLogShow($"开始制作订单[{order.SortNum}]");
//商品类型
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
//子订单ID
subOrderId = order.SuborderId;
//遍历物料
foreach (var item in order.GoodBatchings)
{
var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
//获取主料和容器位置
switch (batchings[res.BatchingLoc].BatchingClass)
{
case BATCHING_CLASS.HOLDER:
holderLoc = res.BatchingLoc;
break;
case BATCHING_CLASS.MAIN_MATERIAL:
// mainMaterialLoc ="1";
mainMaterialLoc = res.BatchingLoc;
//验证商品是咖啡还是冰淇淋
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER)
{
//获取当前物料所属商品类型
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc);
}
break;
}
}
}
//根据商品类型执行具体制作流程
switch (currentGoodsType)
{
case GOODS_TYPE.JUICE:
GuMake = order.MakeID == "2";
DoJuicer();
break;
case GOODS_TYPE.NEITHER:
DeviceProcessLogShow("未知的商品类型");
break;
}
}
working = false;
lastRecvdOrder = DateTime.Now;
}
Thread.Sleep(1000);
}), "订单制作");
}

public void Main()
{
//开始心跳刷新,根据咖啡机及冰淇淋机来判断
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// Thread.Sleep(100);
//}), "MORK-IC心跳刷新");
}

public void DataParse<T>(T order)
{
if (order is MorkOrderPush morkOrderPush)
{
morkOrderPushes.Enqueue(morkOrderPush);
}
}

/// <summary>
///
/// </summary>
/// <param name="batchingLoc">物料位置</param>
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc)
{
if (batchings.ContainsKey(batchingLoc))
return batchings[batchingLoc].GoodsType;
return GOODS_TYPE.NEITHER;
}

private AutoResetEvent are = new AutoResetEvent(false);

private T GetStatus<T>(string key)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
return (T)(peripheralStatus[key]);
}
}
return default;
}

private void Wait(int value)
{
while (!((GetStatus<int>("Get_RobotAO1") == value) && GetStatus<int>("GetProgramStatus") == 0))//判断文件是否已经执行结束 且 文件末端变量值==文件名
{
Thread.Sleep(5);
}
}
int[] devStatusBy = new int[2] { 0, 0 };
/// <summary>
/// 果汁机控制信号
/// </summary>
private byte JuicerNum;
/// <summary>
/// 做果汁
/// </summary>
private void DoJuicer()
{
#region 接果汁流程
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
try
{
int JuicerNum1 = int.Parse(mainMaterialLoc);
switch (JuicerNum1)
{
case 52:
if (GuMake)
{
JuicerNum = 0x00;
}
else
{
JuicerNum = 0x01;
}
break;
case 53:
if (GuMake)
{
JuicerNum = 0x02;
}
else
{
JuicerNum = 0x03;
}
break;
case 54:
if (GuMake)
{
JuicerNum = 0x04;
}
else
{
JuicerNum = 0x05;
}
break;
case 55:
if (GuMake)
{
JuicerNum = 0x06;
}
else
{
JuicerNum = 0x07;
}
break;
default:
JuicerNum = 0x00;
break;
}
var devStatus = GetStatus<int[]>("GetDeviceStatus");
var devStatus1 = Convert.ToString(devStatus[0], 2);
var devStatus2 = devStatus[1];

if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0)
{
new WriteJuicer() { Value = JuicerNum }.Publish();

Thread.Sleep(100);
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
while (!(devStatusBy[1] == 0))
{
Thread.Sleep(100);
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
while (devStatusBy.Length != 2)
{
Thread.Sleep(100);
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
}
}
devStatusBy = GetStatus<int[]>("GetDeviceStatus");
Thread.Sleep(5000);
OrderChange(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
}
}
catch (Exception ex)
{
DeviceProcessLogShow("获取果汁机状态失败");
}
#endregion
}

public override DeviceClientType DeviceType => throw new NotImplementedException();


private T McuRead<T>(string tagName, object par)
{
new ReadMcu() { DeviceId = DeviceId, TagName = tagName, ReadPar = par };
if (peripheralStatus.ContainsKey(tagName))
{
if (peripheralStatus[tagName] != null)
{
return (T)peripheralStatus[tagName];
}
}
return default;
}

public void SimOrder<T>(T simOrder)
{

}
public override void DoMain()
{

}

public override void Stop()
{

}

public override void ReadData()
{

}

public override void MainTask()
{

}

public override void ResetProgram()
{

}
public override void SimOrder()
{
}
}
}

+ 0
- 8
BPASmartClient.MorkTJuicer/GVL_MORKJC.cs View File

@@ -1,8 +0,0 @@
using BPASmartClient.Device;

namespace BPASmartClient.MorkTJuicer
{
public class GVL_MORKJC : IStatus
{
}
}

+ 0
- 15
BPASmartClient.MorkTM/Alarm.cs View File

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

namespace BPASmartClient.MorkTM
{
public class Alarm: IAlarm
{
[Alarm("报警")]
public string Name { get; set; }
}
}

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

@@ -6,6 +6,7 @@ using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkTM;
using BPASmartClient.MorkTM.Model;
using System.Collections.Concurrent;
using static BPASmartClient.EventBus.EventBus;


+ 1
- 0
BPASmartClient.MorkTM/GVL_MorkTM.cs View File

@@ -1,6 +1,7 @@
using BPA.Models;
using BPASmartClient.Device;
using BPASmartClient.Model;
using BPASmartClient.MorkTM;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;


+ 0
- 31
BPASmartClient.MorkTM/Model/Alarms.cs View File

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

namespace BPASmartClient.MorkTM.Model
{
public class Alarms : ObservableObject
{
private string _id;
public string ID { get { return _id; } set { _id = value; OnPropertyChanged(); } }

private string _varName;
public string VarName { get { return _varName; } set { _varName = value; OnPropertyChanged(); } }

private string _plcAddress;
public string PLCAddress { get { return _plcAddress; } set { _plcAddress = value; OnPropertyChanged(); } }

private string _modbusTCP;
public string ModbusTCP { get { return _modbusTCP; } set { _modbusTCP = value; OnPropertyChanged(); } }

private string _value;
public string Value { get { return _value; } set { _value = value; OnPropertyChanged(); } }

private string _notes;
public string Notes { get { return _notes; } set { _notes = value; OnPropertyChanged(); } }
}
}

+ 1
- 5
BPASmartClient.MorkTM/OrderLocInfo.cs View File

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

namespace BPASmartClient.MorkTM
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
public ushort RecipeNumber { get; set; }
public string GoodName { get; set; }

public Dictionary<int, float> GoodPushes { get; set; }

}

}

+ 0
- 16
BPASmartClient.MorkTM/Properties/AssemblyInfo.cs View File

@@ -1,16 +0,0 @@
using System.Runtime.InteropServices;

[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)]

// 在此类的 SDK 样式项目中,现在,在此文件中早前定义的几个程序集属性将在生成期间自动添加,并使用在项目属性中定义的值进行填充。有关包含的属性以及如何定制此过程的详细信息,请参阅
// https://aka.ms/assembly-info-properties


// 将 ComVisible 设置为 false 会使此程序集中的类型对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,请将该类型的 ComVisible
// 属性设置为 true。

[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID。

[assembly: Guid("a100db3c-23af-4bd5-991e-224a062d4f2d")]

+ 0
- 63
BPASmartClient.MorkTM/Properties/Resources.Designer.cs View File

@@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace BPASmartClient.MorkTM.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BPASmartClient.MorkTM.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

+ 0
- 101
BPASmartClient.MorkTM/Properties/Resources.resx View File

@@ -1,101 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema

Version 1.3

The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.

Example:

... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>

There are any number of "resheader" rows that contain simple
name/value pairs.

Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.

The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:

Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.

mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

+ 0
- 26
BPASmartClient.MorkTM/Properties/Settings.Designer.cs View File

@@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace BPASmartClient.MorkTM.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

+ 0
- 6
BPASmartClient.MorkTM/Properties/Settings.settings View File

@@ -1,6 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

+ 5
- 5
BPASmartClient.MorkTM/View/Debug.xaml View File

@@ -224,7 +224,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
@@ -240,7 +240,7 @@
<Button Content="出料" Margin="40,0" Command="{Binding OutMaterials}" Style="{StaticResource buttonNormal}"
Width="80" Height="20"/>
</StackPanel>
<Button Grid.Column="1" Style="{StaticResource buttonNormal}" Height="20"
Width="120" Margin="20,0" HorizontalAlignment="Left"
Content="转盘转动" Command="{Binding TurnOn}" />
@@ -259,13 +259,13 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Viewbox Stretch="Fill">
</Viewbox>
<Button Content="制作"
Grid.Row="3" Grid.ColumnSpan="4"
HorizontalAlignment="Center"/>
</Grid>
</Grid>
</UserControl>

+ 1
- 4
BPASmartClient.MorkTM/View/Debug.xaml.cs View File

@@ -1,8 +1,6 @@
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;
@@ -16,14 +14,13 @@ using System.Windows.Shapes;
namespace BPASmartClient.MorkTM.View
{
/// <summary>
/// Debug.xaml 的交互逻辑
/// Debug1.xaml 的交互逻辑
/// </summary>
public partial class Debug : UserControl
{
public Debug()
{
InitializeComponent();
}
}
}

+ 0
- 50
BPASmartClient.MorkTM/View/Monitor.xaml View File

@@ -1,50 +0,0 @@
<UserControl x:Class="BPASmartClient.MorkTM.View.Monitor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkTM.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkTM.ViewModel"
mc:Ignorable="d"
Name="监控画面"
d:DesignHeight="450" d:DesignWidth="800">
<Control.DataContext>
<vm:MonitorViewModel/>
</Control.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Margin="5" >
<DataGrid Style="{StaticResource dataGrid_Style}" ItemsSource="{Binding alarms}"
x:Name="gridAlarm" Margin="5" AutoGenerateColumns="False" RowHeight="100"
LoadingRow="gridProducts_LoadingRow"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>

<DataGridTextColumn Header="ID" Binding="{Binding Path=ID ,Mode=TwoWay ,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="60"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="变量名" Binding="{Binding Path=VarName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="120"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="PLC地址" Binding="{Binding Path=PLCAddress,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="120"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="Modbus TCP地址" Binding="{Binding Path=ModbusTCP,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="170"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="当前值" Binding="{Binding Path=Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="100"
CellStyle="{StaticResource dataGridCell_Style}"/>
<DataGridTextColumn Header="注释" Binding="{Binding Path=Notes,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HeaderStyle="{StaticResource dataGridHeader_Style}" Width="*"
CellStyle="{StaticResource dataGridCell_Style}"/>
</DataGrid.Columns>
</DataGrid>

</Grid>
</UserControl>

+ 0
- 27
BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs View File

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

namespace BPASmartClient.MorkTM.ViewModel
{
public class MonitorViewModel: ObservableObject
{
public ObservableCollection<Alarms> alarms { get; set; } = new ObservableCollection<Alarms>();

public MonitorViewModel()
{
alarms.Add(new Alarms() { ID = "1", VarName = "1", ModbusTCP = "1", Notes = "1111", PLCAddress = "D1", Value = "33" });
alarms.Add(new Alarms() { ID = "2", VarName = "2", ModbusTCP = "2", Notes = "2222", PLCAddress = "D2", Value = "33" });
alarms.Add(new Alarms() { ID = "3", VarName = "3", ModbusTCP = "3", Notes = "3333", PLCAddress = "D2", Value = "33" });




}
}
}

+ 16
- 0
BPASmartClient.MorkTSingle/BPASmartClient.MorkTSingle.csproj View File

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

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

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.KLMCoffee\BPASmartClient.KLMCoffee.csproj" />
</ItemGroup>

</Project>

+ 315
- 0
BPASmartClient.MorkTSingle/Control_MORKJC.cs View File

@@ -0,0 +1,315 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Threading;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading.Tasks;
using BPASmartClient.Device;
using BPA.Message.Enum;
using BPA.Message;
using BPASmartClient.Helper;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Model;
using BPASmartClient.EventBus;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.Model.PLC;
using BPASmartClient.Model.单片机;
using BPASmartClient.Business;
using BPASmartClient.KLMCoffee.Protocal;
using BPASmartClient.Message;
namespace BPASmartClient.MorkTSingle
{
/*
* 冰淇淋咖啡机组合套装
* 物料位置:
* 1:冰淇料
* 2:冰淇淋杯
* 5:咖啡
* 6:咖啡杯
* 9: 茶
* 10: 茶杯
*/
public class Control_MORKJC : BaseDevice
{
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } }

GVL_MORKJC morkT = new GVL_MORKJC();
//物料存放位置
private Dictionary<string, PolymerBatching> batchings = new Dictionary<string, PolymerBatching>();
//容器位置
private string holderLoc;
//主料位置
private string mainMaterialLoc;
/// <summary>
/// 果汁机做法,true:热饮,false:冷饮
/// </summary>
private bool GuMake = false;

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });
}

//private SerialPortClient commProxy;
public void ConnectOk()
{

}
ConcurrentQueue<MorkOrderPush> morkOrderPushes = new ConcurrentQueue<MorkOrderPush>();
/// <summary>
///
/// </summary>
/// <param name="batchingLoc">物料位置</param>
private GOODS_TYPE ValidateGoodsByBatching(string batchingLoc)
{
if (batchings.ContainsKey(batchingLoc))
return batchings[batchingLoc].GoodsType;
return GOODS_TYPE.NEITHER;
}

private AutoResetEvent are = new AutoResetEvent(false);

private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}
DateTime delayTimeOut_Coffee;
private void DoCoffee()
{
if (IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && !morkT.IsCoffeeMake /*&& morkT.coffeeState== K95SysTemStatus.空闲状态*/)
{
Thread.Sleep(1000);
OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
new KLMCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, KLMDrinkFaultCode = (KLMDrinkFaultType)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
morkT.IsCoffeeMake = true;
}
else if (morkT.MakeCoffeeFinish && IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && morkT.IsCoffeeMake)
{
OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"{morkT.morkOrderPushesCoffee.ElementAt(0).GoodName}制作完成");
if (morkT.morkOrderPushesCoffee.TryDequeue(out OrderLocInfo orderloc))
{
morkT.IsCoffeeMake = false;
morkT.MakeCoffeeFinish = false;
Thread.Sleep(1000);
};
}
}

private T McuRead<T>(string tagName, object par)
{
new ReadMcu() { DeviceId = DeviceId, TagName = tagName, ReadPar = par };
if (peripheralStatus.ContainsKey(tagName))
{
if (peripheralStatus[tagName] != null)
{
return (T)peripheralStatus[tagName];
}
}
return default;
}

public void SimOrder<T>(T simOrder)
{

}
public override void DoMain()
{
if (Json<KeepDataBase>.Data.IsVerify)
{
IsHealth = true;
}
IsHealth = true;
serverInit();
DataParse();
}
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;
}
});
}
private void DataParse()
{

EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
DeviceProcessLogShow($"接收到{OrderCount}次订单");
batchings = PolymerBatching.BuildAll();
//商品类型
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
//验证商品是做的某种饮料
if (ValidateGoodsByBatching(res.BatchingLoc) != GOODS_TYPE.NEITHER)
{
//获取当前物料所属商品类型
currentGoodsType = ValidateGoodsByBatching(res.BatchingLoc);
}
switch (batchings[res.BatchingLoc].BatchingClass)
{
case BATCHING_CLASS.HOLDER:
holderLoc = res.BatchingLoc;
break;
case BATCHING_CLASS.MAIN_MATERIAL:
mainMaterialLoc = res.BatchingLoc;
break;
}
//根据商品类型执行具体制作流程
switch (currentGoodsType)
{
case GOODS_TYPE.COFFEE:

if (morkT.morkOrderPushesCoffee.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
{
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo()
{
SuborderId = order.MorkOrder.SuborderId,
BatchingId = res.BatchingId,
Loc = ushort.Parse(mainMaterialLoc),
GoodName = order.MorkOrder.GoodsName,
});
}
break;
case GOODS_TYPE.NEITHER:
DeviceProcessLogShow("未知的商品类型");
break;
}
}
}
}
});
}
public override void Stop()
{

}

public override void ReadData()
{

}
private bool bFirstTrig_Coffee = false;
public override void MainTask()
{
GetStatus("CoffeeStatus", new Action<object>((o) =>
{
if (o is int b)
{
morkT.coffeeState = (K95SysTemStatus)b;
}
}));
GetStatus("CoffeeIsConnected", new Action<object>((o) =>
{
if (o is bool b)
{
morkT.KLMCoffeeIsConnected = b;
}
}));
if ( morkT.morkOrderPushesCoffee.Count > 0) {
if (morkT.KLMCoffeeIsConnected)
{
if (morkT.IsCoffeeMake)
{
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
bFirstTrig_Coffee = false;
morkT.MakeCoffeeFinish = true;
});
if (morkT.MakeCoffeeFinish != true && morkT.MakeCoffeeFinish == false)
{
if (!bFirstTrig_Coffee)
{
bFirstTrig_Coffee = true;
delayTimeOut_Coffee = DateTime.Now;
}
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 60 && bFirstTrig_Coffee == true)
{
DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡");
bFirstTrig_Coffee = false;
morkT.MakeCoffeeFinish = true;
}
}
}
DoCoffee();
}
else
{
MessageLog.GetInstance.ShowEx("未读取到咖啡机设备心跳");
}
}
}

public override void ResetProgram()
{

}
public override void SimOrder()
{
EventBus.EventBus.GetInstance().Subscribe<MorkTSimOrder>(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
string guid = Guid.NewGuid().ToString();
if (@event != null && @event is MorkTSimOrder msm)
{
DeviceProcessLogShow("----开始模拟订单----");
morkT.morkOrderPushesCoffee.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.KLMDrinkFaultCode, SuborderId = guid, GoodName = "模拟咖啡订单" });
}
});
/*
string aa = calLrcCommon("01" + "05" + "0000000D");
string bb = ":01010001" + aa + "\r\n";*/
}
public static string calLrcCommon(string data)
{
try
{
if (data.Length % 2 != 0)
{
data = data + "0";
}
int total = 0;
int len = data.Length;
int num = 0;
while (num < len)
{
string s = data.Substring(num, 2);
total += Convert.ToInt32(s, 16);
num += 2;
}
total = ~total + 1;
string checkSum = (total & 255).ToString("x").ToUpper();
while (checkSum.Length < 2)
{
checkSum = "0" + checkSum;
}
return checkSum;
}
catch (Exception)
{
}
return "";
}
}
}

+ 23
- 0
BPASmartClient.MorkTSingle/GVL_MORKJC.cs View File

@@ -0,0 +1,23 @@
using BPASmartClient.Device;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using BPASmartClient.KLMCoffee.Protocal;

namespace BPASmartClient.MorkTSingle
{
public class GVL_MORKJC : IStatus
{
/// <summary>
/// 咖啡机订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesCoffee = new ConcurrentQueue<OrderLocInfo>();
public bool MakeCoffeeFinish = false;
public bool IsCoffeeMake = false;
public K95SysTemStatus coffeeState { get; set; }
/// <summary>
/// 咖乐美咖啡机心跳
/// </summary>
public bool KLMCoffeeIsConnected = false;
}
}

+ 20
- 0
BPASmartClient.MorkTSingle/OrderLocInfo.cs View File

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

namespace BPASmartClient.MorkTM
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
public ushort RecipeNumber { get; set; }
public string GoodName { get; set; }

public Dictionary<int, float> GoodPushes { get; set; }

}

}

BPASmartClient.MorkTJuicer/PolymerBatching.cs → BPASmartClient.MorkTSingle/PolymerBatching.cs View File

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

namespace BPASmartClient.MorkTJuicer
namespace BPASmartClient.MorkTSingle
{
internal enum GOODS_TYPE
{
@@ -13,6 +13,10 @@ namespace BPASmartClient.MorkTJuicer
/// </summary>
NEITHER,
/// <summary>
/// 咖啡
/// </summary>
COFFEE,
/// <summary>
/// 果汁
/// </summary>
JUICE
@@ -26,17 +30,30 @@ namespace BPASmartClient.MorkTJuicer

internal class PolymerBatching
{
internal const string Juicer_MAIN_BATCHIN1_LOC = "52";
internal const string Juicer_MAIN_BATCHIN2_LOC = "53";
internal const string Juicer_MAIN_BATCHIN3_LOC = "54";
internal const string Juicer_MAIN_BATCHIN4_LOC = "55";
internal const string COFFEE_HOLDER_LOC = "30";
internal const string TEA_HOLDER_LOC = "51";
public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() {
{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE},
{"1", GOODS_TYPE.COFFEE},
{"2", GOODS_TYPE.COFFEE},
{"3", GOODS_TYPE.COFFEE},
{"4", GOODS_TYPE.COFFEE},
{"5", GOODS_TYPE.COFFEE},
{"6", GOODS_TYPE.COFFEE},
{"9", GOODS_TYPE.COFFEE},
{"10", GOODS_TYPE.COFFEE},
{"11", GOODS_TYPE.COFFEE},
{"12", GOODS_TYPE.COFFEE},
{"13", GOODS_TYPE.COFFEE},
{"14", GOODS_TYPE.COFFEE},
{"51", GOODS_TYPE.COFFEE},
{"52", GOODS_TYPE.COFFEE},
{"53", GOODS_TYPE.COFFEE},
{"54", GOODS_TYPE.COFFEE},
{"55", GOODS_TYPE.COFFEE},
{"56", GOODS_TYPE.COFFEE},
{"57", GOODS_TYPE.COFFEE},
{"58", GOODS_TYPE.COFFEE},
{"59", GOODS_TYPE.COFFEE},
{"7", GOODS_TYPE.COFFEE},
{"8", GOODS_TYPE.COFFEE},
};

public GOODS_TYPE GoodsType { get; set; }
@@ -53,10 +70,6 @@ namespace BPASmartClient.MorkTJuicer
GoodsType = GOODS_TYPES[loc];
switch (loc)
{
case COFFEE_HOLDER_LOC:
case TEA_HOLDER_LOC:
BatchingClass = BATCHING_CLASS.HOLDER;
break;
default:
BatchingClass = BATCHING_CLASS.MAIN_MATERIAL;
break;

+ 39
- 0
BPASmartClient.MorkTSingle/View/DebugView.xaml View File

@@ -0,0 +1,39 @@
<UserControl x:Class="BPASmartClient.MorkTSingle.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:vm="clr-namespace:BPASmartClient.MorkTSingle.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="15*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock>咖啡:</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SimOrderCoffeeList}" />
<Button Command="{Binding SimOrderMakeCoffee}">制作</Button>
</StackPanel>
</Grid>
</UserControl>

BPASmartClient.MorkTM/View/Monitor.xaml.cs → BPASmartClient.MorkTSingle/View/DebugView.xaml.cs View File

@@ -13,23 +13,17 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

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

}

private void gridProducts_LoadingRow(object sender, DataGridRowEventArgs e)
{

}
}
}

+ 47
- 0
BPASmartClient.MorkTSingle/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,47 @@
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
namespace BPASmartClient.MorkTSingle.ViewModel;
public class DebugViewModel : ObservableObject
{
public RelayCommand SimOrderMakeCoffee { get; set; }
/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }
/// <summary>
/// 设备数据
/// </summary>
public ObservableCollection<VariableMonitor> variableMonitors { get; set; }
public List<string> Coffees { get; set; } = new List<string>();
public string SimOrderCoffeeList { get { return _simOrderCoffeeList; } set { _simOrderCoffeeList = value; OnPropertyChanged(); } }
public string _simOrderCoffeeList { get; set; }
public DebugViewModel()
{
foreach (KLMDrinkFaultType code in Enum.GetValues(typeof(KLMDrinkFaultType)))
{
Coffees.Add(code.ToString());
}
SimOrderCoffeeList = Coffees[0];
SimOrderMakeCoffee = new RelayCommand(() =>
{
new MorkTSimOrder() {KLMDrinkFaultCode = (KLMDrinkFaultType)Enum.Parse(typeof(KLMDrinkFaultType), SimOrderCoffeeList) }.Publish();
});
}
}


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

@@ -503,7 +503,7 @@ namespace BPASmartClient.MorkT_Container
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish();
Sence(GVL_MorkT.接咖啡);
//Wait();
new DRCoffee_MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
new DRCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, DrinkCode = (DrCoffeeDrinksCode)(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).Loc)}.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
}
else
{


+ 2
- 2
BPASmartClient.MorkT_Container/GVL_MorkT.cs View File

@@ -21,7 +21,7 @@ namespace BPASmartClient.MorkT_Container
public const int 取纸杯 = 10005;//安全位---取杯位
public const int 二次取杯 = 10008;//取纸杯检测位---二次取杯位
public const int 取纸杯检测 = 10006;//取杯位---取杯检测位
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---安全位
public const int 取杯位_机器人安全位 = 10002;//取杯检测位---模组移动安全位

public const int 接咖啡 = 10010;//安全位---接咖啡位

@@ -30,7 +30,7 @@ namespace BPASmartClient.MorkT_Container
public const int 接果汁2 = 10012;//接果汁过渡位---果汁2位
public const int 接果汁3 = 10013;//接果汁过渡位---果汁3位
public const int 接果汁4 = 10014;//接果汁过渡位---果汁4位
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---安全位
public const int 接果汁_机器人安全位 = 10002;//接果汁过渡位---模组移动安全位

public const int 接茶叶 = 10015;
public const int 接茶水 = 10016;


+ 9
- 1
BPASmartClient.SerialPort/SerialPortClient.cs View File

@@ -152,7 +152,11 @@ namespace BPASmartClient.SerialPort
{
lock (lck4Serial)
{
if (!IsHavePort) return;
if (!IsHavePort)
{
MessageLog.GetInstance.Show("咖乐美咖啡机连接失败");
return;
}
if (comPort.IsOpen) comPort.Close();
comPort.PortName = portName;
comPort.BaudRate = (int)baudRate;
@@ -160,6 +164,7 @@ namespace BPASmartClient.SerialPort
comPort.DataBits = (int)dataBits;
comPort.StopBits = stopBits;
comPort.Open();
MessageLog.GetInstance.Show("咖乐美咖啡机连接成功");
}
}

@@ -224,12 +229,15 @@ namespace BPASmartClient.SerialPort
Close();
}

private static readonly object objLock = new object();

/// <summary>
/// 发送数据
/// </summary>
/// <param name="data">发送数据</param>
public void SendData(byte[] data)
{
lock(objLock)
Write(data, 0, data.Length);
}



+ 2
- 2
BPASmartClient/App.config View File

@@ -7,9 +7,9 @@
<add key="IsEnableTest" value="false"/>

<!--测试环境-->
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<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 ="Namespaces" value="DEV.test1.Config"/>

<!--开发环境-->
<add key="apollouri" value="http://10.2.1.21:28080/"/>


+ 2
- 2
BPASmartClient/BPASmartClient.csproj View File

@@ -35,9 +35,9 @@
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_Container\BPASmartClient.MorkT_Container.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_HQ\BPASmartClient.MorkTHQ.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />


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


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


+ 295
- 3
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,6 +17,298 @@
</UserControl.DataContext>

<Grid>
<pry:DosingSystem/>



<!--#region 测试-->
<ListView
Height="150"
VerticalAlignment="Center"
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>

+ 159
- 5
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" />
@@ -71,7 +71,6 @@
HorizontalAlignment="Left"
Command="{Binding SaveRecipe}"
Content="保存配方"
EnableColor="#FFB7B7B7"
FontSize="17"
Foreground="Aqua"
IcoText="&#xe936;"
@@ -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; }



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

@@ -49,6 +49,7 @@ namespace FryPot_DosingSystem.AGV
hs_2,//2号炒锅-运输空碗到-空碗流水线
hs_3,//3号炒锅-运输空碗到-空碗流水线
hs_4,//4号炒锅-运输空碗到-空碗流水线
hs_5,//5号炒锅-运输空碗到-空碗流水线

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


+ 9
- 3
FryPot_DosingSystem/App.xaml.cs View File

@@ -38,7 +38,7 @@ namespace FryPot_DosingSystem
mv.Show();
DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
HubHelper.GetInstance.Connect("192.168.1.130", 8089);
HubHelper.GetInstance.Connect("192.168.1.14", 8089);
AlarmHelper<AlarmInfo>.Init();
}
else
@@ -73,7 +73,7 @@ namespace FryPot_DosingSystem
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.RecipeSetView"
ToggleWindowPath = "View.RecipeManageView"
});

RecipeManage.Add(new SubMenumodel()
@@ -184,7 +184,13 @@ namespace FryPot_DosingSystem
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});

UserManager.Add(new SubMenumodel()
{
SubMenuName = "账号管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.UserManageView"
});

MenuManage.GetInstance.menuModels.Add(new MenuModel()
{


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


+ 27
- 0
FryPot_DosingSystem/Control/GlobalVariable.cs View File

@@ -145,6 +145,33 @@ namespace FryPot_DosingSystem.Control
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相关变量


+ 7
- 0
FryPot_DosingSystem/FryPot_DosingSystem.csproj View File

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

<ItemGroup>
<None Remove="hbl.ico" />
<None Remove="Resources\fonts\iconfont.ttf" />
</ItemGroup>

<ItemGroup>
@@ -19,6 +21,7 @@
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NModbus" Version="3.0.72" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
</ItemGroup>

<ItemGroup>
@@ -29,4 +32,8 @@
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\fonts\iconfont.ttf" />
</ItemGroup>

</Project>

+ 1
- 0
FryPot_DosingSystem/Model/RecipeManage.cs View File

@@ -12,5 +12,6 @@ namespace FryPot_DosingSystem.Model
{
public ObservableCollection<NewRecipeModel> Recipes { get; set; }=new ObservableCollection<NewRecipeModel>();
}
}

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

@@ -21,11 +21,22 @@ namespace FryPot_DosingSystem.Model
private string _recipeName;
public string RecipeName { get { return _recipeName; } set { _recipeName = value;OnPropertyChanged(); } }

/// <summary>
/// 配方创建时间
/// </summary>
private string _dateTime;
public string DataTime { get { return _dateTime; } set { _dateTime = value;OnPropertyChanged(); } }

private string _updateTime;
public string UpdateTime { get { return _updateTime; } set { _updateTime = value;OnPropertyChanged(); } }

/// <summary>
/// 配方下发状况信息
/// </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>();
}


+ 391
- 0
FryPot_DosingSystem/Resources/fonts/demo_index.html View File

@@ -0,0 +1,391 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>iconfont Demo</title>
<link rel="shortcut icon" href="//img.alicdn.com/imgextra/i2/O1CN01ZyAlrn1MwaMhqz36G_!!6000000001499-73-tps-64-64.ico" type="image/x-icon"/>
<link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01EYTRnJ297D6vehehJ_!!6000000008020-55-tps-64-64.svg"/>
<link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="iconfont.css">
<script src="iconfont.js"></script>
<!-- jQuery -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
<!-- 代码高亮 -->
<script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script>
<style>
.main .logo {
margin-top: 0;
height: auto;
}

.main .logo a {
display: flex;
align-items: center;
}

.main .logo .sub-title {
margin-left: 0.5em;
font-size: 22px;
color: #fff;
background: linear-gradient(-45deg, #3967FF, #B500FE);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
</head>
<body>
<div class="main">
<h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
<img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
</a></h1>
<div class="nav-tabs">
<ul id="tabs" class="dib-box">
<li class="dib active"><span>Unicode</span></li>
<li class="dib"><span>Font class</span></li>
<li class="dib"><span>Symbol</span></li>
</ul>
</div>
<div class="tab-container">
<div class="content unicode" style="display: block;">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont">&#xe668;</span>
<div class="name">账号信息</div>
<div class="code-name">&amp;#xe668;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe695;</span>
<div class="name">窗口-最大化_line</div>
<div class="code-name">&amp;#xe695;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe62b;</span>
<div class="name">密码</div>
<div class="code-name">&amp;#xe62b;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe62c;</span>
<div class="name">权限配置</div>
<div class="code-name">&amp;#xe62c;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe669;</span>
<div class="name">close</div>
<div class="code-name">&amp;#xe669;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe67a;</span>
<div class="name">minus</div>
<div class="code-name">&amp;#xe67a;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6a0;</span>
<div class="name">账号中心 账号管理</div>
<div class="code-name">&amp;#xe6a0;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe979;</span>
<div class="name">齿轮,设置,设定</div>
<div class="code-name">&amp;#xe979;</div>
</li>
<li class="dib">
<span class="icon iconfont">&#xe6b7;</span>
<div class="name">面性密码锁</div>
<div class="code-name">&amp;#xe6b7;</div>
</li>
</ul>
<div class="article markdown">
<h2 id="unicode-">Unicode 引用</h2>
<hr>

<p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
<ul>
<li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
<li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
</ul>
<blockquote>
<p>注意:新版 iconfont 支持两种方式引用多色图标:SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)</p>
</blockquote>
<p>Unicode 使用步骤如下:</p>
<h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
<pre><code class="language-css"
>@font-face {
font-family: 'iconfont';
src: url('iconfont.ttf?t=1658305362348') format('truetype');
}
</code></pre>
<h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
<pre><code class="language-css"
>.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
<pre>
<code class="language-html"
>&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content font-class">
<ul class="icon_lists dib-box">
<li class="dib">
<span class="icon iconfont icon-zhanghaoxinxi"></span>
<div class="name">
账号信息
</div>
<div class="code-name">.icon-zhanghaoxinxi
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-window-max_line"></span>
<div class="name">
窗口-最大化_line
</div>
<div class="code-name">.icon-window-max_line
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-mima"></span>
<div class="name">
密码
</div>
<div class="code-name">.icon-mima
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-quanxianpeizhi"></span>
<div class="name">
权限配置
</div>
<div class="code-name">.icon-quanxianpeizhi
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-close"></span>
<div class="name">
close
</div>
<div class="code-name">.icon-close
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-minus"></span>
<div class="name">
minus
</div>
<div class="code-name">.icon-minus
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-zhanghaozhongxinzhanghaoguanli"></span>
<div class="name">
账号中心 账号管理
</div>
<div class="code-name">.icon-zhanghaozhongxinzhanghaoguanli
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-set"></span>
<div class="name">
齿轮,设置,设定
</div>
<div class="code-name">.icon-set
</div>
</li>
<li class="dib">
<span class="icon iconfont icon-mianxingmima"></span>
<div class="name">
面性密码锁
</div>
<div class="code-name">.icon-mianxingmima
</div>
</li>
</ul>
<div class="article markdown">
<h2 id="font-class-">font-class 引用</h2>
<hr>

<p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
<p>与 Unicode 使用方式相比,具有如下特点:</p>
<ul>
<li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
<li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
<pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
</code></pre>
<h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
</code></pre>
<blockquote>
<p>"
iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
</blockquote>
</div>
</div>
<div class="content symbol">
<ul class="icon_lists dib-box">
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhanghaoxinxi"></use>
</svg>
<div class="name">账号信息</div>
<div class="code-name">#icon-zhanghaoxinxi</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-window-max_line"></use>
</svg>
<div class="name">窗口-最大化_line</div>
<div class="code-name">#icon-window-max_line</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-mima"></use>
</svg>
<div class="name">密码</div>
<div class="code-name">#icon-mima</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-quanxianpeizhi"></use>
</svg>
<div class="name">权限配置</div>
<div class="code-name">#icon-quanxianpeizhi</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-close"></use>
</svg>
<div class="name">close</div>
<div class="code-name">#icon-close</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-minus"></use>
</svg>
<div class="name">minus</div>
<div class="code-name">#icon-minus</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-zhanghaozhongxinzhanghaoguanli"></use>
</svg>
<div class="name">账号中心 账号管理</div>
<div class="code-name">#icon-zhanghaozhongxinzhanghaoguanli</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-set"></use>
</svg>
<div class="name">齿轮,设置,设定</div>
<div class="code-name">#icon-set</div>
</li>
<li class="dib">
<svg class="icon svg-icon" aria-hidden="true">
<use xlink:href="#icon-mianxingmima"></use>
</svg>
<div class="name">面性密码锁</div>
<div class="code-name">#icon-mianxingmima</div>
</li>
</ul>
<div class="article markdown">
<h2 id="symbol-">Symbol 引用</h2>
<hr>

<p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
<ul>
<li>支持多色图标了,不再受单色限制。</li>
<li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
<li>兼容性较差,支持 IE9+,及现代浏览器。</li>
<li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
</ul>
<p>使用步骤如下:</p>
<h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
<pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
</code></pre>
<h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
<pre><code class="language-html">&lt;style&gt;
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
&lt;/style&gt;
</code></pre>
<h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
<pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
&lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
&lt;/svg&gt;
</code></pre>
</div>
</div>

</div>
</div>
<script>
$(document).ready(function () {
$('.tab-container .content:first').show()

$('#tabs li').click(function (e) {
var tabContent = $('.tab-container .content')
var index = $(this).index()

if ($(this).hasClass('active')) {
return
} else {
$('#tabs li').removeClass('active')
$(this).addClass('active')

tabContent.hide().eq(index).fadeIn()
}
})
})
</script>
</body>
</html>

BIN
View File


+ 191
- 52
FryPot_DosingSystem/View/AgvView.xaml View File

@@ -27,40 +27,74 @@
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:3" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="path1" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:3" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:3" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="select_color" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Red"/>
<EasingColorKeyFrame KeyTime="00:00:2" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:3" Value="#FF1F4D69"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="unselect_color" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:2" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:3" Value="Yellow"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="gridSplitter" Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Yellow"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="gridSplitter1" Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Yellow"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid Width="60" Height="240" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0">
<GridSplitter Width="5"></GridSplitter>
<GridSplitter Width="5" HorizontalAlignment="Left"></GridSplitter>
<GridSplitter x:Name="gridSplitter" Width="5"></GridSplitter>
<GridSplitter x:Name="gridSplitter1" Width="5" HorizontalAlignment="Left"></GridSplitter>
<Border x:Name="select_color" Background="#FF1F4D69" Visibility="Collapsed"></Border>
<Border x:Name="unselect_color" Background="#FF1F4D69" Visibility="Collapsed"></Border>
<StackPanel>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color }" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
</StackPanel>
<StackPanel VerticalAlignment="Bottom" Margin="0,0,0,20">
<Grid x:Name="c1" Width="40" Height="27" >
@@ -271,40 +305,74 @@
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:3" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="path1" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:3" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2.5" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:3" Value="{x:Static Visibility.Collapsed}"/>
</ObjectAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="select_color" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Red"/>
<EasingColorKeyFrame KeyTime="00:00:2" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:3" Value="#FF1F4D69"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="unselect_color" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Lime"/>
<EasingColorKeyFrame KeyTime="00:00:2" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:3" Value="Yellow"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="gridSplitter" Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Yellow"/>
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="gridSplitter1" Storyboard.TargetProperty="(Control.Background).(SolidColorBrush.Color)">
<EasingColorKeyFrame KeyTime="00:00:00" Value="#FF1F4D69"/>
<EasingColorKeyFrame KeyTime="00:00:1" Value="Yellow"/>
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid Width="60" Height="240" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,0,0,0">
<GridSplitter Width="5"></GridSplitter>
<GridSplitter Width="5" HorizontalAlignment="Left"></GridSplitter>
<GridSplitter x:Name="gridSplitter" Width="5"></GridSplitter>
<GridSplitter x:Name="gridSplitter1" Width="5" HorizontalAlignment="Left"></GridSplitter>
<Border x:Name="select_color" Background="#FF1F4D69" Visibility="Collapsed"></Border>
<Border x:Name="unselect_color" Background="#FF1F4D69" Visibility="Collapsed"></Border>
<StackPanel>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{TemplateBinding Foreground}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color }" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=select_color}" Height="5" Margin="5"/>
<Rectangle Fill="{Binding Background, ElementName=unselect_color}" Height="5" Margin="5"/>
</StackPanel>
<StackPanel VerticalAlignment="Bottom" Margin="0,0,0,20">
<Grid x:Name="c1" Width="40" Height="27" >
@@ -1114,6 +1182,72 @@
</Setter.Value>
</Setter>
</Style>

<Style x:Key="炒锅" BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="#FF1F4D69"/>
<Setter Property="Text" Value="Start"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<ControlTemplate.Resources>
<Storyboard RepeatBehavior="Forever" x:Key="csd_dh1">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:0.5" Value="90"/>
<EasingDoubleKeyFrame KeyTime="00:00:1" Value="180"/>
<EasingDoubleKeyFrame KeyTime="00:00:1.5" Value="270"/>
<EasingDoubleKeyFrame KeyTime="00:00:2" Value="360"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>

</ControlTemplate.Resources>
<Grid Width="100" Height="100">
<Border Style="{DynamicResource border炒锅2}">
<!--<Border x:Name="cai" VerticalAlignment="Top" Width="30" Height="25" Margin="0,10,0,0" Style="{DynamicResource border菜}">
</Border>-->
</Border>
<Ellipse x:Name="ellipse" StrokeThickness="5" Width="50" Height="50" RenderTransformOrigin="0.5,0.5" Margin="5,-3,0,0" VerticalAlignment="Top">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform AngleY="-0"/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
<Ellipse.Stroke>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#CCA48E42"/>
<GradientStop Color="#CC2D48DA" Offset="1"/>
<GradientStop Color="#FF3FD256" Offset="0.305"/>
<GradientStop Color="#FFB12C87" Offset="0.67"/>
</LinearGradientBrush>
</Ellipse.Stroke>
</Ellipse>

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Text" Value="Start">
<Setter TargetName="ellipse" Property="Visibility" Value="Visible" />
<!--<Setter TargetName="cai" Property="Visibility" Value="Visible" />-->
<Trigger.EnterActions>
<BeginStoryboard x:Name="begin_name" Storyboard="{StaticResource csd_dh1}"/>
</Trigger.EnterActions>
</Trigger>
<Trigger Property="Text" Value="Stop">
<Trigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
</Trigger.EnterActions>
<Setter TargetName="ellipse" Property="Visibility" Value="Collapsed" />
<!--<Setter TargetName="cai" Property="Visibility" Value="Collapsed" />-->
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
@@ -1158,11 +1292,16 @@
<TextBox x:Name="xiaochewuping_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="有菜和碗" Cursor="Hand">有菜和碗</Button>
<Button Margin="5" Click="Button_Click" Tag="只有碗" Cursor="Hand">只有碗</Button>

<Button Margin="5" Click="Button_Click" Tag="无物品" Cursor="Hand">无物品</Button>


</StackPanel>
<StackPanel>
<TextBlock Margin="5">滚筒炒锅</TextBlock>
<TextBox x:Name="guntongchaoguo_text" Margin="5">1</TextBox>
<Button Margin="5" Click="Button_Click" Tag="启动炒锅" Cursor="Hand">启动炒锅</Button>
<Button Margin="5" Click="Button_Click" Tag="停止炒锅" Cursor="Hand">停止炒锅</Button>
</StackPanel>

</StackPanel>
</Grid>

@@ -1275,22 +1414,26 @@
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Style="{DynamicResource border炒锅}" HorizontalAlignment="Left">
<Grid Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="45,0,0,20">
<TextBox Style="{StaticResource 炒锅}" Text="{Binding wokModel_1.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(1)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}" Grid.Column="1" HorizontalAlignment="Left">
</Grid>
<Grid Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="45,0,0,20">
<TextBox Style="{StaticResource 炒锅}" Text="{Binding wokModel_2.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(2)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}" Grid.Column="2" HorizontalAlignment="Left">
</Grid>
<Grid Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="45,0,0,20">
<TextBox Style="{StaticResource 炒锅}" Text="{Binding wokModel_3.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(3)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}" Grid.Column="3" HorizontalAlignment="Left">
</Grid>
<Grid Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="45,0,0,20">
<TextBox Style="{StaticResource 炒锅}" Text="{Binding wokModel_4.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(4)号</TextBlock>
</Border>
<Border Style="{DynamicResource border炒锅}" Grid.Column="4" HorizontalAlignment="Left">
</Grid>
<Grid Grid.Column="4" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="45,0,0,20">
<TextBox Style="{StaticResource 炒锅}" Text="{Binding wokModel_5.Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox>
<TextBlock Style="{DynamicResource 80号字体样式}" FontSize="16" Width="18" Margin="-10,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Bottom">炒锅(5)号</TextBlock>
</Border>

</Grid>
<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="0">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
@@ -1317,7 +1460,6 @@
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="1">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
@@ -1344,7 +1486,6 @@
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="2">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
@@ -1371,7 +1512,6 @@
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="3">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>
@@ -1398,7 +1538,6 @@
</ListBox>
</StackPanel>
</Grid>

<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="100,0,-40,80" Grid.Column="4">
<Rectangle Stroke="#FFFFA400" StrokeDashArray="5 5" Margin="10"/>
<StackPanel>


+ 26
- 2
FryPot_DosingSystem/View/AgvView.xaml.cs View File

@@ -74,7 +74,7 @@ namespace FryPot_DosingSystem.View
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Start);
@@ -86,7 +86,7 @@ namespace FryPot_DosingSystem.View
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Stop);
@@ -163,6 +163,30 @@ namespace FryPot_DosingSystem.View
}
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;

}
}


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

Loading…
Cancel
Save