NXX 2 роки тому
джерело
коміт
24ad9bd8cf
49 змінених файлів з 1377 додано та 173 видалено
  1. +11
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. +93
    -1
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  3. BIN
     
  4. BIN
     
  5. +3
    -0
      BPASmartClient.GSIceCream/IceCreamMachine.cs
  6. +1
    -1
      BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs
  7. +1
    -0
      BPASmartClient.GSIceCream/Protocal/MORKI_FAULT.cs
  8. +15
    -11
      BPASmartClient.KLMCoffee/CoffeeMachine.cs
  9. +4
    -4
      BPASmartClient.KLMCoffee/Protocal/SystemStatusModel.cs
  10. +12
    -31
      BPASmartClient.LebaiRobot/LebaiHelper.cs
  11. +9
    -1
      BPASmartClient.MQTT/MQTTProxy.cs
  12. +1
    -0
      BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs
  13. +1
    -0
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  14. +41
    -14
      BPASmartClient.MorkS/Control_Morks.cs
  15. +15
    -0
      BPASmartClient.MorkS/GVL_MORKS.cs
  16. +7
    -1
      BPASmartClient.MorkS/OrderLocInfo.cs
  17. +33
    -1
      BPASmartClient.MorkS/View/Debug.xaml
  18. +39
    -0
      BPASmartClient.MorkS/ViewModel/DebugViewModel.cs
  19. +42
    -0
      BPASmartClient.MorkS/VoiceAPI.cs
  20. +119
    -92
      BPASmartClient.MorkT/Control_MorkT.cs
  21. +3
    -0
      BPASmartClient.MorkT/GLV_MorkT.cs
  22. +13
    -0
      BPASmartClient.MorkT/Model/Global.cs
  23. +30
    -0
      BPASmartClient.MorkT/PreventSleep.cs
  24. +14
    -4
      BPASmartClient.MorkT/View/DebugView.xaml
  25. +11
    -3
      BPASmartClient.MorkT/ViewModel/DebugViewModel.cs
  26. +15
    -0
      BPASmartClient.MorkTM/Alarm.cs
  27. +48
    -0
      BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj
  28. +169
    -0
      BPASmartClient.MorkTM/Control_MorkTM.cs
  29. +33
    -0
      BPASmartClient.MorkTM/GVL_MorkTM.cs
  30. +31
    -0
      BPASmartClient.MorkTM/Model/Alarms.cs
  31. +14
    -0
      BPASmartClient.MorkTM/Model/WritePar.cs
  32. +18
    -0
      BPASmartClient.MorkTM/OrderLocInfo.cs
  33. +24
    -0
      BPASmartClient.MorkTM/PolymerBatching.cs
  34. +16
    -0
      BPASmartClient.MorkTM/Properties/AssemblyInfo.cs
  35. +63
    -0
      BPASmartClient.MorkTM/Properties/Resources.Designer.cs
  36. +101
    -0
      BPASmartClient.MorkTM/Properties/Resources.resx
  37. +26
    -0
      BPASmartClient.MorkTM/Properties/Settings.Designer.cs
  38. +6
    -0
      BPASmartClient.MorkTM/Properties/Settings.settings
  39. +69
    -0
      BPASmartClient.MorkTM/View/Debug.xaml
  40. +28
    -0
      BPASmartClient.MorkTM/View/Debug.xaml.cs
  41. +50
    -0
      BPASmartClient.MorkTM/View/Monitor.xaml
  42. +35
    -0
      BPASmartClient.MorkTM/View/Monitor.xaml.cs
  43. +49
    -0
      BPASmartClient.MorkTM/ViewModel/DebugViewModel.cs
  44. +27
    -0
      BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs
  45. +1
    -0
      BPASmartClient.MorkT_HQ/BPASmartClient.MorkTHQ.csproj
  46. +5
    -4
      BPASmartClient.MorkT_HQ/Control_MorkTHQ.cs
  47. +5
    -4
      BPASmartClient.MorkT_HQ/GLV_MorkTHQ.cs
  48. +2
    -0
      BPASmartClient/BPASmartClient.csproj
  49. +24
    -1
      SmartClient.sln

+ 11
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj Переглянути файл

@@ -182,6 +182,17 @@
<None Remove="Image\顶部线条.png" />
<None Remove="Image\顶部背景.png" />
<None Remove="Image\黑菠萝科技.png" />
<None Remove="Vioce\取餐通知.wav" />
<None Remove="Vioce\电子提示音.wav" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Vioce\取餐通知.wav">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Vioce\电子提示音.wav">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>


+ 93
- 1
BPASmartClient.CustomResource/Themes/MyStyle.xaml Переглянути файл

@@ -779,7 +779,7 @@
</Style.Setters>
</Style>
<!--#endregion-->
<!--#region Button-->
<Style x:Key="TitleBarStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
@@ -1761,5 +1761,97 @@
</Setter>
</Style>
<!--#endregion-->
<!--#region dataGrid-->
<Style TargetType="DataGrid" x:Key="dataGrid_Style">
<!--网格线颜色-->
<Setter Property="CanUserResizeColumns" Value="false" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#a2c2e8" />
<Setter Property="HorizontalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#a2c2e8" />
</Setter.Value>
</Setter>
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#a2c2e8" />
</Setter.Value>
</Setter>
</Style>

<!--#region dataGridRow-->
<Style x:Key="DatagridRow_Style" TargetType="DataGridRow">
<Setter Property="Background" Value="#3afdff" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="20"/>
<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>

<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#4fade8" />
<Setter Property="Foreground" Value="#FF111111" />
</Trigger>
</Style.Triggers>
</Style>
<!--#endregion-->
<!--#region dataGridHeader-->
<Style TargetType="DataGridColumnHeader" x:Key="dataGridHeader_Style">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="30" />
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
BorderBrush="#e6dbba"
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="#d6c79b" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Height" Value="25" />
</Style>
<!--#endregion-->
<!--#region dataGridCell-->
<Style TargetType="DataGridCell" x:Key="dataGridCell_Style">
<Setter Property="Height" Value="20"/>
<Setter Property="FontSize" Value="14"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="White" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>
<!--#endregion-->
<!--#endregion-->

</ResourceDictionary>



+ 3
- 0
BPASmartClient.GSIceCream/IceCreamMachine.cs Переглянути файл

@@ -176,6 +176,7 @@ namespace BPASmartClient.GSIceCream

private void ProcessHeart(ICMSG_Heart_UP heartUpMsg)
{
IsConnected = OnLine;
status["IceCreamIsConnected"] = OnLine;
status["IceCreamCurrentMode"] = heartUpMsg.MS;
@@ -184,6 +185,8 @@ namespace BPASmartClient.GSIceCream
status["IceCreamHJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L, heartUpMsg.HJWD_H }, 0);
status["IceCreamDL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0);
status["IceCreamFault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L, heartUpMsg.GZ_H }, 0);
heartUpMsg.HasGZ(out string msg);
status["IceCreamError"] = msg;
status["IceCreamCXB"] = heartUpMsg.CXB;
status["IceCreamDLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1;



+ 1
- 1
BPASmartClient.GSIceCream/Protocal/ICMSG_Heart_UP.cs Переглянути файл

@@ -65,7 +65,7 @@ namespace BPASmartClient.GSIceCream
msg += ((GZ_L >> 3) & 1) == 1 ? "皮带打滑" : string.Empty;
msg += ((GZ_L >> 2) & 1) == 1 ? "冻缸报警" : string.Empty;
msg += ((GZ_L >> 1) & 1) == 1 ? "缺料报警" : string.Empty;
msg = msg == string.Empty ? "无异常" : msg;
return string.IsNullOrEmpty(msg);
}



+ 1
- 0
BPASmartClient.GSIceCream/Protocal/MORKI_FAULT.cs Переглянути файл

@@ -28,5 +28,6 @@ namespace BPASmartClient.GSIceCream
皮带打滑 = 1 >> 4,
冻缸报警 = 1 >> 5,
缺料报警 = 1 >> 6,
}
}

+ 15
- 11
BPASmartClient.KLMCoffee/CoffeeMachine.cs Переглянути файл

@@ -108,7 +108,7 @@ namespace BPASmartClient.KLMCoffee
{
byte item = dataStorage.GetData();
List<byte> data = new List<byte>() { item };
if (Encoding.ASCII.GetString(data.ToArray()) == ":")
if (Encoding.ASCII.GetString(data.ToArray()) == ":")
{
temp.Add(item);
while (dataStorage.GetSize() < 32) { Thread.Sleep(5); }
@@ -119,10 +119,12 @@ namespace BPASmartClient.KLMCoffee
}
List<byte> vs = new List<byte>() { temp[temp.Count - 4], temp[temp.Count - 3], temp[temp.Count - 2], temp[temp.Count - 1] };

string t = Encoding.ASCII.GetString(vs.ToArray()).ToLower();
//帧尾
if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n")
//if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n")
var package = Encoding.ASCII.GetString(temp.ToArray());
if(package.Contains("\\r\\n"))
{
var package = Encoding.ASCII.GetString(temp.ToArray());
ProcessMsg(package);
}
temp.Clear();
@@ -136,25 +138,26 @@ namespace BPASmartClient.KLMCoffee
{
try
{
lastRefreshTime = DateTime.Now;
SystemStatusModel systemStatus = new K95Command().StateResolution(data);
if (systemStatus != null)
{
status["CoffeeIsconnected"] = OnLine;
if((K95SysTemStatus)status["Status"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡)
status["CoffeeIsConnected"] = OnLine;
if((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡)
{
status["Status"] = systemStatus.temStatus;
status["CoffeeStatus"] = systemStatus.temStatus;
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId });
}
else status["CoffeeStatus"] = systemStatus.temStatus;
status["CoffeedrinkType"] = systemStatus.drinkType;
status["CoffeeAppStatus"] = systemStatus.taskIndex;
status["Coffeeprogress"] = systemStatus.progress;
status["CoffeeWarning"] = systemStatus.faultMessage.dataFault();
status["CoffeeWarning"] = systemStatus.faultMessage?.dataFault();
status["CoffeeKeep"] = systemStatus.upkeepMessage;
if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep())
IsWork = false;
else
IsWork = true;
//if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep())
// IsWork = false;
//else
// IsWork = true;
}

}
@@ -290,6 +293,7 @@ namespace BPASmartClient.KLMCoffee
}
});
InitStatus();
Start();
}

public override void WriteData(string address, object value)


+ 4
- 4
BPASmartClient.KLMCoffee/Protocal/SystemStatusModel.cs Переглянути файл

@@ -90,11 +90,11 @@ namespace BPASmartClient.KLMCoffee.Protocal
if (makeSta.Substring(2,1) == ((TaskIndex)Enum.Parse(typeof(TaskIndex),item)).GetString())
taskIndex = ((TaskIndex)Enum.Parse(typeof(TaskIndex),item));
}

if (makeProgress1 != "0000")
progress = Convert.ToInt32(makeProgress,16) / Convert.ToInt32(makeProgress1,16);
faultMessage = new FaultMessage(ErrorL,ErrorH);
faultMessage = new FaultMessage(ErrorL, ErrorH);
upkeepMessage = new UpkeepMessage(InFormation);
if ( makeProgress1 != "0000")
progress = Convert.ToInt32(makeProgress,16) / Convert.ToInt32(makeProgress1,16);
}
catch (Exception ex)
{


+ 12
- 31
BPASmartClient.LebaiRobot/LebaiHelper.cs Переглянути файл

@@ -365,37 +365,18 @@ namespace BPASmartClient.LebaiRobot
await client?.RunScene(id);
MessageLog.GetInstance.Show($"调用场景:{id}");
}
/// <summary>
/// 设置输出
/// </summary>
/// <param name="bDO"></param>
/// <param name="pin"></param>
public void SetOutput(bool bDO, int pin = 0)
{
try
{
if (client == null) { return; }
var res = client.SetDIO(new DIO() { Pin = pin, Value = bDO ? 1 : 0 });

}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}

public void MoveL(double pose)
{
//try
//{
// if (client == null) { return; }
// var res = client.MovePT(new PVATRequest() { })

//}
//catch (Exception ex)
//{
// MessageLog.GetInstance.ShowEx(ex.ToString());
//}
}
//public async void ExecuteLua()
// {
// try
// {
// string lua = ""
// if (client == null) return;
// await client?.ExecuteLua()
// }
// catch (Exception ex)
// }
}
}

+ 9
- 1
BPASmartClient.MQTT/MQTTProxy.cs Переглянути файл

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

namespace BPASmartClient.MQTT
@@ -23,7 +24,7 @@ namespace BPASmartClient.MQTT
private IMqttClient client;

public void Connect(string userName, string Password, string ip, int port, string clientId)
{
{
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddMqttClientHostedService(p =>
{
@@ -63,6 +64,13 @@ namespace BPASmartClient.MQTT
{
if (client.IsConnected)
await client.PublishAsync(topic, content);
else
{
client?.ReconnectAsync();
Thread.Sleep(10);
}
}

public async void Subscrib(params string[] topics)


+ 1
- 0
BPASmartClient.Model/乐白机器人/Enum/Lebai_qsqdCode.cs Переглянути файл

@@ -9,6 +9,7 @@ namespace BPASmartClient.Model.乐白机器人.Enum
public class Lebai_qsqdCode
{
#region 且时且多设备
public const int SENCE_自嗨 = 10008;
public const int SENCE_取咖啡杯 = 10031;
public const int SENCE_取冰淇淋杯 = 10032;
public const int SENCE_咖啡杯检测 = 10033;


+ 1
- 0
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj Переглянути файл

@@ -11,6 +11,7 @@
<ItemGroup>
<PackageReference Include="BPA.Models" Version="1.0.10" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="6.0.0" />
</ItemGroup>

<ItemGroup>


+ 41
- 14
BPASmartClient.MorkS/Control_Morks.cs Переглянути файл

@@ -18,6 +18,9 @@ using BPASmartClient.MorkS.Model;
using System.Collections.ObjectModel;
using BPASmartClient.MorkS.ViewModel;
using BPASmartClient.Business;
using System.Speech.Synthesis;
using System.Windows.Forms;
using System.Media;

namespace BPASmartClient.MorkS
{
@@ -29,6 +32,7 @@ namespace BPASmartClient.MorkS

public override void DoMain()
{
MonitorViewModel.DeviceId = DeviceId;
ServerInit();
DataParse();
@@ -51,22 +55,26 @@ namespace BPASmartClient.MorkS
}
}

ActionManage.GetInstance.Register(new Action(() =>
ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
Random rd = new Random();
ThreadManage.GetInstance().StartLong(new Action(() =>
if (o.Length > 0 )
{
int NoodleLoc = rd.Next(1, 6);
int BowlLoc = rd.Next(10, 11);
string guid = new Guid().ToString();
Random rd = new Random();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
int NoodleLoc = (int)o[0] == 0? rd.Next(1, 6) : (int)o[0];
int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1];

string guid = new Guid().ToString();

mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");

mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
Thread.Sleep(60000);
}), "ForOrder");
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
Thread.Sleep(60000);
}), "ForOrder");
}
}), "EnableForOrder");

ActionManage.GetInstance.Register(new Action<object>((o) =>
@@ -78,6 +86,7 @@ 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()
@@ -131,7 +140,7 @@ namespace BPASmartClient.MorkS
private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
@@ -331,6 +340,7 @@ namespace BPASmartClient.MorkS
if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11)
{
mORKS.TakeBowlId = orderLocInfo.SuborderId;
mORKS.TakeBowName = orderLocInfo.GoodName;
TakeBowlControl(orderLocInfo.Loc);
SetRecipeNumber(orderLocInfo.RecipeNumber);
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
@@ -346,6 +356,7 @@ namespace BPASmartClient.MorkS
{
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock)
{
DeviceProcessLogShow("开始取碗流程");
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
if (res == null || res?.Count == 0)
@@ -539,9 +550,11 @@ namespace BPASmartClient.MorkS


mORKS.OutMealId = mORKS.IngredientsCompleteId;
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{ mORKS.OutMealId}");

mORKS.OutNoodleing = true;
}
}
@@ -557,7 +570,9 @@ namespace BPASmartClient.MorkS
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle))
{
mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
mORKS.IngredientsCompleteName = mORKS.TakeBowName;
mORKS.TakeBowlId = string.Empty;
mORKS.TakeBowName = string.Empty;
DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
mORKS.TakeBowlInterlock = false;
}
@@ -569,6 +584,7 @@ namespace BPASmartClient.MorkS
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutNoodleing = false;
WaitMeaLSpeak(mORKS.OutMealName);
}

//取餐完成逻辑处理
@@ -579,6 +595,7 @@ namespace BPASmartClient.MorkS
ResetCookComplete();
mORKS.CookCompleteFlatBit = false;
mORKS.OutMealId = string.Empty;
mORKS.OutMealName = string.Empty;
}

//机器人取面完成信号检测
@@ -599,7 +616,17 @@ namespace BPASmartClient.MorkS


}

/// <summary>
/// 语音提醒取餐
/// </summary>
/// <param name="meal"></param>
private void WaitMeaLSpeak(string meal)
{
VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav");
Thread.Sleep(1000);
mORKS.speech.Speak(meal);
VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav");
}

#region PLC 控制函数



+ 15
- 0
BPASmartClient.MorkS/GVL_MORKS.cs Переглянути файл

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

@@ -328,11 +329,19 @@ namespace BPASmartClient.MorkS
/// 取碗订单ID
/// </summary>
public string TakeBowlId = string.Empty;
/// <summary>
/// 取碗订单名称
/// </summary>
public string TakeBowName = string.Empty;

/// <summary>
/// 配料完成订单ID
/// </summary>
public string IngredientsCompleteId = string.Empty;
/// <summary>
/// 配料完成订单名称
/// </summary>
public string IngredientsCompleteName = string.Empty;

/// <summary>
/// 煮面口对应的订单ID
@@ -343,6 +352,10 @@ namespace BPASmartClient.MorkS
/// 出餐订单ID
/// </summary>
public string OutMealId = string.Empty;
/// <summary>
/// 出餐订单名称
/// </summary>
public string OutMealName = string.Empty;

/// <summary>
/// 转台位置轮询
@@ -355,6 +368,8 @@ namespace BPASmartClient.MorkS
[VariableMonitor("转台当前启动位置")]
public ushort CurrentLoc { get; set; } = 0;

public SpeechSynthesizer speech = new SpeechSynthesizer();

#endregion
}
}

+ 7
- 1
BPASmartClient.MorkS/OrderLocInfo.cs Переглянути файл

@@ -1,4 +1,5 @@
using System;
using BPA.Message;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -13,5 +14,10 @@ namespace BPASmartClient.MorkS
public ushort RecipeNumber { get; set; }
public int BatchingId { get; set; }
public string GoodName { get; set; }

public int RecipeId { get; set; }

public List<int> Recipes { get; set; }

}
}

+ 33
- 1
BPASmartClient.MorkS/View/Debug.xaml Переглянути файл

@@ -25,6 +25,15 @@
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CaretBrush" Value="Aqua" />
</Style>
<Style x:Key="CheckBox" TargetType="CheckBox">
<Setter Property="Foreground" Value="Aqua"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="10,0"/>
<Setter Property="IsChecked" Value="False"/>
</Style>
</UserControl.Resources>

<Grid Margin="20">
@@ -40,6 +49,8 @@
Foreground="{StaticResource TitleBorderColor}"
Text="面条位置:" />
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding NoodleLoc}" />
<CheckBox Content="随机面条位置" Style="{StaticResource CheckBox}" IsChecked="{Binding IsNoodPositon}" Background="White"/>

</StackPanel>

<StackPanel Margin="10,0,0,20" Orientation="Horizontal">
@@ -48,16 +59,37 @@
Foreground="{StaticResource TitleBorderColor}"
Text="面碗位置:" />
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding BowlLoc}" />
<CheckBox Content="随机面碗位置" Style="{StaticResource CheckBox}" IsChecked="{Binding IsBowPositon}" Background="White"/>
<CheckBox Content="启用本地模拟功能" Style="{StaticResource CheckBox}" IsChecked="{Binding LocalSimOrder}" Background="White" Command="{Binding EnableLacalSimOrder}"/>
</StackPanel>

<StackPanel Orientation="Horizontal">
<Button
Grid.Row="0"
Width="170"
HorizontalAlignment="Left"
Command="{Binding SimOrderRandomCommand}"
Content="启动随机模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}"
/>
<Button
Grid.Row="0"
Width="170"
HorizontalAlignment="Left"
Command="{Binding SimOrderRandomCloseCommand}"
Content="关闭随机模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}"
/>
<Button
Grid.Row="0"
Width="130"
HorizontalAlignment="Left"
Command="{Binding SimOrderCommand}"
Content="模拟订单"
Style="{StaticResource ButtonStyle}" />
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}"/>
<Button
Grid.Row="0"
Width="120"


+ 39
- 0
BPASmartClient.MorkS/ViewModel/DebugViewModel.cs Переглянути файл

@@ -8,6 +8,9 @@ using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.EventBus;
using BPASmartClient.MorkS.Model;
using System.Windows;
using BPASmartClient.Message;

namespace BPASmartClient.MorkS.ViewModel
{
@@ -19,13 +22,38 @@ namespace BPASmartClient.MorkS.ViewModel
SimOrderCommand = new RelayCommand(() =>
{
new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
});
SimOrderRandomCommand = new RelayCommand(() =>
{
int NoodPosition = 0;
int BowPosion = 0;
NoodPosition = IsNoodPositon == true ? 0 : NoodleLoc;
BowPosion = IsBowPositon == true ? 0 : BowlLoc;
ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion });
});
SimOrderRandomCloseCommand = new RelayCommand(() =>
{
ThreadManage.GetInstance().StopTask("ForOrder");
MessageLog.GetInstance.Show("停止模拟随机订单");
});
EnableLacalSimOrder = new RelayCommand(() =>
{
Global.EnableLocalSimOrder = LocalSimOrder;
VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
});
VisibilitySimOrder = LocalSimOrder == true? Visibility.Visible : Visibility.Collapsed;
}

public RelayCommand InitCommand { get; set; }

public RelayCommand SimOrderCommand { get; set; }

public RelayCommand SimOrderRandomCommand { get; set; }

public RelayCommand SimOrderRandomCloseCommand { get; set; }

public RelayCommand EnableLacalSimOrder { get; set; }
public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } }
private int _mNoodleLoc = 1;

@@ -33,5 +61,16 @@ namespace BPASmartClient.MorkS.ViewModel
public int BowlLoc { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } }
private int _mBowlLoc = 10;

public bool IsNoodPositon { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
private bool _isNoodPositon = false;

public bool IsBowPositon { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
private bool _isBowPositon = false;

public bool LocalSimOrder { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
private bool _localSimOrder = Global.EnableLocalSimOrder;

public Visibility VisibilitySimOrder { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
private Visibility _visibilitySimOrder;
}
}

+ 42
- 0
BPASmartClient.MorkS/VoiceAPI.cs Переглянути файл

@@ -0,0 +1,42 @@
using BPASmartClient.Message;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkS
{
public class VoiceAPI
{
public VoiceAPI()
{
}
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound, int hmod, int fdwSound);


// 系统播放wav格式的文件
public static void m_SystemPlayWav(string strPlayFile)
{
try
{
if (strPlayFile.Trim() == "")
{ return; }//为空不放

string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
strPath = strPath + strPlayFile;

int SND_FILENAME = 0x00020000;
int SND_ASYNC = 0x0001;
PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.Message);
}
}
}
}

+ 119
- 92
BPASmartClient.MorkT/Control_MorkT.cs Переглянути файл

@@ -13,6 +13,7 @@ using BPASmartClient.Model.乐白机器人.Enum;
using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.MorkT.Model;
using BPASmartClient.Peripheral;
using Robotc;
using System;
@@ -31,6 +32,8 @@ namespace BPASmartClient.MorkT

GLV_MorkT morkT = new GLV_MorkT();

DateTime morkTime = DateTime.Now;


public override void DoMain()
{
@@ -48,9 +51,9 @@ namespace BPASmartClient.MorkT
});
int i = 0;
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
PreventSleep.SleepControl(true);//防止电脑休眠

MessageLog.GetInstance.Show("MORKT 设备初始化完成");

}

public override void ResetProgram()
@@ -73,35 +76,51 @@ namespace BPASmartClient.MorkT

public override void MainTask()
{
if (morkT.waitMorkOrder != null)//更新订单取走状态
if (morkTime.AddMinutes(Global.TimeInterval).Minute == DateTime.Now.Minute)
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) =>
morkTime = DateTime.Now;
if ((ELebaiRModel)peripheralStatus["RobotMode"] == ELebaiRModel.空闲状态)
{
if (o != null && o.Length > 0 && o[0] is bool res)
{
if (!res)
{
OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow("订单取餐完成");
morkT.waitMorkOrder = null;
}
}
});
}
MakeCoffeeProcess();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (o) =>
{
if (o != null && o.Length > 0 && o[0] is bool resultValue)
{
if (!resultValue)//取餐口有空余位置
{
MakeIceCreamProcess();
MakeCoffeeComplete();
}
}
});
MessageLog.GetInstance.Show("机器人开始自嗨!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_自嗨 });
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
Thread.Sleep(50);
}

}
else if (morkTime.AddMinutes(Global.TimeInterval) < DateTime.Now) morkTime = DateTime.Now;
#region morkt流程
//if (morkT.waitMorkOrder != null)//更新订单取走状态
//{
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) =>
// {
// if (o != null && o.Length > 0 && o[0] is bool res)
// {
// if (!res)
// {
// OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE);
// DeviceProcessLogShow("订单取餐完成");
// morkT.waitMorkOrder = null;
// }
// }
// });
//}
//MakeCoffeeProcess();
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (o) =>
// {
// if (o != null && o.Length > 0 && o[0] is bool resultValue)
// {
// if (!resultValue)//取餐口有空余位置
// {
// MakeIceCreamProcess();
// MakeCoffeeComplete();
// }
// }
// });

#endregion
}

public override void ReadData()
@@ -187,6 +206,14 @@ namespace BPASmartClient.MorkT
}
}));

GetStatus("IceCreamError", new Action<object>((o) =>
{
if (o is string error)
{
morkT.IceCreamError = error;
}
}));
GetStatus("IceCreamDLCompleted", new Action<object>((o) =>
{
if (o is bool b)
@@ -399,7 +426,7 @@ namespace BPASmartClient.MorkT
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接咖啡后回原点 }); //接咖啡后回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (BPASmartClient.Model.咖啡机.Enum.DrCoffeeDrinksCode)int.Parse(orderLoc.Loc) });//接咖啡控制
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!");
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc;
}
@@ -487,7 +514,7 @@ namespace BPASmartClient.MorkT
DeviceProcessLogShow("执行二次取咖啡杯");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取咖啡杯 }); //SENCE_二次取咖啡杯
Wait();
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
count++;
goto p;
@@ -511,45 +538,45 @@ namespace BPASmartClient.MorkT
/// </summary>
private void MakeIceCreamProcess()
{
//if (IceCreamCanMake())
//{
if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
if (IceCreamCanMake())
{
DoIceCream(order);
}
//if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
//{
// DoIceCream(order);
//}

//if(peripheralStatus.ContainsKey("IceCreamCurrentMode"))
//{
// if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
//}
if (peripheralStatus.ContainsKey("IceCreamCurrentMode"))
{
if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
}

//if(peripheralStatus.ContainsKey("IceCreamCXB"))
//{
// if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
// {
// bool result = true;
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
// {
// if (res[0] is bool resultValue)
// {
// result = resultValue;
// }
// });
// if (result)
// {
// if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡");
// morkT.IceIsOK = false;
// }
// else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
// {
// morkT.IceIsOK = true;
// DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]");
// DoIceCream(order);
// }
// }
//}
if (peripheralStatus.ContainsKey("IceCreamCXB"))
{
if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
{
bool result = true;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
{
if (res[0] is bool resultValue)
{
result = resultValue;
}
});
if (result)
{
if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡");
morkT.IceIsOK = false;
}
else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
{
morkT.IceIsOK = true;
DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]");
DoIceCream(order);
}
}
}

//}
}
}


@@ -652,10 +679,10 @@ namespace BPASmartClient.MorkT
private void GetIceCream(OrderLocInfo order)
{
//制冷模式
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_单片机接冰淇淋 }); //SENCE_接1号冰淇淋
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接1号冰淇淋 }); //SENCE_接1号冰淇淋
Wait();
bool doItResult = true;

@@ -663,37 +690,37 @@ namespace BPASmartClient.MorkT
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true });
//Thread.Sleep(500);
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = true ,pin = 1});
Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = false, pin = 1 });
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = true ,pin = 1});
//Thread.Sleep(500);
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, bDO = false, pin = 1 });

Thread.Sleep(500);
EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料
DeviceProcessLogShow("开始等待6s");
Thread.Sleep(5000);
//Thread.Sleep(500);
//EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId, SteeringEngine = IC_SE.SE_2 });//冰淇淋出料
//DeviceProcessLogShow("开始等待6s");
//Thread.Sleep(5000);

//出料
//EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId },(o)=>
//{
// doItResult = (bool)o[0];
//});
//if (doItResult)
//{
// IceCreamCookCheck();
//}
//else
//{
// int count_1 = 0;
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }, (o) =>
{
doItResult = (bool)o[0];
});
if (doItResult)
{
IceCreamCookCheck();
}
else
{
int count_1 = 0;

// while ((byte)peripheralStatus["IceCreamCXB"] <= 86)
// {
// Thread.Sleep(5);
// count_1++;
// if (count_1 >= 2000)
// break;
// }
// IceCreamCookCheck();
//}
while ((byte)peripheralStatus["IceCreamCXB"] <= 86)
{
Thread.Sleep(5);
count_1++;
if (count_1 >= 2000)
break;
}
IceCreamCookCheck();
}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
}



+ 3
- 0
BPASmartClient.MorkT/GLV_MorkT.cs Переглянути файл

@@ -92,6 +92,9 @@ namespace BPASmartClient.MorkT
[VariableMonitor("冰淇淋机器故障")]
public MORKI_FAULT IceCreamFault { get; set; }

[VariableMonitor("冰淇淋机器异常")]
public string? IceCreamError { get; set; }

[VariableMonitor("冰淇淋机器打料完成")]
public bool DLCompleted { get; set; }



+ 13
- 0
BPASmartClient.MorkT/Model/Global.cs Переглянути файл

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

namespace BPASmartClient.MorkT.Model
{
public class Global
{
public static int TimeInterval { get; set; } = 15;
}
}

+ 30
- 0
BPASmartClient.MorkT/PreventSleep.cs Переглянути файл

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

namespace BPASmartClient.MorkT
{
public class PreventSleep
{
[DllImport("kernel32.dll")]
static extern uint SetThreadExecutionState(uint dwThreadId);
const uint ES_SYSTEM_REQUIRED = 0x00000001;
const uint ES_DISPLAY_REQUIRED = 0x00000002;
const uint ES_CONTINUOUS = 0x80000000;

public static void SleepControl(bool isSleep)
{
if (isSleep)
{
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED);
}
else
{
SetThreadExecutionState(ES_CONTINUOUS);
}
}
}
}

+ 14
- 4
BPASmartClient.MorkT/View/DebugView.xaml Переглянути файл

@@ -25,7 +25,7 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="14*"/>
<RowDefinition Height="0.1*"/>
<RowDefinition Height="8*"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>

@@ -46,6 +46,9 @@
<TextBlock Text="机器人模式:"/>
<TextBlock Text="{Binding RobotMode}"
Margin="40,0"/>
<TextBlock Text="机器人自嗨时间间隔:"/>
<TextBox Text="{Binding TimeInterval}" Width="40" Margin="10,0,5,0"/>
<TextBlock Text="分"/>
</StackPanel>
<TextBlock Text="连接状态" />
<TextBlock Text="{Binding RobotConnected}"
@@ -283,7 +286,7 @@
Content="制作"/>
<Button Margin="10,0"
Command="{}"
Content="停止制作"/>
Content="停止制作" Cursor="Hand"/>
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>模式</TextBlock>
@@ -301,11 +304,18 @@
<GroupBox Header="单片机控制"
FontSize="18"
Grid.Row="1" Grid.ColumnSpan="2"
Margin="0,0,0,10" HorizontalAlignment="Right" Width="1000">
Margin="0,0,0,10" HorizontalAlignment="Left" Width="1000">
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center" >
<Button Content="咖啡杯落杯" Height="30" Width="120"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_COFFEE"
Margin="10,10,50,10" Cursor="Hand"/>
<Button Content="冰淇淋杯落杯" Height="30" Width="120"
Command="{Binding Button_CupControlCommand}"
CommandParameter="CUP_ICECREAM" Margin="10,10,50,10"
/>

</StackPanel>
</GroupBox>



+ 11
- 3
BPASmartClient.MorkT/ViewModel/DebugViewModel.cs Переглянути файл

@@ -13,6 +13,7 @@ using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.MorkT.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -37,6 +38,12 @@ namespace BPASmartClient.MorkT.ViewModel
/// </summary>
public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
private string _robotMode { get; set; }
/// <summary>
/// 乐白机器人自嗨时间间隔
/// </summary>
public int TimeInterval { get { return Global.TimeInterval; } set { Global.TimeInterval = value; OnPropertyChanged(); } }
//private int _timeInterval { get; set; } = Global.TimeInterval;

/// <summary>
/// 机器人控制指令
/// </summary>
@@ -45,6 +52,7 @@ namespace BPASmartClient.MorkT.ViewModel
/// 机器人控制
/// </summary>
/// <param name="o"></param>
public RelayCommand Button_SetValueCommand { get; set; }

@@ -135,12 +143,12 @@ namespace BPASmartClient.MorkT.ViewModel

private void Button_MakeIceCream()
{
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId });
}
private void Button_SetIceCreamModel()
{
MORKI_MODE mORKI_MODE = (MORKI_MODE)Enum.Parse(typeof(MORKI_MODE), SelecteIceCreamdMode);
new GSIceCream_ModeSetEvent() { DeviceId = DeviceId, Mode = mORKI_MODE }.Publish();
EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = mORKI_MODE });
}
#endregion

@@ -328,7 +336,7 @@ namespace BPASmartClient.MorkT.ViewModel
DL = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电流").CurrentValue;
DY = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器电压").CurrentValue;
CurrentMode = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器模式").CurrentValue;
IceCreamFault = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器故障").CurrentValue;
IceCreamFault = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器异常").CurrentValue;
CXB = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器成型比").CurrentValue;
DLCompleted = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器打料完成")?.CurrentValue == "True" ? "打料完成" : "打料中";
}


+ 15
- 0
BPASmartClient.MorkTM/Alarm.cs Переглянути файл

@@ -0,0 +1,15 @@
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; }
}
}

+ 48
- 0
BPASmartClient.MorkTM/BPASmartClient.MorkTM.csproj Переглянути файл

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

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<OutputType>Library</OutputType>
<UseWindowsForms>False</UseWindowsForms>
</PropertyGroup>

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

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>

<ItemGroup>
<Folder Include="Control\" />
</ItemGroup>

</Project>

+ 169
- 0
BPASmartClient.MorkTM/Control_MorkTM.cs Переглянути файл

@@ -0,0 +1,169 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkTM.Model;
using System.Collections.Concurrent;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MorkTM
{
public class Control_MorkTM : BaseDevice
{
public override DeviceClientType DeviceType => throw new NotImplementedException();

GVL_MorkTM morkTM = new GVL_MorkTM();
public override void DoMain()
{
ServerInit();
DataParse();

ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteVW");

ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");

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

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

//配方数据信息
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is RecipeBomEvent recipe)
{
recipeBoms = recipe.recipeBoms;
}
});
}
private void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if(@event == null) return;
if(@event is DoOrderEvent order)
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
OrderChange(order.MorkOrder, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单");
Dictionary<string, int> OrderPushes = new Dictionary<string, int>();
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);
}
}

morkTM.morkOrderPushesTeaWithMilk.Enqueue(new OrderLocInfo()
{
GoodName = order.MorkOrder.GoodsName,
SuborderId = order.MorkOrder.SuborderId,
GoodPushes = OrderPushes
});
}
});
}
private void OrderChange(MorkOrderPush orderPush, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent()
{
SortNum = orderPush.SortNum.ToString(),
GoodName = orderPush.GoodsName,
Status = oRDER_STATUS,
SubOrderId = orderPush.SuborderId,
deviceClientType = DeviceType
});
}


public override void MainTask()
{
IsHealth = true;
MakeTeaWithMilkProcess();
}

private void MakeTeaWithMilkProcess()
{
if(morkTM.morkOrderPushesTeaWithMilk.Count > 0)
{
if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc))
{
morkTM.RecipesPushes.Clear();
morkTM.RecipesPushes = orderLoc.GoodPushes;
foreach(var item in morkTM.RecipesPushes)
{
WriteData(item.Key,item.Value);
while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete))
{
Thread.Sleep(100);
}
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}");
}
}
}
}


public override void ReadData()
{
throw new NotImplementedException();
}

public override void ResetProgram()
{
morkTM = null;
morkTM = new GVL_MorkTM();
}

private void WriteData(string address, object value)
{
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
}

private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}

public override void SimOrder()
{
throw new NotImplementedException();
}

public override void Stop()
{
throw new NotImplementedException();
}
}
}

+ 33
- 0
BPASmartClient.MorkTM/GVL_MorkTM.cs Переглянути файл

@@ -0,0 +1,33 @@
using BPA.Models;
using BPASmartClient.Device;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkTM
{
public class GVL_MorkTM: IStatus
{
/// <summary>
/// 奶茶订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTeaWithMilk = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 当前正在制作的奶茶订单
/// </summary>
public OrderLocInfo CurrentOrderLoc = new OrderLocInfo();
/// <summary>
/// 奶茶配料的队列
/// </summary>
public Dictionary<string, int> RecipesPushes = new Dictionary<string, int>();
/// <summary>
///
/// </summary>
[VariableMonitor("出料完成", "", "")]
public bool OutMaterialComplete { get; set; }

}
}

+ 31
- 0
BPASmartClient.MorkTM/Model/Alarms.cs Переглянути файл

@@ -0,0 +1,31 @@
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(); } }
}
}

+ 14
- 0
BPASmartClient.MorkTM/Model/WritePar.cs Переглянути файл

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

namespace BPASmartClient.MorkTM.Model
{
public class WritePar
{
public string Address { get; set; }
public object Value { get; set; }
}
}

+ 18
- 0
BPASmartClient.MorkTM/OrderLocInfo.cs Переглянути файл

@@ -0,0 +1,18 @@
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; }
}
}

+ 24
- 0
BPASmartClient.MorkTM/PolymerBatching.cs Переглянути файл

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

namespace BPASmartClient.MorkTM
{
public enum Material
{
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_Top_4,Marerial_Bottom_5, Marerial_Bottom_6
}
public enum TeaStorageBox
{
TeaStorageBox_1, TeaStorageBox_2, TeaStorageBox_3, TeaStorageBox_4, TeaStorageBox_5, TeaStorageBox_6
}

public class PolymerBatching
{

}
}

+ 16
- 0
BPASmartClient.MorkTM/Properties/AssemblyInfo.cs Переглянути файл

@@ -0,0 +1,16 @@
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")]

+ 63
- 0
BPASmartClient.MorkTM/Properties/Resources.Designer.cs Переглянути файл

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <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;
}
}
}
}

+ 101
- 0
BPASmartClient.MorkTM/Properties/Resources.resx Переглянути файл

@@ -0,0 +1,101 @@
<?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>

+ 26
- 0
BPASmartClient.MorkTM/Properties/Settings.Designer.cs Переглянути файл

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <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;
}
}
}
}

+ 6
- 0
BPASmartClient.MorkTM/Properties/Settings.settings Переглянути файл

@@ -0,0 +1,6 @@
<?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>

+ 69
- 0
BPASmartClient.MorkTM/View/Debug.xaml Переглянути файл

@@ -0,0 +1,69 @@
<UserControl x:Class="BPASmartClient.MorkTM.View.Debug"
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"
d:DesignHeight="800" d:DesignWidth="1000"
Name="调试界面">
<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="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
</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"/>
<TextBox Text="{Binding MaertialsWight}" Width="60" Margin="10,0"/>
<Button Content="出料" Margin="40,0" Command="{Binding OutMaterials}"/>
</StackPanel>
<Button Grid.Column="1"
Width="120" Margin="20,0" HorizontalAlignment="Left"
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"/>
<ComboBox ItemsSource="{Binding}" Width="120"/>
</StackPanel>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>

</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="4*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Viewbox Stretch="Fill">
</Viewbox>
<Button Content="制作"
Grid.Row="3" Grid.ColumnSpan="4"
HorizontalAlignment="Center"/>
</Grid>

</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkTM/View/Debug.xaml.cs Переглянути файл

@@ -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 BPASmartClient.MorkTM.View
{
/// <summary>
/// Debug.xaml 的交互逻辑
/// </summary>
public partial class Debug : UserControl
{
public Debug()
{
InitializeComponent();
}
}
}

+ 50
- 0
BPASmartClient.MorkTM/View/Monitor.xaml Переглянути файл

@@ -0,0 +1,50 @@
<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>

+ 35
- 0
BPASmartClient.MorkTM/View/Monitor.xaml.cs Переглянути файл

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

}

private void gridProducts_LoadingRow(object sender, DataGridRowEventArgs e)
{

}
}
}

+ 49
- 0
BPASmartClient.MorkTM/ViewModel/DebugViewModel.cs Переглянути файл

@@ -0,0 +1,49 @@
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.MorkTM.ViewModel
{
public class DebugViewModel : ObservableObject
{
/// <summary>
/// 出料口集合
/// </summary>
public List<string> Materials { get; set; } = new List<string>();

/// <summary>
/// 奶茶
/// </summary>
public ObservableCollection<string> TeaWithMilkType { get; set; }
/// <summary>
/// 出料
/// </summary>
public RelayCommand OutMaterials { get; set; }
/// <summary>
/// 转盘转动
/// </summary>
public RelayCommand TurnOn { get; set; }
public float MaertialsWight { get { return _maertialsWight; } set { _maertialsWight = value; OnPropertyChanged(); } }
private float _maertialsWight = 10;
public DebugViewModel()
{
foreach(TeaStorageBox code in Enum.GetValues(typeof(TeaStorageBox)))
{
Materials.Add(code.ToString());
}

foreach (Material materials in Enum.GetValues(typeof(Material)))
{
Materials.Add(materials.ToString());
}

}
}
}

+ 27
- 0
BPASmartClient.MorkTM/ViewModel/MonitorViewModel.cs Переглянути файл

@@ -0,0 +1,27 @@
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" });




}
}
}

+ 1
- 0
BPASmartClient.MorkT_HQ/BPASmartClient.MorkTHQ.csproj Переглянути файл

@@ -19,6 +19,7 @@
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" />
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" />
<ProjectReference Include="..\BPASmartClient.KLMCoffee\BPASmartClient.KLMCoffee.csproj" />
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" />


+ 5
- 4
BPASmartClient.MorkT_HQ/Control_MorkTHQ.cs Переглянути файл

@@ -5,6 +5,7 @@ using BPASmartClient.DRCoffee;
using BPASmartClient.EventBus;
using BPASmartClient.GSIceCream;
using BPASmartClient.Helper;
using BPASmartClient.KLMCoffee.Protocal;
using BPASmartClient.Lebai;
using BPASmartClient.LebaiRobot;
using BPASmartClient.Message;
@@ -187,7 +188,7 @@ namespace BPASmartClient.MorkTHQ

GetStatus("CoffeeStatus", new Action<object>((o) =>
{
if (o is DrCoffeeStatus coffeeStatus)
if (o is K95SysTemStatus coffeeStatus)
{
morkT.DrCoffeeStatus = coffeeStatus;
}
@@ -195,7 +196,7 @@ namespace BPASmartClient.MorkTHQ

GetStatus("CoffeeAppStatus", new Action<object>((o) =>
{
if (o is DrCoffeeAppStatus appStatus)
if (o is TaskIndex appStatus)
{
morkT.CoffeeAppStatus = appStatus;
}
@@ -203,14 +204,14 @@ namespace BPASmartClient.MorkTHQ

GetStatus("CoffeeWarning", new Action<object>((o) =>
{
if (o is DrCoffeeWarning coffeeWarning)
if (o is FaultMessage coffeeWarning)
{
morkT.CoffeeWarning = coffeeWarning;
}
}));
GetStatus("CoffeeFault", new Action<object>((o) =>
{
if (o is DrCoffeeFault coffeeFault)
if (o is UpkeepMessage coffeeFault)
{
morkT.CaffeeFault = coffeeFault;
}


+ 5
- 4
BPASmartClient.MorkT_HQ/GLV_MorkTHQ.cs Переглянути файл

@@ -1,6 +1,7 @@
using BPASmartClient.Device;
using BPASmartClient.DRCoffee;
using BPASmartClient.GSIceCream;
using BPASmartClient.KLMCoffee.Protocal;
using BPASmartClient.LebaiRobot;
using BPASmartClient.Model.冰淇淋.Enum;
using Robotc;
@@ -113,16 +114,16 @@ namespace BPASmartClient.MorkTHQ
public bool CoffeeIsConnected { get; set; }

[VariableMonitor("咖啡机状态")]
public DrCoffeeStatus DrCoffeeStatus { get; set; }
public K95SysTemStatus DrCoffeeStatus { get; set; }

[VariableMonitor("咖啡机应用状态")]
public DrCoffeeAppStatus CoffeeAppStatus { get; set; }
public TaskIndex CoffeeAppStatus { get; set; }

[VariableMonitor("咖啡机告警")]
public DrCoffeeWarning CoffeeWarning { get; set; }
public FaultMessage CoffeeWarning { get; set; }

[VariableMonitor("咖啡机故障")]
public DrCoffeeFault CaffeeFault { get; set; }
public UpkeepMessage CaffeeFault { get; set; }

[VariableMonitor("咖啡机制作进度")]
public int Coffeeprogress { get; set; }


+ 2
- 0
BPASmartClient/BPASmartClient.csproj Переглянути файл

@@ -36,7 +36,9 @@
<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_HQ\BPASmartClient.MorkTHQ.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>


+ 24
- 1
SmartClient.sln Переглянути файл

@@ -96,7 +96,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTHQ", "B
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DosingSystem", "DosingSystem\DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTJuicer", "BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj", "{724087A3-E7E7-4494-B844-414FF5CD1D40}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer", "BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj", "{724087A3-E7E7-4494-B844-414FF5CD1D40}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{C404A775-A36C-4A0A-B25B-C4212DC2293D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -892,6 +894,26 @@ Global
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x64.Build.0 = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.ActiveCfg = Release|Any CPU
{724087A3-E7E7-4494-B844-414FF5CD1D40}.Release|x86.Build.0 = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM.Build.0 = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|ARM64.Build.0 = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x64.ActiveCfg = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x64.Build.0 = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x86.ActiveCfg = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Debug|x86.Build.0 = Debug|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|Any CPU.Build.0 = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM.ActiveCfg = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM.Build.0 = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM64.ActiveCfg = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|ARM64.Build.0 = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x64.ActiveCfg = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x64.Build.0 = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x86.ActiveCfg = Release|Any CPU
{C404A775-A36C-4A0A-B25B-C4212DC2293D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -936,6 +958,7 @@ Global
{00C17D87-A323-4A97-BC21-7039E55614DE} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{724087A3-E7E7-4494-B844-414FF5CD1D40} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{C404A775-A36C-4A0A-B25B-C4212DC2293D} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Завантаження…
Відмінити
Зберегти