diff --git a/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs b/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
index be1ff668..52e0ac49 100644
--- a/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
@@ -75,7 +75,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// 主菜单的显示隐藏设置
///
public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } }
- private Visibility _mMainMenuVisibility;
+ private Visibility _mMainMenuVisibility = Visibility.Visible;
///
/// 子菜单集合
@@ -114,7 +114,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// 子菜单的显示隐藏设置
///
public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } }
- private Visibility _mSubMenuVisibility = Visibility.Collapsed;
+ private Visibility _mSubMenuVisibility = Visibility.Visible;
diff --git a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
index 019e2250..203d70e0 100644
--- a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
@@ -22,7 +22,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
private Permission _perimission;
public string UserName { get { return _userName; } set { _userName = value; OnPropertyChanged(); } }
- private string _userName ;
+ private string _userName;
public string Password { get { return _password; } set { _password = value; OnPropertyChanged(); } }
private string _password;
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
index 85faa469..11f61598 100644
--- a/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
@@ -85,25 +85,52 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
Global.userInfo.LastLogInTime = DateTime.Now.ToString();
res.LastLogInTime = DateTime.Now.ToString();
Config.GetInstance.SaveUser();
+
//permission权限
- for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
+ if (res.userTreeViewModels != null)
{
- if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
- MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
- else
- MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
-
- if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
- MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
-
- for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
+ VisibilityState(Visibility.Collapsed);
+ for (int i = 0; i < res.userTreeViewModels?.Count; i++)
{
- if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
- MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
- else
- MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
+ var menName = res.userTreeViewModels.ElementAt(i).Name;//获取子菜单的名称
+
+ var res1 = MenuManage.GetInstance.menuModels.FirstOrDefault(p => p.subMenumodels.FirstOrDefault(s => s.SubMenuName.Equals(menName)) != null);//通过子菜单获取主菜单的信息
+ if (res1 != null)
+ {
+ res1.MainMenuVisibility = Visibility.Visible;
+ var res2 = res1.subMenumodels.FirstOrDefault(p => p.SubMenuName.Equals(menName));
+ if (res2 != null) res2.SubMenuVisibility = Visibility.Visible;
+ }
}
}
+ else
+ {
+ VisibilityState(Visibility.Visible);
+ }
+
+
+
+
+
+ //permission权限
+ //for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
+ //{
+ // if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
+ // MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
+ // else
+ // MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
+
+ // if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
+ // MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
+
+ // for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
+ // {
+ // if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
+ // MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
+ // else
+ // MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
+ // }
+ //}
////分配后的权限
//if (res.permission == Enums.Permission.管理员)
@@ -149,6 +176,18 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
}
+ private void VisibilityState(Visibility tempVisibility)
+ {
+ for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
+ {
+ MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = tempVisibility;
+ for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
+ {
+ MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = tempVisibility;
+ }
+ }
+ }
+
public RelayCommand LoginCommand { get; set; }
public RelayCommand ExitCommand { get; set; }
diff --git a/BPASmartClient.MorkBF/GVL_MorkBF.cs b/BPASmartClient.MorkBF/GVL_MorkBF.cs
index 54762ca4..5333bd13 100644
--- a/BPASmartClient.MorkBF/GVL_MorkBF.cs
+++ b/BPASmartClient.MorkBF/GVL_MorkBF.cs
@@ -35,7 +35,7 @@ namespace BPASmartClient.MorkBF
///
/// 炒锅1当前流程
///
- public List FryPot1_CurrentProcess;
+ public List FryPot1_CurrentProcess;
///
/// 炒锅2当前流程
///
@@ -46,7 +46,7 @@ namespace BPASmartClient.MorkBF
///
/// 炒锅1锅低温度
///
- [VariableMonitor("炒锅1锅低温度", "VW120","160")]
+ [VariableMonitor("炒锅1锅低温度", "VW120", "160")]
public int FirePot1_Temperature { get; set; }
///
/// 炒锅1脉冲值
@@ -68,87 +68,87 @@ namespace BPASmartClient.MorkBF
/// 炒锅1急停
///
[VariableMonitor("炒锅1急停", "M20.2", "482")]
- public bool FirePot1_Emergencystop{ get; set; }
+ public bool FirePot1_Emergencystop { get; set; }
///
/// 1#炒锅荤菜盆有无检测
///
[VariableMonitor("1#炒锅1锅低温度", "M20.3", "483")]
- public bool FirePot1_MealTubExist{ get; set; }
+ public bool FirePot1_MealTubExist { get; set; }
///
/// 1#炒锅素菜盆1有无检测
///
[VariableMonitor("炒锅素菜盆1有无检测", "M20.4", "484")]
- public bool FirePot1_VegetablesTub1Exist{ get; set; }
+ public bool FirePot1_VegetablesTub1Exist { get; set; }
///
/// 1#炒锅素菜盆2有无检测
///
[VariableMonitor("1#炒锅素菜盆2有无检测", "M20.5", "485")]
- public bool FirePot1_VegetablesTub2Exist{ get; set; }
+ public bool FirePot1_VegetablesTub2Exist { get; set; }
///
/// 1#炒锅调料盆1有无检测
///
[VariableMonitor("1#炒锅调料盆1有无检测", "M20.6", "486")]
- public bool FirePot1_Seasoning1Exist{ get; set; }
+ public bool FirePot1_Seasoning1Exist { get; set; }
///
/// 1#炒锅调料盆2有无检测
///
[VariableMonitor("1#炒锅调料盆2有无检测", "M20.7", "487")]
- public bool FirePot1_Seasoning2Exist{ get; set; }
+ public bool FirePot1_Seasoning2Exist { get; set; }
///
/// 1#炒锅辅料盆1有无检测
///
[VariableMonitor("1#炒锅辅料盆1有无检测", "M21.0", "488")]
- public bool FirePot1_Accessories1Exist{ get; set; }
+ public bool FirePot1_Accessories1Exist { get; set; }
///
/// 1#炒锅辅料盆2有无检测
///
[VariableMonitor("1#炒锅辅料盆2有无检测", "M21.1", "489")]
- public bool FirePot1_Accessories2Exist{ get; set; }
+ public bool FirePot1_Accessories2Exist { get; set; }
///
/// 1#炒锅出餐空盆有无检测
///
[VariableMonitor("1#炒锅出餐空盆有无检测", "M21.2", "490")]
- public bool FirePot1_OutFoodTubExist{ get; set; }
+ public bool FirePot1_OutFoodTubExist { get; set; }
///
/// 1#炒锅在原点反馈
///
[VariableMonitor("1#炒锅在原点反馈", "M21.3", "491")]
- public bool FirePot1_OnOrigin{ get; set; }
+ public bool FirePot1_OnOrigin { get; set; }
///
/// 1#炒制位置1反馈
///
[VariableMonitor("1#炒制位置1反馈", "M21.4", "492")]
- public bool FirePot1_FirePosition1{ get; set; }
+ public bool FirePot1_FirePosition1 { get; set; }
///
/// 1#炒制位置2反馈
///
[VariableMonitor("1#炒制位置2反馈", "M21.5", "493")]
- public bool FirePot1_FirePosition2{ get; set; }
+ public bool FirePot1_FirePosition2 { get; set; }
///
/// 1#炒制位置3反馈
///
[VariableMonitor("1#炒制位置3反馈", "M21.6", "494")]
- public bool FirePot1_FirePosition3{ get; set; }
+ public bool FirePot1_FirePosition3 { get; set; }
///
/// 1#炒制位置4反馈
///
[VariableMonitor("1#炒制位置4反馈", "M21.7", "495")]
- public bool FirePot1_FirePosition4{ get; set; }
+ public bool FirePot1_FirePosition4 { get; set; }
///
/// 1#炒锅在出餐倒料位置反馈
///
[VariableMonitor("1#炒锅在出餐倒料位置反馈", "M22.0", "496")]
- public bool FirePot1_PotOnOutFoodPosition{ get; set; }
+ public bool FirePot1_PotOnOutFoodPosition { get; set; }
///
/// 1#炒锅在投料位置反馈、
///
[VariableMonitor("1#炒锅在投料位置反馈", "M22.1", "497")]
- public bool FirePot1_PotOnIntoFoodPosition{ get; set; }
+ public bool FirePot1_PotOnIntoFoodPosition { get; set; }
///
/// 1#炒锅在洗锅位置反馈
///
[VariableMonitor("1#炒锅在洗锅位置反馈", "M22.2", "498")]
- public bool FirePot1_PotOnCleanPosition{ get; set; }
+ public bool FirePot1_PotOnCleanPosition { get; set; }
public int FirePot1_FireGear { get; set; } = 0;
public int FirePot1_StirGear { get; set; } = 0;
@@ -161,12 +161,12 @@ namespace BPASmartClient.MorkBF
/// 炒锅2锅低温度
///
[VariableMonitor("炒锅2锅低温度", "VW150", "175")]
- public int FirePot2_Temperature{ get; set; }
+ public int FirePot2_Temperature { get; set; }
///
/// 炒锅2脉冲值
///
[VariableMonitor("炒锅2脉冲值", "VW152", "176")]
- public int FirePot2_Pulse{ get; set; }
+ public int FirePot2_Pulse { get; set; }
///
/// 炒锅2初始化完成
///
@@ -177,97 +177,98 @@ namespace BPASmartClient.MorkBF
/// 炒锅2手动自动模式
///
[VariableMonitor("炒锅2手动自动模式", "M25.1", "521")]
- public bool FirePot2_IsAuto{ get; set; }
+ public bool FirePot2_IsAuto { get; set; }
///
/// 炒锅2急停
///
[VariableMonitor("炒锅2急停", "M25.2", "522")]
- public bool FirePot2_Emergencystop{ get; set; }
+ public bool FirePot2_Emergencystop { get; set; }
///
/// 2#炒锅荤菜盆有无检测
///
[VariableMonitor("2#炒锅荤菜盆有无检测", "M25.3", "523")]
- public bool FirePot2_MealTubExist{ get; set; }
+ public bool FirePot2_MealTubExist { get; set; }
///
/// 2#炒锅素菜盆1有无检测
///
[VariableMonitor("2#炒锅素菜盆1有无检测", "M25.4", "524")]
- public bool FirePot2_VegetablesTub1Exist{ get; set; }
+ public bool FirePot2_VegetablesTub1Exist { get; set; }
///
/// 2#炒锅素菜盆2有无检测
///
[VariableMonitor("2#炒锅素菜盆2有无检测", "M25.5", "525")]
- public bool FirePot2_VegetablesTub2Exist{ get; set; }
+ public bool FirePot2_VegetablesTub2Exist { get; set; }
///
/// 2#炒锅调料盆1有无检测
///
[VariableMonitor("2#炒锅调料盆1有无检测", "M25.6", "526")]
- public bool FirePot2_Seasoning1Exist{ get; set; }
+ public bool FirePot2_Seasoning1Exist { get; set; }
///
/// 2#炒锅调料盆2有无检测
///
[VariableMonitor("2#炒锅调料盆2有无检测", "M25.7", "527")]
- public bool FirePot2_Seasoning2Exist{ get; set; }
+ public bool FirePot2_Seasoning2Exist { get; set; }
///
/// 2#炒锅辅料盆1有无检测
///
[VariableMonitor("2#炒锅1锅低温度", "M26.0", "528")]
- public bool FirePot2_Accessories1Exist{ get; set; }
+ public bool FirePot2_Accessories1Exist { get; set; }
///
/// 2#炒锅辅料盆2有无检测
///
[VariableMonitor("2#炒锅辅料盆2有无检测", "M26.1", "529")]
- public bool FirePot2_Accessories2Exist{ get; set; }
+ public bool FirePot2_Accessories2Exist { get; set; }
///
/// 2#炒锅出餐空盆有无检测
///
[VariableMonitor("2#炒锅出餐空盆有无检测", "M26.2", "530")]
- public bool FirePot2_OutFoodTubExist{ get; set; }
+ public bool FirePot2_OutFoodTubExist { get; set; }
///
/// 2#炒锅在原点反馈
///
[VariableMonitor("2#炒锅在原点反馈", "M26.3", "531")]
- public bool FirePot2_OnOrigin{ get; set; }
+ public bool FirePot2_OnOrigin { get; set; }
///
/// 2#炒制位置1反馈
///
[VariableMonitor("2#炒制位置1反馈", "M26.4", "532")]
- public bool FirePot2_FirePosition1{ get; set; }
+ public bool FirePot2_FirePosition1 { get; set; }
///
/// 2#炒制位置2反馈
///
[VariableMonitor("2#炒制位置2反馈", "M26.5", "533")]
- public bool FirePot2_FirePosition2{ get; set; }
+ public bool FirePot2_FirePosition2 { get; set; }
///
/// 2#炒制位置3反馈
///
[VariableMonitor("2#炒制位置3反馈", "M26.6", "534")]
- public bool FirePot2_FirePosition3{ get; set; }
+ public bool FirePot2_FirePosition3 { get; set; }
///
/// 2#炒制位置4反馈
///
[VariableMonitor("2#炒制位置4反馈", "M26.7", "535")]
- public bool FirePot2_FirePosition4{ get; set; }
+ public bool FirePot2_FirePosition4 { get; set; }
///
/// 2#炒锅在出餐倒料位置反馈
///
[VariableMonitor("2#炒锅在出餐倒料位置反馈", "M27.0", "536")]
- public bool FirePot2_PotOnOutFoodPosition{ get; set; }
+ public bool FirePot2_PotOnOutFoodPosition { get; set; }
///
/// 2#炒锅在投料位置反馈、
///
[VariableMonitor("2#炒锅在投料位置反馈", "M27.1", "537")]
- public bool FirePot2_PotOnIntoFoodPosition{ get; set; }
+ public bool FirePot2_PotOnIntoFoodPosition { get; set; }
///
/// 2#炒锅在洗锅位置反馈
///
[VariableMonitor("2#炒锅在洗锅位置反馈", "M27.2", "538")]
- public bool FirePot2_PotOnCleanPosition{ get; set; }
+ public bool FirePot2_PotOnCleanPosition { get; set; }
public int FirePot2_FireGear { get; set; } = 0;
public int FirePot2_StirGear { get; set; } = 0;
public int FirePot2_FlipSpeed { get; set; } = 0;
+ #endregion
#region 机器人数据读取
public bool Robot_IsBusy;
@@ -283,37 +284,37 @@ namespace BPASmartClient.MorkBF
/// 1号锅倒荤菜完成
///
[VariableMonitor("机器人#1号锅倒荤菜完成", "GM500", "4596")]
- public bool Robot_FirePot1OutMeal{ get; set; }
+ public bool Robot_FirePot1OutMeal { get; set; }
///
/// 1号炒锅倒素菜1完成
///
[VariableMonitor("机器人#1号炒锅倒素菜1完成", "GM501", "4597")]
- public bool Robot_FirePot1OutVegetables1{ get; set; }
+ public bool Robot_FirePot1OutVegetables1 { get; set; }
///
/// 1号炒锅倒素菜2完成
///
[VariableMonitor("机器人#1号炒锅倒素菜2完成", "GM502", "4598")]
- public bool Robot_FirePot1OutVegetables2{ get; set; }
+ public bool Robot_FirePot1OutVegetables2 { get; set; }
///
/// 1号炒锅倒调料完成
///
[VariableMonitor("机器人#1号炒锅倒调料完成", "GM503", "4599")]
- public bool Robot_FirePot1OutSeasoning{ get; set; }
+ public bool Robot_FirePot1OutSeasoning { get; set; }
///
/// 1号炒锅倒辅料完成
///
[VariableMonitor("机器人#1号炒锅倒辅料完成", "GM504", "4600")]
- public bool Robot_FirePot1OutAccessories{ get; set; }
+ public bool Robot_FirePot1OutAccessories { get; set; }
///
/// 机器人到位,请求1#炒锅倒菜
///
[VariableMonitor("机器人到位,请求1#炒锅倒菜", "GM505", "4601")]
- public bool Robot_ArriveFirePot1{ get; set; }
+ public bool Robot_ArriveFirePot1 { get; set; }
///
/// 1号炒锅出餐完成
///
[VariableMonitor("机器人#1号炒锅出餐完成", "GM506", "4602")]
- public bool Robot_FirePot1OutFoodComplete{ get; set; }
+ public bool Robot_FirePot1OutFoodComplete { get; set; }
@@ -328,37 +329,37 @@ namespace BPASmartClient.MorkBF
/// 2号炒锅倒素菜1完成
///
[VariableMonitor("机器人#2号炒锅倒素菜1完成", "GM511", "4607")]
- public bool Robot_FirePot2OutVegetables1{ get; set; }
+ public bool Robot_FirePot2OutVegetables1 { get; set; }
///
/// 2号炒锅倒素菜2完成
///
[VariableMonitor("2号炒锅倒素菜2完成", "GM512", "4608")]
- public bool Robot_FirePot2OutVegetables2{ get; set; }
+ public bool Robot_FirePot2OutVegetables2 { get; set; }
///
/// 2号炒锅倒调料完成
///
[VariableMonitor("机器人#2号炒锅倒调料完成", "GM513", "4609")]
- public bool Robot_FirePot2OutSeasoning{ get; set; }
+ public bool Robot_FirePot2OutSeasoning { get; set; }
///
/// 2号炒锅倒辅料完成
///
[VariableMonitor("机器人#2号炒锅倒辅料完成", "GM514", "4610")]
- public bool Robot_FirePot2OutAccessories{ get; set; }
+ public bool Robot_FirePot2OutAccessories { get; set; }
///
/// 机器人到位,请求1#炒锅倒菜
///
[VariableMonitor("机器人#机器人到位,请求1#炒锅倒菜", "GM515", "4611")]
- public bool Robot_ArriveFirePot2{ get; set; }
+ public bool Robot_ArriveFirePot2 { get; set; }
///
/// 2号炒锅出餐完成
///
[VariableMonitor("机器人#2号炒锅出餐完成", "GM516", "4612")]
- public bool Robot_FirePot2OutFoodComplete{ get; set; }
+ public bool Robot_FirePot2OutFoodComplete { get; set; }
///
/// 机器人动作反馈
///
[VariableMonitor("机器人动作反馈", "GI5", "5")]
- public int Robot_ActionCallback{ get; set; }
+ public int Robot_ActionCallback { get; set; }
#endregion
@@ -370,7 +371,7 @@ namespace BPASmartClient.MorkBF
public GVL_MorkBF()
{
FirePot1_CompleteSingle = new Dictionary
- {
+ {
{1,Robot_FirePot1OutMeal },
{2,Robot_FirePot1OutVegetables1 },
{3,Robot_FirePot1OutVegetables2 },
diff --git a/BPASmartClient.ScreenALL/App.config b/BPASmartClient.ScreenALL/App.config
index 7eeaad9e..6a7db7eb 100644
--- a/BPASmartClient.ScreenALL/App.config
+++ b/BPASmartClient.ScreenALL/App.config
@@ -6,5 +6,8 @@
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.ScreenLib/Helper/HttpRequestHelper.cs b/BPASmartClient.ScreenLib/Helper/HttpRequestHelper.cs
new file mode 100644
index 00000000..053a4c29
--- /dev/null
+++ b/BPASmartClient.ScreenLib/Helper/HttpRequestHelper.cs
@@ -0,0 +1,328 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+namespace BPASmartClient.ScreenLib
+{
+ ///
+ /// 该类实现客户端http 同步请求
+ /// 支持环境 -.net4.0/-.net4.5
+ /// 创建人:奉友福
+ ///
+ public class HttpRequestHelper
+ {
+ #region 私有变量
+ #endregion
+
+ #region 公用函数
+ ///
+ /// GET 同步请求
+ /// 创建人:奉友福
+ /// 创建时间:2020-11-19
+ ///
+ /// 请求地址
+ /// 超时时间设置,默认5秒
+ public static string HttpGetRequest(string url, int _timeout = 2000)
+ {
+ string resultData = string.Empty;
+
+ try
+ {
+ WebClient wc = new WebClient();
+ byte[] bytes = wc.DownloadData(url);
+ string s = Encoding.UTF8.GetString(bytes);
+ return s;
+ }
+ catch (Exception e)
+ {
+ throw e;
+ }
+ return "";
+
+ try
+ {
+ var getrequest = HttpRequest.GetInstance().CreateHttpRequest(url, "GET", _timeout);
+ var getreponse = getrequest.GetResponse() as HttpWebResponse;
+ resultData = HttpRequest.GetInstance().GetHttpResponse(getreponse, "GET");
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ return resultData;
+ }
+ ///
+ /// POST 同步请求
+ /// 创建人:奉友福
+ /// 创建时间:2020-11-19
+ ///
+ /// 请求地址
+ /// 请求数据
+ ///
+ public static string HttpPostRequest(string url, string PostJsonData, int _timeout = 2000)
+ {
+ string resultData = string.Empty;
+ try
+ {
+ var postrequest = HttpRequest.GetInstance().CreateHttpRequest(url, "POST", _timeout, PostJsonData);
+ var postreponse = postrequest.GetResponse() as HttpWebResponse;
+ resultData = HttpRequest.GetInstance().GetHttpResponse(postreponse, "POST");
+ }
+ catch (Exception ex)
+ {
+ return ex.Message;
+ }
+ return resultData;
+ }
+
+ public static string HttpDeleteRequest(string url, string PostJsonData, int _timeout = 10000)
+ {
+ string resultData = string.Empty;
+ try
+ {
+ var deleteRequest = HttpRequest.CreateDeleteHttpRequest(url, PostJsonData, _timeout);
+ var deleteReponse = deleteRequest.GetResponse() as HttpWebResponse;
+ using (StreamReader reader = new StreamReader(deleteReponse.GetResponseStream(), Encoding.GetEncoding("UTF-8")))
+ {
+ resultData = reader.ReadToEnd();
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ return resultData;
+ }
+
+ ///
+ /// GET 同步请求
+ ///
+ /// 地址
+ /// 头
+ /// 内容
+ ///
+ public static string GetHttpGetResponseWithHead(string url, HttpRequestHeader head, string headInfo)
+ {
+ HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+ request.Method = "GET";
+ request.ContentType = "application/json;charset=UTF-8";
+ request.Timeout = 6000;
+ request.Headers.Set(head, headInfo);
+ StreamReader sr = null;
+ HttpWebResponse response = null;
+ Stream stream = null;
+ try
+ {
+ response = (HttpWebResponse)request.GetResponse();
+ stream = response.GetResponseStream();
+ sr = new StreamReader(stream, Encoding.GetEncoding("utf-8"));
+ var resultData = sr.ReadToEnd();
+ return resultData;
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(url + " 访问失败:" + ex.Message);
+ //return ex.Message;
+ }
+ finally
+ {
+ if (response != null)
+ {
+ response.Dispose();
+ }
+ if (stream != null)
+ {
+ stream.Dispose();
+ }
+ if (sr != null)
+ {
+ sr.Dispose();
+ }
+ }
+ return null;
+ }
+
+
+
+ ///
+ /// Post请求带Token
+ /// 2021-2-2 by dulf
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static string HttpPostResponseWithHead(string url, HttpRequestHeader head, string headInfo, string postParam, int Timeout = 6000)
+ {
+ string resultData = string.Empty;
+ try
+ {
+ var postrequest = WebRequest.Create(url) as HttpWebRequest;
+ postrequest.Timeout = Timeout;
+ postrequest.Method = "POST";
+ postrequest.ContentType = "application/json;charset=UTF-8";
+ postrequest.Headers.Set(head, headInfo);
+ byte[] data = Encoding.UTF8.GetBytes(postParam);
+ using (Stream reqStream = postrequest.GetRequestStream())
+ {
+ reqStream.Write(data, 0, data.Length);
+ var postreponse = postrequest.GetResponse() as HttpWebResponse;
+ resultData = HttpRequest.GetInstance().GetHttpResponse(postreponse, "POST");
+ reqStream.Close();
+ }
+ return resultData;
+ }
+ catch (Exception ex)
+ {
+ Console.Write("请求异常:" + ex.Message);
+ }
+ return "";
+ }
+ #endregion
+
+ }
+ ///
+ /// HTTP请求类
+ ///
+ public class HttpRequest
+ {
+ #region 私有变量
+ ///
+ /// http请求超时时间设置
+ /// 默认值:5秒
+ ///
+ private static int Timeout = 5000;
+ #endregion
+
+ #region 单例模式
+ private static HttpRequest _HttpRequest = null;
+ public static HttpRequest GetInstance()
+ {
+ if (_HttpRequest == null)
+ {
+ _HttpRequest = new HttpRequest();
+ }
+ return _HttpRequest;
+ }
+ private HttpRequest()
+ {
+
+ }
+ #endregion
+
+ #region 公用函数
+ ///
+ /// 函数名称:创建http请求
+ /// 创建人:奉友福
+ /// 创建时间:2020-11-19
+ /// 例如GET 请求: 地址 + "GET"
+ /// 例如POST请求: 地址 + "POST" + JSON
+ ///
+ /// http请求地址
+ /// http请求方式:GET/POST
+ /// http请求附带数据
+ ///
+ public HttpWebRequest CreateHttpRequest(string url, string requestType, int _timeout = 5000, params object[] strjson)
+ {
+ HttpWebRequest request = null;
+ const string get = "GET";
+ const string post = "POST";
+ Timeout = _timeout;
+ if (string.Equals(requestType, get, StringComparison.OrdinalIgnoreCase))
+ {
+ request = CreateGetHttpRequest(url);
+ }
+ if (string.Equals(requestType, post, StringComparison.OrdinalIgnoreCase))
+ {
+ request = CreatePostHttpRequest(url, strjson[0].ToString());
+ }
+ return request;
+ }
+ ///
+ /// http获取数据
+ ///
+ ///
+ ///
+ ///
+ public string GetHttpResponse(HttpWebResponse response, string requestType)
+ {
+ var resultData = string.Empty;
+ const string post = "POST";
+ string encoding = "UTF-8";
+ if (string.Equals(requestType, post, StringComparison.OrdinalIgnoreCase))
+ {
+ encoding = response.ContentEncoding;
+ if (encoding == null || encoding.Length < 1)
+ encoding = "UTF-8";
+ }
+ using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding)))
+ {
+ resultData = reader.ReadToEnd();
+ }
+ return resultData;
+ }
+ #endregion
+
+ #region 私有函数
+ ///
+ /// http+GET请求
+ ///
+ /// 请求地址
+ /// 请求结果
+ private static HttpWebRequest CreateGetHttpRequest(string url)
+ {
+ var getrequest = WebRequest.Create(url) as HttpWebRequest;
+ getrequest.Method = "GET";
+ getrequest.Timeout = Timeout;
+ getrequest.ContentType = "application/json;charset=UTF-8";
+ getrequest.Proxy = null;
+ getrequest.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
+ return getrequest;
+ }
+ ///
+ /// http+POST请求
+ ///
+ /// 请求地址
+ ///
+ /// 请求结果
+ private static HttpWebRequest CreatePostHttpRequest(string url, string postData)
+ {
+ var postrequest = WebRequest.Create(url) as HttpWebRequest;
+ //postrequest.KeepAlive = false;
+ postrequest.Timeout = Timeout;
+ postrequest.Method = "POST";
+ postrequest.ContentType = "application/json;charset=UTF-8";
+ //postrequest.ContentLength = postData.Length;
+ //postrequest.AllowWriteStreamBuffering = false;
+ //StreamWriter writer = new StreamWriter(postrequest.GetRequestStream(), Encoding.UTF8);
+ //writer.Write(postData);
+ //writer.Flush();
+ byte[] data = Encoding.UTF8.GetBytes(postData);
+ using (Stream reqStream = postrequest.GetRequestStream())
+ {
+ reqStream.Write(data, 0, data.Length);
+ reqStream.Close();
+ }
+ return postrequest;
+ }
+
+ public static HttpWebRequest CreateDeleteHttpRequest(string url, string postJson, int _timeout = 5000)
+ {
+ var deleteRequest = WebRequest.Create(url) as HttpWebRequest;
+ deleteRequest.Timeout = _timeout;
+ deleteRequest.Method = "DELETE";
+ deleteRequest.ContentType = "application/json;charset=UTF-8";
+ byte[] data = Encoding.UTF8.GetBytes(postJson);
+ using (Stream reqStream = deleteRequest.GetRequestStream())
+ {
+ reqStream.Write(data, 0, data.Length);
+ reqStream.Close();
+ }
+ return deleteRequest;
+ }
+ #endregion
+ }
+}
diff --git a/BPASmartClient.ScreenLib/Helper/Main.cs b/BPASmartClient.ScreenLib/Helper/Main.cs
index 3071390c..1b5b041c 100644
--- a/BPASmartClient.ScreenLib/Helper/Main.cs
+++ b/BPASmartClient.ScreenLib/Helper/Main.cs
@@ -1,6 +1,7 @@
using BPA.Communication;
using BPA.Helper;
using BPA.Message;
+using Microsoft.Web.WebView2.Wpf;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
@@ -9,6 +10,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using System.Windows.Controls;
namespace BPASmartClient.ScreenLib
{
@@ -43,6 +45,10 @@ namespace BPASmartClient.ScreenLib
#region 自建变量
///
+ /// 分餐机广告
+ ///
+ public List SaasRouteReturn =new List { };
+ ///
/// 是否运行
///
public bool IsRunning { get; set; }
@@ -134,6 +140,7 @@ namespace BPASmartClient.ScreenLib
{
try
{
+ ReadSass();
//连接MQTT、Redis
Connection();
IsRunning = true;
@@ -184,6 +191,52 @@ namespace BPASmartClient.ScreenLib
#region 调用事件
///
+ /// 调用Sass接口拿到广告
+ ///
+ public void ReadSass()
+ {
+ try
+ {
+ string SaasRoute = System.Configuration.ConfigurationManager.AppSettings["SaasRoute"].ToString();
+ string res = HttpRequestHelper.HttpGetRequest(SaasRoute);
+ if (!string.IsNullOrEmpty(res))
+ {
+ HttpReturn httpReturn= JsonConvert.DeserializeObject(res);
+ var Init =httpReturn?.data?.Devices?.Join(httpReturn?.data?.Stalls, t => t.GateId, x => x.Id, (t, x) => new AdDTO
+ {
+ Ad = x.Remaek,
+ Device = t.Name,
+ Stalls = x.Name,
+ Address = t.Address,
+ }).ToList();
+ SaasRouteReturn= Init;
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ ///
+ /// 显示地址
+ ///
+ ///
+ ///
+ public async void InitView2(string input, WebView2 view2, GroupBox group)
+ {
+ var height = 540;
+ var width = 940;
+ input = input.Replace("style=\"width: 100%;\"", "");
+ StringBuilder sb = new StringBuilder();
+ sb.Append("" + input + "");
+ var html = sb.ToString();
+ await view2.EnsureCoreWebView2Async(null);
+ view2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
+ view2.CoreWebView2.Settings.AreDevToolsEnabled = false;
+ view2.CoreWebView2.NavigateToString(html);
+ }
+ ///
/// 读取配置
///
public void ReadPZ()
diff --git a/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs b/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs
index a29e5515..7945149b 100644
--- a/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs
+++ b/BPASmartClient.ScreenLib/Model/OrderMakeModel.cs
@@ -1,5 +1,6 @@
using BPA.Helper;
using BPA.Message.Enum;
+using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -104,4 +105,84 @@ namespace BPASmartClient.ScreenLib
}
}
+ public class HttpReturn
+ {
+ public bool isSuccess { get; set; }
+
+ public StoreInfoResponse data { get; set; }
+ }
+
+ public class StoreInfoResponse
+ {
+ ///
+ /// 档口
+ ///
+ [JsonProperty("gateList")]
+ public List Stalls { get; set; }
+ ///
+ /// 设备
+ ///
+ [JsonProperty("payCardList")]
+ public List Devices { get; set; }
+ }
+ public class StallModelResponse
+ {
+
+ public string Id { get; set; }
+ ///
+ /// 档口名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 归属门店
+ ///
+ public string StoreId { get; set; }
+ ///
+ /// 收费方式(1,固定金额2,自由设定)
+ ///
+ public int Mode { get; set; }
+ ///
+ /// 收款金额
+ ///
+ public decimal Price { get; set; }
+ ///
+ /// 广告
+ ///
+ public string Remaek { get; set; }
+ ///
+ ///状态0正常,1停用
+ ///
+ public int Status { get; set; }
+ }
+ public class DeviceModelResponse
+ {
+ public string Id { get; set; }
+ ///
+ /// 刷卡设备名称
+ ///
+ public string Name { get; set; }
+ ///
+ /// 档口id
+ ///
+ public string GateId { get; set; }
+ ///
+ /// 地址
+ ///
+ public string Address { get; set; }
+ ///
+ /// 刷卡间隔时间
+ ///
+ public int SleepTime { get; set; }
+ ///
+ /// 状态0正常,1停用
+ ///
+ public int Status { get; set; }
+ }
+ public class AdDTO
+ {
+ public string Device { get; set; }
+ public string Ad { get; set; }
+ public string Stalls { get; set; }
+ public string Address { get; set; }
+ }
}
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
index e5617d76..ef44de59 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
@@ -86,13 +86,13 @@
-
-
+
+
-
+
-
+
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs
index b6b53f5f..0fb10de8 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs
@@ -25,6 +25,55 @@ namespace BPASmartClient.ScreenLib
{
InitializeComponent();
this.DataContext = new ScreenSplitMealsControl1ViewModel();
+
+ if (int.Parse(System.Configuration.ConfigurationManager.AppSettings["ShowForm"].ToString()) == 0)
+ {
+ guanggao.Visibility = Visibility.Visible;
+ diqiu.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ guanggao.Visibility = Visibility.Collapsed;
+ diqiu.Visibility = Visibility.Visible;
+ }
+ Show();
+ }
+
+
+ ///
+ /// 点击切换广告
+ ///
+ ///
+ ///
+ private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ try
+ {
+ guanggao.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ diqiu.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ Show();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ ///
+ /// 显示广告
+ ///
+ public void Show()
+ {
+ string str = string.Empty;
+ if (Main.GetInstance.SaasRouteReturn != null && Main.GetInstance.SaasRouteReturn.Count >= 6)
+ {
+ AdDTO dto = Main.GetInstance.SaasRouteReturn?.Find(par => par.Address == "01");
+ if (dto != null)
+ {
+ str = dto.Ad;
+ Main.GetInstance.InitView2(str, webView, guanggao);
+ }
+ }
}
}
}
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
index c6429b06..4c24fc11 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
@@ -37,6 +37,20 @@ namespace BPASmartClient.ScreenLib
/// 当前刷新数据类型
///
public ScreenDeviceType type = ScreenDeviceType.分餐机;
+
+ ///
+ /// 订单总数
+ ///
+ public int OrderCount
+ {
+ get { return _OrderCount; }
+ set
+ {
+ _OrderCount = value;
+ OnPropertyChanged();
+ }
+ }
+ private int _OrderCount = 0;
#endregion
public ScreenSplitMealsControl1ViewModel()
@@ -51,6 +65,8 @@ namespace BPASmartClient.ScreenLib
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;
+
+ OrderCount = modelMaxWok.SplitMeals_CreditCardCount_1 + modelMaxWok.SplitMeals_CreditCardCount_2;
}
}));
Thread.Sleep(1000);
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml
index 94f1cbc3..8235fbd6 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml
@@ -1,188 +1,189 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 设备工作状态
-
-
-
- 今日刷卡数
-
-
-
-
-
-
-
-
-
-
-
- 前一位刷卡人
-
-
-
- 当前刷卡人
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 设备工作状态
-
-
-
- 今日刷卡数
-
-
-
-
-
-
-
-
-
-
-
- 前一位刷卡人
-
-
-
- 当前刷卡人
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设备工作状态
+
+
+
+ 今日刷卡数
+
+
+
+
+
+
+
+
+
+
+
+ 前一位刷卡人
+
+
+
+ 当前刷卡人
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设备工作状态
+
+
+
+ 今日刷卡数
+
+
+
+
+
+
+
+
+
+
+
+ 前一位刷卡人
+
+
+
+ 当前刷卡人
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml.cs b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml.cs
index 114548d9..f48b9b69 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml.cs
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml.cs
@@ -24,6 +24,55 @@ namespace BPASmartClient.ScreenLib
{
InitializeComponent();
this.DataContext = new ScreenSplitMealsControl2ViewModel();
+
+ if (int.Parse(System.Configuration.ConfigurationManager.AppSettings["ShowForm"].ToString()) == 0)
+ {
+ guanggao.Visibility = Visibility.Visible;
+ diqiu.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ guanggao.Visibility = Visibility.Collapsed;
+ diqiu.Visibility = Visibility.Visible;
+ }
+ Show();
+ }
+
+
+ ///
+ /// 点击切换广告
+ ///
+ ///
+ ///
+ private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ try
+ {
+ guanggao.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ diqiu.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ Show();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ ///
+ /// 显示广告
+ ///
+ public void Show()
+ {
+ string str = string.Empty;
+ if (Main.GetInstance.SaasRouteReturn != null && Main.GetInstance.SaasRouteReturn.Count >= 6)
+ {
+ AdDTO dto = Main.GetInstance.SaasRouteReturn?.Find(par => par.Address == "02");
+ if (dto != null)
+ {
+ str = dto.Ad;
+ Main.GetInstance.InitView2(str, webView, guanggao);
+ }
+ }
}
}
}
diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs
index e717d2b0..2cf8e38c 100644
--- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs
+++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs
@@ -37,6 +37,20 @@ namespace BPASmartClient.ScreenLib
/// 当前刷新数据类型
///
public ScreenDeviceType type = ScreenDeviceType.分餐机;
+
+ ///
+ /// 订单总数
+ ///
+ public int OrderCount
+ {
+ get { return _OrderCount; }
+ set
+ {
+ _OrderCount = value;
+ OnPropertyChanged();
+ }
+ }
+ private int _OrderCount = 0;
#endregion
public ScreenSplitMealsControl2ViewModel()
@@ -51,6 +65,8 @@ namespace BPASmartClient.ScreenLib
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;
+ OrderCount = modelMaxWok.SplitMeals_CreditCardCount_3 + modelMaxWok.SplitMeals_CreditCardCount_4;
+
}
}));
Thread.Sleep(1000);
diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml b/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml
index ae690224..1a5c6e34 100644
--- a/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml
+++ b/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml
@@ -194,13 +194,13 @@
-
-
+
+
-
+
-
+
diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml.cs b/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml.cs
index 0605a58e..68b96745 100644
--- a/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml.cs
+++ b/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml.cs
@@ -24,6 +24,54 @@ namespace BPASmartClient.ScreenLib
{
InitializeComponent();
this.DataContext = new ScreenMaxWokControlViewModel();
+ if (int.Parse(System.Configuration.ConfigurationManager.AppSettings["ShowForm"].ToString()) == 0)
+ {
+ guanggao.Visibility = Visibility.Visible;
+ diqiu.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ guanggao.Visibility = Visibility.Collapsed;
+ diqiu.Visibility = Visibility.Visible;
+ }
+ Show();
+ }
+
+
+ ///
+ /// 点击切换广告
+ ///
+ ///
+ ///
+ private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ try
+ {
+ guanggao.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ diqiu.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ Show();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ ///
+ /// 显示广告
+ ///
+ public void Show()
+ {
+ string str = string.Empty;
+ if (Main.GetInstance.SaasRouteReturn != null && Main.GetInstance.SaasRouteReturn.Count >= 6)
+ {
+ AdDTO dto = Main.GetInstance.SaasRouteReturn?.Find(par => par.Address == "05");
+ if (dto != null)
+ {
+ str = dto.Ad;
+ Main.GetInstance.InitView2(str, webView, guanggao);
+ }
+ }
}
}
}
diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs b/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs
index 08932c92..9e0e3760 100644
--- a/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs
+++ b/BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs
@@ -67,6 +67,20 @@ namespace BPASmartClient.ScreenLib
/// 当前刷新数据类型
///
public ScreenDeviceType type = ScreenDeviceType.大炒;
+
+ ///
+ /// 订单总数
+ ///
+ public int OrderCount
+ {
+ get { return _OrderCount; }
+ set
+ {
+ _OrderCount = value;
+ OnPropertyChanged();
+ }
+ }
+ private int _OrderCount =0;
#endregion
public ScreenMaxWokControlViewModel()
@@ -86,6 +100,7 @@ namespace BPASmartClient.ScreenLib
ProcessModel1?.ToList().ForEach(par => { if (par.Id+1 == ProcessModel1.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ProcessModel2?.ToList().ForEach(par => { if (par.Id+1 == ProcessModel2.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ViewData = modelMaxWok;
+ OrderCount = modelMaxWok.MaxWok_OrderCount_1 + modelMaxWok.MaxWok_OrderCount_2;
}
}));
Thread.Sleep(1000);
diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml
index 2c85b329..3c632781 100644
--- a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml
+++ b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml
@@ -194,13 +194,13 @@
-
-
+
+
-
+
-
+
diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml.cs b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml.cs
index 26b55e6a..6f7c1f8f 100644
--- a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml.cs
+++ b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml.cs
@@ -24,6 +24,54 @@ namespace BPASmartClient.ScreenLib
{
InitializeComponent();
this.DataContext = new ScreenMinWokControlViewModel();
+ if (int.Parse(System.Configuration.ConfigurationManager.AppSettings["ShowForm"].ToString()) == 0)
+ {
+ guanggao.Visibility = Visibility.Visible;
+ diqiu.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ guanggao.Visibility = Visibility.Collapsed;
+ diqiu.Visibility = Visibility.Visible;
+ }
+ Show();
+ }
+
+
+ ///
+ /// 点击切换广告
+ ///
+ ///
+ ///
+ private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ try
+ {
+ guanggao.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ diqiu.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ Show();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ ///
+ /// 显示广告
+ ///
+ public void Show()
+ {
+ string str = string.Empty;
+ if (Main.GetInstance.SaasRouteReturn != null && Main.GetInstance.SaasRouteReturn.Count >= 6)
+ {
+ AdDTO dto = Main.GetInstance.SaasRouteReturn?.Find(par => par.Address == "06");
+ if (dto != null)
+ {
+ str = dto.Ad;
+ Main.GetInstance.InitView2(str, webView, guanggao);
+ }
+ }
}
}
}
diff --git a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs
index 18329714..a4429133 100644
--- a/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs
+++ b/BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs
@@ -66,6 +66,20 @@ namespace BPASmartClient.ScreenLib
/// 当前刷新数据类型
///
public ScreenDeviceType type = ScreenDeviceType.小炒;
+
+ ///
+ /// 订单总数
+ ///
+ public int OrderCount
+ {
+ get { return _OrderCount; }
+ set
+ {
+ _OrderCount = value;
+ OnPropertyChanged();
+ }
+ }
+ private int _OrderCount = 0;
#endregion
public ScreenMinWokControlViewModel()
@@ -84,6 +98,8 @@ namespace BPASmartClient.ScreenLib
ProcessModel1?.ToList().ForEach(par => { if (par.Id + 1 == ProcessModel1.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ProcessModel2?.ToList().ForEach(par => { if (par.Id + 1 == ProcessModel2.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ViewData = modelMaxWok;
+ OrderCount = modelMaxWok.MinWok_OrderCount_1 + modelMaxWok.MinWok_OrderCount_2;
+
}
}));
Thread.Sleep(1000);
diff --git a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml
index 35fb916c..bc6f826d 100644
--- a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml
+++ b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml
@@ -116,15 +116,15 @@
-
-
+
+
-
+
-
+
-
+
@@ -220,7 +220,7 @@
-
+
diff --git a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml.cs b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml.cs
index e25e9142..c58c48ad 100644
--- a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml.cs
+++ b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml.cs
@@ -24,6 +24,54 @@ namespace BPASmartClient.ScreenLib
{
InitializeComponent();
this.DataContext = new ScreenMorksControlViewModel();
+
+ if (int.Parse(System.Configuration.ConfigurationManager.AppSettings["ShowForm"].ToString()) == 0)
+ {
+ guanggao.Visibility = Visibility.Visible;
+ diqiu.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ guanggao.Visibility = Visibility.Collapsed;
+ diqiu.Visibility = Visibility.Visible;
+ }
+ Show();
+ }
+
+ ///
+ /// 点击切换广告
+ ///
+ ///
+ ///
+ private void StackPanel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ try
+ {
+ guanggao.Visibility = guanggao.Visibility==Visibility.Collapsed? Visibility.Visible: Visibility.Collapsed;
+ diqiu.Visibility = guanggao.Visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
+ Show();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ ///
+ /// 显示广告
+ ///
+ public void Show()
+ {
+ string str=string.Empty;
+ if (Main.GetInstance.SaasRouteReturn != null && Main.GetInstance.SaasRouteReturn.Count >=6)
+ {
+ AdDTO dto= Main.GetInstance.SaasRouteReturn?.Find(par => par.Address =="04");
+ if (dto != null)
+ {
+ str = dto.Ad;
+ Main.GetInstance.InitView2(str, webView, guanggao);
+ }
+ }
}
}
}
diff --git a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs
index 136b4014..d007e44b 100644
--- a/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs
+++ b/BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs
@@ -9,6 +9,7 @@ using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using BPA.Message;
+using System.Windows;
namespace BPASmartClient.ScreenLib
{
diff --git a/BPASmartClient.ScreenMaxWok/App.config b/BPASmartClient.ScreenMaxWok/App.config
index 7eeaad9e..6a7db7eb 100644
--- a/BPASmartClient.ScreenMaxWok/App.config
+++ b/BPASmartClient.ScreenMaxWok/App.config
@@ -6,5 +6,8 @@
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.ScreenMinWok/App.config b/BPASmartClient.ScreenMinWok/App.config
index 7eeaad9e..6a7db7eb 100644
--- a/BPASmartClient.ScreenMinWok/App.config
+++ b/BPASmartClient.ScreenMinWok/App.config
@@ -6,5 +6,8 @@
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.ScreenMorks/App.config b/BPASmartClient.ScreenMorks/App.config
index 58a38bef..6a7db7eb 100644
--- a/BPASmartClient.ScreenMorks/App.config
+++ b/BPASmartClient.ScreenMorks/App.config
@@ -5,6 +5,9 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.ScreenSplitMeals/App.config b/BPASmartClient.ScreenSplitMeals/App.config
index 09ca65fa..c283b525 100644
--- a/BPASmartClient.ScreenSplitMeals/App.config
+++ b/BPASmartClient.ScreenSplitMeals/App.config
@@ -6,7 +6,9 @@
-
+
+
+
diff --git a/BPASmartClient.SmallBatchingSystem/Services/Control.cs b/BPASmartClient.SmallBatchingSystem/Services/Control.cs
index bd17b38a..5a241054 100644
--- a/BPASmartClient.SmallBatchingSystem/Services/Control.cs
+++ b/BPASmartClient.SmallBatchingSystem/Services/Control.cs
@@ -1,4 +1,4 @@
-#define test
+//#define ModelSwitch
using BPA.Helper;
using BPASmartClient.SmallBatchingSystem;
@@ -38,8 +38,8 @@ namespace BPASmartClient.SmallBatchingSystem
{
if (MakeOrderQueue.TryDequeue(out RecipeInfo recipeInfo))
{
- //ProcessOne(recipeInfo);
- ProcessTwo(recipeInfo);
+ ProcessOne(recipeInfo);
+ //ProcessTwo(recipeInfo);
}
}
Thread.Sleep(10);
@@ -80,8 +80,8 @@ namespace BPASmartClient.SmallBatchingSystem
if (res != null)
{
StatusNotify(res.SiloName, Status.正在配料);
- RunLog($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{temp1.SiloWeight}");
- PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)temp1.SiloWeight);
+ RunLog($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{temp1.SiloWeight * 10}");
+ PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)(temp1.SiloWeight * 10));
RunLog($"写启动信号地址:{GetStartSingleAdd(res.SiloLoc)}");
PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
@@ -109,6 +109,97 @@ namespace BPASmartClient.SmallBatchingSystem
RunLog($"【{recipeInfo.RecipeName}】配方执行完成");
ActionManage.GetInstance.Send("GrindArenaceousCancel");
}
+
+
+ // IsCancel = false;
+ // Dictionary> DeviceSoilInfo = new Dictionary>();
+ // List OutletInfo = new List();
+ // recipeInfo.SiloInfoModels.ToList()?.ForEach(item =>
+ // {
+ // var res = Json.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s == item.SiloName) != null);
+ // if (res != null)
+ // {
+ // var soliInfo = Json.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == item.SiloName);
+ // if (soliInfo != null)
+ // {
+ // if (!DeviceSoilInfo.ContainsKey(res.OutletLoc))
+ // {
+ // DeviceSoilInfo.Add(res.OutletLoc, new List());
+ // DeviceSoilInfo[res.OutletLoc].Add(soliInfo.SiloLoc);
+ // }
+ // else
+ // {
+ // DeviceSoilInfo[res.OutletLoc].Add(soliInfo.SiloLoc);
+ // }
+ // }
+
+ // }
+ // });
+
+ // foreach (var temp in DeviceSoilInfo)
+ // {
+ // PlcServer.GetInstance.WriteData("VW302", (ushort)temp.Key);//设置出料口位置
+ //#if ModelSwitch
+ // PlcServer.GetInstance.WriteData("M10.4", true);//定位启动
+ //#else
+ // PlcServer.GetInstance.WriteData("M10.0", true);//定位启动
+ //#endif
+
+ // RunLog($"启动定位,出料口位置:{temp.Key}");
+ // int index = temp.Key - 1;
+ // if (index >= 0)
+ // {
+ // RunLog("等待定位完成");
+ // while (!PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);//等待定位反馈
+ // if (IsCancel) break;
+ // RunLog("定位完成");
+ // PlcServer.GetInstance.WriteData("M20.0", false);
+ // while (PlcDataModel.TargetLocComplete && !IsCancel) Thread.Sleep(1);
+ // if (IsCancel) break;
+ // RunLog("定位完成,复位成功");
+ // foreach (var temp1 in temp.Value)
+ // {
+ // //var rest = Json.Data.OutletInfoModels.FirstOrDefault(p => p.SiloInfos.FirstOrDefault(s => s.Contains(temp1.SiloName)) != null);
+ // //if (rest != null && rest.OutletLoc == temp)
+ // //{
+
+ // var res = Json.Data.SiloInfoModels.FirstOrDefault(p => p.SiloLoc == temp1);
+ // if (res != null)
+ // {
+ // var tempRecipe = recipeInfo.SiloInfoModels.FirstOrDefault(p => p.SiloName == res.SiloName);
+ // if (tempRecipe != null)
+ // {
+ // StatusNotify(res.SiloName, Status.正在配料);
+ // RunLog($"写重量地址:{GetWeightAdd(res.SiloLoc)},重量:{tempRecipe.SiloWeight}");
+ // PlcServer.GetInstance.WriteData(GetWeightAdd(res.SiloLoc), (ushort)(tempRecipe.SiloWeight * 10));
+ // RunLog($"写启动信号地址:{GetStartSingleAdd(res.SiloLoc)}");
+ // PlcServer.GetInstance.WriteData(GetStartSingleAdd(res.SiloLoc), true);
+ // while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
+ // if (IsCancel) break;
+ // RunLog("出料完成,复位出料完成状态");
+ //#if ModelSwitch
+ // PlcServer.GetInstance.WriteData("M10.0", false);//复位出料完成信号
+ //#else
+ // PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
+ //#endif
+ // while (PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成信号复位成功
+ // if (IsCancel) break;
+ // RunLog("出料完成复位成功");
+ // StatusNotify(res.SiloName, Status.配料完成);
+ // }
+ // }
+ // //}
+ // }
+ // if (IsCancel) return;
+ // }
+ // }
+
+
+
+
+
+
+
}
///
@@ -179,10 +270,10 @@ namespace BPASmartClient.SmallBatchingSystem
while (!PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成
if (IsCancel) break;
RunLog("出料完成,复位出料完成状态");
-#if test
+#if ModelSwitch
PlcServer.GetInstance.WriteData("M10.0", false);//复位出料完成信号
#else
-PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
+ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
#endif
while (PlcDataModel.BatchingCompleted && !IsCancel) Thread.Sleep(1);//等待出料完成信号复位成功
@@ -275,7 +366,7 @@ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
///
private string GetWeightAdd(int num)
{
-#if test
+#if ModelSwitch
if (num > 0)
{
int add = 0;
@@ -287,10 +378,10 @@ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
}
return default;
#else
- if (num > 0)
+ if (num > 0)
{
int add = 0;
- if (num >= 1 && num <= 18)
+ if (num >= 1 && num <= 8)
{
add = 100 + (num - 1) * 2;
}
@@ -312,12 +403,14 @@ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
public void RunLog(string info)
{
+ BPA.Helper.MessageLog.GetInstance.Show(info);
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.ShowRunLog(info);
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
}
public void OperationLog(string info)
{
+ BPA.Helper.MessageLog.GetInstance.Show(info);
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.ShowUserLog(info);
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
}
@@ -342,7 +435,7 @@ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
///
private string GetStartSingleAdd(int num)
{
-#if test
+#if ModelSwitch
if (num > 0)
{
string Add = string.Empty;
@@ -359,7 +452,7 @@ PlcServer.GetInstance.WriteData("M4.0", false);//复位出料完成信号
}
return default;
#else
-if (num > 0)
+ if (num > 0)
{
string Add = string.Empty;
var t = num / 8;
diff --git a/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs b/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
index 9ccec0cf..860e58dc 100644
--- a/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
+++ b/BPASmartClient.SmallBatchingSystem/Services/PlcServer.cs
@@ -28,32 +28,13 @@ namespace BPASmartClient.SmallBatchingSystem
ThreadManage.GetInstance().StartLong(new Action(() =>
{
//带称程序
- //var res = ReadData("M20.0", 1);//到达目标位置信号
- //if (res != null && res is bool[] bools && bools.Length == 1)
- //{
- // PlcDataModel.TargetLocComplete = bools[0];
- //}
-
- //var res1 = ReadData("M4.0", 1);//通道出料完成
- //if (res1 != null && res1 is bool[] bools1 && bools1.Length == 1)
- //{
- // PlcDataModel.BatchingCompleted = bools1[0];
- //}
-
- //var res2 = ReadData("M13.3", 1);//配方配料完成,托盘在放碗或取碗位置
- //if (res2 != null && res2 is bool[] bools2 && bools2.Length == 1)
- //{
- // PlcDataModel.RecipeBatchingComplete = bools2[0];
- //}
-
- //定时程序
var res = ReadData("M20.0", 1);//到达目标位置信号
if (res != null && res is bool[] bools && bools.Length == 1)
{
PlcDataModel.TargetLocComplete = bools[0];
}
- var res1 = ReadData("M10.0", 1);//通道出料完成
+ var res1 = ReadData("M4.0", 1);//通道出料完成
if (res1 != null && res1 is bool[] bools1 && bools1.Length == 1)
{
PlcDataModel.BatchingCompleted = bools1[0];
@@ -65,6 +46,25 @@ namespace BPASmartClient.SmallBatchingSystem
PlcDataModel.RecipeBatchingComplete = bools2[0];
}
+ //定时程序
+ //var res = ReadData("M20.0", 1);//到达目标位置信号
+ //if (res != null && res is bool[] bools && bools.Length == 1)
+ //{
+ // PlcDataModel.TargetLocComplete = bools[0];
+ //}
+
+ //var res1 = ReadData("M10.0", 1);//通道出料完成
+ //if (res1 != null && res1 is bool[] bools1 && bools1.Length == 1)
+ //{
+ // PlcDataModel.BatchingCompleted = bools1[0];
+ //}
+
+ //var res2 = ReadData("M13.3", 1);//配方配料完成,托盘在放碗或取碗位置
+ //if (res2 != null && res2 is bool[] bools2 && bools2.Length == 1)
+ //{
+ // PlcDataModel.RecipeBatchingComplete = bools2[0];
+ //}
+
Thread.Sleep(10);
}), "PLC 数据监听");
});
diff --git a/BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs b/BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs
index fd7aec69..90ac9a53 100644
--- a/BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs
+++ b/BPASmartClient.SmallBatchingSystem/ViewModels/GrindArenaceousViewModel.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System.Collections.ObjectModel;
+using BPASmartClient.CustomResource.Pages.Model;
namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
@@ -36,13 +37,18 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
});
}
}), "OpenRecipeStatusMotion", true);
- CancelCommand = new RelayCommand(() => { Control.GetInstance.IsCancel = true; ActionManage.GetInstance.Send("GrindArenaceousCancel"); });
+ CancelCommand = new RelayCommand(() =>
+ {
+ if (MessageNotify.GetInstance.ShowDialog($"是否取消配方制作,取消后设备将终止配料过程!", DialogType.Warning))
+ {
+ Control.GetInstance.IsCancel = true; ActionManage.GetInstance.Send("GrindArenaceousCancel");
+ }
+ });
}
public string RecipeName { get { return _mRecipeName; } set { _mRecipeName = value; OnPropertyChanged(); } }
private string _mRecipeName;
-
public ObservableCollection Recipes { get; set; } = new ObservableCollection();
}
}
diff --git a/BPASmartClient.SmallBatchingSystem/ViewModels/OutletManagementViewModel.cs b/BPASmartClient.SmallBatchingSystem/ViewModels/OutletManagementViewModel.cs
index 65a762e6..a04e6123 100644
--- a/BPASmartClient.SmallBatchingSystem/ViewModels/OutletManagementViewModel.cs
+++ b/BPASmartClient.SmallBatchingSystem/ViewModels/OutletManagementViewModel.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
+using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.SmallBatchingSystem.Views;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -29,8 +30,11 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
var res = Json.Data.OutletInfoModels.FirstOrDefault(p => p.OutletName == o.ToString());
if (res != null)
{
- Json.Data.OutletInfoModels.Remove(res);
- Control.GetInstance.OperationLog($"{res.OutletName} 删除成功");
+ if (MessageNotify.GetInstance.ShowDialog($"是否删除【{res.OutletName}】出料口,删除后数据将永久丢失!无法找回", DialogType.Warning))
+ {
+ Json.Data.OutletInfoModels.Remove(res);
+ Control.GetInstance.OperationLog($"{res.OutletName} 删除成功");
+ }
}
}
});
diff --git a/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs b/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs
index f0e3705c..86b83e0d 100644
--- a/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs
+++ b/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeControlViewModel.cs
@@ -10,6 +10,7 @@ using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.SmallBatchingSystem.Views;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
+using BPASmartClient.CustomResource.Pages.Model;
namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
@@ -44,16 +45,18 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
}
else
{
- App.Current.Dispatcher.Invoke(() =>
- {
- NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", "配方下发失败,硬件设备状态未装备就绪!");
- });
+ //App.Current.Dispatcher.Invoke(() =>
+ //{
+ // NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "错误", "配方下发失败,硬件设备状态未装备就绪!");
+ //});
+ MessageNotify.GetInstance.ShowDialog($"配方下发失败,硬件设备状态未装备就绪!", DialogType.Error);
+
Control.GetInstance.RunLog("配方下发失败,硬件设备状态未装备就绪!");
}
});
});
- DeviceInitCommand = new RelayCommand(() => { PlcServer.GetInstance.WriteData("M10.3", true); });
+ DeviceInitCommand = new RelayCommand(() => { PlcServer.GetInstance.WriteData("M10.4", true); });
}
public RelayCommand DeviceInitCommand { get; set; }
diff --git a/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeViewModel.cs b/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeViewModel.cs
index 6bb94e57..df7c2382 100644
--- a/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeViewModel.cs
+++ b/BPASmartClient.SmallBatchingSystem/ViewModels/RecipeViewModel.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Helper;
+using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.SmallBatchingSystem.Views;
@@ -31,9 +32,12 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
var res = Json.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res != null)
{
- Json.Data.Recipes.Remove(res);
- Control.GetInstance.NotifyPrompt($"{res.RecipeName} 删除成功");
- Control.GetInstance.OperationLog($"{res.RecipeName} 删除成功");
+ if (MessageNotify.GetInstance.ShowDialog($"是否删除【{res.RecipeName}】配方,删除后数据将永久丢失!无法找回", DialogType.Warning))
+ {
+ Json.Data.Recipes.Remove(res);
+ Control.GetInstance.NotifyPrompt($"{res.RecipeName} 删除成功");
+ Control.GetInstance.OperationLog($"{res.RecipeName} 删除成功");
+ }
}
}
});
diff --git a/BPASmartClient.SmallBatchingSystem/ViewModels/SiloManagementViewModel.cs b/BPASmartClient.SmallBatchingSystem/ViewModels/SiloManagementViewModel.cs
index e82b3cf7..113af5ae 100644
--- a/BPASmartClient.SmallBatchingSystem/ViewModels/SiloManagementViewModel.cs
+++ b/BPASmartClient.SmallBatchingSystem/ViewModels/SiloManagementViewModel.cs
@@ -8,6 +8,7 @@ using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.SmallBatchingSystem.Views;
using System.Collections.ObjectModel;
using BPA.Helper;
+using BPASmartClient.CustomResource.Pages.Model;
namespace BPASmartClient.SmallBatchingSystem.ViewModels
{
@@ -29,9 +30,12 @@ namespace BPASmartClient.SmallBatchingSystem.ViewModels
var res = Json.Data.SiloInfoModels.FirstOrDefault(p => p.SiloName == o.ToString());
if (res != null)
{
- Json.Data.SiloInfoModels.Remove(res);
- Control.GetInstance.NotifyPrompt($"{res.SiloName} 删除成功");
- Control.GetInstance.OperationLog($"{res.SiloName} 删除成功");
+ if (MessageNotify.GetInstance.ShowDialog($"是否删除【{res.SiloName}】原料,删除后数据将永久丢失!无法找回", DialogType.Warning))
+ {
+ Json.Data.SiloInfoModels.Remove(res);
+ Control.GetInstance.NotifyPrompt($"{res.SiloName} 删除成功");
+ Control.GetInstance.OperationLog($"{res.SiloName} 删除成功");
+ }
}
}
});
diff --git a/BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml b/BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml
index 76883ee3..0eb6e6db 100644
--- a/BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml
+++ b/BPASmartClient.SmallBatchingSystem/Views/RecipeControlView.xaml
@@ -28,7 +28,7 @@
Height="30"
Margin="10,0,10,0"
HorizontalAlignment="Right"
- Command="{Binding AddCommand}"
+ Command="{Binding DeviceInitCommand}"
Content="初始化"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
diff --git a/DosingSystem/App.xaml.cs b/DosingSystem/App.xaml.cs
index dbe281db..3a1ba87f 100644
--- a/DosingSystem/App.xaml.cs
+++ b/DosingSystem/App.xaml.cs
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystem
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方管理",
- SubMenuPermission = new Permission[] { Permission.管理员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeSettingsView"
});
@@ -70,7 +70,7 @@ namespace BPASmartClient.DosingSystem
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeControlView"
});
@@ -78,6 +78,7 @@ namespace BPASmartClient.DosingSystem
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
MainMenuName = "配方管理",
Alias = "Recipe Management",
subMenumodels = RecipeManage,
@@ -89,7 +90,7 @@ namespace BPASmartClient.DosingSystem
ParSet.Add(new SubMenumodel()
{
SubMenuName = "原料参数设置",
- SubMenuPermission = new Permission[] { Permission.管理员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.DeviceMaterialParView"
});
@@ -97,7 +98,7 @@ namespace BPASmartClient.DosingSystem
ParSet.Add(new SubMenumodel()
{
SubMenuName = "设备参数设置",
- SubMenuPermission = new Permission[] { Permission.管理员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.CommParSetView"
});
@@ -113,6 +114,7 @@ namespace BPASmartClient.DosingSystem
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
MainMenuName = "参数设置",
Alias = "Parameter Set",
subMenumodels = ParSet,
@@ -124,7 +126,7 @@ namespace BPASmartClient.DosingSystem
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "气缸手动控制",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.ManualControlView"
});
@@ -132,7 +134,7 @@ namespace BPASmartClient.DosingSystem
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "输送带手动控制",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.ConveyerBeltManualView"
});
@@ -147,6 +149,7 @@ namespace BPASmartClient.DosingSystem
{
MainMenuIcon = "",
MainMenuName = "手动控制",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
Alias = "Parameter Set",
subMenumodels = ManualControl,
});
@@ -157,7 +160,7 @@ namespace BPASmartClient.DosingSystem
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "操作日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserLogView"
});
@@ -165,7 +168,7 @@ namespace BPASmartClient.DosingSystem
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "运行日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.RunLogView"
});
@@ -173,7 +176,7 @@ namespace BPASmartClient.DosingSystem
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "报警记录",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.AlarmView"
});
@@ -181,7 +184,7 @@ namespace BPASmartClient.DosingSystem
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "调试日志",
- SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.DebugLogView"
});
@@ -198,6 +201,7 @@ namespace BPASmartClient.DosingSystem
{
MainMenuIcon = "",
MainMenuName = "消息日志",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
Alias = "Message Log",
subMenumodels = InfoLog,
});
@@ -208,7 +212,7 @@ namespace BPASmartClient.DosingSystem
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "原料设备列表",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.DeviceListView"
});
@@ -216,7 +220,7 @@ namespace BPASmartClient.DosingSystem
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.HardwareStatusView"
});
@@ -225,6 +229,7 @@ namespace BPASmartClient.DosingSystem
{
MainMenuIcon = "",
MainMenuName = "设备监控",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
Alias = "Device Monitor",
subMenumodels = DeviceMonitor,
});
@@ -235,7 +240,7 @@ namespace BPASmartClient.DosingSystem
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户登录",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.SubPagLoginView"
});
@@ -243,14 +248,14 @@ namespace BPASmartClient.DosingSystem
UserManager.Add(new SubMenumodel()
{
SubMenuName = "密码修改",
- SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.PasswordChangeView"
});
UserManager.Add(new SubMenumodel()
{
SubMenuName = "用户管理",
- SubMenuPermission = new Permission[] { Permission.管理员 },
+ SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.UserManagerView"
});
@@ -267,6 +272,7 @@ namespace BPASmartClient.DosingSystem
{
MainMenuIcon = "",
MainMenuName = "用户管理",
+ MainMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
Alias = "User Management",
subMenumodels = UserManager,
});