@@ -200,7 +200,17 @@ | |||
<None Remove="Image\顶部线条.png" /> | |||
<None Remove="Image\顶部背景.png" /> | |||
<None Remove="Image\黑菠萝科技.png" /> | |||
<None Remove="Videos\Login.mp4" /> | |||
<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> | |||
@@ -947,7 +947,7 @@ | |||
</Style.Setters> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region Button--> | |||
<Style x:Key="TitleBarStyle" TargetType="Button"> | |||
<Setter Property="Foreground" Value="White" /> | |||
@@ -1937,5 +1937,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> |
@@ -191,6 +191,7 @@ namespace BPASmartClient.DRCoffee | |||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||
Thread.Sleep(200); | |||
free = false; | |||
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -210,6 +211,7 @@ namespace BPASmartClient.DRCoffee | |||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||
Thread.Sleep(200); | |||
free = false; | |||
MessageLog.GetInstance.Show($"咖啡机: 咖啡取消指令"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -228,6 +230,7 @@ namespace BPASmartClient.DRCoffee | |||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||
Thread.Sleep(200); | |||
free = false; | |||
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -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; | |||
@@ -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); | |||
} | |||
@@ -28,5 +28,6 @@ namespace BPASmartClient.GSIceCream | |||
皮带打滑 = 1 >> 4, | |||
冻缸报警 = 1 >> 5, | |||
缺料报警 = 1 >> 6, | |||
} | |||
} |
@@ -5,7 +5,7 @@ using BPASmartClient.Peripheral; | |||
using BPASmartClient.SerialPort; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.Icemoker | |||
namespace BPASmartClient.IceMaker | |||
{ | |||
public class IceMakerMachine : BasePeripheral | |||
{ | |||
@@ -1,17 +0,0 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.IceMaker | |||
{ | |||
public enum IceMakerStatus | |||
{ | |||
关机状态=0x01, | |||
制冰状态=0x02, | |||
电机故障=0x04, | |||
缺水=0x08, | |||
冰满=0x16 | |||
} | |||
} |
@@ -17,6 +17,7 @@ namespace BPASmartClient.Juicer | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
IsConnected = juicerHelper.IsOpen; | |||
status["JuiceIsConnect"] = juicerHelper.IsOpen; | |||
if (!IsConnected) IsWork = false; | |||
while (IsConnected) | |||
{ | |||
@@ -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,19 +138,26 @@ namespace BPASmartClient.KLMCoffee | |||
{ | |||
try | |||
{ | |||
lastRefreshTime = DateTime.Now; | |||
SystemStatusModel systemStatus = new K95Command().StateResolution(data); | |||
if (systemStatus != null) | |||
{ | |||
status["Status"] = systemStatus.temStatus; | |||
status["drinkType"] = systemStatus.drinkType; | |||
status["AppStatus"] = systemStatus.taskIndex; | |||
status["progress"] = systemStatus.progress; | |||
status["Warning"] = systemStatus.faultMessage.dataFault(); | |||
status["Keep"] = systemStatus.upkeepMessage; | |||
if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) | |||
IsWork = false; | |||
else | |||
IsWork = true; | |||
status["CoffeeIsConnected"] = OnLine; | |||
if((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) | |||
{ | |||
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["CoffeeKeep"] = systemStatus.upkeepMessage; | |||
//if (systemStatus.faultMessage.IsFault() || systemStatus.upkeepMessage.IsUpkeep()) | |||
// IsWork = false; | |||
//else | |||
// IsWork = true; | |||
} | |||
} | |||
@@ -160,18 +169,18 @@ namespace BPASmartClient.KLMCoffee | |||
protected override void InitStatus() | |||
{ | |||
status["Status"] = K95SysTemStatus.空闲状态; | |||
status["drinkType"] = DrinkType.意式; | |||
status["AppStatus"] = TaskIndex.无任务; | |||
status["progress"] = 0; | |||
status["Warning"] = new FaultMessage(0x00, 0x00).dataFault(); | |||
status["Keep"] = new UpkeepMessage(0x00).dataFault(); | |||
status["CoffeeStatus"] = K95SysTemStatus.空闲状态; | |||
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() | |||
{ | |||
commProxy = new SerialPortClient(PortName, (BaudRates)Enum.Parse(typeof(BaudRates), BaudRate)); | |||
commProxy = new SerialPortClient(communicationPar.SerialPort, (BaudRates)communicationPar.BaudRate); | |||
commProxy.SetDataStorage(dataStorage); | |||
//伽乐美咖啡机制作 | |||
@@ -284,6 +293,7 @@ namespace BPASmartClient.KLMCoffee | |||
} | |||
}); | |||
InitStatus(); | |||
Start(); | |||
} | |||
public override void WriteData(string address, object value) | |||
@@ -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) | |||
{ | |||
@@ -365,5 +365,18 @@ namespace BPASmartClient.LebaiRobot | |||
await client?.RunScene(id); | |||
MessageLog.GetInstance.Show($"调用场景:{id}"); | |||
} | |||
//public async void ExecuteLua() | |||
// { | |||
// try | |||
// { | |||
// string lua = "" | |||
// if (client == null) return; | |||
// await client?.ExecuteLua() | |||
// } | |||
// catch (Exception ex) | |||
// } | |||
} | |||
} |
@@ -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; | |||
@@ -29,6 +30,7 @@ namespace BPASmartClient.Model.乐白机器人.Enum | |||
public const int SENCE_冰淇淋杯回原点 = 10049; | |||
public const int SENCE_取咖啡出餐 = 10052; | |||
public const int SENCE_机器人回原点 = 10058; | |||
// 单片机冰淇淋机器场景 | |||
public const int SENCE_单片机接冰淇淋 = 10055; | |||
public const int SENCE_单片机放冰淇淋位置 = 10056; | |||
@@ -522,11 +522,8 @@ namespace BPASmartClient.MorkF | |||
} | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) | |||
@@ -11,6 +11,7 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Models" Version="1.0.13" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
<PackageReference Include="System.Speech" Version="6.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -20,6 +20,9 @@ using BPASmartClient.MorkS.ViewModel; | |||
using BPASmartClient.Business; | |||
using BPASmartClient.Model.小炒机; | |||
using BPA.Models; | |||
using System.Speech.Synthesis; | |||
using System.Windows.Forms; | |||
using System.Media; | |||
namespace BPASmartClient.MorkS | |||
{ | |||
@@ -31,6 +34,7 @@ namespace BPASmartClient.MorkS | |||
public override void DoMain() | |||
{ | |||
MonitorViewModel.DeviceId = DeviceId; | |||
ServerInit(); | |||
DataParse(); | |||
@@ -53,22 +57,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) => | |||
@@ -80,6 +88,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() | |||
@@ -135,7 +144,7 @@ namespace BPASmartClient.MorkS | |||
private void GetStatus(string key, Action<object> action) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
action?.Invoke(peripheralStatus[key]); | |||
@@ -335,6 +344,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); | |||
@@ -350,6 +360,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) | |||
@@ -547,9 +558,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; | |||
} | |||
} | |||
@@ -565,7 +578,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; | |||
} | |||
@@ -577,6 +592,7 @@ namespace BPASmartClient.MorkS | |||
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成"); | |||
mORKS.CookCompleteFlatBit = true; | |||
mORKS.OutNoodleing = false; | |||
WaitMeaLSpeak(mORKS.OutMealName); | |||
} | |||
//取餐完成逻辑处理 | |||
@@ -587,6 +603,7 @@ namespace BPASmartClient.MorkS | |||
ResetCookComplete(); | |||
mORKS.CookCompleteFlatBit = false; | |||
mORKS.OutMealId = string.Empty; | |||
mORKS.OutMealName = string.Empty; | |||
} | |||
//机器人取面完成信号检测 | |||
@@ -611,7 +628,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 控制函数 | |||
@@ -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 | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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" | |||
@@ -9,6 +9,8 @@ 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 | |||
{ | |||
@@ -20,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; | |||
@@ -34,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; | |||
} | |||
} |
@@ -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); | |||
} | |||
} | |||
} | |||
} |
@@ -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; | |||
} | |||
@@ -432,7 +459,7 @@ namespace BPASmartClient.MorkT | |||
/// </summary> | |||
private void DoCoffeeQC(OrderLocInfo order) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10052 }); //SENCE_取咖啡出餐 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡出餐 }); //SENCE_取咖啡出餐 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
//订单状态改变:完成 | |||
@@ -451,7 +478,7 @@ namespace BPASmartClient.MorkT | |||
{ | |||
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 = 10031 }); //SENCE_取咖啡杯 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取咖啡杯 }); //SENCE_取咖啡杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_COFFEE });//落碗控制 | |||
@@ -461,7 +488,7 @@ namespace BPASmartClient.MorkT | |||
int count = 1; | |||
bool result = true; | |||
p: | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯检测 }); //SENCE_咖啡杯检测 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=> | |||
@@ -478,16 +505,16 @@ namespace BPASmartClient.MorkT | |||
{ | |||
//退出循环回到初始位置 | |||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_咖啡杯回原点 }); //SENCE_咖啡杯回原点 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
morkT.GetCoffeeCup = false; | |||
return; | |||
} | |||
DeviceProcessLogShow("执行二次取咖啡杯"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯 | |||
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); | |||
} | |||
} | |||
} | |||
//} | |||
} | |||
} | |||
@@ -575,7 +602,7 @@ namespace BPASmartClient.MorkT | |||
{ | |||
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 = 10032 }); //SENCE_取冰淇淋杯 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_取冰淇淋杯 }); //SENCE_取冰淇淋杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | |||
Thread.Sleep(500); | |||
@@ -592,7 +619,7 @@ namespace BPASmartClient.MorkT | |||
bool result = true; | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
p: | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10034 }); //SENCE_冰淇淋杯检测 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯检测 }); //SENCE_冰淇淋杯检测 | |||
Wait(); | |||
Thread.Sleep(500); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => | |||
@@ -627,14 +654,14 @@ namespace BPASmartClient.MorkT | |||
{ | |||
//退出循环回到初始位置 | |||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯,仍未成功,订单默认废弃,机器人回到初始位置!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_冰淇淋杯回原点 }); //SENCE_冰淇淋杯回原点 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 },(o) => { }); | |||
morkT.GetIceCreamCup = false; | |||
return; | |||
} | |||
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10036 }); //SENCE_二次取冰淇淋杯 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_二次取冰淇淋杯 }); //SENCE_二次取冰淇淋杯 | |||
EventBus.EventBus.GetInstance().Equals(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
@@ -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 = 10055 }); //SENCE_接1号冰淇淋 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_接1号冰淇淋 }); //SENCE_接1号冰淇淋 | |||
Wait(); | |||
bool doItResult = true; | |||
@@ -663,35 +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_LebaiSenceEvent { DeviceId=DeviceId,}) | |||
//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) => { }); | |||
} | |||
@@ -714,7 +743,7 @@ namespace BPASmartClient.MorkT | |||
Thread.Sleep(500); | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10056 }); //SENCE_放冰淇淋位置 | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_放冰淇淋位置 }); //SENCE_放冰淇淋位置 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
//订单状态改变:完成 | |||
@@ -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; } | |||
@@ -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; | |||
} | |||
} |
@@ -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); | |||
} | |||
} | |||
} | |||
} |
@@ -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}" | |||
@@ -79,10 +82,16 @@ | |||
Command="{Binding Button_RobotControlCommand}" | |||
CommandParameter="机器人急停"/> | |||
<!--<Button Content="机器人回原点" | |||
Margin="20,5" Width="110" Height="60" | |||
Command="{Binding Button_GoToHomeCommand}" | |||
CommandParameter="机器人急停">--> | |||
<!--</Button>--> | |||
</ListBox> | |||
</Grid> | |||
</GroupBox> | |||
<!--<GroupBox Grid.Row="2" | |||
<GroupBox Grid.Row="2" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Header=" 冰淇淋机器 "> | |||
@@ -172,8 +181,8 @@ | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</GroupBox>--> | |||
<GroupBox Grid.Row="2" Grid.Column="0" | |||
</GroupBox> | |||
<!--<GroupBox Grid.Row="2" Grid.Column="0" | |||
FontSize="20" FontFamily="楷体" | |||
Header="单片机冰淇淋" > | |||
<Grid> | |||
@@ -214,7 +223,7 @@ | |||
</ListBox> | |||
</Grid> | |||
</GroupBox> | |||
</GroupBox>--> | |||
<GroupBox Grid.Row="2" Grid.Column="1" | |||
FontFamily="楷体" | |||
@@ -277,7 +286,7 @@ | |||
Content="制作"/> | |||
<Button Margin="10,0" | |||
Command="{}" | |||
Content="停止制作"/> | |||
Content="停止制作" Cursor="Hand"/> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
@@ -295,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> | |||
@@ -8,10 +8,12 @@ using BPASmartClient.LebaiRobot; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.Model.乐白机器人; | |||
using BPASmartClient.Model.乐白机器人.Enum; | |||
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; | |||
@@ -36,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> | |||
@@ -44,9 +52,12 @@ namespace BPASmartClient.MorkT.ViewModel | |||
/// 机器人控制 | |||
/// </summary> | |||
/// <param name="o"></param> | |||
public RelayCommand Button_SetValueCommand { get; set; } | |||
public RelayCommand Button_GoToHomeCommand { get; set; } | |||
private void Button_SetValue() | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }); | |||
@@ -56,6 +67,14 @@ namespace BPASmartClient.MorkT.ViewModel | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() }); | |||
} | |||
private void Button_GoToHome() | |||
{ | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点"); | |||
//EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_机器人回原点 }); | |||
//MessageLog.GetInstance.Show("开始执行乐白机器人回原点-----"); | |||
} | |||
#endregion | |||
#region 冰淇淋机器 | |||
@@ -124,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 | |||
@@ -222,10 +241,13 @@ namespace BPASmartClient.MorkT.ViewModel | |||
private void Button_SCChipRefrigeration() | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||
//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, Value = true, Pin = 1 }); | |||
Thread.Sleep(500); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { DeviceId = DeviceId, Value = false, Pin = 1 }); | |||
} | |||
private void Button_SCChipDischarge() | |||
@@ -248,6 +270,7 @@ namespace BPASmartClient.MorkT.ViewModel | |||
{ | |||
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl); | |||
Button_SetValueCommand = new RelayCommand(Button_SetValue); | |||
Button_GoToHomeCommand = new RelayCommand(Button_GoToHome); | |||
Button_MakeIceCreamCommand = new RelayCommand(Button_MakeIceCream); | |||
Button_SetIceCreamModelCommand = new RelayCommand(Button_SetIceCreamModel); | |||
@@ -313,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" ? "打料完成" : "打料中"; | |||
} | |||
@@ -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; } | |||
} | |||
} |
@@ -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> |
@@ -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(); | |||
} | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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(); } } | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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 | |||
{ | |||
} | |||
} |
@@ -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")] |
@@ -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; | |||
} | |||
} | |||
} | |||
} |
@@ -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> |
@@ -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; | |||
} | |||
} | |||
} | |||
} |
@@ -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> |
@@ -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> |
@@ -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(); | |||
} | |||
} | |||
} |
@@ -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> |
@@ -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) | |||
{ | |||
} | |||
} | |||
} |
@@ -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()); | |||
} | |||
} | |||
} | |||
} |
@@ -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" }); | |||
} | |||
} | |||
} |
@@ -7,8 +7,6 @@ using BPASmartClient.Device; | |||
using System.Collections.Concurrent; | |||
using BPASmartClient.LebaiRobot; | |||
using BPASmartClient.DRCoffee; | |||
using BPASmartClient.IceMaker; | |||
namespace BPASmartClient.MorkT_BarCounter | |||
{ | |||
public class GVL_MorkT : IStatus | |||
@@ -198,7 +198,7 @@ namespace BPASmartClient.MorkT_Container | |||
bFirstTrig_Coffee = true; | |||
delayTimeOut_Coffee = DateTime.Now; | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 18 && bFirstTrig_Coffee == true) | |||
else if (DateTime.Now.Subtract(delayTimeOut_Coffee).TotalSeconds > 180 && bFirstTrig_Coffee == true) | |||
{ | |||
DeviceProcessLogShow("接咖啡超时,接咖啡结束,等待取咖啡"); | |||
bFirstTrig_Coffee = false; | |||
@@ -231,7 +231,7 @@ namespace BPASmartClient.MorkT_Container | |||
bFirstTrig_Juice = true; | |||
delayTimeOut_Juice = DateTime.Now; | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 3 && bFirstTrig_Juice == true) | |||
else if (DateTime.Now.Subtract(delayTimeOut_Juice).TotalSeconds > 15 && bFirstTrig_Juice == true) | |||
{ | |||
DeviceProcessLogShow("接果汁超时,接果汁结束,等待取果汁"); | |||
bFirstTrig_Juice = false; | |||
@@ -246,7 +246,7 @@ namespace BPASmartClient.MorkT_Container | |||
bFirstTrig_TeaWater = true; | |||
delayTimeOut_Water = DateTime.Now;//开启接水信号后,记录当前时间 | |||
} | |||
else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 5 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 | |||
else if (DateTime.Now.Subtract(delayTimeOut_Water).TotalSeconds >= 50 && bFirstTrig_TeaWater == true)//接水超过50s后,启动接水完成标志,开启接水程序 | |||
{ | |||
DeviceProcessLogShow("接茶或水延迟时间结束"); | |||
bFirstTrig_TeaWater = false; | |||
@@ -329,7 +329,7 @@ namespace BPASmartClient.MorkT_Container | |||
/// 判断是否有咖啡订单 | |||
/// </summary> | |||
/// <returns></returns> | |||
private bool IsMakeCoffee() | |||
private bool IsMakeCoffee() | |||
{ | |||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesCoffee.Count > 0 && !morkTLebaiJC.IsHaveCoffeeCup) ? true : false; | |||
return bMake; | |||
@@ -340,7 +340,7 @@ namespace BPASmartClient.MorkT_Container | |||
/// <returns></returns> | |||
private bool IsMakeJuice() | |||
{ | |||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false; | |||
bool bMake = (IsHealth && morkTLebaiJC.morkOrderPushesJuicer.Count > 0 && !morkTLebaiJC.IsHaveJuiceCup) ? true : false; | |||
return bMake; | |||
} | |||
/// <summary> | |||
@@ -490,7 +490,7 @@ namespace BPASmartClient.MorkT_Container | |||
outCupCheck = false; | |||
OrderChange(morkTLebaiJC.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1 || true) | |||
if (resultTakeCup == 1) | |||
{ | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(GVL_MorkT.机器人安全位); | |||
@@ -549,7 +549,7 @@ namespace BPASmartClient.MorkT_Container | |||
{ | |||
OrderChange(morkTLebaiJC.morkOrderPushesWater.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1 || true) | |||
if (resultTakeCup == 1) | |||
{ | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
Sence(GVL_MorkT.接开水); | |||
@@ -587,7 +587,7 @@ namespace BPASmartClient.MorkT_Container | |||
{ | |||
OrderChange(morkTLebaiJC.morkOrderPushesTea.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
if (resultTakeCup == 1 || true) | |||
if (resultTakeCup == 1) | |||
{ | |||
DeviceProcessLogShow("取茶杯完成"); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
@@ -688,7 +688,7 @@ namespace BPASmartClient.MorkT_Container | |||
OrderChange(morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
int resultTakeCup = takeCup(); | |||
JuiceCH = morkTLebaiJC.morkOrderPushesJuicer.ElementAt(0).Loc; | |||
if (resultTakeCup == 1 ||true ) | |||
if (resultTakeCup == 1) | |||
{ | |||
getIce(); | |||
new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }.Publish(); | |||
@@ -7,7 +7,6 @@ using BPASmartClient.Device; | |||
using System.Collections.Concurrent; | |||
using BPASmartClient.LebaiRobot; | |||
using BPASmartClient.DRCoffee; | |||
using BPASmartClient.IceMaker; | |||
namespace BPASmartClient.MorkT_Container | |||
{ | |||
@@ -208,7 +208,7 @@ namespace BPASmartClient.MorkT_Container.ViewModel; | |||
} | |||
private void IceMaker_BtnSetIceTimeCommand() | |||
{ | |||
new SetIceNumber{ Value= IceMaker_IceTime }.Publish(); | |||
new SetIceNumber{ Value= IceMaker_IceTime * 0.1 }.Publish(); | |||
} | |||
#endregion | |||
#region 咖啡机 | |||
@@ -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" /> |
@@ -1,9 +1,11 @@ | |||
using BPA.Message.Enum; | |||
using BPA.Message; | |||
using BPA.Message.Enum; | |||
using BPASmartClient.Device; | |||
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; | |||
@@ -22,14 +24,14 @@ using System.Threading; | |||
using System.Threading.Tasks; | |||
using static BPASmartClient.EventBus.EventBus; | |||
namespace BPASmartClient.MorkT_HQ | |||
namespace BPASmartClient.MorkTHQ | |||
{ | |||
public class Control_MorkT_HQ : BaseDevice | |||
public class Control_MorkTHQ : BaseDevice | |||
{ | |||
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.MORKT; } } | |||
GLV_MorkT_HQ morkT = new GLV_MorkT_HQ(); | |||
GLV_MorkTHQ morkT = new GLV_MorkTHQ(); | |||
int[] devStatusBy = new int[2] { 0, 0 }; | |||
public override void DoMain() | |||
{ | |||
@@ -40,7 +42,7 @@ namespace BPASmartClient.MorkT_HQ | |||
IsHealth = true; | |||
ServerInit(); | |||
DataParse(); | |||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||
{ | |||
if (morkT.MakeCoffeeOrder != null) | |||
morkT.MakeCoffeeOrder.OrderStatus = 1; | |||
@@ -55,7 +57,7 @@ namespace BPASmartClient.MorkT_HQ | |||
public override void ResetProgram() | |||
{ | |||
morkT = null; | |||
morkT = new GLV_MorkT_HQ(); | |||
morkT = new GLV_MorkTHQ(); | |||
} | |||
@@ -72,34 +74,16 @@ namespace BPASmartClient.MorkT_HQ | |||
public override void MainTask() | |||
{ | |||
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(); | |||
} | |||
} | |||
}); | |||
//制作果汁 | |||
MakeJuiceProcess(); | |||
//制作冰淇淋 | |||
MakeIceCreamProcess(); | |||
//制作完取咖啡 | |||
MakeCoffeeComplete(); | |||
} | |||
@@ -204,7 +188,7 @@ namespace BPASmartClient.MorkT_HQ | |||
GetStatus("CoffeeStatus", new Action<object>((o) => | |||
{ | |||
if (o is DrCoffeeStatus coffeeStatus) | |||
if (o is K95SysTemStatus coffeeStatus) | |||
{ | |||
morkT.DrCoffeeStatus = coffeeStatus; | |||
} | |||
@@ -212,7 +196,7 @@ namespace BPASmartClient.MorkT_HQ | |||
GetStatus("CoffeeAppStatus", new Action<object>((o) => | |||
{ | |||
if (o is DrCoffeeAppStatus appStatus) | |||
if (o is TaskIndex appStatus) | |||
{ | |||
morkT.CoffeeAppStatus = appStatus; | |||
} | |||
@@ -220,18 +204,26 @@ namespace BPASmartClient.MorkT_HQ | |||
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; | |||
} | |||
})); | |||
GetStatus("Coffeeprogress", new Action<object>((o) => | |||
{ | |||
if (o is int coffeeFault) | |||
{ | |||
morkT.Coffeeprogress = coffeeFault; | |||
} | |||
})); | |||
GetStatus("SCChipIsConnect", new Action<object>((o) => | |||
{ | |||
if (o is bool b) | |||
@@ -239,6 +231,13 @@ namespace BPASmartClient.MorkT_HQ | |||
morkT.SCChipIsConnect = b; | |||
} | |||
})); | |||
GetStatus("JuiceIsConnect", new Action<object>((o) => | |||
{ | |||
if (o is bool b) | |||
{ | |||
morkT.JuiceIsConnect = b; | |||
} | |||
})); | |||
} | |||
@@ -333,6 +332,20 @@ namespace BPASmartClient.MorkT_HQ | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.JUICE: | |||
if(morkT.morkOrderPushesIceCream.FirstOrDefault(p=>p.SuborderId == order?.MorkOrder.SuborderId) == null) | |||
{ | |||
morkT.GuMake = order.MorkOrder.MakeID == "2"; | |||
morkT.morkOrderPushesJuice.Enqueue(new OrderLocInfo() | |||
{ | |||
SuborderId = order.MorkOrder.SuborderId, | |||
BatchingId = res.BatchingId, | |||
Loc = loc_Goods, | |||
GoodsName = order.MorkOrder.GoodsName, | |||
SortNum = order.MorkOrder.SortNum | |||
}); | |||
} | |||
break; | |||
case GOODS_TYPE.NEITHER: | |||
DeviceProcessLogShow("未知的商品类型"); | |||
break; | |||
@@ -371,6 +384,7 @@ namespace BPASmartClient.MorkT_HQ | |||
} | |||
} | |||
#region 咖啡 | |||
/// <summary> | |||
/// 是否可以开始制作咖啡 | |||
/// </summary> | |||
@@ -397,7 +411,7 @@ namespace BPASmartClient.MorkT_HQ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051}); //接咖啡后回原点 | |||
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 KLMCoffee_MakeCoffeeEvent() {DeviceId = DeviceId, DrinkCode = (Model.咖啡机.Enum.DrinkType)int.Parse(orderLoc.Loc) });//接咖啡控制 | |||
DeviceProcessLogShow($"发送咖啡机制作{orderLoc.Loc}!"); | |||
morkT.IsCoffeeMake = true; morkT.MakeCoffeeOrder = orderLoc; | |||
} | |||
@@ -450,50 +464,16 @@ namespace BPASmartClient.MorkT_HQ | |||
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 = 10031 }); //SENCE_取咖啡杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId= DeviceId ,Cup = IC_CUP.CUP_COFFEE});//落碗控制 | |||
Thread.Sleep(500); | |||
DeviceProcessLogShow("尝试取咖啡杯!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
int count = 1; | |||
bool result = true; | |||
p: | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10033 }); //SENCE_咖啡杯检测 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetTCPInputEvent { DeviceId = DeviceId, Pin = 1 }, (o)=> | |||
{ | |||
if(o != null && o.Length > 0 && o[0] is bool resultValue) | |||
{ | |||
result = resultValue; | |||
} | |||
}); | |||
if (!result) | |||
{ | |||
if (count >= 3) | |||
{ | |||
//退出循环回到初始位置 | |||
DeviceProcessLogShow($"执行{count}次取咖啡杯,仍为成功,订单默认废弃,机器人回到初始位置!"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { }); | |||
morkT.GetCoffeeCup = false; | |||
return; | |||
} | |||
DeviceProcessLogShow("执行二次取咖啡杯"); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10035 }); //SENCE_二次取咖啡杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Equals(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; | |||
} | |||
morkT.GetCoffeeCup = true; | |||
DeviceProcessLogShow("取咖啡杯完成"); | |||
} | |||
#endregion | |||
#region 冰淇淋 | |||
/// <summary> | |||
/// 冰淇淋是否可以开始制作 | |||
/// </summary> | |||
@@ -509,45 +489,40 @@ namespace BPASmartClient.MorkT_HQ | |||
/// </summary> | |||
private void MakeIceCreamProcess() | |||
{ | |||
//if (IceCreamCanMake()) | |||
//{ | |||
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("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 (IceCreamCanMake()) | |||
{ | |||
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); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
@@ -557,12 +532,9 @@ namespace BPASmartClient.MorkT_HQ | |||
private void DoIceCream(OrderLocInfo order) | |||
{ | |||
GetIceCreamCup(); | |||
CheckICeCreaCup(); | |||
if(morkT.GetIceCreamCup) | |||
{ | |||
GetIceCream(order); | |||
PutIceCream(order); | |||
} | |||
//CheckICeCreaCup(); | |||
GetIceCream(order); | |||
PutIceCream(order); | |||
} | |||
@@ -575,7 +547,6 @@ namespace BPASmartClient.MorkT_HQ | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { }); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10032 }); //SENCE_取冰淇淋杯 | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new SCChip_TakeCupEvent { DeviceId = DeviceId, Cup = IC_CUP.CUP_ICECREAM });//落碗控制 | |||
Thread.Sleep(500); | |||
DeviceProcessLogShow("尝试取冰淇淋杯!"); | |||
@@ -657,37 +628,37 @@ namespace BPASmartClient.MorkT_HQ | |||
Wait(); | |||
bool doItResult = true; | |||
//出料 | |||
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 }); | |||
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 SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true }); | |||
//Thread.Sleep(500); | |||
//EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false }); | |||
//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) => { }); | |||
} | |||
@@ -757,10 +728,138 @@ namespace BPASmartClient.MorkT_HQ | |||
Thread.Sleep(5000); | |||
} | |||
#endregion | |||
#region 果汁 | |||
/// <summary> | |||
/// 制作果汁流程 | |||
/// </summary> | |||
private void MakeJuiceProcess() | |||
{ | |||
if(morkT.morkOrderPushesJuice.TryDequeue(out OrderLocInfo order)) | |||
{ | |||
OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 11111 });//SENCE_取果汁杯位置 | |||
int JuicerNum1 = int.Parse(order.Loc); | |||
switch (JuicerNum1) | |||
{ | |||
case 52: | |||
if (morkT.GuMake) | |||
{ | |||
morkT.JuicerNum = 0x00; | |||
} | |||
else | |||
{ | |||
morkT.JuicerNum = 0x01; | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接1号果汁位置 }); | |||
Wait(); | |||
break; | |||
case 53: | |||
if (morkT.GuMake) | |||
{ | |||
morkT.JuicerNum = 0x02; | |||
} | |||
else | |||
{ | |||
morkT.JuicerNum = 0x03; | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接2号果汁位置 }); | |||
Wait(); | |||
break; | |||
case 54: | |||
if (morkT.GuMake) | |||
{ | |||
morkT.JuicerNum = 0x04; | |||
} | |||
else | |||
{ | |||
morkT.JuicerNum = 0x05; | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接3号果汁位置 }); | |||
Wait(); | |||
break; | |||
case 55: | |||
if (morkT.GuMake) | |||
{ | |||
morkT.JuicerNum = 0x06; | |||
} | |||
else | |||
{ | |||
morkT.JuicerNum = 0x07; | |||
} | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接4号果汁位置 }); | |||
Wait(); | |||
break; | |||
default: | |||
morkT.JuicerNum = 0x00; | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接果汁公共位置 }); | |||
Wait(); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_接1号果汁位置 }); | |||
Wait(); | |||
break; | |||
} | |||
var devStatus = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||
var devStatus1 = Convert.ToString(devStatus[0], 2); | |||
var devStatus2 = devStatus[1]; | |||
if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new WriteJuicer() { Value = morkT.JuicerNum }); | |||
Thread.Sleep(100); | |||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||
while (!(devStatusBy[1] == 0)) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||
while (devStatusBy.Length != 2) | |||
{ | |||
Thread.Sleep(100); | |||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||
} | |||
} | |||
devStatusBy = GetDeviceStatus<int[]>("GetDeviceStatus"); | |||
Thread.Sleep(5000); | |||
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_HQ.SENCE_放果汁杯位置后回原点 }); | |||
Wait(); | |||
OrderChange(order.SuborderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE); | |||
MessageLog.GetInstance.Show("果汁制作完成"); | |||
} | |||
} | |||
} | |||
private T GetDeviceStatus<T>(string key) | |||
{ | |||
if (peripheralStatus.ContainsKey(key)) | |||
{ | |||
if (peripheralStatus[key] != null) | |||
{ | |||
return (T)(peripheralStatus[key]); | |||
} | |||
} | |||
return default; | |||
} | |||
#endregion | |||
public override void SimOrder() | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} |
@@ -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; | |||
@@ -11,9 +12,9 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkT_HQ | |||
namespace BPASmartClient.MorkTHQ | |||
{ | |||
public class GLV_MorkT_HQ:IStatus | |||
public class GLV_MorkTHQ:IStatus | |||
{ | |||
/// <summary> | |||
/// 咖啡订单队列 | |||
@@ -25,6 +26,10 @@ namespace BPASmartClient.MorkT_HQ | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesIceCream = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 果汁订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<OrderLocInfo> morkOrderPushesJuice = new ConcurrentQueue<OrderLocInfo>(); | |||
/// <summary> | |||
/// 等待取餐订单 | |||
/// </summary> | |||
public OrderLocInfo waitMorkOrder = null; | |||
@@ -57,6 +62,16 @@ namespace BPASmartClient.MorkT_HQ | |||
/// </summary> | |||
public bool GetIceCreamCup; | |||
/// <summary> | |||
/// 果汁机做法,true:热饮,false:冷饮 | |||
/// </summary> | |||
public bool GuMake = false; | |||
/// <summary> | |||
/// 果汁机控制信号 | |||
/// </summary> | |||
public byte JuicerNum; | |||
#region | |||
[VariableMonitor("机器人连接状态")] | |||
@@ -99,20 +114,47 @@ namespace BPASmartClient.MorkT_HQ | |||
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; } | |||
[VariableMonitor("单片机连接状态")] | |||
public bool SCChipIsConnect { get; set; } | |||
[VariableMonitor("果汁机连接状态")] | |||
public bool JuiceIsConnect { get; set; } | |||
#endregion | |||
} | |||
public class Lebai_HQ | |||
{ | |||
#region 环球设备 | |||
public const int SENCE_取咖啡杯 = 10001; | |||
public const int SENCE_取冰淇淋杯 = 10002; | |||
public const int SENCE_接咖啡后回原点 = 10003; | |||
public const int SENCE_取咖啡出餐 = 10004; | |||
public const int SENCE_接1号冰淇淋 = 10005; | |||
public const int SENCE_放冰淇淋位置 = 10006; | |||
public const int SENCE_取果汁杯位置 = 10007; | |||
public const int SENCE_接果汁公共位置 = 10008; | |||
public const int SENCE_接1号果汁位置 = 10009; | |||
public const int SENCE_接2号果汁位置 = 10010; | |||
public const int SENCE_接3号果汁位置 = 10011; | |||
public const int SENCE_接4号果汁位置 = 10012; | |||
public const int SENCE_放果汁杯位置后回原点 = 10013; | |||
#endregion | |||
} | |||
} |
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkT_HQ | |||
namespace BPASmartClient.MorkTHQ | |||
{ | |||
public class OrderLocInfo | |||
{ | |||
@@ -16,7 +16,7 @@ namespace BPASmartClient.MorkT_HQ | |||
public int OrderStatus { get; set; } | |||
public string MakeID { get; set; } | |||
public OrderLocInfo() | |||
{ | |||
OrderStatus = 0; | |||
@@ -8,7 +8,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkT_HQ | |||
namespace BPASmartClient.MorkTHQ | |||
{ | |||
public enum GOODS_TYPE | |||
{ | |||
@@ -29,6 +29,10 @@ namespace BPASmartClient.MorkT_HQ | |||
internal const string ICE_MAIN_BATCHIN1_LOC = "52"; | |||
internal const string ICE_MAIN_BATCHIN2_LOC = "53"; | |||
internal const string ICE_MAIN_BATCHIN3_LOC = "54"; | |||
//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 ICE_HOLDER_LOC = "51"; | |||
public static Dictionary<string, GOODS_TYPE> GOODS_TYPES = new Dictionary<string, GOODS_TYPE>() { | |||
@@ -1,9 +1,9 @@ | |||
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.DebugView" | |||
<UserControl x:Class="BPASmartClient.MorkTHQ.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.MorkT_HQ.ViewModel" | |||
xmlns:vm ="clr-namespace:BPASmartClient.MorkTHQ.ViewModel" | |||
mc:Ignorable="d" | |||
Name="调试界面" | |||
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded"> | |||
@@ -25,7 +25,7 @@ | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="14*"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="10*"/> | |||
<RowDefinition Height="20*"/> | |||
</Grid.RowDefinitions> | |||
@@ -198,6 +198,7 @@ | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="99" /> | |||
@@ -209,20 +210,23 @@ | |||
<TextBlock FontSize="18" | |||
Grid.Column="1" | |||
Text="{Binding CoffeeStatus}" Height="23" /> | |||
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">应用状态</TextBlock> | |||
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">制作任务</TextBlock> | |||
<TextBlock FontSize="18" | |||
Grid.Column="3" | |||
Text="{Binding AppStatus}" Height="23"/> | |||
Text="{Binding CoffeeAppStatus}" Height="23"/> | |||
<TextBlock Grid.Row="1" Grid.Column="0" Height="22" Width="80" FontSize="18">告警信息</TextBlock> | |||
<TextBlock FontSize="15" | |||
Grid.Row="1" | |||
Grid.Column="1" | |||
Text="{Binding Warning}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">故障信息</TextBlock> | |||
Text="{Binding CoffeeWarning}" /> | |||
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">保养信息</TextBlock> | |||
<TextBlock FontSize="18" | |||
Grid.Row="1" | |||
Grid.Column="3" | |||
Text="{Binding CaffeeFault}" Height="22" Width="60" /> | |||
Text="{Binding CoffeeFault}" Height="22" Width="60" /> | |||
<TextBlock Text="制作进度" Grid.Row="2"/> | |||
<TextBlock Grid.Row="2" Grid.Column="1" | |||
Text="{Binding Coffeeprogress}"/> | |||
</Grid> | |||
<StackPanel Grid.Row="2" Orientation="Vertical"> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
@@ -238,28 +242,41 @@ | |||
Command="{}" | |||
Content="停止制作"/> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"> | |||
<TextBlock>模式</TextBlock> | |||
<ComboBox Margin="10,0" | |||
Width="100" | |||
ItemsSource="{Binding CoffeeCmds}" | |||
SelectedItem="{Binding SelectedCoffeeCmd}"/> | |||
<Button Margin="10,0" | |||
Command="{}" | |||
Content="设置" Cursor="Hand"/> | |||
</StackPanel> | |||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal"/> | |||
</StackPanel> | |||
</Grid> | |||
</GroupBox> | |||
<GroupBox Header="单片机控制" | |||
<GroupBox Header="果汁机" Margin="10" | |||
FontSize="18" | |||
Grid.Row="1" Grid.ColumnSpan="2" | |||
Margin="0,0,0,10" HorizontalAlignment="Right" Width="1000"> | |||
<StackPanel Orientation="Horizontal" | |||
VerticalAlignment="Center" > | |||
HorizontalAlignment="Left" > | |||
<Grid> | |||
<Grid.ColumnDefinitions > | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Text="连接状态" /> | |||
<TextBlock Text="{Binding JuiceIsConnect}" | |||
Margin="120,0,0,0"/> | |||
<StackPanel Orientation="Horizontal" Grid.Column="1"> | |||
<TextBlock Text="果汁:" Margin="10"/> | |||
<TextBlock Text="{Binding JuiceIsConnect}"/> | |||
<ComboBox Margin="10,0" | |||
Width="100" FontSize="16" | |||
ItemsSource="{Binding Juice}" | |||
SelectedItem="{Binding SelectedJuice}" | |||
IsReadOnly="True"/> | |||
<ComboBox Margin="10,0" | |||
Width="49" FontSize="16" | |||
ItemsSource="{Binding Temperature}" | |||
SelectedItem="{Binding SelectedTemperature}" | |||
IsReadOnly="True"/> | |||
<Button Margin="10,0" | |||
Command="{Binding MakeJuiceCommand}" | |||
Content="制作"/> | |||
</StackPanel> | |||
</StackPanel> | |||
</Grid> | |||
</GroupBox> | |||
</Grid> | |||
@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.MorkT_HQ.View | |||
namespace BPASmartClient.MorkTHQ.View | |||
{ | |||
/// <summary> | |||
/// MorkT_DebugView.xaml 的交互逻辑 | |||
@@ -1,10 +1,10 @@ | |||
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.Monitor" | |||
<UserControl x:Class="BPASmartClient.MorkTHQ.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.MorkT_HQ.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkT_HQ.ViewModel" | |||
xmlns:local="clr-namespace:BPASmartClient.MorkTHQ.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkTHQ.ViewModel" | |||
mc:Ignorable="d" | |||
Name="监控画面" | |||
d:DesignHeight="450" d:DesignWidth="800" Unloaded="Monitor_Unloaded"> | |||
@@ -14,7 +14,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.MorkT_HQ.View | |||
namespace BPASmartClient.MorkTHQ.View | |||
{ | |||
/// <summary> | |||
/// Monitor.xaml 的交互逻辑 | |||
@@ -1,9 +1,9 @@ | |||
<UserControl x:Class="BPASmartClient.MorkT_HQ.View.ParSer" | |||
<UserControl x:Class="BPASmartClient.MorkTHQ.View.ParSer" | |||
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.MorkT_HQ.View" | |||
xmlns:local="clr-namespace:BPASmartClient.MorkTHQ.View" | |||
mc:Ignorable="d" | |||
Name="参数设置界面" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.MorkT_HQ.View | |||
namespace BPASmartClient.MorkTHQ.View | |||
{ | |||
/// <summary> | |||
/// ParSer.xaml 的交互逻辑 | |||
@@ -20,7 +20,7 @@ using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Threading; | |||
namespace BPASmartClient.MorkT_HQ.ViewModel | |||
namespace BPASmartClient.MorkTHQ.ViewModel | |||
{ | |||
public class DebugViewModel : ObservableObject | |||
{ | |||
@@ -124,7 +124,7 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||
private void Button_MakeIceCream() | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId }); | |||
} | |||
private void Button_SetIceCreamModel() | |||
{ | |||
@@ -147,19 +147,21 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||
/// <summary> | |||
/// 应用状态 | |||
/// </summary> | |||
public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } } | |||
private string _appStatus { get; set; } | |||
public string CoffeeAppStatus { get { return _coffeAappStatus; } set { _coffeAappStatus = value; OnPropertyChanged(); } } | |||
private string _coffeAappStatus { get; set; } | |||
/// <summary> | |||
/// 告警 | |||
/// </summary> | |||
public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } } | |||
public string _warning { get; set; } | |||
public string CoffeeWarning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } } | |||
private string _warning { get; set; } | |||
/// <summary> | |||
/// 故障信息 | |||
/// </summary> | |||
public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } } | |||
public string _caffeeFault { get; set; } | |||
public string CoffeeFault { get { return _coffeeFault; } set { _coffeeFault = value; OnPropertyChanged(); } } | |||
private string _coffeeFault { get; set; } | |||
public string Coffeeprogress { get { return _coffeeprogress; } set { _coffeeprogress = value; OnPropertyChanged(); } } | |||
private string _coffeeprogress { get; set; } | |||
public List<string> Coffees { get; set; } = new List<string>(); | |||
public string SelectedCoffee { get; set; } | |||
@@ -235,6 +237,65 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||
#endregion | |||
#region 果汁机 | |||
/// <summary> | |||
/// 果汁机连接状态 | |||
/// </summary> | |||
public string JuiceIsConnect { get { return _juiceIsConnect; } set { _juiceIsConnect = value; OnPropertyChanged(); } } | |||
private string _juiceIsConnect { get; set; } | |||
public List<string> Juice { get; set; } = new List<string>() { "果汁1", "果汁2", "果汁3", "果汁4" }; | |||
public string SelectedJuice { get; set; } = "果汁1"; | |||
public List<string> Temperature { get; set; } = new List<string>() { "冷", "热" }; | |||
public string SelectedTemperature { get; set; } = "冷"; | |||
public RelayCommand MakeJuiceCommand { get; set; } | |||
private void MakeJuice() | |||
{ | |||
switch (SelectedJuice) | |||
{ | |||
case "果汁1": | |||
if (SelectedTemperature == "冷") | |||
{ | |||
MakeJuiceEvent(0x01); | |||
} | |||
else MakeJuiceEvent(0x00); | |||
break; | |||
case "果汁2": | |||
if (SelectedTemperature == "冷") | |||
{ | |||
MakeJuiceEvent(0x03); | |||
} | |||
else MakeJuiceEvent(0x02); | |||
break; | |||
case "果汁3": | |||
if (SelectedTemperature == "冷") | |||
{ | |||
MakeJuiceEvent(0x05); | |||
} | |||
else MakeJuiceEvent(0x04); | |||
break; | |||
case "果汁4": | |||
if (SelectedTemperature == "冷") | |||
{ | |||
MakeJuiceEvent(0x07); | |||
} | |||
else MakeJuiceEvent(0x06); | |||
break; | |||
default: | |||
MakeJuiceEvent(0x00); | |||
break; | |||
} | |||
} | |||
private void MakeJuiceEvent(byte b) | |||
{ | |||
EventBus.EventBus.GetInstance().Publish(new WriteJuicer { DeviceId = DeviceId, Value = b }); | |||
} | |||
#endregion | |||
/// <summary> | |||
/// 设备ID | |||
/// </summary> | |||
@@ -266,7 +327,9 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||
Button_SCChipDischarge(); | |||
}); | |||
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode))) | |||
MakeJuiceCommand = new RelayCommand(MakeJuice); | |||
foreach (DrinkType code in Enum.GetValues(typeof(DrinkType))) | |||
{ | |||
Coffees.Add(code.ToString()); | |||
} | |||
@@ -283,9 +346,11 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||
} | |||
SelecteIceCreamdMode = IceCreamModes[0]; | |||
Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device => | |||
{ | |||
if (device.Name == "MorkT") DeviceId = device.DeviceId | |||
if (device.Name == "MorkTHQ") DeviceId = device.DeviceId | |||
; | |||
}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
@@ -299,13 +364,15 @@ namespace BPASmartClient.MorkT_HQ.ViewModel | |||
IceCreamConnected = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||
SCChipIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||
JuiceIsConnect = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接"; | |||
RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue; | |||
CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue; | |||
AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue; | |||
Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue; | |||
CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue; | |||
CoffeeAppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue; | |||
CoffeeWarning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue; | |||
CoffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue; | |||
Coffeeprogress = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机制作进度").CurrentValue; | |||
YLWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器预冷温度").CurrentValue; | |||
HQWD = variableMonitors.FirstOrDefault(p => p.Notes == "冰淇淋机器回气温度").CurrentValue; | |||
@@ -12,7 +12,7 @@ using System.Threading.Tasks; | |||
using System.Windows.Data; | |||
using System.Windows.Media; | |||
namespace BPASmartClient.MorkT_HQ.ViewModel | |||
namespace BPASmartClient.MorkTHQ.ViewModel | |||
{ | |||
public class MonitorViewModel: ObservableObject | |||
@@ -1,5 +1,6 @@ | |||
| |||
using BPASmartClient.EventBus; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model.单片机; | |||
using BPASmartClient.Model.单片机.Enum; | |||
using BPASmartClient.SCChip; | |||
@@ -148,6 +149,7 @@ namespace BPASmartClient.SCChip | |||
package.Cmd = IC_CMD.TAKE_CUP; | |||
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup; | |||
commProxy.SendData(StructureToByte(package)); | |||
MessageLog.GetInstance.Show($"发送落杯指令--{(@event as SCChip_TakeCupEvent).Cup}"); | |||
bool wait = true; | |||
var waitTimeout = DateTime.Now.AddSeconds(3); | |||
@@ -166,7 +168,7 @@ namespace BPASmartClient.SCChip | |||
break; | |||
} | |||
} | |||
Thread.Sleep(10); | |||
Thread.Sleep(50); | |||
} | |||
} | |||
@@ -144,7 +144,7 @@ namespace BPASmartClient.SCChip | |||
} | |||
continue; | |||
} | |||
Thread.Sleep(5); | |||
Thread.Sleep(10); | |||
} | |||
/// <summary> | |||
@@ -281,7 +281,7 @@ namespace BPASmartClient.SCChip | |||
package.Cmd = IC_CMD.TAKE_CUP; | |||
package.Value = (byte)(@event as SCChip_TakeCupEvent).Cup; | |||
commProxy.SendData(StructureToByte(package)); | |||
MessageLog.GetInstance.Show($"发送落杯指令--{(@event as SCChip_TakeCupEvent).Cup}"); | |||
bool wait = true; | |||
var waitTimeout = DateTime.Now.AddSeconds(3); | |||
while (wait) | |||
@@ -351,7 +351,7 @@ namespace BPASmartClient.SCChip | |||
} | |||
Thread.Sleep(10); | |||
} | |||
Thread.Sleep(1700); | |||
Thread.Sleep(1800); | |||
switch ((IC_SE)(@event as SCChip_MakeIceCreamEvent).SteeringEngine) | |||
{ | |||
case IC_SE.SE_1: | |||
@@ -88,6 +88,14 @@ namespace BPASmartClient.ViewModel | |||
IsAllSelect = item.IsAllSelect, | |||
morkOrderPushes = morkOrders, | |||
}); | |||
/* | |||
foreach (var mo in morkOrders) | |||
{ | |||
DoOrderEvent de = new DoOrderEvent(); | |||
de.DeviceId = int.Parse(item.DeviceId); | |||
de.MorkOrder = mo.OrderPush; | |||
EventBus.EventBus.GetInstance().Publish(de); | |||
}*/ | |||
} | |||
} | |||
WeakReferenceMessenger.Default.Send("true", "Close"); | |||
@@ -36,9 +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_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" /> | |||
<ProjectReference Include="..\FryPot_DosingSystem\FryPot_DosingSystem.csproj" /> | |||
@@ -92,7 +92,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.JAKA", "BPAS | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Juicer", "BPASmartClient.Juicer\BPASmartClient.Juicer.csproj", "{C28A88B1-E449-484C-AC67-B5038FF2CA79}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_HQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkT_HQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTHQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkTHQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem", "DosingSystem\BPASmartClient.DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}" | |||
EndProject | |||