From 2f73a52f8eb5047888c573b4edf3eaf1dae7cdef Mon Sep 17 00:00:00 2001 From: fyf Date: Fri, 18 Nov 2022 17:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.ScreenALL/App.config | 3 + .../Helper/HttpRequestHelper.cs | 328 +++++++++++++++ BPASmartClient.ScreenLib/Helper/Main.cs | 53 +++ .../Model/OrderMakeModel.cs | 81 ++++ .../分餐机/ScreenSplitMealsControl1.xaml | 8 +- .../ScreenSplitMealsControl1.xaml.cs | 49 +++ .../ScreenSplitMealsControl1ViewModel.cs | 16 + .../分餐机/ScreenSplitMealsControl2.xaml | 377 +++++++++--------- .../ScreenSplitMealsControl2.xaml.cs | 49 +++ .../ScreenSplitMealsControl2ViewModel.cs | 16 + .../炒锅/ScreenMaxWokControl.xaml | 8 +- .../炒锅/ScreenMaxWokControl.xaml.cs | 48 +++ .../炒锅/ScreenMaxWokControlViewModel.cs | 15 + .../炒锅/ScreenMinWokControl.xaml | 8 +- .../炒锅/ScreenMinWokControl.xaml.cs | 48 +++ .../炒锅/ScreenMinWokControlViewModel.cs | 16 + .../煮面机/ScreenMorksControl.xaml | 12 +- .../煮面机/ScreenMorksControl.xaml.cs | 48 +++ .../煮面机/ScreenMorksControlViewModel.cs | 1 + BPASmartClient.ScreenMaxWok/App.config | 3 + BPASmartClient.ScreenMinWok/App.config | 3 + BPASmartClient.ScreenMorks/App.config | 5 +- BPASmartClient.ScreenSplitMeals/App.config | 4 +- 23 files changed, 991 insertions(+), 208 deletions(-) create mode 100644 BPASmartClient.ScreenLib/Helper/HttpRequestHelper.cs 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 @@ - + + +