diff --git a/BPASmartClient.AGV/AGVHelper.cs b/BPASmartClient.AGV/AGVHelper.cs index e4b50fd8..54afe569 100644 --- a/BPASmartClient.AGV/AGVHelper.cs +++ b/BPASmartClient.AGV/AGVHelper.cs @@ -48,7 +48,7 @@ namespace BPASmartClient.AGV HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.Method = "POST"; request.Headers["header"] = head; - //request.Proxy = new WebProxy("192.168.1.12",80); + request.Proxy = null; byte[] bytes = Encoding.UTF8.GetBytes(body); request.ContentType = "application/json; charset=UTF-8"; ;//窗体数据被编码为名称/值对形式 //request.ContentType = "application/json"; @@ -56,7 +56,7 @@ namespace BPASmartClient.AGV Stream myResponseStream = request.GetRequestStream(); myResponseStream.Write(bytes, 0, bytes.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);//解码 string retString = myStreamReader.ReadToEnd(); myStreamReader.Close(); myResponseStream.Close(); @@ -134,9 +134,9 @@ namespace BPASmartClient.AGV ////url = url + "?sign=" + MD5Deal(body); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -182,10 +182,10 @@ namespace BPASmartClient.AGV ////启用签名 ////url = url + "?sign=" + MD5Deal(body); //string data= HttpRequest(url, head, body); - //object objData= JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //object objData = JsonConvert.DeserializeObject(data); + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -232,9 +232,9 @@ namespace BPASmartClient.AGV ////url = url + "?sign=" + MD5Deal(body); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -281,9 +281,9 @@ namespace BPASmartClient.AGV ////url = url + "?sign=" + MD5Deal(body); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -330,9 +330,9 @@ namespace BPASmartClient.AGV ////url = url + "?sign=" + MD5Deal(body); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -379,9 +379,9 @@ namespace BPASmartClient.AGV ////url = url + "?sign=" + MD5Deal(body); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -428,9 +428,9 @@ namespace BPASmartClient.AGV ////url = url + "?sign=" + MD5Deal(body); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -477,9 +477,9 @@ namespace BPASmartClient.AGV ////url = url + "?sign=" + MD5Deal(body); //string data = HttpRequest(url, head, body); //object objData = JsonConvert.DeserializeObject(data); - //if (objData != null && objData is HttpResponseModel response) + //if (objData != null && objData is HttpResponseBodyModel response) //{ - // return response.Body?.code; + // return response.code; //} return "Analysis Error"; } @@ -505,9 +505,9 @@ namespace BPASmartClient.AGV //url = url + "?sign=" + MD5Deal(body); string data = HttpRequest(url, head, body); object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) + if (objData != null && objData is HttpResponseBodyModel response) { - return response.Body?.code; + return response.code; } return "Analysis Error"; } @@ -533,9 +533,9 @@ namespace BPASmartClient.AGV //url = url + "?sign=" + MD5Deal(body); string data = HttpRequest(url, head, body); object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) + if (objData != null && objData is HttpResponseBodyModel response) { - return response.Body?.code; + return response.code; } return "Analysis Error"; } @@ -565,9 +565,9 @@ namespace BPASmartClient.AGV //url = url + "?sign=" + MD5Deal(body); string data = HttpRequest(url, head, body); object objData = JsonConvert.DeserializeObject(data); - if (objData != null && objData is HttpResponseModel response) + if (objData != null && objData is HttpResponseBodyModel response) { - return response.Body?.code; + return response.code; } return "Analysis Error"; } diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index 931bb4fa..883716d6 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -21,6 +21,8 @@ + + @@ -119,6 +121,7 @@ + @@ -161,6 +164,7 @@ + @@ -183,6 +187,7 @@ + @@ -226,6 +231,8 @@ + + @@ -261,14 +268,17 @@ + PreserveNewest + + diff --git a/BPASmartClient.CustomResource/Converters/OpacityConverter .cs b/BPASmartClient.CustomResource/Converters/OpacityConverter .cs new file mode 100644 index 00000000..83623f91 --- /dev/null +++ b/BPASmartClient.CustomResource/Converters/OpacityConverter .cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace BPASmartClient.CustomResource.Converters +{ + public class OpacityConverter: IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + double returnValue = 0.2; + if (value != null && value is bool statusValue) + { + switch (statusValue) + { + case true: + returnValue = 1; + break; + case false: + returnValue = 0.2; + break; + + } + } + return returnValue; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/BPASmartClient.CustomResource/Fonts/MT/iconfont.ttf b/BPASmartClient.CustomResource/Fonts/MT/iconfont.ttf new file mode 100644 index 00000000..8281b8a5 Binary files /dev/null and b/BPASmartClient.CustomResource/Fonts/MT/iconfont.ttf differ diff --git a/BPASmartClient.CustomResource/Fonts/naicha.ttf b/BPASmartClient.CustomResource/Fonts/naicha.ttf new file mode 100644 index 00000000..a790bcd4 Binary files /dev/null and b/BPASmartClient.CustomResource/Fonts/naicha.ttf differ diff --git a/BPASmartClient.CustomResource/Image/浅色背景.jpeg b/BPASmartClient.CustomResource/Image/浅色背景.jpeg new file mode 100644 index 00000000..d6efe965 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/浅色背景.jpeg differ diff --git a/BPASmartClient.CustomResource/Image/纹理背景.jpeg b/BPASmartClient.CustomResource/Image/纹理背景.jpeg new file mode 100644 index 00000000..a6919df9 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/纹理背景.jpeg differ diff --git a/BPASmartClient.CustomResource/Image/背景矢量/beijing.png b/BPASmartClient.CustomResource/Image/背景矢量/beijing.png new file mode 100644 index 00000000..15d57a81 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/背景矢量/beijing.png differ diff --git a/BPASmartClient.CustomResource/Image/调味品.jpeg b/BPASmartClient.CustomResource/Image/调味品.jpeg new file mode 100644 index 00000000..67804993 Binary files /dev/null and b/BPASmartClient.CustomResource/Image/调味品.jpeg differ diff --git a/BPASmartClient.CustomResource/Pages/Model/UserManager.cs b/BPASmartClient.CustomResource/Pages/Model/UserManager.cs index 258199e9..1baf3908 100644 --- a/BPASmartClient.CustomResource/Pages/Model/UserManager.cs +++ b/BPASmartClient.CustomResource/Pages/Model/UserManager.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +9,6 @@ namespace BPASmartClient.CustomResource.Pages.Model { public class UserManager { - public List userInfos { get; set; } = new List(); + public ObservableCollection userInfos { get; set; } = new ObservableCollection(); } } diff --git a/BPASmartClient.CustomResource/Pages/View/MainView.xaml b/BPASmartClient.CustomResource/Pages/View/MainView.xaml index cf1f6ccc..ee6df780 100644 --- a/BPASmartClient.CustomResource/Pages/View/MainView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/MainView.xaml @@ -442,10 +442,12 @@ + VerticalScrollBarVisibility="Hidden" + > @@ -550,9 +552,8 @@ FontSize="18" Foreground="#1A8ADE" Text="{Binding TimeVisible}" /> - - - + + diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs index 86c6f4cb..88b4aeb0 100644 --- a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs +++ b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs @@ -95,7 +95,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel /// /// 开机自启 /// - public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } + public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } } public RelayCommand NavChangedCommand { get; set; } public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } } diff --git a/BPASmartClient.CustomResource/Themes/MyStyle.xaml b/BPASmartClient.CustomResource/Themes/MyStyle.xaml index 7195c894..6dcc33ee 100644 --- a/BPASmartClient.CustomResource/Themes/MyStyle.xaml +++ b/BPASmartClient.CustomResource/Themes/MyStyle.xaml @@ -830,6 +830,16 @@ + + diff --git a/BPASmartClient.HubHelper/BPASmartClient.HubHelper.csproj b/BPASmartClient.HubHelper/BPASmartClient.HubHelper.csproj index be19220f..98a9415e 100644 --- a/BPASmartClient.HubHelper/BPASmartClient.HubHelper.csproj +++ b/BPASmartClient.HubHelper/BPASmartClient.HubHelper.csproj @@ -8,6 +8,7 @@ + diff --git a/BPASmartClient.KLMCoffee/CoffeeMachine.cs b/BPASmartClient.KLMCoffee/CoffeeMachine.cs index e2a20f59..b459392b 100644 --- a/BPASmartClient.KLMCoffee/CoffeeMachine.cs +++ b/BPASmartClient.KLMCoffee/CoffeeMachine.cs @@ -61,6 +61,8 @@ namespace BPASmartClient.KLMCoffee { MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); } + + } /// @@ -102,6 +104,8 @@ namespace BPASmartClient.KLMCoffee private void ResolveMsg() { + status["CoffeeIsConnected"] = OnLine; + IsConnected = OnLine; List temp = new List(); //一系列解包 while (dataStorage.GetSize() > 0) @@ -170,12 +174,11 @@ namespace BPASmartClient.KLMCoffee protected override void InitStatus() { status["CoffeeStatus"] = K95SysTemStatus.空闲状态; - status["CoffeedrinkType"] = DrinkType.意式; + status["CoffeedrinkType"] = DrinkType.意式咖啡; status["CoffeeAppStatus"] = TaskIndex.无任务; status["Coffeeprogress"] = 0; status["CoffeeWarning"] = new FaultMessage(0x00, 0x00).dataFault(); status["CoffeeKeep"] = new UpkeepMessage(0x00).dataFault(); - } public override void Init() @@ -189,9 +192,12 @@ namespace BPASmartClient.KLMCoffee try { free = true; - Thread.Sleep(200); - byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); + Thread.Sleep(300); + K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode; + //byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); + byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString()); commProxy.SendData(data); + MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成"); Thread.Sleep(200); free = false; } diff --git a/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs b/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs index ddca4769..90ad6882 100644 --- a/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs +++ b/BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs @@ -89,12 +89,12 @@ namespace BPASmartClient.KLMCoffee.Protocal { switch (me) { - case DrinkType.意式: return "01"; - case DrinkType.美式: return "02"; + case DrinkType.意式咖啡: return "01"; + case DrinkType.美式咖啡: return "02"; case DrinkType.热水: return "03"; - case DrinkType.卡布: return "04"; - case DrinkType.玛奇朵: return "05"; - case DrinkType.拿铁: return "06"; + case DrinkType.卡布奇诺: return "04"; + case DrinkType.玛琪雅朵: return "05"; + case DrinkType.拿铁咖啡: return "06"; case DrinkType.热牛奶: return "07"; case DrinkType.热奶沫: return "08"; default: return "01"; diff --git a/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs b/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs index da2fd40d..1a870f78 100644 --- a/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs +++ b/BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs @@ -11,34 +11,34 @@ namespace BPASmartClient.KLMCoffee.Protocal /// public enum K95deFaultCoffeeEnum { - 意式咖啡, - 美式咖啡, - 咖啡意式咖啡, - 卡布奇诺, - 玛琪雅朵, - 拿铁, - 白咖啡, - 芮斯崔朵, - 意式玛奇朵, - 奶油咖啡, - 双杯意式咖啡, - 双杯卡布奇诺, - 双杯拿铁, - 双杯玛琪雅朵, - 双杯白咖啡, - 双杯咖啡, - 双杯芮斯崔朵, - 双杯意式玛奇朵, - 双杯奶油咖啡, - 热水, - 牛奶, - 奶沫, - 大壶咖啡, - 取消制作, - 放杯确认, - 清洗冲泡器, - 清洗奶沫器, - 清洗奶沫器确认, - 状态查询 + 意式咖啡 = 1, + 美式咖啡 = 2, + 咖啡意式咖啡 = 9, + 卡布奇诺 = 4, + 玛琪雅朵 = 5, + 拿铁 = 6, + 白咖啡 = 14, + 芮斯崔朵 = 10, + 意式玛奇朵 = 13, + 奶油咖啡 = 12, + 双杯意式咖啡 = 51, + 双杯卡布奇诺 = 55, + 双杯拿铁 = 57, + 双杯玛琪雅朵 = 56, + 双杯白咖啡 = 59, + 双杯咖啡 = 52, + 双杯芮斯崔朵 = 53, + 双杯意式玛奇朵 = 58, + 双杯奶油咖啡 = 54, + 热水 = 3, + 牛奶 = 7, + 奶沫 = 8, + 大壶咖啡 = 11, + 取消制作 = 200, + 放杯确认 = 201, + 清洗冲泡器 = 202, + 清洗奶沫器 = 203, + 清洗奶沫器确认 = 204, + 状态查询 = 205 } } diff --git a/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs b/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs index 5665fd69..35677fb7 100644 --- a/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs +++ b/BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs @@ -63,7 +63,7 @@ namespace BPASmartClient.KLMCoffee.Protocal public RecipeModel() { - 饮品类型 = DrinkType.意式; + 饮品类型 = DrinkType.意式咖啡; 咖啡量 = 0; 咖啡温度 = TempEnum.低; 咖啡浓度 = CoffeeConcentration.清淡; @@ -125,22 +125,22 @@ namespace BPASmartClient.KLMCoffee.Protocal { switch (drink) { - case DrinkType.意式: + case DrinkType.意式咖啡: return GetItalian(60); break; - case DrinkType.美式: + case DrinkType.美式咖啡: return GetAmerican(60,450); break; case DrinkType.热水: return GetHotWater(194); break; - case DrinkType.卡布: + case DrinkType.卡布奇诺: return GetCabo(60,17); break; - case DrinkType.玛奇朵: + case DrinkType.玛琪雅朵: return GetMacChiato(60,8,17); break; - case DrinkType.拿铁: + case DrinkType.拿铁咖啡: return GetLatte(60,8,17); break; case DrinkType.热牛奶: @@ -166,7 +166,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 15-240 public string GetItalian(int _咖啡量) { - 饮品类型 = DrinkType.意式; + 饮品类型 = DrinkType.意式咖啡; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -187,7 +187,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 25-450 public string GetAmerican(int _咖啡量,int _热水量) { - 饮品类型 = DrinkType.美式; + 饮品类型 = DrinkType.美式咖啡; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -228,7 +228,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 5-120 public string GetCabo(int _咖啡量,int _奶沫时间) { - 饮品类型 = DrinkType.卡布; + 饮品类型 = DrinkType.卡布奇诺; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -250,7 +250,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 5-120 public string GetMacChiato(int _咖啡量,int _牛奶时间,int _奶沫时间) { - 饮品类型 = DrinkType.玛奇朵; + 饮品类型 = DrinkType.玛琪雅朵; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; @@ -272,7 +272,7 @@ namespace BPASmartClient.KLMCoffee.Protocal /// 5-120 public string GetLatte(int _咖啡量,int _牛奶时间,int _奶沫时间) { - 饮品类型 = DrinkType.拿铁; + 饮品类型 = DrinkType.拿铁咖啡; 咖啡量 = _咖啡量; 咖啡温度 = TempEnum.中; 咖啡浓度 = CoffeeConcentration.适中; diff --git a/BPASmartClient.MilkWithTea/App.config b/BPASmartClient.MilkWithTea/App.config new file mode 100644 index 00000000..4d680ea0 --- /dev/null +++ b/BPASmartClient.MilkWithTea/App.config @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BPASmartClient.MilkWithTea/App.xaml b/BPASmartClient.MilkWithTea/App.xaml new file mode 100644 index 00000000..dc565115 --- /dev/null +++ b/BPASmartClient.MilkWithTea/App.xaml @@ -0,0 +1,591 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MilkWithTea/App.xaml.cs b/BPASmartClient.MilkWithTea/App.xaml.cs new file mode 100644 index 00000000..42734460 --- /dev/null +++ b/BPASmartClient.MilkWithTea/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace BPASmartClient.MilkWithTea +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/BPASmartClient.MilkWithTea/AssemblyInfo.cs b/BPASmartClient.MilkWithTea/AssemblyInfo.cs new file mode 100644 index 00000000..8b5504ec --- /dev/null +++ b/BPASmartClient.MilkWithTea/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj b/BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj new file mode 100644 index 00000000..b7de3156 --- /dev/null +++ b/BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj @@ -0,0 +1,27 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml b/BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml new file mode 100644 index 00000000..2b27ca59 --- /dev/null +++ b/BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs b/BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs new file mode 100644 index 00000000..953dcde6 --- /dev/null +++ b/BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.MilkWithTea.Control +{ + /// + /// CircularProgressBar.xaml 的交互逻辑 + /// + public partial class CircularProgressBar : UserControl + { + public CircularProgressBar() + { + InitializeComponent(); + UpdateValue(Percent * 3.6); + } + public double Percent + { + get { return (double)GetValue(PercentProperty); } + set + { + SetValue(PercentProperty, value); + UpdateValue(Percent * 3.6); + } + + } + + //public static DependencyProperty PercentProperty => percentProperty; + + // Using a DependencyProperty as the backing store for Percent. This enables animation, styling, binding, etc... + private static readonly DependencyProperty PercentProperty = + DependencyProperty.Register("Percent", typeof(double), typeof(CircularProgressBar), new PropertyMetadata(default(double), new PropertyChangedCallback(OnPropertyChanged))); + + + private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CircularProgressBar _cycleProgess = d as CircularProgressBar; + _cycleProgess.UpdateValue(_cycleProgess.Percent * 3.6); + } + private void UpdateValue(double angle) + { + + if (angle > 360) return; + if (angle <= 0) return; + + int offset = 5; + if (angle > 359) angle = 359.8; + double radius = this.Width / 2 - offset; + if (radius < 0) return; + double b = radius * Math.Sin(angle * Math.PI / 180); + double x = radius + b; + double y = radius - radius * Math.Cos(angle * Math.PI / 180); + double startPositionX = radius + offset; + double startPositionY = offset; + + if (angle > 180) + { + + //string Data = string.Format("M {0} 0 A {0} {0} 0 1 1 {1} {2}", radius, Math.Round(x, 2), Math.Round(y, 2)); + string Data = string.Format("M {0} {1} A {2} {2} 0 1 1 {3} {4}", startPositionX, startPositionY, radius, Math.Round(x, 2) + offset, Math.Round(y, 2) + offset); + this.cyclePath.Data = Geometry.Parse(Data); + } + else + { + + //string Data = string.Format("M {0} 0 A {0} {0} 0 0 1 {1} {2}", radius, Math.Round(x,2), Math.Round(y, 2)); + + string Data = string.Format("M {0} {1} A {2} {2} 0 0 1 {3} {4}", startPositionX, startPositionY, radius, Math.Round(x, 2) + offset, Math.Round(y, 2) + offset); + + this.cyclePath.Data = Geometry.Parse(Data); + } + } + + } +} + diff --git a/BPASmartClient.MilkWithTea/DeviceInfo.xml b/BPASmartClient.MilkWithTea/DeviceInfo.xml new file mode 100644 index 00000000..5074e0f0 --- /dev/null +++ b/BPASmartClient.MilkWithTea/DeviceInfo.xml @@ -0,0 +1,86 @@ + + + + + + + + --> + + + + + 192.168.6.1 + 502 + M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7; + + + + + -->--> + + diff --git a/BPASmartClient.MilkWithTea/GLobal.cs b/BPASmartClient.MilkWithTea/GLobal.cs new file mode 100644 index 00000000..ac24bfe9 --- /dev/null +++ b/BPASmartClient.MilkWithTea/GLobal.cs @@ -0,0 +1,57 @@ +using Model; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPASmartClient.MilkWithTea +{ + public class GLobal + { + //路径 + public static string recipePath = string.Empty; + public static string posionPath = string.Empty; + + public static bool makeEnable = false; + + public static ObservableCollection MaterialRecipes { get; set; } = new ObservableCollection(); + + + /// + /// 获取Json文件内容,转换成ObservableCollection + /// + /// + /// + /// + public static ObservableCollection GetJsonToT(string path) + { + if (!File.Exists(path)) + { + //创建该文件 + File.Create(path); + return default; + } + else + { + using (StreamReader recipeReader = new StreamReader(path))//读取json文件 + { + string datacache = ""; + string line; + while ((line = recipeReader.ReadLine()) != null) //循环将每一行数据拼接为一个完整的字符串 + { + datacache = datacache + line; + } + + var res = JsonConvert.DeserializeObject>(datacache); //将string转换为class类,从而达到json文件转换的目的 + if (res != null) + return res; + else return new ObservableCollection { }; + } + } + } + } +} diff --git a/BPASmartClient.MilkWithTea/MainWindow.xaml b/BPASmartClient.MilkWithTea/MainWindow.xaml new file mode 100644 index 00000000..174834ae --- /dev/null +++ b/BPASmartClient.MilkWithTea/MainWindow.xaml @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MilkWithTea/MainWindow.xaml.cs b/BPASmartClient.MilkWithTea/MainWindow.xaml.cs new file mode 100644 index 00000000..091c776d --- /dev/null +++ b/BPASmartClient.MilkWithTea/MainWindow.xaml.cs @@ -0,0 +1,214 @@ +using BPASmartClient.Business; +using BPASmartClient.CustomResource.UserControls; +using BPASmartClient.CustomResource.UserControls.MessageShow; +using BPASmartClient.Device; +using BPASmartClient.Helper; +using BPASmartClient.IoT; +using BPASmartClient.Message; +using BPASmartClient.Peripheral; +using BPASmartClient.ViewModel; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.MilkWithTea +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainConsole mainConsole; + public MainWindow() + { + InitializeComponent(); + + Initialize(); + + } + + + private void Initialize() + { + + ThreadManage.GetInstance().Start(new Action(() => + { + GetDevices(); + mainConsole = new MainConsole(); + mainConsole.Start(); + }), "启动主控制台", false); + + ActionManage.GetInstance.Register(new Action(() => + { + ThreadManage.GetInstance().Start(new Action(() => + { + try + { + DataVClient.GetInstance().Initialize(); + DataVClient.GetInstance().Start(); + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx(ex.ToString()); + } + }), "启动主IoT", false); + }), "配置初始化完成Iot启动"); + + ActionManage.GetInstance.Register(new Action((o) => + { + App.Current.Dispatcher.Invoke(new Action(() => + { + if (o is IOTCommandModel iot) + { + switch (iot.CommandName) + { + case 0://控制类 + if (iot.CommandValue != null && iot.CommandValue.Count > 0) + { + switch (iot.CommandValue.Keys.ToList()[0]) + { + case "程序启动": + //mainConsole.Start(); + break; + //mainConsole.Stop(); + case "程序停止": + break; + case "程序复位": + //mainConsole.Stop(); + //mainConsole.Start(); + break; + default: + break; + } + NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "大屏控制", iot.CommandValue.Keys.ToList()[0]); + } + break; + case 1://设置类 + break; + case 2://通知类 + if (iot.CommandValue != null && iot.CommandValue.ContainsKey("text")) + { + NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "大屏通知", iot.CommandValue["text"]); + } + break; + default: + break; + } + } + })); + }), "IotBroadcast"); + NavButton_Click(new Button() { Tag = "MainControlView" },null); + + } + + /// + /// 获取设备集合 + /// + private void GetDevices() + { + //List IDevices = new List(); + //List IPeripherals = new List(); + + DirectoryInfo directoryInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); + var files = directoryInfo.GetFiles().Where(p => p.FullName.Contains("BPASmartClient.") && p.FullName.Contains("dll")).ToList(); + List fileList = new List(); + + var assemblies = AppDomain.CurrentDomain.GetAssemblies(); + var dlls = assemblies?.Where(p => p.FullName.Contains("BPASmartClient.")).ToList(); + List dllList = new List(); + + if (files != null) + { + foreach (var item in files) + { + var res = System.IO.Path.GetFileNameWithoutExtension(item.FullName); + if (res != null && res.Length > 0 && res.Contains(".") && !res.Contains("dll")) fileList.Add(res); + } + } + + if (dlls != null) + { + dlls.ForEach((item) => + { + item.GetTypes().ToList().ForEach((type) => + { + if (type.GetInterfaces().Contains(typeof(IDevice))) + { + if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName); + } + else if (type.GetInterfaces().Contains(typeof(IPeripheral))) + { + if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName); + } + }); + + dllList.Add(System.IO.Path.GetFileNameWithoutExtension(item.EscapedCodeBase)); + }); + } + + dllList.ForEach((item) => { if (fileList.Contains(item)) fileList.Remove(item); }); + + fileList.ForEach((item) => + { + Assembly.Load(item).GetTypes().ToList().ForEach((type) => + { + if (type.GetInterfaces().Contains(typeof(IDevice))) + { + if (!type.FullName.Contains("BaseDevice")) ShopDeviceConfigViewModel.IDevices.Add(type.FullName); + } + else if (type.GetInterfaces().Contains(typeof(IPeripheral))) + { + if (!type.FullName.Contains("BasePeripheral")) ShopDeviceConfigViewModel.IPeripherals.Add(type.FullName); + } + }); + }); + + + } + + + + private void Grid_MouseDown(object sender, MouseButtonEventArgs e) + { + this.DragMove(); + } + + + + private void CloseButton_Click(object sender, RoutedEventArgs e) + { + this.Close(); + } + + + private void NavButton_Click(object sender, RoutedEventArgs e) + { + try + { + if (sender is Button bt ) + { + Type type = Type.GetType($"BPASmartClient.MilkWithTea.View.{bt.Tag?.ToString()}"); + ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); + contentRegion.Content = (FrameworkElement)cti.Invoke(null); + } + } + catch (Exception ex) + { + MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuItem_Click(),描述:[{ex.Message}]"); + } + } + } +} diff --git a/BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml b/BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml new file mode 100644 index 00000000..a8fbca5d --- /dev/null +++ b/BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml @@ -0,0 +1,299 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs b/BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs new file mode 100644 index 00000000..8593362a --- /dev/null +++ b/BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs @@ -0,0 +1,38 @@ +using BPASmartClient.MilkWithTea.ViewModel; +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.MilkWithTea.View +{ + /// + /// MainControlView.xaml 的交互逻辑 + /// + public partial class MainControlView : UserControl + { + public MainControlView() + { + InitializeComponent(); + } + + private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if((sender as ListBox).SelectedItem is LocalTeaWithMilkConfig config) + { + recipeList.ItemsSource = config.materialRecipes; + } + } + } +} diff --git a/BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml b/BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml new file mode 100644 index 00000000..ca14d7d9 --- /dev/null +++ b/BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs b/BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs new file mode 100644 index 00000000..771aac6a --- /dev/null +++ b/BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs @@ -0,0 +1,30 @@ +using BPASmartClient.ViewModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BPASmartClient.MilkWithTea.View +{ + /// + /// MessageLogInfo.xaml 的交互逻辑 + /// + public partial class MessageLogInfo : UserControl + { + public MessageLogInfo() + { + InitializeComponent(); + this.DataContext = LogViewModel.GetInstance(); + } + } +} diff --git a/BPASmartClient.MilkWithTea/View/ParameterSetting.xaml b/BPASmartClient.MilkWithTea/View/ParameterSetting.xaml new file mode 100644 index 00000000..b3eb4be9 --- /dev/null +++ b/BPASmartClient.MilkWithTea/View/ParameterSetting.xaml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +