pry 2 yıl önce
ebeveyn
işleme
7ff52df490
100 değiştirilmiş dosya ile 5645 ekleme ve 1106 silme
  1. +25
    -25
      BPASmartClient.AGV/AGVHelper.cs
  2. +10
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  3. +37
    -0
      BPASmartClient.CustomResource/Converters/OpacityConverter .cs
  4. BIN
     
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. +2
    -1
      BPASmartClient.CustomResource/Pages/Model/UserManager.cs
  11. +5
    -4
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  12. +1
    -1
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  13. +11
    -1
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  14. +1
    -0
      BPASmartClient.HubHelper/BPASmartClient.HubHelper.csproj
  15. +10
    -4
      BPASmartClient.KLMCoffee/CoffeeMachine.cs
  16. +5
    -5
      BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs
  17. +29
    -29
      BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs
  18. +11
    -11
      BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs
  19. +44
    -0
      BPASmartClient.MilkWithTea/App.config
  20. +591
    -0
      BPASmartClient.MilkWithTea/App.xaml
  21. +17
    -0
      BPASmartClient.MilkWithTea/App.xaml.cs
  22. +10
    -0
      BPASmartClient.MilkWithTea/AssemblyInfo.cs
  23. +27
    -0
      BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj
  24. +31
    -0
      BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml
  25. +88
    -0
      BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs
  26. +86
    -0
      BPASmartClient.MilkWithTea/DeviceInfo.xml
  27. +57
    -0
      BPASmartClient.MilkWithTea/GLobal.cs
  28. +139
    -0
      BPASmartClient.MilkWithTea/MainWindow.xaml
  29. +214
    -0
      BPASmartClient.MilkWithTea/MainWindow.xaml.cs
  30. +299
    -0
      BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml
  31. +4
    -11
      BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml.cs
  32. +221
    -0
      BPASmartClient.MilkWithTea/View/MainControlView.xaml
  33. +38
    -0
      BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs
  34. +56
    -0
      BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml
  35. +30
    -0
      BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs
  36. +113
    -0
      BPASmartClient.MilkWithTea/View/ParameterSetting.xaml
  37. +34
    -0
      BPASmartClient.MilkWithTea/View/ParameterSetting.xaml.cs
  38. +211
    -0
      BPASmartClient.MilkWithTea/ViewModel/LocalConfigureViewModel.cs
  39. +236
    -0
      BPASmartClient.MilkWithTea/ViewModel/MainControlViewModel.cs
  40. +37
    -0
      BPASmartClient.MilkWithTea/ViewModel/MainWindowVeiwModel.cs
  41. +123
    -0
      BPASmartClient.MilkWithTea/ViewModel/PatrameterSettiongViewModel.cs
  42. +8
    -8
      BPASmartClient.Model/咖啡机/Enum/DrinkType.cs
  43. +58
    -0
      BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs
  44. +1
    -1
      BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs
  45. +1
    -0
      BPASmartClient.Model/订单/MorkTSimOrder.cs
  46. +1
    -2
      BPASmartClient.MorkF/Control_MorkF.cs
  47. +0
    -1
      BPASmartClient.MorkS/Control_Morks.cs
  48. +24
    -25
      BPASmartClient.MorkT/View/DebugView.xaml
  49. +0
    -13
      BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj
  50. +0
    -317
      BPASmartClient.MorkTJuicer/Control_MORKJC.cs
  51. +0
    -8
      BPASmartClient.MorkTJuicer/GVL_MORKJC.cs
  52. +0
    -15
      BPASmartClient.MorkTM/Alarm.cs
  53. +4
    -0
      BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj
  54. +303
    -21
      BPASmartClient.MorkTM/Control_MorkTM.cs
  55. +213
    -4
      BPASmartClient.MorkTM/GVL_MorkTM.cs
  56. +0
    -31
      BPASmartClient.MorkTM/Model/Alarms.cs
  57. +55
    -0
      BPASmartClient.MorkTM/Model/LocalTeaWithMilkConfig.cs
  58. +1
    -0
      BPASmartClient.MorkTM/Model/WritePar.cs
  59. +3
    -5
      BPASmartClient.MorkTM/OrderLocInfo.cs
  60. +150
    -14
      BPASmartClient.MorkTM/PolymerBatching.cs
  61. +0
    -16
      BPASmartClient.MorkTM/Properties/AssemblyInfo.cs
  62. +0
    -63
      BPASmartClient.MorkTM/Properties/Resources.Designer.cs
  63. +0
    -101
      BPASmartClient.MorkTM/Properties/Resources.resx
  64. +0
    -26
      BPASmartClient.MorkTM/Properties/Settings.Designer.cs
  65. +0
    -6
      BPASmartClient.MorkTM/Properties/Settings.settings
  66. +217
    -15
      BPASmartClient.MorkTM/View/Debug.xaml
  67. +1
    -3
      BPASmartClient.MorkTM/View/Debug.xaml.cs
  68. +0
    -50
      BPASmartClient.MorkTM/View/Monitor.xaml
  69. +284
    -0
      BPASmartClient.MorkTM/View/RecipeView.xaml
  70. +36
    -0
      BPASmartClient.MorkTM/View/RecipeView.xaml.cs
  71. +0
    -27
      BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs
  72. +241
    -0
      BPASmartClient.MorkTM/ViewModel/RecipeViewModel.cs
  73. +16
    -0
      BPASmartClient.MorkTSingle/BPASmartClient.MorkTSingle.csproj
  74. +316
    -0
      BPASmartClient.MorkTSingle/Control_MORKJC.cs
  75. +23
    -0
      BPASmartClient.MorkTSingle/GVL_MORKJC.cs
  76. +20
    -0
      BPASmartClient.MorkTSingle/OrderLocInfo.cs
  77. +28
    -15
      BPASmartClient.MorkTSingle/PolymerBatching.cs
  78. +39
    -0
      BPASmartClient.MorkTSingle/View/DebugView.xaml
  79. +29
    -0
      BPASmartClient.MorkTSingle/View/DebugView.xaml.cs
  80. +47
    -0
      BPASmartClient.MorkTSingle/ViewModel/DebugViewModel.cs
  81. +0
    -94
      BPASmartClient.MorkT_BarCounter/ViewModel/MonitorViewModel.cs
  82. +1
    -1
      BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
  83. +2
    -2
      BPASmartClient.MorkT_Container/GVL_MorkT.cs
  84. +0
    -92
      BPASmartClient.MorkT_Container/ViewModel/MonitorViewModel.cs
  85. +1
    -1
      BPASmartClient.Peripheral/BasePeripheral.cs
  86. +10
    -2
      BPASmartClient.SerialPort/SerialPortClient.cs
  87. +7
    -7
      BPASmartClient/App.config
  88. +3
    -3
      BPASmartClient/BPASmartClient.csproj
  89. +11
    -0
      BPASmartClient/DeviceInfo.xml
  90. +2
    -2
      BPASmartClient/MainWindow.xaml
  91. +8
    -2
      FryPot_DosingSystem/App.xaml.cs
  92. +19
    -20
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  93. +7
    -0
      FryPot_DosingSystem/FryPot_DosingSystem.csproj
  94. +1
    -0
      FryPot_DosingSystem/Model/RecipeManage.cs
  95. +11
    -0
      FryPot_DosingSystem/Model/RecipeModel.cs
  96. +391
    -0
      FryPot_DosingSystem/Resources/fonts/demo_index.html
  97. BIN
     
  98. +1
    -1
      FryPot_DosingSystem/View/NewRecipeView.xaml.cs
  99. +170
    -0
      FryPot_DosingSystem/View/RecipeManageView.xaml
  100. +28
    -0
      FryPot_DosingSystem/View/RecipeManageView.xaml.cs

+ 25
- 25
BPASmartClient.AGV/AGVHelper.cs Dosyayı Görüntüle

@@ -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";
}


+ 10
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Dosyayı Görüntüle

@@ -21,6 +21,8 @@
<ItemGroup>
<None Remove="Fonts\80号-萌趣小鱼体.ttf" />
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\MT\iconfont.ttf" />
<None Remove="Fonts\naicha.ttf" />
<None Remove="Fonts\Quartz Regular.ttf" />
<None Remove="Image\AGV\agv.png" />
<None Remove="Image\AGV\AGV小车.png" />
@@ -119,6 +121,7 @@
<None Remove="Image\智慧城市科技风登录页面边框.png" />
<None Remove="Image\有告警.png" />
<None Remove="Image\标题背景.png" />
<None Remove="Image\浅色背景.jpeg" />
<None Remove="Image\环形切图\内圈\未选中.png" />
<None Remove="Image\环形切图\内圈\选中.png" />
<None Remove="Image\环形切图\占位.png" />
@@ -161,6 +164,7 @@
<None Remove="Image\窗体样式\Tab\Tab_SelectBJ.png" />
<None Remove="Image\窗体样式\Tab\Tab_SelectWZBJ.png" />
<None Remove="Image\竖线.png" />
<None Remove="Image\纹理背景.jpeg" />
<None Remove="Image\维护.png" />
<None Remove="Image\背景.png" />
<None Remove="Image\背景2.png" />
@@ -183,6 +187,7 @@
<None Remove="Image\表格\表格顶右.png" />
<None Remove="Image\表格\表格顶左.png" />
<None Remove="Image\表格标题背景2.png" />
<None Remove="Image\调味品.jpeg" />
<None Remove="Image\边框效果2.png" />
<None Remove="Image\边角.png" />
<None Remove="Image\退出.png" />
@@ -226,6 +231,8 @@
<ItemGroup>
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\MT\iconfont.ttf" />
<Resource Include="Fonts\naicha.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\AGV\agv.png" />
<Resource Include="Image\AGV\AGV小车.png" />
@@ -261,14 +268,17 @@
<Resource Include="Image\工艺流程.png" />
<Resource Include="Image\智慧城市科技风登录页面.png" />
<Resource Include="Image\智慧城市科技风登录页面边框.png" />
<Resource Include="Image\浅色背景.jpeg" />
<Resource Include="Image\界面2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
<Resource Include="Image\圆角矩形 30 拷贝.png" />
<Resource Include="Image\登录界面背景.jpg" />
<Resource Include="Image\登录界面背景1.jpg" />
<Resource Include="Image\纹理背景.jpeg" />
<Resource Include="Image\背景2.png" />
<Resource Include="Image\背景3.jpg" />
<Resource Include="Image\调味品.jpeg" />
<Resource Include="Image\边角.png" />
</ItemGroup>



+ 37
- 0
BPASmartClient.CustomResource/Converters/OpacityConverter .cs Dosyayı Görüntüle

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







+ 2
- 1
BPASmartClient.CustomResource/Pages/Model/UserManager.cs Dosyayı Görüntüle

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

+ 5
- 4
BPASmartClient.CustomResource/Pages/View/MainView.xaml Dosyayı Görüntüle

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

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

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

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

<!--#endregion-->


+ 1
- 1
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs Dosyayı Görüntüle

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

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


+ 11
- 1
BPASmartClient.CustomResource/Themes/MyStyle.xaml Dosyayı Görüntüle

@@ -830,6 +830,16 @@
</Style.Setters>
</Style>

<Style x:Key="boreder奶茶背景" TargetType="Border">
<Style.Setters>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/背景矢量/beijing.png"/>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>

<Style x:Key="border界面背景" TargetType="Border">
<Style.Setters>
<Setter Property="Background">
@@ -1866,7 +1876,7 @@
<Style x:Key="80号字体样式" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;Component/Fonts/#zihun80hao-mengquxiaoyuti" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="Foreground" Value="#FFFCD5B5" />
</Style>



+ 1
- 0
BPASmartClient.HubHelper/BPASmartClient.HubHelper.csproj Dosyayı Görüntüle

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

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

</Project>

+ 10
- 4
BPASmartClient.KLMCoffee/CoffeeMachine.cs Dosyayı Görüntüle

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


}

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

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

}

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


+ 5
- 5
BPASmartClient.KLMCoffee/Protocal/K95commandEnumExtensions.cs Dosyayı Görüntüle

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


+ 29
- 29
BPASmartClient.KLMCoffee/Protocal/K95deFaultCoffeeEnum.cs Dosyayı Görüntüle

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

+ 11
- 11
BPASmartClient.KLMCoffee/Protocal/RecipeModel.cs Dosyayı Görüntüle

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

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


+ 44
- 0
BPASmartClient.MilkWithTea/App.config Dosyayı Görüntüle

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>

<!--通用配置-->
<!--<add key="ClientId" value="43"/>-->
<add key="IsEnableTest" value="false"/>

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

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

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

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->
<!--LOCAL:直接使用下方本地“设备连接信息”-->
<add key="StartupMode" value="API"/>
<add key="ProductKey" value="grgpECHSL7q"/>
<add key="DeviceName" value="qsqdzklb"/>
<add key="DeviceSecret" value="e2b300892c3e21469c8dc6c7c5c4430d"/>
<add key="PasswordBox" value="6WrKhYmTIhLV7g24jIH/lg=="/>


<!--外设配置-->
<add key="COM_Coffee" value="COM3"/>
<add key="BAUD_Coffee" value="115200"/>
<add key="COM_IceCream" value="COM12"/>
<add key="BAUD_IceCream" value="9600"/>
<add key="IceCream_CXB_Threshold" value="90"/>
<add key="COM_ICChip" value="COM6"/>
<add key="BAUD_IChip" value="9600"/>

</appSettings>
</configuration>

+ 591
- 0
BPASmartClient.MilkWithTea/App.xaml Dosyayı Görüntüle

@@ -0,0 +1,591 @@
<Application x:Class="BPASmartClient.MilkWithTea.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea"
StartupUri="MainWindow.xaml">
<Application.Resources>
<Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}">
<Grid x:Name="Grid">
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent"/>
<Border x:Name="Rectangle1" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Tag" Value="Horizontal">
<Setter TargetName="Rectangle1" Property="Width" Value="Auto"/>
<Setter TargetName="Rectangle1" Property="Height" Value="7"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--滚动条样式-->
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Foreground" Value="LightGray"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Width" Value="11"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid x:Name="GridRoot" Width="14" Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--This is scrollbar track-->
<Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="True" Focusable="False">
<Track.Thumb>
<Thumb x:Name="Thumb" Background="{TemplateBinding Foreground}" Style="{DynamicResource ScrollThumbs}"/>
</Track.Thumb>
<Track.IncreaseRepeatButton>
<RepeatButton x:Name="PageUp" Command="ScrollBar.PageUpCommand" Opacity="0" Focusable="False"/>
</Track.IncreaseRepeatButton>
<Track.DecreaseRepeatButton>
<RepeatButton x:Name="PageDown" Command="ScrollBar.PageDownCommand" Opacity="0" Focusable="False"/>
</Track.DecreaseRepeatButton>
</Track>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="Thumb" Property="Visibility" Value="Collapsed"/>
</Trigger>
<Trigger Property="Orientation" Value="Horizontal">
<Setter TargetName="GridRoot" Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90"/>
</Setter.Value>
</Setter>
<Setter TargetName="PART_Track" Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="-90"/>
</Setter.Value>
</Setter>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="12"/>
<Setter TargetName="Thumb" Property="Tag" Value="Horizontal"/>
<Setter TargetName="PageDown" Property="Command" Value="ScrollBar.PageLeftCommand"/>
<Setter TargetName="PageUp" Property="Command" Value="ScrollBar.PageRightCommand"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--datagrid标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="30" />
<Setter Property="Foreground" Value="DarkSlateGray" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="Black" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="25" />
</Style>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#FF31879E" />
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Height="{TemplateBinding Height}"
SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


<Style x:Key="buttonNormal" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="#58B0ED"/>
<Setter Property="BorderBrush" Value="#FF707070"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="10" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border" Value="#58B0ED "/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="border" Value="#58B0ED"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--下拉列表样式-->
<Style x:Key="ExpanderStyle" TargetType="{x:Type Expander}">
<Setter Property="IsExpanded" Value="False"></Setter>
<Setter Property="Margin" Value="40,20"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
</Grid.RowDefinitions>

<Border BorderThickness="1" Background="White" BorderBrush="Black" CornerRadius="10" Padding="10,2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>

<ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" VerticalAlignment="Center"/>
<ToggleButton x:Name="HeaderSite" Grid.Column="1" Background="Transparent"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{DynamicResource ExpanderToggleButtonStyle}" />
</Grid>
</Border>
<ContentPresenter x:Name="ExpandSite" Grid.Row="1"
ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value=" #E1FFFF"/>
</Trigger>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ExpanderToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Height" Value="30" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="FontSize" Value="22" />
<Setter Property="FontFamily" Value="宋体" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Width" Value="50"></Setter>
<Setter Property="Padding" Value="5 5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Canvas Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Canvas x:Name="canvNormal" Visibility="Visible"
Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Left="-30">
<Path Data="M 0 0 L 6 6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="10"/>
<Path Data="M 0 0 L 6 6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="15"/>
</Canvas>
<Canvas x:Name="canvChecked" Visibility="Hidden"
Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}" SnapsToDevicePixels="True" Canvas.Left="-30">
<Path Data="M 0 0 L 6 -6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="15"/>
<Path Data="M 0 0 L 6 -6 12 0 " Stroke="#FF37A0EA" StrokeThickness="2" Canvas.Left="5" Canvas.Top="20"/>
</Canvas>

<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>

</Canvas>

<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="SlateGray" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter Property="Visibility" TargetName="canvChecked" Value="Visible" />
<Setter Property="Visibility" TargetName="canvNormal" Value="Hidden" />
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="Gray"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!--GroupBox-->
<Style x:Key="GroupBoxStyle1" TargetType="{x:Type GroupBox}">
<Setter Property="BorderBrush" Value="#D5DFE5"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="20"/>
<Setter Property="BorderThickness" Value="10"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupBox}">
<Grid SnapsToDevicePixels="true">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="6"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" MinHeight="59"/>
<RowDefinition Height="*"/>
<RowDefinition Height="6"/>
</Grid.RowDefinitions>
<Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" Grid.Column="0" CornerRadius="4" Grid.Row="0" Grid.RowSpan="4" Background="Transparent" Margin="0,-0.25,0,0.25">
<Border.Effect>
<DropShadowEffect Color="#FFAAAAAA" Direction="350"/>
</Border.Effect>
</Border>
<Border x:Name="Header" Grid.Column="1" Padding="3,1,3,0" Grid.Row="1" Grid.RowSpan="1" HorizontalAlignment="Right" Background="{x:Null}" Margin="0" Height="16.96" VerticalAlignment="Top"/>
<ContentPresenter Grid.ColumnSpan="2" Grid.Column="1" Margin="{TemplateBinding Padding}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.RowSpan="1"/>
<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
<Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
</Border>
</Border>
<Grid x:Name="HeaderGrid" Height="47.2" VerticalAlignment="Stretch" Grid.Column="2" Grid.ColumnSpan="2" Grid.RowSpan="1" Margin="0,7.982,-16,3.818" Grid.Row="1" HorizontalAlignment="Right">
<Path Data="M12.19,0 L12.290733,14.847 -1.3000648E-08,14.847 z" Height="16.1" Margin="0,0,8.067,0" RenderTransformOrigin="0.499999978361064,0.499999995889058" Stretch="Fill" Stroke="Black" StrokeThickness="0" VerticalAlignment="Top" HorizontalAlignment="Right" Width="12.29" >
<Path.Fill>
<LinearGradientBrush EndPoint="0.466,2.201" StartPoint="0.5,0">
<GradientStop Color="#C66A6A6A" Offset="1"/>
<GradientStop Color="#E1434343" Offset="0.855"/>
<GradientStop Color="#FFC6C6C6" Offset="0.11"/>
</LinearGradientBrush>
</Path.Fill>
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="90.087"/>
<TranslateTransform Y="-6.04399277075815" X="6.0531771644038841"/>
</TransformGroup>
</Path.RenderTransform>
</Path>
<Border BorderBrush="Black" BorderThickness="0" Margin="0,8.061,0,0" CornerRadius="16,0,0,16" Background="White">
<Border.Effect>
<DropShadowEffect Direction="195" BlurRadius="10" Opacity="0.305" ShadowDepth="6"/>
</Border.Effect>
<Border x:Name="contentBorder" BorderBrush="Black" Margin="6,6,0,6" CornerRadius="16,0,0,16">
<Border.Background>
<LinearGradientBrush EndPoint="1.002,0.498" StartPoint="-0.024,0.502">
<GradientStop Color=" #4682B4" Offset="0.027"/>
<GradientStop Color=" #F0FFFF" Offset="0.994"/>
</LinearGradientBrush>
</Border.Background>
<Grid>
<ContentControl HorizontalAlignment="Left" Margin="20,0,23,0" VerticalAlignment="Center" Foreground="White">
<ContentPresenter ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="0" Width="212.323"/>
</ContentControl>
</Grid>
</Border>
</Border>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<!--Combox-->
<Style TargetType="{x:Type ComboBox}" x:Key="cmbstyle">
<Setter Property="Background" Value="White"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--ComBoxItem-->
<Style TargetType="ComboBoxItem">
<Setter Property="MinHeight" Value="22"></Setter>
<Setter Property="MinWidth" Value="60"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Border BorderThickness="0" CornerRadius="3" Width="{TemplateBinding Width}" Height="30" Background="{TemplateBinding Background}" >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" x:Name="grid">
<ToggleButton
Width="{Binding ElementName=grid,Path=ActualWidth}"
Height="{Binding ElementName=grid, Path=ActualHeight}"
Content="{TemplateBinding Text}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5,0,0,0"
BorderThickness="0"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
>
<ToggleButton.Style >
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="0" >
<TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>

<Grid Grid.Column="1" >
<ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
ClickMode="Press">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<TextBlock Foreground="{TemplateBinding Foreground}" x:Name="arrow_tb" Text="&#xf02a9;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">

</Trigger>
<EventTrigger RoutedEvent="Checked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>

<EventTrigger RoutedEvent="Unchecked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
<Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
</Border.Effect>
<ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>


<Border.Effect>
<DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
</Border.Effect>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>


</Style>
<!--开关按钮-->
<Style x:Key="OpenCheckBoxStyle1" TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<ControlTemplate.Resources>
<Storyboard x:Key="OnChecking">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="45"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Key="OnUnchecking">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ThicknessAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="slider" Storyboard.TargetProperty="(FrameworkElement.Margin)">
<SplineThicknessKeyFrame KeyTime="00:00:00.3000000" Value="1,1,1,1"/>
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>

<DockPanel x:Name="dockPanel">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True" VerticalAlignment="Center"/>
<Grid Margin="5,5,0,5" Width="80" Background="#FFC0CCD9">
<TextBlock Text="OFF" TextWrapping="Wrap" FontWeight="Bold" FontSize="16" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,3,0" Foreground="Red"/>
<TextBlock HorizontalAlignment="Left" Margin="2,0,0,0" FontSize="16" FontWeight="Bold" Text="ON" VerticalAlignment="Center" TextWrapping="Wrap" Foreground="#008000"/>
<Border HorizontalAlignment="Left" x:Name="slider" Width="33" BorderThickness="1,1,1,1" CornerRadius="3,3,3,3" RenderTransformOrigin="0.5,0.5" Margin="1,1,1,1">
<Border.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="0"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Border.RenderTransform>
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFFFFFFF" Offset="0"/>
<GradientStop Color="#FF4490FF" Offset="1"/>
</LinearGradientBrush>
</Border.BorderBrush>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF8AB4FF" Offset="1"/>
<GradientStop Color="#FFD1E2FF" Offset="0"/>
</LinearGradientBrush>
</Border.Background>
</Border>
</Grid>
</DockPanel>

<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource OnUnchecking}" x:Name="OnUnchecking_BeginStoryboard"/>
</Trigger.ExitActions>
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource OnChecking}" x:Name="OnChecking_BeginStoryboard"/>
</Trigger.EnterActions>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</Application.Resources>
</Application>

+ 17
- 0
BPASmartClient.MilkWithTea/App.xaml.cs Dosyayı Görüntüle

@@ -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
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
BPASmartClient.MilkWithTea/AssemblyInfo.cs Dosyayı Görüntüle

@@ -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)
)]

+ 27
- 0
BPASmartClient.MilkWithTea/BPASmartClient.MilkWithTea.csproj Dosyayı Görüntüle

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

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

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.EventBus\BPASmartClient.EventBus.csproj" />
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="DeviceInfo.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

+ 31
- 0
BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml Dosyayı Görüntüle

@@ -0,0 +1,31 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.Control.CircularProgressBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.Control"
xmlns:ccontrols="http://schemas.microsoft.com/expression/2010/drawing"
mc:Ignorable="d" x:Name="circularProgress"
Height="100" Width="100">
<Grid x:Name="layout" Width="{Binding RelativeSource={RelativeSource Self}, Path=Width}" Height="100" >
<Ellipse Width="{Binding ElementName=layout, Path=Width}"
Height="{Binding ElementName=layout, Path=Height}"
StrokeThickness="10" Stroke="#ddd" >
<Ellipse.Effect >
<DropShadowEffect BlurRadius="8" ShadowDepth="0" Color="AliceBlue" ></DropShadowEffect>
</Ellipse.Effect>
</Ellipse>
<Path x:Name="cyclePath" StrokeStartLineCap="Round" StrokeEndLineCap="Round" Stroke="#FF37A0EA" StrokeThickness="10" >
<Path.Effect>
<DropShadowEffect Color="WhiteSmoke" ShadowDepth="0" BlurRadius="5"/>
</Path.Effect>

</Path>
<Viewbox Margin="20">
<TextBlock Foreground="DarkSlateGray" HorizontalAlignment="Center" VerticalAlignment="Center" >
<Run Text="{Binding Percent, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"></Run>
<Run Text="%"></Run>
</TextBlock>
</Viewbox>
</Grid>
</UserControl>

+ 88
- 0
BPASmartClient.MilkWithTea/Control/CircularProgressBar.xaml.cs Dosyayı Görüntüle

@@ -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
{
/// <summary>
/// CircularProgressBar.xaml 的交互逻辑
/// </summary>
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);
}
}

}
}


+ 86
- 0
BPASmartClient.MilkWithTea/DeviceInfo.xml Dosyayı Görüntüle

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8" ?>
<BPADevices>
<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Device_MorkT" DeviceId="1">
<Peripherals>
<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<HandSensor>1</HandSensor>
<OutputSingalValue>0</OutputSingalValue>
</Parameters>
</Peripheral>

<Peripheral Module="BPASmartClient.SCChip.ICChipMachine">
<Parameters>
<PortName>COM5</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>

<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine">
<Parameters>
<PortName>COM5</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->

<!--<Device Name="MorkT" Module="BPASmartClient.MorkT.Control_MorkT" DeviceId="29">
<Peripherals>
<Peripheral Module="BPASmartClient.DRCoffee.CoffeeMachine">
<Parameters>
<PortName>COM4</PortName>
<BaudRate>115200</BaudRate>-->
<!--<IpAddress>192.168.6.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>-->
<!--
</Parameters>
</Peripheral>
<Peripheral Module="BPASmartClient.GSIceCream.IceCreamMachine">
<Parameters>
<PortName>COM6</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>
<Peripheral Module="BPASmartClient.SCChip.ICChipMachine">
<Parameters>
<PortName>COM7</PortName>
<BaudRate>9600</BaudRate>
</Parameters>
</Peripheral>
<!<Peripheral Module="BPASmartClient.Lebai.LebaiRobot">
<Parameters>
<IpAddress>192.168.2.100</IpAddress>
<HandSensor>1</HandSensor>
<OutputSingalValue>0</OutputSingalValue>
</Parameters>
</Peripheral>-->
<!--</Peripherals>
</Device>-->-->
<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>192.168.6.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>127.0.0.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
<PLCReadAddress>M,M230.0,24</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>-->-->-->

</BPADevices>

+ 57
- 0
BPASmartClient.MilkWithTea/GLobal.cs Dosyayı Görüntüle

@@ -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<LocalTeaWithMilkConfig> MaterialRecipes { get; set; } = new ObservableCollection<LocalTeaWithMilkConfig>();


/// <summary>
/// 获取Json文件内容,转换成ObservableCollection
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="path"></param>
/// <returns></returns>
public static ObservableCollection<T> GetJsonToT<T>(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<ObservableCollection<T>>(datacache); //将string转换为class类,从而达到json文件转换的目的
if (res != null)
return res;
else return new ObservableCollection<T> { };
}
}
}
}
}

+ 139
- 0
BPASmartClient.MilkWithTea/MainWindow.xaml Dosyayı Görüntüle

@@ -0,0 +1,139 @@
<Window x:Class="BPASmartClient.MilkWithTea.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm ="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
mc:Ignorable="d"
Title="MainWindow" Height="1000" Width="1600" WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowStartupLocation="CenterScreen">
<Window.DataContext>
<vm:MainWindowVeiwModel/>
</Window.DataContext>
<Window.Resources>
<Style x:Key="menuButtonTemplate" TargetType="{x:Type Button}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Foreground" Value="AliceBlue"/>
<Setter Property="Margin" Value="0,20"/>
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="10" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="True">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#63BCFB"/>
<Setter Property="BorderBrush" TargetName="border" Value="#63BCFB"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border" Value="#63BCFB"/>
<Setter Property="BorderBrush" TargetName="border" Value="#63BCFB"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Background" TargetName="border" Value="#FFBCDDEE"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="border" Value="#FFF4F4F4"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
<Setter Property="Foreground" Value="#FF838383"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

</Style>
</Window.Resources>
<Border Background="#FF37A0EA" CornerRadius="20" BorderThickness="0">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions >
<Grid.RowDefinitions >
<RowDefinition Height="67"/>
<RowDefinition />
</Grid.RowDefinitions>


<Grid Grid.RowSpan="3" MouseDown="Grid_MouseDown">

<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="150"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="80"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
<RowDefinition Height="60"/>
<RowDefinition Height="80"/>
<RowDefinition Height="20"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Height="76" Width="114">
<TextBlock Text="奶茶" FontSize="38" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#zihun80hao-mengquxiaoyuti" HorizontalAlignment="Center"/>
<TextBlock Text="味魔方" FontSize="38" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#zihun80hao-mengquxiaoyuti"/>
</StackPanel>
<Button Grid.Row="2" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="MainControlView" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe61c;" Margin="5,0"/>
<TextBlock Text="主页"/>
</StackPanel>
</Button>
<Button Grid.Row="3" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="MessageLogInfo" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe626;" Margin="5,0"/>
<TextBlock Text="日志"/>
</StackPanel>
</Button>
<Button Grid.Row="4" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="LocalConfigureView" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe63f;" Margin="5,0"/>
<TextBlock Text="配置"/>
</StackPanel>
</Button>
<Button Grid.Row="5" Style="{StaticResource menuButtonTemplate}" Click="NavButton_Click" Tag="ParameterSetting" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe62a;" Margin="5,0"/>
<TextBlock Text="参数"/>
</StackPanel>
</Button>
<control:DateTimeUI Grid.Row="8" HorizontalContentAlignment="Center" />
<Button Grid.Row="9" Style="{StaticResource menuButtonTemplate}" Click="CloseButton_Click" Margin="0,20,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xe892;" Margin="5,0"/>
<TextBlock Text="退出"/>
</StackPanel>
</Button>
<CheckBox Content="开机自启" Grid.Row="7" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="16,0"
IsChecked="{Binding AutoStart}"/>
</Grid>
<Border Grid.Column="1" Grid.RowSpan="3" Background="Transparent">
<Border Background="White" CornerRadius="20" BorderThickness="0">
<Grid>
<ContentControl x:Name="contentRegion">
<local:MessageLogInfo/>
</ContentControl>
</Grid>
</Border>
</Border>
</Grid>
</Border>
</Window>

+ 214
- 0
BPASmartClient.MilkWithTea/MainWindow.xaml.cs Dosyayı Görüntüle

@@ -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
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
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<object>((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);

}

/// <summary>
/// 获取设备集合
/// </summary>
private void GetDevices()
{
//List<string> IDevices = new List<string>();
//List<string> IPeripherals = new List<string>();

DirectoryInfo directoryInfo = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory);
var files = directoryInfo.GetFiles().Where(p => p.FullName.Contains("BPASmartClient.") && p.FullName.Contains("dll")).ToList();
List<string> fileList = new List<string>();

var assemblies = AppDomain.CurrentDomain.GetAssemblies();
var dlls = assemblies?.Where(p => p.FullName.Contains("BPASmartClient.")).ToList();
List<string> dllList = new List<string>();

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

+ 299
- 0
BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml Dosyayı Görüntüle

@@ -0,0 +1,299 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.LocalConfigureView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
<UserControl.DataContext>
<vm:LocalConfigureViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="TextBlock.FontSize" Value="13" />
<Setter Property="Padding" Value="10" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Mode=Self},Path=Content.Text}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<!--HorizontalAlignment 可以设置内容展示位置-->
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="{TemplateBinding Padding}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsKeyboardFocusWithin" Value="True">
<Setter Property="BorderBrush" Value="Black"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="Selector.IsSelectionActive" Value="False"/>
</MultiTrigger.Conditions>
<Setter Property="Background" Value="Black"/>
</MultiTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="Selector.IsSelectionActive" Value="True"/>
</MultiTrigger.Conditions>
<Setter Property="Foreground" Value="#666666"/>
<Setter Property="Background" Value="Black" />
</MultiTrigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".56"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="DataGridRow">
<Setter Property="FontSize" Value="16"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="0,5"/>
<Style.Triggers>
<!-- 隔行换色 -->
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFAFAFA" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF5F5F7" />
</Trigger>

<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#F0FFFF" />
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Button">
<Setter Property="Width" Value="90"/>
<Setter Property="Height" Value="20"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="#43a9c7"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#2f96b4"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#2a89a4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>


</UserControl.Resources>
<Grid Background="#F3F6F9" Margin="20">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<!--奶茶配方录入-->
<Expander Style="{StaticResource ExpanderStyle}">
<Expander.Header>
<TextBlock Text="奶茶配方录入" />
</Expander.Header>
<Expander.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
<TextBlock Text="奶茶名称:" Foreground="DarkSlateGray" FontSize="20" Margin="10,0" VerticalAlignment="Center" />
<TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0" VerticalContentAlignment="Center" Padding="2"/>
<Button Content="添加配方" Margin="10,0" Width="120" Command="{Binding AddRecipeCommand}" Style="{StaticResource buttonNormal}"/>
<Button Content="保存" Margin="10,0" Width="80" Command="{Binding SaveRecipeCommand}" Style="{StaticResource buttonNormal}"/>
<Button Content="清空" Margin="10,0" Width="80" Command="{Binding RecipeCancelCommand}" Style="{StaticResource buttonNormal}"/>
</StackPanel>
<DataGrid Grid.Row="1" Margin="100,5,100,20" AutoGenerateColumns="False" RowHeight="30" ItemsSource="{Binding materialRecipes}"
x:Name="recipeDataGrid"
FrozenColumnCount="1"
VerticalAlignment="Center" HorizontalAlignment="Center"
Background="#F3F6F9"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
<DataGrid.Columns >
<DataGridTemplateColumn Header="ID" Width="40">
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<TextBlock Text="{ Binding MaterialID}" Foreground="Black"
VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料" Width="200">
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<ComboBox x:Name="combox" FontSize="16" Width="100"
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
IsReadOnly="True" Style="{StaticResource cmbstyle}" Height="30"
SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料量" Width="175" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="3" >
<TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
<TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16" Foreground="Black"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTemplateColumn Header="操作" Width="300">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Margin="4"
Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Expander.Content>
</Expander>
<!--配料录入-->
<Expander Grid.Row="1" Style="{StaticResource ExpanderStyle}">
<Expander.Header>
<TextBlock Text="本地配料录入" />
</Expander.Header>
<Expander.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="更新物料位置名称" Grid.ColumnSpan="2" Style="{StaticResource buttonNormal}" Height="34" Width="200" Command="{Binding UpdateMaterialPosionCommand}"/>
<DataGrid Grid.Row="1" Margin="100,5" AutoGenerateColumns="False" ItemsSource="{Binding materail1,Mode=TwoWay}"
FrozenColumnCount="1" RowHeight="30"
VerticalAlignment="Top" HorizontalAlignment="Center"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="物料位置" Width="170">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Foreground="Black" Text="{Binding MaterialPosion}"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="物料" Width="250">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center" HorizontalContentAlignment="Center"
Margin="2"
Width="160" FontSize="16"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Row="1" Grid.Column="1" Margin="100,5" AutoGenerateColumns="False" ItemsSource="{Binding materail2,Mode=TwoWay}"
FrozenColumnCount="1" RowHeight="30"
VerticalAlignment="Top" HorizontalAlignment="Center"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="物料位置" Width="170">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Foreground="Black" Text="{Binding MaterialPosion}"
VerticalAlignment="Center" HorizontalAlignment="Left"
Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="物料" Width="250">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
VerticalAlignment="Center" HorizontalContentAlignment="Center"
Margin="2"
Width="160" FontSize="16"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Expander.Content>
</Expander>
<!--奶茶清单-->
<Expander Grid.Row="2" Style="{StaticResource ExpanderStyle}" >
<Expander.Header>
<TextBlock Text="本地奶茶配方"/>
</Expander.Header>
<Expander.Content>
<DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="30" ItemsSource="{Binding localMaterialRecipes}" Width="500"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="奶茶" Width="200">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding GoodNames}" Foreground="Black"
VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="5,2" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="操作" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="删除" Margin="2"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Expander.Content>
</Expander>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>

BPASmartClient.MorkTM/View/Monitor.xaml.cs → BPASmartClient.MilkWithTea/View/LocalConfigureView.xaml.cs Dosyayı Görüntüle

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

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

}

private void gridProducts_LoadingRow(object sender, DataGridRowEventArgs e)
{

}
}
}

+ 221
- 0
BPASmartClient.MilkWithTea/View/MainControlView.xaml Dosyayı Görüntüle

@@ -0,0 +1,221 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.MainControlView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
xmlns:controls="clr-namespace:BPASmartClient.MilkWithTea.Control"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
<UserControl.DataContext>
<vm:MainControlViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<con:ColorConverter x:Key="ColorConverter" />
<con:TextConverter x:Key="TextConverter" />
<con:OpacityConverter x:Key="OpacityConverter"/>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="28"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>

<Style TargetType="{x:Type ListBox}">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border x:Name="Bd" BorderBrush="Transparent" BorderThickness="0"
Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
<ScrollViewer Focusable="false">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Stretch"/>
</ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true"/>
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style TargetType="DataGridRow">
<Setter Property="FontSize" Value="16"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Height" Value="28"/>
<Style.Triggers>
<!-- 隔行换色 -->
<Trigger Property="AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFAFAFA" />
</Trigger>
<Trigger Property="AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF5F5F7" />
</Trigger>

<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#4fade8" />
</Trigger>
</Style.Triggers>
</Style>

</ResourceDictionary>




</UserControl.Resources>
<Grid Background="#F3F6F9" Margin="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="1"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="60"/>
<RowDefinition Height="280"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<GroupBox Header="订单队列" Style="{StaticResource GroupBoxStyle1}" FontSize="18">
<DataGrid ItemsSource="{Binding orderStatusLists}"
Grid.Row="1" AutoGenerateColumns="False" RowHeight="250"
FrozenColumnCount="1" Margin="30,5"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Header="取餐号" Binding="{Binding OrderPush.SortNum}" Width="*"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}">
</DataGridTextColumn>
<DataGridTextColumn Header="商品名" Binding="{Binding OrderPush.GoodsName}" Width="2*" />
<DataGridTextColumn Header="开始时间" Binding="{Binding StartDate}" Width="2*"/>
<DataGridTextColumn Header="结束时间" Binding="{Binding EndDate}" Width="2*"/>
<DataGridTextColumn Header="制作状态" Binding="{Binding OrderStatus, Converter={StaticResource TextConverter}}" Width="2*"/>
<DataGridTextColumn Header="完成时间" Binding="{Binding CompleteDate}" Width="2*" />
</DataGrid.Columns>
</DataGrid>
</GroupBox>
<GroupBox Grid.Row="2" Header="当前奶茶进度" Style="{StaticResource GroupBoxStyle1}" FontSize="18">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="200"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="{Binding CurrentGood}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20"/>
<controls:CircularProgressBar Grid.Column="2" Percent="{Binding MakePercent}" />
</Grid>
</GroupBox>


<Border Grid.Column="1" Grid.RowSpan="5" BorderBrush="Black" BorderThickness="1" />
<Grid Opacity="{Binding MakeEnable ,Converter= {StaticResource OpacityConverter}}" Grid.Column="2" Grid.RowSpan="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="60"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="100"/>
</Grid.RowDefinitions>
<TextBlock Grid.ColumnSpan="2" Text="本地奶茶下单" HorizontalAlignment="Center" />
<Border Grid.ColumnSpan="2" Grid.Row="1" Background="Transparent" Visibility="{Binding Visibility}" Margin="5">
<Border Background="White" Height="50" CornerRadius="10" HorizontalAlignment="Stretch">
<Grid Height="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe62f;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont" FontSize="28"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBox Grid.Column="1" x:Name="searchQuery"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" TextAlignment="Left"
BorderThickness="0" Background="Transparent"
IsEnabled="{Binding MakeEnable}"/>
<TextBlock Grid.Column="1" Margin="3,0,0,0" Text="搜索本地奶茶" FontWeight="Bold" HorizontalAlignment="Left" TextAlignment="Left" VerticalAlignment="Center" Foreground="LightGray" IsHitTestVisible="False">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Text, ElementName=searchQuery}" Value="">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</Border>
</Border>
<TextBlock Text="奶茶" Grid.Row="2" Margin="20,10" FontSize="22" />
<TextBlock Text="配方" Grid.Row="2" Grid.Column="1" Margin="10" FontSize="22"/>
<Border BorderBrush="#D5DFE5" BorderThickness="4" Grid.Row="3" Margin="20,0,0,0">
<ListBox ItemsSource="{Binding localTeaWithMilks}" SelectionChanged="ListBox_SelectionChanged" IsEnabled="{Binding MakeEnable}"
Foreground="LightSlateGray">
<ListBox.ItemTemplate>
<DataTemplate >
<Grid>
<TextBlock Text="{Binding GoodNames}" Margin="5,10" FontSize="22"
Background="Transparent" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<ListBox x:Name="recipeList" Grid.Row="3" Grid.Column="1" Margin="5,10"
ItemsSource="{Binding materialRecipes}" FontSize="18"
Width="200" HorizontalAlignment="Left" Foreground="LightSlateGray">
<ListBox.ItemTemplate>
<DataTemplate >
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Material}" Margin="20,10"/>
<TextBlock Text="{Binding MaterialWeight}" Margin="20,10,0,10"/>
<TextBlock Text="g" Margin="0,10"/>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Grid.Row="4" Style="{StaticResource buttonNormal}" VerticalAlignment="Top" Height="40" Width="150" Margin="20"
Command="{Binding MakeGoodCommand}" IsEnabled="{Binding MakeEnable}">
<Button.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="&#xe607;" VerticalAlignment="Center" Foreground="White" FontSize="18" HorizontalAlignment="Center" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont"/>
<TextBlock Grid.Column="1" Text="制作奶茶" TextAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Foreground="White" FontSize="16"/>
</Grid>
</Button.Content>
</Button>
</Grid>

</Grid>
</UserControl>

+ 38
- 0
BPASmartClient.MilkWithTea/View/MainControlView.xaml.cs Dosyayı Görüntüle

@@ -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
{
/// <summary>
/// MainControlView.xaml 的交互逻辑
/// </summary>
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;
}
}
}
}

+ 56
- 0
BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml Dosyayı Görüntüle

@@ -0,0 +1,56 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.MessageLogInfo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent">
<UserControl.Resources>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="#F3F6F9 "/>
</Style>
</UserControl.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="1">
<Border Background="White" BorderBrush="#D5DFE5 " BorderThickness="12" CornerRadius="5">
<DataGrid Margin="20" ItemsSource="{Binding LogDataGrid, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"
AutoGenerateColumns="False"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="日志时间" Width="300">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding time, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTemplateColumn Header="日志类型" Width="200">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="日志内容" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Left" Text="{Binding message, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border>
</Grid>
</Grid>
</UserControl>

+ 30
- 0
BPASmartClient.MilkWithTea/View/MessageLogInfo.xaml.cs Dosyayı Görüntüle

@@ -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
{
/// <summary>
/// MessageLogInfo.xaml 的交互逻辑
/// </summary>
public partial class MessageLogInfo : UserControl
{
public MessageLogInfo()
{
InitializeComponent();
this.DataContext = LogViewModel.GetInstance();
}
}
}

+ 113
- 0
BPASmartClient.MilkWithTea/View/ParameterSetting.xaml Dosyayı Görüntüle

@@ -0,0 +1,113 @@
<UserControl x:Class="BPASmartClient.MilkWithTea.View.ParameterSetting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MilkWithTea.View"
xmlns:vm="clr-namespace:BPASmartClient.MilkWithTea.ViewModel"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1400" Background="Transparent" >
<UserControl.DataContext>
<vm:PatrameterSettiongViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style TargetType="TextBlock">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Foreground" Value="DarkSlateGray"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="18"/>
</Style>
</UserControl.Resources>
<Grid Background="#F3F6F9" Margin="20" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="300"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<GroupBox Grid.ColumnSpan="2" Header="参数调试" FontSize="20" Style="{StaticResource GroupBoxStyle1}" Padding="40,20">
<GroupItem>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="20"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="通道口:"/>
<ComboBox ItemsSource="{Binding materialPosions}"
SelectedIndex="{Binding MaterialID ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Margin="10,0" Width="120 " Style="{StaticResource cmbstyle}"/>
<TextBlock Text="出料量:" Margin="10,0,0,0" />
<TextBox Text="{Binding OutMaterailWeight}" Width="60" Margin="10,0" VerticalContentAlignment="Center"/>
<TextBlock Text="g" Margin="2,0"/>
<Button Content="出料" Style="{StaticResource buttonNormal}" Height="36" Width="100" Margin="30,0" Command="{Binding OutMaterailCommad}"/>
<TextBlock Text="转盘位置:" Margin="60,0,10,0"/>
<ComboBox ItemsSource="{Binding TurntablePosion}"
SelectedIndex="{Binding TurntableID,Mode=TwoWay ,UpdateSourceTrigger=PropertyChanged}"
Margin="10,0" Width="100 " Style="{StaticResource cmbstyle}"/>
<Button Content="转动" Style="{StaticResource buttonNormal}" Height="36" Width="80" Margin="30,0"
Command="{Binding TurntableCommad}"/>
</StackPanel>
<CheckBox Grid.Row="2" Content="禁用本地奶茶下单" HorizontalAlignment="Left" Margin="0,10"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
IsChecked="{Binding IsEnable}"/>
</Grid>
</GroupItem>
</GroupBox>
<GroupBox Grid.ColumnSpan="2" Grid.Row="1" Header="通道矫正" FontSize="20" BorderThickness="10" Style="{StaticResource GroupBoxStyle1}">
<GroupItem>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="通道" />
<TextBlock Text="名称" Grid.Column="1"/>
<TextBlock Text="开关" Grid.Column="2"/>
<TextBlock Text="校正后的重量" Grid.Column="5"/>
<TextBlock Text="出料时间" Grid.Column="3"/>

<ComboBox Grid.Row="1" Width="100" Style="{StaticResource cmbstyle}" ItemsSource="{Binding materialPosions}"
SelectedIndex="{Binding CorrectPassway ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" SelectionChanged="ComboBox_SelectionChanged" />
<TextBlock Grid.Row="1" Grid.Column="1" ></TextBlock>
<CheckBox x:Name="OpenIsCheck"
Grid.Row="1" Grid.Column="2" Style="{StaticResource OpenCheckBoxStyle1}" Height="40"
IsChecked="{Binding PasswayIsOpen,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Command="{Binding OpenPasswayCommand}"/>
<TextBox Text="{Binding CorrectMatetailWeight,Mode=TwoWay}" Grid.Row="1" Grid.Column="5" Width="60" Height="30"></TextBox>
<TextBlock Text="克" Grid.Row="1" Grid.Column="5" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<TextBox Text="{Binding OutTime}" Grid.Row="1" Grid.Column="3" Width="60" Height="30"></TextBox>
<TextBlock Text="秒" Grid.Row="1" Grid.Column="3" HorizontalAlignment="Right" Margin="0,0,16,0"></TextBlock>
<TextBlock Text="矫正方法" Grid.Column="7"/>
<Button Content="开始矫正" Style="{StaticResource buttonNormal}"
Grid.Row="1" Grid.Column="4" HorizontalAlignment="Center"
Height="40" Width="120"
Command="{Binding CheckPasswayCommad}"/>
<Button Content="确认重量" Style="{StaticResource buttonNormal}"
Grid.Row="1" Grid.Column="6" HorizontalAlignment="Center"
Height="40" Width="120"
Command="{Binding CheckMaterailWeightCommand}"/>
<TextBlock Text=" 准备好校正电子秤,打开需要校正的通道,点击“开始校正”的按钮,填入校正后的重量并确认。"
Margin="6,0" TextWrapping="Wrap"
Grid.Column="7" Grid.Row="1" />
</Grid>
</GroupItem>
</GroupBox>
</Grid>
</UserControl>

+ 34
- 0
BPASmartClient.MilkWithTea/View/ParameterSetting.xaml.cs Dosyayı Görüntüle

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

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if(this.OpenIsCheck!=null) this.OpenIsCheck.IsChecked = false;

}
}
}

+ 211
- 0
BPASmartClient.MilkWithTea/ViewModel/LocalConfigureViewModel.cs Dosyayı Görüntüle

@@ -0,0 +1,211 @@
using BPASmartClient.MorkTM;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
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;
using System.Windows;

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class LocalConfigureViewModel : ObservableObject

{
#region 奶茶配方录入
/// <summary>
/// 奶茶配方
/// </summary>
public ObservableCollection<MaterialRecipe> materialRecipes { get => materialRecipes1; set => materialRecipes1 = value; }
/// <summary>
/// 出料集合
/// </summary>
public ObservableCollection<string> MaterailList { get; set; } = new ObservableCollection<string>();
/// <summary>
/// 奶茶名称
/// </summary>
public string LocalGoodName { get { return _localGoodName; } set { _localGoodName = value; OnPropertyChanged(); } }
private string _localGoodName;

private ObservableCollection<MaterialRecipe> materialRecipes1 = new ObservableCollection<MaterialRecipe>();

/// <summary>
/// 添加一条配方
/// </summary>
public RelayCommand AddRecipeCommand { get; set; }
/// <summary>
/// 删除一条配方
/// </summary>
public RelayCommand<object> RemoveRecipeCommand { get; set; }
/// <summary>
/// 取消配方
/// </summary>
public RelayCommand RecipeCancelCommand { get; set; }
/// <summary>
/// 保存配方
/// </summary>
public RelayCommand SaveRecipeCommand { get; set; }

#endregion

#region 本地奶茶配方
/// <summary>
/// 本地奶茶配方列表
/// </summary>
public ObservableCollection<LocalTeaWithMilkConfig> localMaterialRecipes { get; set; } = GLobal.MaterialRecipes;

/// <summary>
/// 删除配方奶茶
/// </summary>
public RelayCommand<object> DeleteRecipeCommand { get; set; }

#endregion

#region 物料位置名称
/// <summary>
/// 物料位置名称集合
/// </summary>
public ObservableCollection<MaterailNameAndPosion> materailNameAndPosions { get; set; } = new ObservableCollection<MaterailNameAndPosion>();
public List<MaterailNameAndPosion> materail1 { get; set; } = new List<MaterailNameAndPosion>();
public List<MaterailNameAndPosion> materail2 { get; set; } = new List<MaterailNameAndPosion>();
/// <summary>
/// 更新物料位置
/// </summary>
public RelayCommand UpdateMaterialPosionCommand { get; set; }
#endregion

public LocalConfigureViewModel()
{
materialRecipes.Add(new MaterialRecipe()
{
MaterialWeight = 10
});




AddRecipeCommand = new RelayCommand(new Action(() =>
{
materialRecipes.Add(new MaterialRecipe()
{
MaterialID = materialRecipes.Count() + 1
});

}));

RemoveRecipeCommand = new RelayCommand<object>((o =>
{
if (o != null && o is int index)
{
materialRecipes.RemoveAt(index);
for (int i = 0; i < materialRecipes.Count; i++)//ID排序
{
materialRecipes[i].MaterialID = i + 1;
}
}

}));

RecipeCancelCommand = new RelayCommand(new Action(() =>
{
materialRecipes.Clear();
LocalGoodName = String.Empty;
}));

SaveRecipeCommand = new RelayCommand(new Action(() =>
{
if (LocalGoodName == "" || LocalGoodName == null) return;
if (materialRecipes.Count == 0) return;

localMaterialRecipes.Insert(0, new LocalTeaWithMilkConfig()
{
GoodNames = LocalGoodName,
materialRecipes = materialRecipes

});

UpdateLocalJosnData<LocalTeaWithMilkConfig>(GLobal.recipePath, localMaterialRecipes);//更新奶茶配方json文件
MessageBox.Show("保存成功");
}));


DeleteRecipeCommand = new RelayCommand<object>((o =>
{
if (o != null && o is int index)
{
localMaterialRecipes.RemoveAt(index);
UpdateLocalJosnData<LocalTeaWithMilkConfig>(GLobal.recipePath, localMaterialRecipes);//更新奶茶配方json文件
}
}));

UpdateMaterialPosionCommand = new RelayCommand(new Action(() =>
{
materailNameAndPosions.Clear();
foreach(var item in materail1)
{
materailNameAndPosions.Add(item);
}
foreach (var item in materail2)
{
materailNameAndPosions.Add(item);
}
UpdateLocalJosnData<MaterailNameAndPosion>(GLobal.posionPath, materailNameAndPosions);//更新物料位置名称
MaterailList.Clear();
foreach (MaterailNameAndPosion m in materailNameAndPosions)
{
if (m.MaterialName != null) MaterailList.Add(m.MaterialName);

}
}));

Init();
}

/// <summary>
/// 界面初始化加载
/// </summary>
private void Init()
{

materailNameAndPosions = GLobal.GetJsonToT<MaterailNameAndPosion>(GLobal.posionPath);
if (materailNameAndPosions.Count == 0)
{
foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion)))
{
materailNameAndPosions.Add(new MaterailNameAndPosion()
{
MaterialPosion = item.ToString()
});
}
}
materail1 = materailNameAndPosions.Take<MaterailNameAndPosion>(14).ToList();
materail2 = materailNameAndPosions.TakeLast<MaterailNameAndPosion>(14).ToList();
foreach (MaterailNameAndPosion m in materailNameAndPosions)
{
if (m.MaterialName != null) MaterailList.Add(m.MaterialName);

}
}

/// <summary>
/// 更新Json文件数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="path"></param>
/// <param name="ts"></param>
private void UpdateLocalJosnData<T>(string path, ObservableCollection<T> ts)
{
if (ts != null) File.WriteAllText(path, JsonConvert.SerializeObject(ts));

}
}
}

+ 236
- 0
BPASmartClient.MilkWithTea/ViewModel/MainControlViewModel.cs Dosyayı Görüntüle

@@ -0,0 +1,236 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class MainControlViewModel: ObservableObject
{

public ObservableCollection<LocalTeaWithMilkConfig> localTeaWithMilks { get; set; } = GLobal.MaterialRecipes;

public ObservableCollection<MaterialRecipe> materialRecipes { get; set; } = new ObservableCollection<MaterialRecipe>();

/// <summary>
/// 订单状态列表
/// </summary>
public ObservableCollection<MorkOrder> orderStatusLists { get; set; } = new ObservableCollection<MorkOrder>();

/// <summary>
/// 等待取餐列表
/// </summary>
public ObservableCollection<MorkOrder> WaitTakeMeal { get; set; } = new ObservableCollection<MorkOrder>();

/// <summary>
/// 当前正在制作的奶茶
/// </summary>
public string CurrentGood { get { return _currentGood; } set { _currentGood = value; OnPropertyChanged(); } }
private string _currentGood = "无";
/// <summary>
/// 奶茶制作百分比
/// </summary>
public string MakePercent { get { return _makePercent; } set { _makePercent = value; OnPropertyChanged(); } }
private string _makePercent = "100";

/// <summary>
/// 当前正在制作的奶茶
/// </summary>
public bool MakeEnable { get { return GLobal.makeEnable; } set { GLobal.makeEnable = value; OnPropertyChanged(); } }

/// <summary>
/// 本地奶茶制作
/// </summary>
public RelayCommand MakeGoodCommand { get; set; }

public MainControlViewModel()
{
MakeGoodCommand = new RelayCommand(new Action(() =>
{

}));
Init();
MorkOrderPush morkOrderPush = new MorkOrderPush() { GoodsName = "水果奶茶", SortNum = 1 };

orderStatusLists.Add(new MorkOrder()
{
StartDate = "11",EndDate ="15",CompleteDate ="4",OrderStatus = ORDER_STATUS.COOKING,
OrderPush = morkOrderPush

});
orderStatusLists.Add(new MorkOrder()
{
StartDate = "11",
EndDate = "15",
CompleteDate = "4",
OrderStatus = ORDER_STATUS.COOKING,
OrderPush = morkOrderPush

});
orderStatusLists.Add(new MorkOrder()
{
StartDate = "11",
EndDate = "15",
CompleteDate = "4",
OrderStatus = ORDER_STATUS.COOKING,
OrderPush = morkOrderPush

});



}


/// <summary>
/// MQTT 大屏取餐通知委托
/// </summary>
public void Init()
{
//清除订单数据
//ActionManage.GetInstance.Register(new Action(() =>
//{
// Application.Current.Dispatcher.Invoke(() =>
// {
// orderStatusLists.Clear();
// WaitTakeMeal.Clear();
// });
//}), "ClearOrders");

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o is object[] obj)
{
if (o.Length == 2)
{
if (o[0] is MorkOrderPush morkOrderpush && o[1] is IDevice device)
{
ObservableCollection<MorkOrder> observableCollection = new ObservableCollection<MorkOrder>();
MorkOrder morkOrder = new MorkOrder()
{
OrderPush = morkOrderpush,
OrderStatus = ORDER_STATUS.WAIT,
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
};
observableCollection.Add(morkOrder);
Application.Current?.Dispatcher.BeginInvoke((Action)delegate
{
int index = Array.FindIndex(Json<KeepDataBase>.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString());
if (index < 0)
{
Json<KeepDataBase>.Data.orderLists.Add(new OrderData()
{
DeviceId = device.DeviceId.ToString(),
IsAllSelect = true,
morkOrderPushes = observableCollection,

});
}
else
{
Json<KeepDataBase>.Data.orderLists.ElementAt(index).morkOrderPushes.Add(morkOrder);
}

orderStatusLists.Add(new MorkOrder()
{
OrderPush = morkOrderpush,
OrderStatus = ORDER_STATUS.WAIT,
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
});
});

}
}
}

}), "AddOrder");

EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle);

ActionManage.GetInstance.Register(new Action<object[]>((o)=>
{
if (o is object[] obj)
{
if (o.Length == 2)
{
CurrentGood = o[0].ToString();
MakePercent = o[1].ToString();
}
}
}), "奶茶制作进度");


}

private void OrderStatusChangedHandle(IEvent @event, EventBus.EventBus.EventCallBackHandle callBack)
{
OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent;
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
switch (orderStatusChange.Status)
{
case ORDER_STATUS.COOKING:
if (index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
break;
case ORDER_STATUS.COMPLETED_COOK:
if (index >= 0 && index < orderStatusLists.Count)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

//压力测试时注释,正常使用需要取消注释
if (!BPASmartClient.Business.InternetInfo.IsEnableTest)
{
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
orderStatusLists.RemoveAt(index);
}

});
}

break;
case ORDER_STATUS.COMPLETED_TAKE:
if (BPASmartClient.Business.InternetInfo.IsEnableTest && index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

//压力测试时注释,正常使用需要取消注释
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
if (re != null)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
WaitTakeMeal.Remove(re);
var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
});
}
break;
default:
break;

}
}
}
}

+ 37
- 0
BPASmartClient.MilkWithTea/ViewModel/MainWindowVeiwModel.cs Dosyayı Görüntüle

@@ -0,0 +1,37 @@
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class MainWindowVeiwModel : ObservableObject
{
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }

public MainWindowVeiwModel()
{
init();
}

private void init()
{
string path = Path.Combine(Environment.CurrentDirectory, "AccessFile", "Recipes");
//判断文件夹是否存在,如果不存在就创建file文件夹
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
GLobal.recipePath = Path.Combine(path, "LocalRecipes.json");
GLobal.posionPath = Path.Combine(path, "MaterialPosion.json");

GLobal.MaterialRecipes = GLobal.GetJsonToT<LocalTeaWithMilkConfig>(GLobal.recipePath);
}

}
}

+ 123
- 0
BPASmartClient.MilkWithTea/ViewModel/PatrameterSettiongViewModel.cs Dosyayı Görüntüle

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

namespace BPASmartClient.MilkWithTea.ViewModel
{
public class PatrameterSettiongViewModel: ObservableObject
{
/// <summary>
/// 物料通道口列表
/// </summary>
public ObservableCollection<MaterialPosion> materialPosions { get; set; } = new ObservableCollection<MaterialPosion>();
/// <summary>
/// 转盘位置列表
/// </summary>
public ObservableCollection<OutMaterialPosion> TurntablePosion { get; set; } = new ObservableCollection<OutMaterialPosion>();

/// <summary>
/// 出料位置ID
/// </summary>
public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } }
private int _materialID = 0;
/// <summary>
/// 出料重量
/// </summary>
public float OutMaterailWeight { get { return _outMaterilWeight; } set { _outMaterilWeight = value; OnPropertyChanged(); } }
private float _outMaterilWeight;
/// <summary>
/// 装盘ID
/// </summary>
public int TurntableID { get { return _turntableID; } set { _turntableID = value; OnPropertyChanged(); } }
private int _turntableID = 0;
/// <summary>
/// 矫正的通道号
/// </summary>
public int CorrectPassway { get { return _CorrectPassway; } set { _CorrectPassway = value; OnPropertyChanged(); } }
private int _CorrectPassway = 0;
/// <summary>
/// 通道是否开启
/// </summary>
public bool PasswayIsOpen { get { return _passwayIsOpen; } set { _passwayIsOpen = value; OnPropertyChanged(); } }
private bool _passwayIsOpen ;
/// <summary>
/// 矫正重量
/// </summary>
public float CorrectMatetailWeight { get { return _CorrectMatetailWeight; } set { _CorrectMatetailWeight = value; OnPropertyChanged(); } }
private float _CorrectMatetailWeight = 0;
/// <summary>
/// 矫正时间
/// </summary>
public int OutTime { get { return _0utTime; } set { _0utTime = value; OnPropertyChanged(); } }
private int _0utTime = 0;

public bool IsEnable { get { return !GLobal.makeEnable; } set { GLobal.makeEnable = !value; OnPropertyChanged(); } }
/// <summary>
/// 出料动作
/// </summary>
public RelayCommand OutMaterailCommad { get; set; }
/// <summary>
/// 转动转盘
/// </summary>
public RelayCommand TurntableCommad { get; set; }
/// <summary>
/// 开始矫正
/// </summary>
public RelayCommand CheckPasswayCommad { get; set; }
/// <summary>
/// 开启通道
/// </summary>
public RelayCommand OpenPasswayCommand { get; set; }
/// <summary>
/// 确认重量
/// </summary>
public RelayCommand CheckMaterailWeightCommand { get; set; }

public PatrameterSettiongViewModel()
{
foreach(MaterialPosion materialPosion in Enum.GetValues(typeof(MaterialPosion)))
{
materialPosions.Add(materialPosion);
}

foreach(OutMaterialPosion outMaterialPosion in Enum.GetValues(typeof(OutMaterialPosion)))
{
TurntablePosion.Add(outMaterialPosion);
}

OutMaterailCommad = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("通道口出料", new object[] { MaterialID +1, OutMaterailWeight });
}));

TurntableCommad = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("转盘转动", new object[] { TurntableID });
}));

OpenPasswayCommand = new RelayCommand(new Action(() =>
{
if(PasswayIsOpen) ActionManage.GetInstance.Send("开启通道", new object[] { CorrectPassway + 1 });

}));

CheckPasswayCommad = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("开始矫正", new object[] { CorrectPassway + 1,OutTime });
}));

CheckMaterailWeightCommand = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("矫正重量", new object[] { CorrectPassway + 1, CorrectMatetailWeight });
}));

}
}
}

+ 8
- 8
BPASmartClient.Model/咖啡机/Enum/DrinkType.cs Dosyayı Görüntüle

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

+ 58
- 0
BPASmartClient.Model/咖啡机/Enum/KLMDrinkFaultType.cs Dosyayı Görüntüle

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

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

+ 1
- 1
BPASmartClient.Model/咖啡机/KLMCoffeeEvent.cs Dosyayı Görüntüle

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

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

/// <summary>


+ 1
- 0
BPASmartClient.Model/订单/MorkTSimOrder.cs Dosyayı Görüntüle

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


+ 1
- 2
BPASmartClient.MorkF/Control_MorkF.cs Dosyayı Görüntüle

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

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

}
if (morkF.MinorProessStatus)
{


+ 0
- 1
BPASmartClient.MorkS/Control_Morks.cs Dosyayı Görüntüle

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

}

public override void ResetProgram()


+ 24
- 25
BPASmartClient.MorkT/View/DebugView.xaml Dosyayı Görüntüle

@@ -24,12 +24,12 @@
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="14*"/>
<RowDefinition Height="8*"/>
<RowDefinition Height="20*"/>
<RowDefinition Height="384*"/>
<RowDefinition Height="111*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>

<GroupBox Grid.ColumnSpan="2"
<GroupBox Grid.ColumnSpan="2" Visibility="Collapsed"
FontFamily="楷体"
FontSize="20"
Header=" 乐白机器人 ">
@@ -91,15 +91,15 @@
</ListBox>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2"
<GroupBox Grid.Row="0"
FontFamily="楷体"
FontSize="20"
Header=" 冰淇淋机器 ">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="10*" />
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<TextBlock Text="连接状态" />
<TextBlock Text="{Binding IceCreamConnected}"
@@ -166,17 +166,17 @@
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>冰淇淋</TextBlock>
<Button Command="{Binding Button_MakeIceCreamCommand}"
Margin="20,0"
Margin="40,5" Height="50" Width="170"
Content="制作" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>模式</TextBlock>
<ComboBox Width="100"
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="70">
<TextBlock >模式</TextBlock>
<ComboBox Width="100" Height="40" FontSize="22"
Margin="20,0"
ItemsSource="{Binding IceCreamModes}"
SelectedItem="{Binding SelecteIceCreamdMode}" />
<Button Command="{Binding Button_SetIceCreamModelCommand}"
Margin="20,0"
Margin="20,0" Height="50" Width="150"
Content="设置" />
</StackPanel>
</StackPanel>
@@ -224,8 +224,8 @@
</ListBox>
</Grid>
</GroupBox>-->
<GroupBox Grid.Row="2" Grid.Column="1"
<GroupBox Grid.Row="0" Grid.Column="1"
FontFamily="楷体"
FontSize="20"
Header=" 咖啡机">
@@ -275,26 +275,25 @@
Text="{Binding CaffeeFault}" Height="22" Width="60" />
</Grid>
<StackPanel Grid.Row="2" Orientation="Vertical">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60">
<TextBlock>饮品</TextBlock>
<ComboBox Margin="10,0"
Width="100"
<ComboBox Margin="10,0" Height="40" FontSize="20"
Width="120"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SelectedCoffee}" />
<Button Margin="10,0"
<Button Margin="10,0" Height="40" Width="120"
Command="{}"
Content="制作"/>
<Button Margin="10,0"
<Button Margin="10,0" Height="40" Width="120"
Command="{}"
Content="停止制作" Cursor="Hand"/>
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" Height="60">
<TextBlock>模式</TextBlock>
<ComboBox Margin="10,0"
Width="100"
<ComboBox Margin="10,0" Height="40" Width="120" FontSize="20"
ItemsSource="{Binding CoffeeCmds}"
SelectedItem="{Binding SelectedCoffeeCmd}"/>
<Button Margin="10,0"
<Button Margin="10,0" Height="40" Width="120"
Command="{}"
Content="设置" Cursor="Hand"/>
</StackPanel>
@@ -307,11 +306,11 @@
Margin="0,0,0,10" HorizontalAlignment="Left" Width="1000">
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center" >
<Button Content="咖啡杯落杯" Height="30" Width="120"
<Button Content="咖啡杯落杯" Height="40" Width="170"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_COFFEE"
Margin="10,10,50,10" Cursor="Hand"/>
<Button Content="冰淇淋杯落杯" Height="30" Width="120"
<Button Content="冰淇淋杯落杯" Height="40" Width="170"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10"
/>


+ 0
- 13
BPASmartClient.MorkTJuicer/BPASmartClient.MorkTJuicer.csproj Dosyayı Görüntüle

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

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

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

</Project>

+ 0
- 317
BPASmartClient.MorkTJuicer/Control_MORKJC.cs Dosyayı Görüntüle

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

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

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

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

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

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

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

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

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

private AutoResetEvent are = new AutoResetEvent(false);

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

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

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

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

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


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

public void SimOrder<T>(T simOrder)
{

}
public override void DoMain()
{

}

public override void Stop()
{

}

public override void ReadData()
{

}

public override void MainTask()
{

}

public override void ResetProgram()
{

}
public override void SimOrder()
{
}
}
}

+ 0
- 8
BPASmartClient.MorkTJuicer/GVL_MORKJC.cs Dosyayı Görüntüle

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

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

+ 0
- 15
BPASmartClient.MorkTM/Alarm.cs Dosyayı Görüntüle

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

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

+ 4
- 0
BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj Dosyayı Görüntüle

@@ -45,4 +45,8 @@
<Folder Include="Control\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
</ItemGroup>

</Project>

+ 303
- 21
BPASmartClient.MorkTM/Control_MorkTM.cs Dosyayı Görüntüle

@@ -6,6 +6,7 @@ using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkTM;
using BPASmartClient.MorkTM.Model;
using System.Collections.Concurrent;
using static BPASmartClient.EventBus.EventBus;
@@ -17,11 +18,61 @@ namespace BPASmartClient.MorkTM
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.TMC_MT; } }

GVL_MorkTM morkTM = new GVL_MorkTM();
PolymerBatching polymer = new PolymerBatching();

//浮点数放大倍数
const int expand = 100;

public override void DoMain()
{
ServerInit();
DataParse();
PolymerBatching.GetMaterialInfo();
polymer.GetMaterialInfo();
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if(o.Length > 0)
{
Dictionary<int, float> res = new Dictionary<int, float>();
res.Add(Convert.ToInt32(o[0]), Convert.ToSingle(o[1]));
SetMatertialWeight(res);
Thread.Sleep(1000);
OpenUsePassageWay(Convert.ToInt32(o[0]));
}
}), "通道口出料");

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if(o.Length > 0)
{
PosionTurnOnTest(Convert.ToInt32(o[0]));
}
}), "转盘转动");
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
OpenPassway(Convert.ToInt32(o[0]));
}
}), "开启通道");

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
CheckPassway(Convert.ToInt32(o[0]), Convert.ToInt32(o[1]));
}
}), "开始矫正");
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
CheckMaterailWeight(Convert.ToInt32(o[0]), Convert.ToInt32(o[1]));
}
}), "矫正重量");


ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
@@ -31,6 +82,8 @@ namespace BPASmartClient.MorkTM
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");
morkTM.ReachPosions = new List<bool>() { morkTM.ReachOutPosion_0, morkTM.ReachPosion_1, morkTM.ReachPosion_2, morkTM.ReachPosion_3, morkTM.ReachPosion_4, morkTM.ReachPosion_5, morkTM.ReachPosion_6 };

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

@@ -66,15 +119,16 @@ namespace BPASmartClient.MorkTM
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
OrderChange(order.MorkOrder, ORDER_STATUS.WAIT);
morkTM.doOrderEvents.Add(order);
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单");
Dictionary<string, int> OrderPushes = new Dictionary<string, int>();
Dictionary<int, float> OrderPushes = new Dictionary<int, float>();
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
OrderPushes.TryAdd(res.BatchingLoc, item.BatchingCount);
OrderPushes.TryAdd(int.Parse(res.BatchingLoc), item.BatchingCount);
}
}

@@ -87,18 +141,22 @@ namespace BPASmartClient.MorkTM
}
});
}
private void OrderChange(MorkOrderPush orderPush, ORDER_STATUS oRDER_STATUS)
{
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
var res = morkTM.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent()
{
SortNum = orderPush.SortNum.ToString(),
GoodName = orderPush.GoodsName,
SortNum = res.MorkOrder. SortNum.ToString(),
GoodName = res.MorkOrder.GoodsName,
Status = oRDER_STATUS,
SubOrderId = orderPush.SuborderId,
SubOrderId = res.MorkOrder.SuborderId,
deviceClientType = DeviceType
});
if(oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) morkTM.doOrderEvents.Remove(res);
}

public override void MainTask()
{
@@ -108,30 +166,253 @@ namespace BPASmartClient.MorkTM

private void MakeTeaWithMilkProcess()
{
if(morkTM.morkOrderPushesTeaWithMilk.Count > 0)
if (morkTM.morkOrderPushesTeaWithMilk.Count > 0)
{
if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc))
if (morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc)) //&&原点位置是否有杯子)
{
morkTM.MakeCount = 0;
SetMatertialWeight(orderLoc.GoodPushes);//设置物料出料量
morkTM.RecipesPushes.Clear();
morkTM.RecipesPushes = orderLoc.GoodPushes;
foreach(var item in morkTM.RecipesPushes)
MakeProcess(orderLoc.GoodName, morkTM.MakeCount, morkTM.RecipesPushes.Count);
OrderChange(orderLoc.SuborderId, ORDER_STATUS.COOKING);
foreach (var item in morkTM.RecipesPushes)
{
WriteData(item.Key,item.Value);
while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete))
{
Thread.Sleep(100);
}
morkTM.MakeCount++;
PosionTurnOn(item.Key);//设定转盘位置并等待到位信号
Thread.Sleep(1000);
OpenUsePassageWay(item.Key);//打开通道并等待出料完成
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}");
}
MakeProcess(orderLoc.GoodName,morkTM.MakeCount,morkTM.RecipesPushes.Count);
}
TurnOutPosion();
OrderChange(orderLoc.SuborderId, ORDER_STATUS.COMPLETED_COOK);
MakeProcess(orderLoc.GoodName, 1, 1);
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}制作完成");



}
}
}
/// <summary>
/// 打开出料通道
/// </summary>
private void OpenUsePassageWay(int pos)
{
string address = "";
foreach (var item in polymer.OutPosionPLCs)//根据位置筛选物料plc点位
{
if(item.posion is MaterialPosion posion)
{
if(posion == (MaterialPosion)pos)
{
WriteData(item.SetPLCPosion,true);
address = item.GetPLCPosion;
return;
}
}
}
while(!morkTM.outMaterialCompletes[pos]) //等待出料完成
{
Thread.Sleep(1000);
}
WriteData(address, false);


}

/// <summary>
/// 转盘旋转位置设定
/// </summary>
/// <param name="posion"></param>
private void PosionTurnOn(int posion)
{
int i = 0;
string address = "";
foreach (var item in polymer.GoodsMaterialPosion)
{
if (item.Key.Contains((MaterialPosion)posion))
{
WriteData(item.Value.SetPLCPosion,true);
i = Convert.ToInt32(item.Value.posion);
address = item.Value.GetPLCPosion;
return;
}
}
while(!morkTM.ReachPosions[i])//等待转盘到达信号
{
Thread.Sleep(1000);
}
if(address != null) WriteData(address, false);//把信号置为0


}

#region 调试功能
/// <summary>
/// 转盘回原点
/// </summary>
private void TurnOutPosion()
{
WriteData("M4.6", true);
while (!morkTM.ReachPosions[6])
{
Thread.Sleep(1000);
}
WriteData("M14.6", false);
}
/// <summary>
/// 调试转盘
/// </summary>
/// <param name="posion"></param>
private void PosionTurnOnTest(int posion)
{
if(posion==0) TurnOutPosion();
else
{
string address = string.Empty;
int i = 0;
foreach (var item in polymer.TurnPosionPLCs)
{
if ((OutMaterialPosion)item.posion == (OutMaterialPosion)posion)
{
WriteData(item.SetPLCPosion, true);
address = item.GetPLCPosion;
i = Convert.ToInt32(item.posion);
return ;
}
}
while(morkTM.ReachPosions[i-1])
{
Thread.Sleep(1000);
}
WriteData(address,false);
}
}

/// <summary>
/// 开启通道
/// </summary>
private void OpenPassway(int posion)
{
foreach(var item in polymer.OutPosionPLCs)
{
if((MaterialPosion)item.posion == (MaterialPosion)posion)
{
WriteData(item.SetPLCPosion,true);
return ;
}
}
}
/// <summary>
/// 开始校正
/// </summary>
/// <param name="passway"></param>
/// <param name="time"></param>
private void CheckPassway(int passway,int time)
{
WriteData(polymer.PasswayPosionList[(MaterialPosion)passway], Convert.ToInt32(time * expand));//写入出料时间
WriteData("M5.0", true);//开始校正
}

/// <summary>
/// 确认校正重量
/// </summary>
private void CheckMaterailWeight(int passway,float weight)
{
WriteData(polymer.PasswayPosionList[(MaterialPosion)passway], weight*expand);
}

/// <summary>
/// 奶茶制作进度
/// </summary>
private void MakeProcess(string goodName,int percent,int count)
{
int res = Convert.ToInt32(Math.Floor((double)percent / count)) * 100;
ActionManage.GetInstance.Send("奶茶制作进度",new object[] {goodName, res });
}
#endregion

/// <summary>
/// 把每一个物料的用量写入plc
/// </summary>
/// <param name="materials"></param>
private void SetMatertialWeight(Dictionary<int, float> materials)
{
foreach (var material in materials)
{
int value = Convert.ToInt32(material.Value*expand);
WriteData(polymer.MaterialPosionList[(MaterialPosion)material.Key], value);
Thread.Sleep(200);
}
}
public override void ReadData()
{
throw new NotImplementedException();
//启用通道的地址1
GetStatus("M0.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 28)
{

}
}));

GetStatus("M10.0",new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 28)
{
for (int i = 0; i < 28; i++)
{
if (morkTM.outMaterialCompletes.ContainsKey(i+1))
{
morkTM.outMaterialCompletes[i+1] = bools[i];
}
else
{
morkTM.outMaterialCompletes.Add(i+1, bools[i]);
}
}
}
}));
//转盘移动的地址
GetStatus("M4.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{

}
}));
//装盘移动到位的地址
GetStatus("M14.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{
morkTM.ReachPosion_1 = bools[0];
morkTM.ReachPosion_2 = bools[1];
morkTM.ReachPosion_3 = bools[2];
morkTM.ReachPosion_4 = bools[3];
morkTM.ReachPosion_5 = bools[4];
morkTM.ReachPosion_6 = bools[5];
morkTM.ReachOutPosion_0 = bools[6];
for (int i = 0; i < 7; i++)
{
morkTM.ReachPosions[i] = bools[i];
}
}
}));


}

public override void ResetProgram()
@@ -155,6 +436,7 @@ namespace BPASmartClient.MorkTM
}
}
}

public override void SimOrder()
{


+ 213
- 4
BPASmartClient.MorkTM/GVL_MorkTM.cs Dosyayı Görüntüle

@@ -1,5 +1,7 @@
using BPA.Models;
using BPASmartClient.Device;
using BPASmartClient.Model;
using BPASmartClient.MorkTM;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -22,12 +24,219 @@ namespace BPASmartClient.MorkTM
/// <summary>
/// 奶茶配料的队列
/// </summary>
public Dictionary<string, int> RecipesPushes = new Dictionary<string, int>();
public Dictionary<int, float> RecipesPushes = new Dictionary<int, float>();
/// <summary>
///
/// PLC——转盘到达点位集合
/// </summary>
[VariableMonitor("出料完成", "", "")]
public bool OutMaterialComplete { get; set; }
public List<bool> ReachPosions = new List<bool>();
/// <summary>
/// PLC-- 通道出料完成信号集合
/// </summary>
public Dictionary< int,bool> outMaterialCompletes = new Dictionary<int,bool>();
/// <summary>
/// 订单暂存列表
/// </summary>
public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();
/// <summary>
/// 奶茶制作进度分数
/// </summary>
public int MakeCount = 0;


[VariableMonitor("打开通道1", "M10.0", "400")]
public bool UsePassageWay_1 { get; set; }

[VariableMonitor("打开通道2", "M10.1", "401")]
public bool UsePassageWay_2 { get; set; }

[VariableMonitor("打开通道3", "M10.2", "402")]
public bool UsePassageWay_3 { get; set; }
[VariableMonitor("打开通道4", "M10.3", "403")]
public bool UsePassageWay_4 { get; set; }
[VariableMonitor("打开通道5", "M10.4", "404")]
public bool UsePassageWay_5 { get; set; }

[VariableMonitor("打开通道6", "M10.5", "405")]
public bool UsePassageWay_6 { get; set; }

[VariableMonitor("打开通道7", "M10.6", "406")]
public bool UsePassageWay_7 { get; set; }

[VariableMonitor("打开通道8", "M10.7", "407")]
public bool UsePassageWay_8 { get; set; }

[VariableMonitor("打开通道9", "M11.0", "408")]
public bool UsePassageWay_9 { get; set; }

[VariableMonitor("打开通道10", "M11.1", "409")]
public bool UsePassageWay_10 { get; set; }

[VariableMonitor("打开通道11", "M11.2", "410")]
public bool UsePassageWay_11 { get; set; }

[VariableMonitor("打开通道12", "M11.3", "411")]
public bool UsePassageWay_12 { get; set; }

[VariableMonitor("打开通道13", "M11.4", "412")]
public bool UsePassageWay_13 { get; set; }

[VariableMonitor("打开通道14", "M11.5", "413")]
public bool UsePassageWay_14 { get; set; }

[VariableMonitor("打开通道15", "M11.6", "414")]
public bool UsePassageWay_15 { get; set; }

[VariableMonitor("打开通道16", "M11.7", "415")]
public bool UsePassageWay_16 { get; set; }

[VariableMonitor("打开通道17", "M12.0", "416")]
public bool UsePassageWay_17 { get; set; }

[VariableMonitor("打开通道18", "M12.1", "417")]
public bool UsePassageWay_18 { get; set; }

[VariableMonitor("打开通道19", "M12.2", "418")]
public bool UsePassageWay_19 { get; set; }

[VariableMonitor("打开通道20", "M12.3", "419")]
public bool UsePassageWay_20 { get; set; }

[VariableMonitor("打开通道21", "M12.4", "420")]
public bool UsePassageWay_21 { get; set; }

[VariableMonitor("打开通道22", "M12.5", "421")]
public bool UsePassageWay_22 { get; set; }

[VariableMonitor("打开通道23", "M12.6", "422")]
public bool UsePassageWay_23 { get; set; }

[VariableMonitor("打开通道24", "M12.7", "423")]
public bool UsePassageWay_24 { get; set; }

[VariableMonitor("打开通道25", "M13.0", "424")]
public bool UsePassageWay_25 { get; set; }

[VariableMonitor("打开通道26", "M13.1", "425")]
public bool UsePassageWay_26 { get; set; }

[VariableMonitor("打开通道27", "M13.2", "426")]
public bool UsePassageWay_27 { get; set; }

[VariableMonitor("打开通道28", "M13.3", "427")]
public bool UsePassageWay_28 { get; set; }


[VariableMonitor("通道出料完成信号1", "M50.0", "720")]
public bool OutMateraiComplete_1 { get; set; }

[VariableMonitor("通道出料完成信号2", "M50.1", "721")]
public bool OutMateraiComplete_2 { get; set; }

[VariableMonitor("通道出料完成信号3", "M50.2", "722")]
public bool OutMateraiComplete_3 { get; set; }

[VariableMonitor("通道出料完成信号4", "M50.3", "723")]
public bool OutMateraiComplete_4 { get; set; }

[VariableMonitor("通道出料完成信号5", "M50.4", "724")]
public bool OutMateraiComplete_5 { get; set; }

[VariableMonitor("通道出料完成信号6", "M50.5", "725")]
public bool OutMateraiComplete_6 { get; set; }

[VariableMonitor("通道出料完成信号7", "M50.6", "726")]
public bool OutMateraiComplete_7 { get; set; }

[VariableMonitor("通道出料完成信号8", "M50.7", "727")]
public bool OutMateraiComplete_8 { get; set; }

[VariableMonitor("通道出料完成信号9", "M51.0", "728")]
public bool OutMateraiComplete_9 { get; set; }

[VariableMonitor("通道出料完成信号10", "M51.1", "729")]
public bool OutMateraiComplete_10 { get; set; }

[VariableMonitor("通道出料完成信号11", "M51.2", "730")]
public bool OutMateraiComplete_11 { get; set; }

[VariableMonitor("通道出料完成信号12", "M51.3", "731")]
public bool OutMateraiComplete_12 { get; set; }

[VariableMonitor("通道出料完成信号13", "M51.4", "732")]
public bool OutMateraiComplete_13 { get; set; }

[VariableMonitor("通道出料完成信号14", "M51.5", "733")]
public bool OutMateraiComplete_14 { get; set; }

[VariableMonitor("通道出料完成信号15", "M51.6", "734")]
public bool OutMateraiComplete_15 { get; set; }

[VariableMonitor("通道出料完成信号16", "M51.7", "735")]
public bool OutMateraiComplete_16 { get; set; }

[VariableMonitor("通道出料完成信号17", "M52.0", "736")]
public bool OutMateraiComplete_17 { get; set; }

[VariableMonitor("通道出料完成信号18", "M52.1", "737")]
public bool OutMateraiComplete_18 { get; set; }

[VariableMonitor("通道出料完成信号19", "M52.2", "738")]
public bool OutMateraiComplete_19 { get; set; }

[VariableMonitor("通道出料完成信号20", "M52.3", "739")]
public bool OutMateraiComplete_20 { get; set; }

[VariableMonitor("通道出料完成信号21", "M52.4", "740")]
public bool OutMateraiComplete_21 { get; set; }

[VariableMonitor("通道出料完成信号22", "M52.5", "741")]
public bool OutMateraiComplete_22 { get; set; }

[VariableMonitor("通道出料完成信号23", "M52.6", "742")]
public bool OutMateraiComplete_23 { get; set; }

[VariableMonitor("通道出料完成信号24", "M52.7", "743")]
public bool OutMateraiComplete_24 { get; set; }

[VariableMonitor("通道出料完成信号25", "M53.0", "744")]
public bool OutMateraiComplete_25 { get; set; }

[VariableMonitor("通道出料完成信号26", "M53.1", "744")]
public bool OutMateraiComplete_26 { get; set; }

[VariableMonitor("通道出料完成信号27", "M53.2", "745")]
public bool OutMateraiComplete_27 { get; set; }

[VariableMonitor("通道出料完成信号28", "M53.3", "746")]
public bool OutMateraiComplete_28 { get; set; }


[VariableMonitor("到达一号位置", "M14.0", "432")]
public bool ReachPosion_1 { get; set; }

[VariableMonitor("到达二号位置", "M14.1", "433")]
public bool ReachPosion_2 { get; set; }

[VariableMonitor("到达三号位置", "M14.2", "434")]
public bool ReachPosion_3 { get; set; }

[VariableMonitor("到达四号位置", "M14.3", "435")]
public bool ReachPosion_4 { get; set; }

[VariableMonitor("到达五号位置", "M14.4", "436")]
public bool ReachPosion_5 { get; set; }

[VariableMonitor("到达六号位置", "M14.5", "437")]
public bool ReachPosion_6 { get; set; }

[VariableMonitor("到达取料位置", "M14.6", "438")]
public bool ReachOutPosion_0 { get; set; }





}
}

+ 0
- 31
BPASmartClient.MorkTM/Model/Alarms.cs Dosyayı Görüntüle

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

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

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

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

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

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

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

+ 55
- 0
BPASmartClient.MorkTM/Model/LocalTeaWithMilkConfig.cs Dosyayı Görüntüle

@@ -0,0 +1,55 @@
using BPASmartClient.MorkTM;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace Model
{
public class LocalTeaWithMilkConfig: ObservableObject
{
/// <summary>
/// 奶茶名称
/// </summary>
public string GoodNames { get { return _goodNames; } set { _goodNames = value; OnPropertyChanged(); } }
private string _goodNames;
/// <summary>
/// 奶茶配方
/// </summary>
public ObservableCollection<MaterialRecipe> materialRecipes = new ObservableCollection<MaterialRecipe>();
}


public class MaterialRecipe:ObservableObject
{
/// <summary>
/// 物料ID
/// </summary>
public int MaterialID { get { return _materialID; } set { _materialID = value; OnPropertyChanged(); } }
private int _materialID =1;
/// <summary>
/// 物料位置
/// </summary>
public string Material { get { return _material; } set { _material = value; OnPropertyChanged(); } }
private string _material ;
/// <summary>
/// 物料的出料量
/// </summary>
public int MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } }
private int _materialWeight = 10;
}

public class MaterailNameAndPosion: ObservableObject
{
public string MaterialPosion { get { return _materaiPosion; } set { _materaiPosion = value; OnPropertyChanged(); } }
private string _materaiPosion;

public string MaterialName { get { return _materailName; } set { _materailName = value; OnPropertyChanged(); } }
private string _materailName;

}
}

+ 1
- 0
BPASmartClient.MorkTM/Model/WritePar.cs Dosyayı Görüntüle

@@ -10,5 +10,6 @@ namespace BPASmartClient.MorkTM.Model
{
public string Address { get; set; }
public object Value { get; set; }

}
}

+ 3
- 5
BPASmartClient.MorkTM/OrderLocInfo.cs Dosyayı Görüntüle

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

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

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

}

+ 150
- 14
BPASmartClient.MorkTM/PolymerBatching.cs Dosyayı Görüntüle

@@ -8,33 +8,169 @@ namespace BPASmartClient.MorkTM
{
public enum MaterialPosion
{
Material_Top_1, Material_Top_2, Material_Top_3, Material_Top_4, Material_Top_5, Material_Top_6,
Material_Mid_1, Material_Mid_2, Material_Mid_3, Material_Mid_4, Material_Mid_5, Material_Mid_6, Material_Mid_7, Material_Mid_8, Material_Mid_9, Material_Mid_10,
Marerial_Bottom_1, Marerial_Bottom_2, Marerial_Bottom_3, Marerial_Bottom_4, Marerial_Bottom_5, Marerial_Bottom_6,
Matetial_Tea_1, Matetial_Tea_2, Matetial_Tea_3, Matetial_Tea_4, Matetial_Tea_5, Matetial_Tea_6
Top1 =1, Top2 =2, Top3 =3, Top4 = 4, Top5 = 5, Top6= 6, Top7 = 7, Top8=8, Top9 =9, Top10 =10,
Top11 = 11, Top12 =12, Top13 =13, Top14 =14, Top15= 15, Top16=16, Top17 =17, Top18 =18, Top19 =19, Top20 =20,
Top21 =21, Top22 =22, Top23 =23, Top24 =24, Top25 =25, Top26 =26, Top27 =27, Top28=28

}
public enum OutMaterialPosion
{
OutMaterial_1, OutMaterial_2, OutMaterial_3, OutMaterial_4, OutMaterial_5, OutMaterial_6, OutMaterial_7, OutMaterial_8, OutMaterial_9, OutMaterial_10
出料位=0, 一号位 = 1, 二号位 = 2, 三号位 = 3, 四号位 = 4, 五号位 = 5, 六号位 = 6
}
public class CommationPosionPLC
{
public CommationPosionPLC( string set,string get, Enum @enum)
{
SetPLCPosion = set;
GetPLCPosion = get;
posion = @enum;
}
public string SetPLCPosion;

public string GetPLCPosion;

public Enum posion;
}
public class PolymerBatching
{
public static void GetMaterialInfo()
/// <summary>
/// 物料对应的plc点位
/// </summary>
public Dictionary<MaterialPosion, string> MaterialPosionList = new Dictionary<MaterialPosion, string>()
{
Array arrayPosion = Enum.GetValues(typeof(MaterialPosion));
Array arrayOutPosion = Enum.GetValues(typeof(OutMaterialPosion));
for (int i = 0; i < arrayPosion.Length; i++)
{
int j = (int)Math.Ceiling((double)(i + 1) / 3) - 1;
GoodsMaterialPosion.Add((MaterialPosion)arrayPosion.GetValue(i), (OutMaterialPosion)arrayOutPosion.GetValue(j));
{MaterialPosion.Top1 , "VW304"},
{MaterialPosion.Top2 , "VW308"},
{MaterialPosion.Top3 , "VW312"},
{MaterialPosion.Top4 , "VW316"},
{MaterialPosion.Top5 , "VW320"},
{MaterialPosion.Top6 , "VW324"},
{MaterialPosion.Top7 , "VW328"},
{MaterialPosion.Top8 , "VW332"},
{MaterialPosion.Top9 , "VW336"},
{MaterialPosion.Top10, "VW340" },
{MaterialPosion.Top11, "VW344" },
{MaterialPosion.Top12, "VW348" },
{MaterialPosion.Top13, "VW352" },
{MaterialPosion.Top14, "VW356" },
{MaterialPosion.Top15, "VW360" },
{MaterialPosion.Top16, "VW364" },
{MaterialPosion.Top17, "VW368" },
{MaterialPosion.Top18, "VW372" },
{MaterialPosion.Top19, "VW376" },
{MaterialPosion.Top20, "VW380" },
{MaterialPosion.Top21, "VW384" },
{MaterialPosion.Top22, "VW388" },
{MaterialPosion.Top23, "VW392" },
{MaterialPosion.Top24, "VW396" },
{MaterialPosion.Top25, "VW400" },
{MaterialPosion.Top26, "VW404" },
{MaterialPosion.Top27, "VW408" },
{MaterialPosion.Top28, "VW412" },

};
/// <summary>
/// 通道校正PLC点位
/// </summary>
public Dictionary<MaterialPosion, string> PasswayPosionList = new Dictionary<MaterialPosion, string>()
{
{MaterialPosion.Top1 , "VW104"},
{MaterialPosion.Top2 , "VW108"},
{MaterialPosion.Top3 , "VW112"},
{MaterialPosion.Top4 , "VW116"},
{MaterialPosion.Top5 , "VW120"},
{MaterialPosion.Top6 , "VW124"},
{MaterialPosion.Top7 , "VW128"},
{MaterialPosion.Top8 , "VW132"},
{MaterialPosion.Top9 , "VW136"},
{MaterialPosion.Top10, "VW140" },
{MaterialPosion.Top11, "VW144" },
{MaterialPosion.Top12, "VW148" },
{MaterialPosion.Top13, "VW152" },
{MaterialPosion.Top14, "VW156" },
{MaterialPosion.Top15, "VW160" },
{MaterialPosion.Top16, "VW164" },
{MaterialPosion.Top17, "VW168" },
{MaterialPosion.Top18, "VW172" },
{MaterialPosion.Top19, "VW176" },
{MaterialPosion.Top20, "VW180" },
{MaterialPosion.Top21, "VW184" },
{MaterialPosion.Top22, "VW188" },
{MaterialPosion.Top23, "VW192" },
{MaterialPosion.Top24, "VW196" },
{MaterialPosion.Top25, "VW200" },
{MaterialPosion.Top26, "VW204" },
{MaterialPosion.Top27, "VW208" },
{MaterialPosion.Top28, "VW212" },

};
/// <summary>
/// plc转盘点位
/// </summary>
public List<CommationPosionPLC> TurnPosionPLCs = new List<CommationPosionPLC>()
{
new CommationPosionPLC("M4.0","M14.0",OutMaterialPosion.一号位),
new CommationPosionPLC("M4.1","M14.1",OutMaterialPosion.二号位),
new CommationPosionPLC("M4.2","M14.2",OutMaterialPosion.三号位),
new CommationPosionPLC("M4.3","M14.3",OutMaterialPosion.四号位),
new CommationPosionPLC("M4.4","M14.4",OutMaterialPosion.五号位),
new CommationPosionPLC("M4.5","M14.5",OutMaterialPosion.六号位),
};
/// <summary>
/// plc出料点位
/// </summary>
public List<CommationPosionPLC> OutPosionPLCs = new List<CommationPosionPLC>()
{
new CommationPosionPLC("M0.0","M10.0",MaterialPosion.Top1),
new CommationPosionPLC("M0.1","M10.1",MaterialPosion.Top2),
new CommationPosionPLC("M0.2","M10.2",MaterialPosion.Top3),
new CommationPosionPLC("M0.3","M10.3",MaterialPosion.Top4),
new CommationPosionPLC("M0.4","M10.4",MaterialPosion.Top5),
new CommationPosionPLC("M0.5","M10.5",MaterialPosion.Top6),
new CommationPosionPLC("M0.6","M10.6",MaterialPosion.Top7),
new CommationPosionPLC("M0.7","M10.7",MaterialPosion.Top8),
new CommationPosionPLC("M1.0","M11.0",MaterialPosion.Top9),
new CommationPosionPLC("M1.1","M11.1",MaterialPosion.Top10),
new CommationPosionPLC("M1.2","M11.2",MaterialPosion.Top11),
new CommationPosionPLC("M1.3","M11.3",MaterialPosion.Top12),
new CommationPosionPLC("M1.4","M11.4",MaterialPosion.Top13),
new CommationPosionPLC("M1.5","M11.5",MaterialPosion.Top14),
new CommationPosionPLC("M1.6","M11.6",MaterialPosion.Top15),
new CommationPosionPLC("M1.7","M11.7",MaterialPosion.Top16),
new CommationPosionPLC("M2.0","M12.0",MaterialPosion.Top17),
new CommationPosionPLC("M2.1","M12.1",MaterialPosion.Top18),
new CommationPosionPLC("M2.2","M12.2",MaterialPosion.Top19),
new CommationPosionPLC("M2.3","M12.3",MaterialPosion.Top20),
new CommationPosionPLC("M2.4","M12.4",MaterialPosion.Top21),
new CommationPosionPLC("M2.5","M12.5",MaterialPosion.Top22),
new CommationPosionPLC("M2.6","M12.6",MaterialPosion.Top23),
new CommationPosionPLC("M2.7","M12.7",MaterialPosion.Top24),
new CommationPosionPLC("M3.0","M13.0",MaterialPosion.Top25),
new CommationPosionPLC("M3.1","M13.1",MaterialPosion.Top26),
new CommationPosionPLC("M3.2","M13.2",MaterialPosion.Top27),
new CommationPosionPLC("M3.3","M13.3",MaterialPosion.Top28),
};

public void GetMaterialInfo()
{
List<MaterialPosion> materialPosions = Enum.GetValues(typeof(MaterialPosion)).Cast<MaterialPosion>().ToList();
for (int i = 0; i < Enum.GetValues(typeof(OutMaterialPosion)).Length -1; i++)
{
if (i == 2 || i == 3)
{
GoodsMaterialPosion.Add(materialPosions.Take(4).ToList(), TurnPosionPLCs[i]);
materialPosions.RemoveRange(0, 4);
}
else
{
GoodsMaterialPosion.Add(materialPosions.Take(5).ToList(), TurnPosionPLCs[i]);
materialPosions.RemoveRange(0, 5);
}
}

}

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

+ 0
- 16
BPASmartClient.MorkTM/Properties/AssemblyInfo.cs Dosyayı Görüntüle

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

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

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


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

[assembly: ComVisible(false)]

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

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

+ 0
- 63
BPASmartClient.MorkTM/Properties/Resources.Designer.cs Dosyayı Görüntüle

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

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

+ 0
- 101
BPASmartClient.MorkTM/Properties/Resources.resx Dosyayı Görüntüle

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

Version 1.3

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

Example:

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

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

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

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

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

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

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

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

+ 0
- 26
BPASmartClient.MorkTM/Properties/Settings.Designer.cs Dosyayı Görüntüle

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

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

+ 0
- 6
BPASmartClient.MorkTM/Properties/Settings.settings Dosyayı Görüntüle

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

+ 217
- 15
BPASmartClient.MorkTM/View/Debug.xaml Dosyayı Görüntüle

@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkTM.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkTM.ViewModel"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="1000"
Name="调试界面">
@@ -12,18 +13,218 @@
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<Style x:Key="buttonNormal" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle">
<Setter.Value>
<Style>
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" SnapsToDevicePixels="True" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Background" Value="#58B0ED"/>
<Setter Property="BorderBrush" Value="#FF707070"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" CornerRadius="10" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" TargetName="border" Value="#58B0ED "/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF2C628B"/>
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Background" TargetName="border" Value="#FF3C7FB1"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FF245A83"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="border" Value="#58B0ED"/>
<Setter Property="BorderBrush" TargetName="border" Value="#FFADB2B5"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Combox-->
<Style TargetType="{x:Type ComboBox}" x:Key="cmbstyle">
<Setter Property="Background" Value="White"/>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<!--ComBoxItem-->
<Style TargetType="ComboBoxItem">
<Setter Property="MinHeight" Value="22"></Setter>
<Setter Property="MinWidth" Value="60"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border Name="Back" Background="Transparent" BorderThickness="0,0,0,0" BorderBrush="#81D779" >
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0,0,0"></ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Back" Property="Background" Value="LightGray"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Border BorderThickness="0" CornerRadius="3" Width="100" Height="30" Background="{TemplateBinding Background}" >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" x:Name="grid">
<ToggleButton
Width="{Binding ElementName=grid,Path=ActualWidth}"
Height="{Binding ElementName=grid, Path=ActualHeight}"
Content="{TemplateBinding Text}" VerticalAlignment="Center"
HorizontalAlignment="Left" Margin="5,0,0,0"
BorderThickness="0"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"
>
<ToggleButton.Style >
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="0" >
<TextBlock Foreground="{TemplateBinding Foreground}" Text="{TemplateBinding Content}" Margin="4 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>

<Grid Grid.Column="1" >
<ToggleButton IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Foreground="{TemplateBinding Foreground}"
ClickMode="Press">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Background" Value="White"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<TextBlock Foreground="{TemplateBinding Foreground}" x:Name="arrow_tb" Text="&#xf02a9;" FontFamily="/BPASmartClient.CustomResource;component/Fonts/MT/#iconfont" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">

</Trigger>
<EventTrigger RoutedEvent="Checked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="180"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>

<EventTrigger RoutedEvent="Unchecked">
<BeginStoryboard>
<Storyboard >
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="arrow_tb" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="180"/>
<EasingDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToggleButton.Style>
</ToggleButton>
</Grid>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide">
<Border CornerRadius="1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
<Border.Effect>
<DropShadowEffect Color="Black" BlurRadius="2" ShadowDepth="0" Opacity="0.5"/>
</Border.Effect>
<ScrollViewer Margin="4,6,4,6" MaxHeight="{TemplateBinding MaxDropDownHeight}" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="White"/>
</ScrollViewer>
</Border>
</Popup>
</Grid>


<Border.Effect>
<DropShadowEffect ShadowDepth="-1" Opacity="0.3" Color="#FF969696" BlurRadius="5"/>
</Border.Effect>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>


</Style>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
@@ -33,15 +234,16 @@
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="出料口" Margin="10,0"/>
<ComboBox ItemsSource="{Binding Materials}" Width="80" Margin="20,0"/>
<TextBlock Text="出料量" Margin="40,0,10,0"/>
<ComboBox ItemsSource="{Binding Materials}" Margin="20,0" Width="120 " Style="{StaticResource cmbstyle}" />
<TextBlock Text="出料量" Margin="10,0,10,0"/>
<TextBox Text="{Binding MaertialsWight}" Width="60" Margin="10,0"/>
<Button Content="出料" Margin="40,0" Command="{Binding OutMaterials}"/>
<Button Content="出料" Margin="40,0" Command="{Binding OutMaterials}" Style="{StaticResource buttonNormal}"
Width="80" Height="20"/>
</StackPanel>
<Button Grid.Column="1"
<Button Grid.Column="1" Style="{StaticResource buttonNormal}" Height="20"
Width="120" Margin="20,0" HorizontalAlignment="Left"
Content="转盘转动" Command="{Binding TurnOn}"/>
Content="转盘转动" Command="{Binding TurnOn}" />
<Border BorderBrush="White" BorderThickness="2" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"/>
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="奶茶" Margin="20,0"/>
@@ -57,13 +259,13 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Viewbox Stretch="Fill">
</Viewbox>
<Button Content="制作"
Grid.Row="3" Grid.ColumnSpan="4"
HorizontalAlignment="Center"/>
</Grid>

</Grid>
</UserControl>

+ 1
- 3
BPASmartClient.MorkTM/View/Debug.xaml.cs Dosyayı Görüntüle

@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@@ -16,7 +14,7 @@ using System.Windows.Shapes;
namespace BPASmartClient.MorkTM.View
{
/// <summary>
/// Debug.xaml 的交互逻辑
/// Debug1.xaml 的交互逻辑
/// </summary>
public partial class Debug : UserControl
{


+ 0
- 50
BPASmartClient.MorkTM/View/Monitor.xaml Dosyayı Görüntüle

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

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

</Grid>
</UserControl>

+ 284
- 0
BPASmartClient.MorkTM/View/RecipeView.xaml Dosyayı Görüntüle

@@ -0,0 +1,284 @@
<UserControl x:Class="View.RecipeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:View"
xmlns:vm ="clr-namespace:ViewModel"
mc:Ignorable="d"
Name="参数设置界面"
d:DesignHeight="600" d:DesignWidth="800">
<UserControl.DataContext>
<vm:RecipeViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="button_Style" TargetType="Button">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Foreground" Value="#a2c2e8" />
<Setter Property="Width" Value="80" />
<Setter Property="Height" Value="25" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ControlTemplate.Resources>
<Storyboard x:Key="OnMouseEnter1">
<ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
<EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF139DDB" />
</ColorAnimationUsingKeyFrames>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="BD" Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
<EasingColorKeyFrame KeyTime="0:0:0.1" Value="#FF135EC2" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Border
x:Name="BD"
Background="Transparent"
BorderBrush="#05408a"
BorderThickness="1"
CornerRadius="12">
<TextBlock
x:Name="textBlock"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
FontSize="16"
Foreground="#a2c2e8"
Text="{TemplateBinding Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="BD" Property="Background" Value="#009dff" />
<Setter TargetName="textBlock" Property="Foreground" Value="#a2c2e8" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="BD" Property="Background" Value="#ff55" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="DataGrid">
<Setter Property="CanUserResizeColumns" Value="false" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4fade8" />
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#4fade8" />
</Setter.Value>
</Setter>

</Style>
<!--标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="25" />
<Setter Property="Foreground" Value="#FF00EEF3" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
BorderBrush="#FF074B92"
Width="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="#FF074B92" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="25" />
</Style>
<!--行样式触发-->
<!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="30" />
<Setter Property="Foreground" Value="#a2c2e8" />
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>

<!--单元格样式触发-->
<Style TargetType="DataGridCell">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridCell">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Height="30" >
<ContentPresenter Height="28" />
</TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4fade8" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>

</ResourceDictionary>
</UserControl.Resources>
<Grid >
<Grid Margin="50" >
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="奶茶配方录入" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="40,0">
<TextBlock Text="奶茶名称:" Foreground="#409EFF" FontSize="16" Margin="10,0" VerticalAlignment="Center"/>
<TextBox Text="{Binding LocalGoodName}" Width="120" FontSize="16" Margin="10,0"/>
<Button Content="添加配方" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding AddRecipeCommand}"/>
<Button Content="保存" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding SaveRecipeCommand}"/>
<Button Content="取消" Style="{StaticResource button_Style}" Margin="10,0" Command="{Binding RecipeCancelCommand}"/>
</StackPanel>
<DataGrid Grid.Row="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materialRecipes}"
x:Name="recipeDataGrid"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False" >
<DataGrid.Columns >
<DataGridTemplateColumn Header="ID" Width="30">
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<TextBlock Text="{ Binding MaterialID}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料" Width="*">
<DataGridTemplateColumn.CellTemplate >
<DataTemplate>
<ComboBox x:Name="combox" FontSize="16" Width="100"
ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MaterailList}"
IsReadOnly="True"
SelectedValue="{Binding Material ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="配料量" Width="175">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBox Text="{Binding MaterialWeight}" VerticalAlignment="Center" HorizontalAlignment="Center" Width="50" FontSize="16"/>
<TextBlock Text="g" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<DataGridTemplateColumn Header="操作" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.RemoveRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
Style="{StaticResource button_Style}"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>

<TextBlock Text="本地奶茶配方" Grid.Row="3" Foreground="Wheat" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<DataGrid Grid.Row="4" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding localMaterialRecipes}" Width="500"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="奶茶" Width="200">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding RecipeName}" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="操作" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<Button Content="删除" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteRecipeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}, Path=SelectedIndex}"
Style="{StaticResource button_Style}"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>

<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="配料名称修改" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Wheat" FontSize="18"/>
<Button Content="更新物料位置名称" Grid.Column="2" Grid.Row="1" Style="{StaticResource button_Style}" Width="150" Command="{Binding UpdateMaterialPosionCommand}"/>
<DataGrid Grid.Row="2" Grid.RowSpan="3" Grid.Column="2" Margin="100,5" AutoGenerateColumns="False" RowHeight="250" ItemsSource="{Binding materailNameAndPosions}"
FrozenColumnCount="1"
VerticalAlignment="Top"
IsReadOnly="True"
CanUserResizeColumns="False" CanUserResizeRows="False" SelectionMode="Single"
CanUserReorderColumns="False" AlternationCount="2" RowHeaderWidth="0" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="物料位置" Width="170">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Text="{Binding MaterialPosion}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5,0" FontSize="16"/>
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="物料" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding MaterialName ,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalContentAlignment="Center" Width="80" FontSize="16"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>

</Grid>
</Grid>

</UserControl>

+ 36
- 0
BPASmartClient.MorkTM/View/RecipeView.xaml.cs Dosyayı Görüntüle

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ViewModel;

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

private void DataGridComboBoxColumn_SourceUpdated(object sender, DataTransferEventArgs e)
{

}

}
}

+ 0
- 27
BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs Dosyayı Görüntüle

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

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

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




}
}
}

+ 241
- 0
BPASmartClient.MorkTM/ViewModel/RecipeViewModel.cs Dosyayı Görüntüle

@@ -0,0 +1,241 @@
using BPASmartClient.MorkTM;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Text;
using System.Windows;

namespace ViewModel
{
public class RecipeViewModel : ObservableObject
{
//路径
string recipePath = string.Empty;
string posionPath = string.Empty;


#region 奶茶配方录入
/// <summary>
/// 奶茶配方
/// </summary>
public ObservableCollection<MaterialRecipe> materialRecipes { get; set;} = new ObservableCollection<MaterialRecipe>();
/// <summary>
/// 出料集合
/// </summary>
public ObservableCollection<string> MaterailList { get; set; } = new ObservableCollection<string>();
/// <summary>
/// 奶茶名称
/// </summary>
public string LocalGoodName { get { return _localGoodName; } set { _localGoodName = value; OnPropertyChanged(); } }
private string _localGoodName;
/// <summary>
/// 添加一条配方
/// </summary>
public RelayCommand AddRecipeCommand { get; set; }
/// <summary>
/// 删除一条配方
/// </summary>
public RelayCommand<object> RemoveRecipeCommand { get; set; }
/// <summary>
/// 取消配方
/// </summary>
public RelayCommand RecipeCancelCommand { get; set; }
/// <summary>
/// 保存配方
/// </summary>
public RelayCommand SaveRecipeCommand { get; set; }

#endregion

#region 本地奶茶配方
/// <summary>
/// 本地奶茶配方列表
/// </summary>
public ObservableCollection<LocalTeaWithMilkConfig> localMaterialRecipes { get; set; } = new ObservableCollection<LocalTeaWithMilkConfig>();
/// <summary>
/// 删除配方奶茶
/// </summary>
public RelayCommand<object> DeleteRecipeCommand { get; set; }

#endregion

#region 物料位置名称
/// <summary>
/// 物料位置名称集合
/// </summary>
public ObservableCollection<MaterailNameAndPosion> materailNameAndPosions { get; set; } = new ObservableCollection<MaterailNameAndPosion>();
/// <summary>
/// 更新物料位置
/// </summary>
public RelayCommand UpdateMaterialPosionCommand{ get; set; }
#endregion

public RecipeViewModel()
{
materialRecipes.Add(new MaterialRecipe()
{
MaterialWeight = 10
});

foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion)))
{
materailNameAndPosions.Add(new MaterailNameAndPosion()
{
MaterialPosion = item.ToString()
});
}


AddRecipeCommand = new RelayCommand(new Action(() =>
{
materialRecipes.Add(new MaterialRecipe()
{
MaterialID = materialRecipes.Count() + 1
}) ;
}));

RemoveRecipeCommand = new RelayCommand<object>((o=>
{
if(o!=null&&o is int index)
{
materialRecipes.RemoveAt(index);
for (int i = 0; i < materialRecipes.Count; i++)//ID排序
{
materialRecipes[i].MaterialID = i + 1;
}
}
}));

RecipeCancelCommand = new RelayCommand(new Action(() =>
{
materialRecipes.Clear();
}));

SaveRecipeCommand = new RelayCommand(new Action(() =>
{
if(LocalGoodName == "" || LocalGoodName == null) return;
if(materialRecipes.Count == 0) return;
localMaterialRecipes.Insert(0, new LocalTeaWithMilkConfig()
{
GoodNames = LocalGoodName,
materialRecipes = materialRecipes

});

UpdateLocalJosnData<LocalTeaWithMilkConfig>(recipePath, localMaterialRecipes);//更新奶茶配方json文件
MessageBox.Show("保存成功");
}));


DeleteRecipeCommand = new RelayCommand<object>((o =>
{
if (o != null && o is int index)
{
localMaterialRecipes.RemoveAt(index);
UpdateLocalJosnData<LocalTeaWithMilkConfig>(recipePath, localMaterialRecipes);//更新奶茶配方json文件
}
}));

UpdateMaterialPosionCommand = new RelayCommand(new Action(() =>
{
UpdateLocalJosnData<MaterailNameAndPosion>(posionPath, materailNameAndPosions);//更新物料位置名称
}));

Init();
}

/// <summary>
/// 界面初始化加载
/// </summary>
private void Init()
{
string path = Path.Combine(Environment.CurrentDirectory, "AccessFile", "Recipes");
//判断文件夹是否存在,如果不存在就创建file文件夹
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
recipePath = Path.Combine(path, "LocalRecipes.json");
posionPath = Path.Combine(path, "MaterialPosion.json");

localMaterialRecipes = GetJsonToT<LocalTeaWithMilkConfig>(recipePath);
materailNameAndPosions = GetJsonToT<MaterailNameAndPosion>(posionPath);
if(materailNameAndPosions.Count == 0)
{
foreach (MaterialPosion item in Enum.GetValues(typeof(MaterialPosion)))
{
materailNameAndPosions.Add(new MaterailNameAndPosion()
{
MaterialPosion = item.ToString()
});
}
}

foreach(MaterailNameAndPosion m in materailNameAndPosions)
{
if(m.MaterialName!=null) MaterailList.Add(m.MaterialName);

}


}

/// <summary>
/// 获取Json文件内容,转换成ObservableCollection
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="path"></param>
/// <returns></returns>
private ObservableCollection<T> GetJsonToT<T>(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<ObservableCollection<T>>(datacache); //将string转换为class类,从而达到json文件转换的目的
if(res != null)
return res;
else return new ObservableCollection<T> { };
}
}
}
/// <summary>
/// 更新Json文件数据
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="path"></param>
/// <param name="ts"></param>
private void UpdateLocalJosnData<T>(string path,ObservableCollection<T> ts)
{
if(ts != null) File.WriteAllText(path, JsonConvert.SerializeObject(ts));

}
}


}

+ 16
- 0
BPASmartClient.MorkTSingle/BPASmartClient.MorkTSingle.csproj Dosyayı Görüntüle

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

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

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

</Project>

+ 316
- 0
BPASmartClient.MorkTSingle/Control_MORKJC.cs Dosyayı Görüntüle

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

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

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

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

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

private AutoResetEvent are = new AutoResetEvent(false);

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

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

public void SimOrder<T>(T simOrder)
{

}
public override void DoMain()
{
if (Json<KeepDataBase>.Data.IsVerify)
{
IsHealth = true;
}
IsHealth = true;
serverInit();
DataParse();
}
private void serverInit()
{
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is MaterialDeliveryEvent material)
{
orderMaterialDelivery = material.orderMaterialDelivery;
}
});
}
private void DataParse()
{

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

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

}

public override void ReadData()
{

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

public override void ResetProgram()
{

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

+ 23
- 0
BPASmartClient.MorkTSingle/GVL_MORKJC.cs Dosyayı Görüntüle

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

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

+ 20
- 0
BPASmartClient.MorkTSingle/OrderLocInfo.cs Dosyayı Görüntüle

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

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

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

}

}

BPASmartClient.MorkTJuicer/PolymerBatching.cs → BPASmartClient.MorkTSingle/PolymerBatching.cs Dosyayı Görüntüle

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

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

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

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

+ 39
- 0
BPASmartClient.MorkTSingle/View/DebugView.xaml Dosyayı Görüntüle

@@ -0,0 +1,39 @@
<UserControl x:Class="BPASmartClient.MorkTSingle.View.DebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.MorkTSingle.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="15*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock>咖啡:</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SimOrderCoffeeList}" />
<Button Command="{Binding SimOrderMakeCoffee}">制作</Button>
</StackPanel>
</Grid>
</UserControl>

+ 29
- 0
BPASmartClient.MorkTSingle/View/DebugView.xaml.cs Dosyayı Görüntüle

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

+ 47
- 0
BPASmartClient.MorkTSingle/ViewModel/DebugViewModel.cs Dosyayı Görüntüle

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


+ 0
- 94
BPASmartClient.MorkT_BarCounter/ViewModel/MonitorViewModel.cs Dosyayı Görüntüle

@@ -1,94 +0,0 @@
using BPASmartClient.Business;
using BPASmartClient.Helper;
using BPASmartClient.Model.乐白机器人;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.MorkT_BarCounter.ViewModel
{

public class MonitorViewModel: ObservableObject
{
#region 传感器
/// <summary>
/// 机器人夹爪传感器
/// </summary>
public bool RobotSenser { get { return _robotSenser; } set { _robotSenser = value; OnPropertyChanged(); } }
private bool _robotSenser;
/// <summary>
/// 冰淇淋出口传感器
/// </summary>
public bool IceCreamSenser { get { return _iceCreamSenser; } set { _iceCreamSenser = value; OnPropertyChanged(); } }
private bool _iceCreamSenser;
/// <summary>
/// 取餐口检测传感器
/// </summary>
public bool TakeMealSenser { get { return _takeMealSenser; } set { _takeMealSenser = value; OnPropertyChanged(); } }
private bool _takeMealSenser;

#endregion


/// <summary>
/// 设备ID
/// </summary>
int DeviceId;
public MonitorViewModel()
{
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
if (device.Name == "MorkT") DeviceId = device.DeviceId;

});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent() { DeviceId = DeviceId, Pin = 1 },(res)=>
{
if(res != null&& res.Length>0&& res[0] is bool b)
{
RobotSenser = b;
}
});

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (res) =>
{
if (res != null && res.Length > 0 && res[0] is bool b)
{
TakeMealSenser = b;
}
});

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent() { DeviceId = DeviceId, Pin = 3 }, (res) =>
{
if (res != null && res.Length > 0 && res[0] is bool b)
{
IceCreamSenser = b;
}
});
Thread.Sleep(500);
}), "MorkT-传感器监视");
}
}

public class BoolToColorConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool) value? new SolidColorBrush(Color.FromRgb(144, 238, 144)) : new SolidColorBrush(Color.FromRgb(178, 34, 34));
}

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

}

+ 1
- 1
BPASmartClient.MorkT_Container/Control_MorkT_Container.cs Dosyayı Görüntüle

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


+ 2
- 2
BPASmartClient.MorkT_Container/GVL_MorkT.cs Dosyayı Görüntüle

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

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

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

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


+ 0
- 92
BPASmartClient.MorkT_Container/ViewModel/MonitorViewModel.cs Dosyayı Görüntüle

@@ -1,92 +0,0 @@
using BPASmartClient.Business;
using BPASmartClient.Helper;
using BPASmartClient.Model.乐白机器人;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.MorkT_Container.ViewModel
{

public class MonitorViewModel: ObservableObject
{
#region 传感器
/// <summary>
/// 机器人夹爪传感器
/// </summary>
public bool RobotSenser { get { return _robotSenser; } set { _robotSenser = value; OnPropertyChanged(); } }
private bool _robotSenser;
/// <summary>
/// 冰淇淋出口传感器
/// </summary>
public bool IceCreamSenser { get { return _iceCreamSenser; } set { _iceCreamSenser = value; OnPropertyChanged(); } }
private bool _iceCreamSenser;
/// <summary>
/// 取餐口检测传感器
/// </summary>
public bool TakeMealSenser { get { return _takeMealSenser; } set { _takeMealSenser = value; OnPropertyChanged(); } }
private bool _takeMealSenser;

#endregion
/// <summary>
/// 设备ID
/// </summary>
int DeviceId;
public MonitorViewModel()
{
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
if (device.Name == "MorkT") DeviceId = device.DeviceId;

});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent() { DeviceId = DeviceId, Pin = 1 },(res)=>
{
if(res != null&& res.Length>0&& res[0] is bool b)
{
RobotSenser = b;
}
});

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (res) =>
{
if (res != null && res.Length > 0 && res[0] is bool b)
{
TakeMealSenser = b;
}
});

EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent() { DeviceId = DeviceId, Pin = 3 }, (res) =>
{
if (res != null && res.Length > 0 && res[0] is bool b)
{
IceCreamSenser = b;
}
});
Thread.Sleep(500);
}), "MorkT-传感器监视");
}
}

public class BoolToColorConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool) value? new SolidColorBrush(Color.FromRgb(144, 238, 144)) : new SolidColorBrush(Color.FromRgb(178, 34, 34));
}

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

}

+ 1
- 1
BPASmartClient.Peripheral/BasePeripheral.cs Dosyayı Görüntüle

@@ -30,7 +30,7 @@ namespace BPASmartClient.Peripheral
public ConcurrentDictionary<string, object> status { get; set; } = new ConcurrentDictionary<string, object>();
public ObservableCollection<Variable> variables { get; set; } = new ObservableCollection<Variable>();

/// <summary>
/// <summary>q
/// 外设状态集合
/// </summary>
//protected ConcurrentDictionary<string, object> status = new ConcurrentDictionary<string, object>();


+ 10
- 2
BPASmartClient.SerialPort/SerialPortClient.cs Dosyayı Görüntüle

@@ -143,7 +143,7 @@ namespace BPASmartClient.SerialPort
/// 判断是否有这个串口
/// </summary>
public bool IsHavePort => System.IO.Ports.SerialPort.GetPortNames().Contains(PortName);
/// <summary>
/// 打开端口
/// </summary>
@@ -152,7 +152,11 @@ namespace BPASmartClient.SerialPort
{
lock (lck4Serial)
{
if (!IsHavePort) return;
if (!IsHavePort)
{
MessageLog.GetInstance.Show($"{portName}连接失败");
return;
}
if (comPort.IsOpen) comPort.Close();
comPort.PortName = portName;
comPort.BaudRate = (int)baudRate;
@@ -160,6 +164,7 @@ namespace BPASmartClient.SerialPort
comPort.DataBits = (int)dataBits;
comPort.StopBits = stopBits;
comPort.Open();
MessageLog.GetInstance.Show($"{portName}连接成功");
}
}

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

private static readonly object objLock = new object();

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



+ 7
- 7
BPASmartClient/App.config Dosyayı Görüntüle

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

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

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

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

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


+ 3
- 3
BPASmartClient/BPASmartClient.csproj Dosyayı Görüntüle

@@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1185.39" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
</ItemGroup>

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


+ 11
- 0
BPASmartClient/DeviceInfo.xml Dosyayı Görüntüle

@@ -85,6 +85,17 @@
</Peripheral>
</Peripherals>
</Device>-->-->
<Device Name="MorkTM" Module="BPASmartClient.MorkTM.Control_MorkTM" DeviceId="55">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters>
<IpAddress>192.168.6.1</IpAddress>
<Port>502</Port>
<PLCReadAddress>M,M0.1,1;M,M1.0,8;M,M2.0,9;M,M8.0,4;M,M13.5,1;M,M16.0,7;</PLCReadAddress>
</Parameters>
</Peripheral>
</Peripherals>
</Device>
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine">


+ 2
- 2
BPASmartClient/MainWindow.xaml Dosyayı Görüntüle

@@ -27,7 +27,7 @@
</ResourceDictionary>
</Window.Resources>

<Border x:Name="br" Style="{DynamicResource border主窗体背景}">
<Border Style="{DynamicResource border主窗体背景}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
@@ -40,7 +40,7 @@
<ColumnDefinition Width="300" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border
<Border x:Name="br"
Grid.ColumnSpan="2"
Height="52"
VerticalAlignment="Top"


+ 8
- 2
FryPot_DosingSystem/App.xaml.cs Dosyayı Görüntüle

@@ -73,7 +73,7 @@ namespace FryPot_DosingSystem
SubMenuName = "配方管理",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.RecipeSetView"
ToggleWindowPath = "View.RecipeManageView"
});

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

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

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


+ 19
- 20
FryPot_DosingSystem/Control/DosingLogicControl.cs Dosyayı Görüntüle

@@ -850,19 +850,17 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LineOneProcessExecute()
{
if (!globalVar.LOneTaskLock)
{
globalVar.LOneTaskLock = true;
//if (!globalVar.LOneTaskLock)
//{
// globalVar.LOneTaskLock = true;
LOneRecipeDataToPlc();
LOneLoadRoller();
LOneFryPotInputMaterial();
LOneFallMaterial();
LOneFryPotOutputMaterial();
LOneEmptyOperate();
globalVar.LOneTaskLock = false;


}
// globalVar.LOneTaskLock = false;
//}

}
/// <summary>
@@ -870,36 +868,36 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public void LineTwoProcessExecute()
{
if (!globalVar.LTwoTaskLock)
{
globalVar.LTwoTaskLock = true;
//if (!globalVar.LTwoTaskLock)
//{
// globalVar.LTwoTaskLock = true;
LTwoRecipeDataToPlc();
LTwoAgvLoadRoller();
LTwoFryPotInputMaterial();
LTwoFallMaterial();
LTwoFryPotOutputMaterial();
LTwoEmptyOperate();
globalVar.LTwoTaskLock = false;
// globalVar.LTwoTaskLock = false;

}
//}
}
/// <summary>
/// 线体3的执行流程
/// </summary>
public void LineThreeProcessExecute()
{
if (!globalVar.LThreeTaskLock)
{
globalVar.LThreeTaskLock = true;
//if (!globalVar.LThreeTaskLock)
//{
// globalVar.LThreeTaskLock = true;
LThreeRecipeDataToPlc();
LThreeAgvLoadRoller();
LThreeFryPotInputMaterial();
LThreeFallMaterial();
LThreeFryPotOutputMaterial();
LThreeEmptyOperate();
globalVar.LThreeTaskLock = false;
// globalVar.LThreeTaskLock = false;

}
//}
}

/// <summary>
@@ -930,6 +928,7 @@ namespace FryPot_DosingSystem.Control
globalVar.LThreeMaterialNum = result.materialCollection.Count;
globalVar.LThreeFryPotSerial = headNum;
globalVar.LThreeCurrentRecipeName = result.RecipeName;
AgvViewModel.GetInstance().Set滚筒线上数量(3, globalVar.LThreeMaterialNum.ToString());
MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
{
@@ -953,7 +952,7 @@ namespace FryPot_DosingSystem.Control
}
}
DeviceOperate.GetInstance.WritePlcData("D1043", (ushort)result.materialCollection.Count);//发送3号滚筒线工序数据
AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LThreeFryPotSerial, IsRun.Stop);
//AgvViewModel.GetInstance().Set启动或停止炒锅(globalVar.LThreeFryPotSerial, IsRun.Stop);
}
}

@@ -998,6 +997,7 @@ namespace FryPot_DosingSystem.Control
globalVar.LTwoMaterialNum = result.materialCollection.Count;
globalVar.LTwoFryPotSerial = headNum;
globalVar.LTwoCurrentRecipeName = result.RecipeName;
AgvViewModel.GetInstance().Set滚筒线上数量(2, globalVar.LTwoMaterialNum.ToString());
MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
{
@@ -1071,6 +1071,7 @@ namespace FryPot_DosingSystem.Control
globalVar.LOneMaterialNum = result.materialCollection.Count;
globalVar.LOneFryPotSerial = headNum;
globalVar.LOneCurrentRecipeName = result.RecipeName;
AgvViewModel.GetInstance().Set滚筒线上数量(1, globalVar.LOneMaterialNum.ToString());
MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方");
for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料
{
@@ -2058,8 +2059,6 @@ namespace FryPot_DosingSystem.Control
globalVar.AgvToFryPot = true;
//原料到位,agv到位,agv自行运料到炒锅
}


}
}
else//有故障


+ 7
- 0
FryPot_DosingSystem/FryPot_DosingSystem.csproj Dosyayı Görüntüle

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

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

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

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

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

</Project>

+ 1
- 0
FryPot_DosingSystem/Model/RecipeManage.cs Dosyayı Görüntüle

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

+ 11
- 0
FryPot_DosingSystem/Model/RecipeModel.cs Dosyayı Görüntüle

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

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

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

/// <summary>
/// 配方下发状况信息
/// </summary>
private string _recipeSetInfo;
public string RecipeSetInfo { get { return _recipeSetInfo; } set { _recipeSetInfo = value; OnPropertyChanged(); } }



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

+ 391
- 0
FryPot_DosingSystem/Resources/fonts/demo_index.html Dosyayı Görüntüle

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

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

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

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

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

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

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

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

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

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


+ 1
- 1
FryPot_DosingSystem/View/NewRecipeView.xaml.cs Dosyayı Görüntüle

@@ -27,7 +27,7 @@ namespace FryPot_DosingSystem.View
InitializeComponent();
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.CancelRegister("CloseNewRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView");
ActionManage.GetInstance.Register(new Action(() => { this.Close();}), "CloseNewRecipeView");
}

private void Button_Click(object sender, RoutedEventArgs e)


+ 170
- 0
FryPot_DosingSystem/View/RecipeManageView.xaml Dosyayı Görüntüle

@@ -0,0 +1,170 @@
<UserControl x:Class="FryPot_DosingSystem.View.RecipeManageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FryPot_DosingSystem.View"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:RecipeSetViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="GridResize" TargetType="Grid">
<Style.Triggers>
<!--<Trigger Property="IsMouseOver" Value="False"/>-->
<EventTrigger RoutedEvent="MouseEnter" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.2" To="236" Storyboard.TargetProperty="Width"/>
<DoubleAnimation Duration="0:0:0.2" To="281" Storyboard.TargetProperty="Height"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave" >
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Duration="0:0:0.2" To="235" Storyboard.TargetProperty="Width"/>
<DoubleAnimation Duration="0:0:0.2" To="280" Storyboard.TargetProperty="Height"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
<Style x:Key="FocusVisual">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<SolidColorBrush x:Key="Button.Static.Background" Color="#FFDDDDDD"/>
<SolidColorBrush x:Key="Button.Static.Border" Color="#FF707070"/>
<SolidColorBrush x:Key="Button.MouseOver.Background" Color="Transparent"/>
<SolidColorBrush x:Key="Button.MouseOver.Border" Color="#FF3C7FB1"/>
<SolidColorBrush x:Key="Button.Pressed.Background" Color="#FFC4E5F6"/>
<SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
<SolidColorBrush x:Key="Button.Disabled.Background" Color="#FFF4F4F4"/>
<SolidColorBrush x:Key="Button.Disabled.Border" Color="#FFADB2B5"/>
<SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#FF838383"/>
<Style x:Key="ButtonStyle1" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
<Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
<Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
<Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="55"></RowDefinition>
<!--<RowDefinition Height="30"></RowDefinition>-->
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<UniformGrid Columns="2">
<Image Source="../hbl.ico" HorizontalAlignment="Left"></Image>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="2">
<pry:IcoButton Content="新建配方"
Margin="80,15,10,0"
Width="150"
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Cursor="Hand"
Style="{StaticResource IcoButtonStyle}"
Command="{Binding NewRecipe}">
</pry:IcoButton>
<pry:IcoButton
Content="保存配方" Margin="5,15,10,0"
Width="150"
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Cursor="Hand"
Style="{StaticResource IcoButtonStyle}"
Command="{Binding SaveRecipe}">
</pry:IcoButton>

</StackPanel>
</UniformGrid>
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Hidden" Padding="0,5,0,0">
<ItemsControl ItemsSource="{Binding recipeModels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel></WrapPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Width="235" Height="280" Margin="6,6" Style="{StaticResource GridResize}">
<Grid.RowDefinitions>
<RowDefinition Height="150"/>
<RowDefinition />
</Grid.RowDefinitions>
<Button Panel.ZIndex="1" VerticalAlignment="Top" Background="Transparent" HorizontalAlignment="Right" Width="15" Height="15" FontFamily="/BPASmartClient.CustomResource;component/Fonts/#iconfont" Content="&#xe639;" BorderThickness="0" Foreground="LightGray" Command="{Binding DataContext.DeleteRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeId}"></Button>
<Image Stretch="Fill" Source="/BPASmartClient.CustomResource;component/Image/调味品.jpeg"/>
<StackPanel Grid.Row="2">
<StackPanel.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/浅色背景.jpeg" Opacity="0.4"/>
</StackPanel.Background>
<StackPanel Orientation="Horizontal" Margin="0,5">
<TextBlock Text="配方:" Foreground="White" FontSize="18"></TextBlock>
<TextBlock Text="{Binding RecipeName}" Foreground="Orange" FontSize="18"></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,5">
<TextBlock Text="操作:" Foreground="White" FontSize="18"></TextBlock>
<Button Style="{DynamicResource ButtonStyle1}" Content="编辑" Cursor="Hand" Foreground="Orange" FontSize="18" Background="Transparent" BorderThickness="0" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding RecipeId}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,5">
<TextBlock Text="创建时间:" FontSize="18" Foreground="White"></TextBlock>
<TextBlock Text="{Binding DataTime}" FontSize="18" Foreground="Orange"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,5">
<TextBlock Text="更新时间:" FontSize="18" Foreground="White"></TextBlock>
<TextBlock Text="{Binding UpdateTime}" FontSize="18" Foreground="Orange"/>
</StackPanel>
</StackPanel>

</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</UserControl>

+ 28
- 0
FryPot_DosingSystem/View/RecipeManageView.xaml.cs Dosyayı Görüntüle

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

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

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor

Yükleniyor…
İptal
Kaydet