@@ -138,7 +138,6 @@ namespace BPASmartClient.Modbus | |||
} | |||
} | |||
} | |||
else if (address.ToUpper().Contains("I") && address.Length >= 2) | |||
{ | |||
var res = address.Substring(1).Split('.'); | |||
@@ -172,7 +171,6 @@ namespace BPASmartClient.Modbus | |||
} | |||
} | |||
} | |||
else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3) | |||
{ | |||
var res = address.Substring(2); | |||
@@ -15,7 +15,6 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
public override DeviceClientType DeviceType => DeviceClientType.MORKS; | |||
private GVL_MorkSUpgradedVer mORKS = new GVL_MorkSUpgradedVer(); | |||
private Alarm alarm = new Alarm(); | |||
public override void DoMain() | |||
{ | |||
MonitorViewModel.DeviceId = DeviceId; | |||
@@ -154,8 +153,14 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
{ | |||
if (o != null && o is DoNoodle doN) | |||
{ | |||
List<ushort> values = new List<ushort>() { (ushort)doN.Min,(ushort)doN.Senc}; | |||
WriteData($"VW{324 + (doN.Reset * 4)}", values.ToArray()); | |||
List<ushort> values = new List<ushort>(); | |||
ushort s = 0; | |||
values.Add((ushort)doN.Min); | |||
values.Add((ushort)doN.Senc); | |||
WriteData($"VW{324 + ((doN.Reset - 1) * 4)}", values.ToArray()); | |||
WriteData($"VW4", s.SetBitValue(Convert.ToByte(doN.Reset + 6), true)); | |||
s = 0; | |||
WriteData($"VW4", s.SetBitValue(Convert.ToByte(doN.Reset), true)); | |||
} | |||
}), "Startset"); | |||
#endregion | |||
@@ -427,7 +432,38 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
alarm.SiloNoInit = !mORKS.SiloInitCom; | |||
} | |||
})); | |||
GetStatus("M7.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 6) | |||
{ | |||
mORKS.Nsm = bools; | |||
for (int i = 0; i < bools.Length; i++) | |||
{ | |||
var res = NoodOrderCtrl.GetInstance.doNoodles.FirstOrDefault(o => o.Reset == (i + 1)); | |||
if (bools[i]) | |||
{ | |||
if (!DeviceCtrlViewModel.startCtrl && !res.Docook && res.BtnIsChecked) | |||
{ | |||
res.BtnIsChecked = false; | |||
} | |||
if (res.Docook) | |||
{ | |||
res.Docook = false; | |||
NoodOrderCtrl.GetInstance.Flush(res); | |||
} | |||
} | |||
else | |||
{ | |||
if (!res.Docook) | |||
{ | |||
res.Docook = true; | |||
NoodOrderCtrl.GetInstance.Flush(res); | |||
} | |||
} | |||
} | |||
} | |||
})); | |||
GetStatus("M10.0", new Action<object>((obj) => | |||
{ | |||
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 2) | |||
@@ -523,7 +559,17 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
{ | |||
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1) | |||
{ | |||
if (mORKS.CurrentFeedbackLoc != ushorts[0]) | |||
{ | |||
var res = DeviceCtrlViewModel.CtrlTurns.FirstOrDefault(o => o.Set == $"{ushorts[0]} 号位"); | |||
if (res != null) | |||
{ | |||
res.UnderSet = true; | |||
NoodOrderCtrl.GetInstance.Show($"料仓当前位置:{res.Set}"); | |||
} | |||
} | |||
mORKS.CurrentFeedbackLoc = ushorts[0]; | |||
} | |||
})); | |||
@@ -857,7 +903,7 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) | |||
{ | |||
var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == orderLocInfo.SuborderId); | |||
if (res != null) | |||
if (res != null) | |||
{ | |||
//写入煮面时间 | |||
//List<ushort> values = new List<ushort>(); | |||
@@ -904,7 +950,7 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
mORKS.TakeNoodleInterlock = true; | |||
} | |||
} | |||
} | |||
} | |||
@@ -914,18 +960,6 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
/// <summary>出餐控制</summary> | |||
private void OutNoodleTask() | |||
{ | |||
for (int loc = 0; loc < mORKS.CookNodelId.Length; loc++) | |||
{ | |||
if (mORKS.CookNoodleCom[loc]) | |||
{ | |||
var res = NoodOrderCtrl.GetInstance.doNoodles.FirstOrDefault(o => o.Reset == loc); | |||
if (res != null && res.Docook) | |||
{ | |||
res.Docook = false; | |||
} | |||
} | |||
} | |||
if (mORKS.AllowInvertedFace && mORKS.RobotTaskInterlock && !mORKS.RobotOutDinnigLock && !mORKS.TakeNoodleInterlock && mORKS.RobotStatus) | |||
{ | |||
#region 修改之前的代码 | |||
@@ -962,10 +996,10 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
WriteData($"VW260", (ushort)0);//设置出汤时间 | |||
OrderChange(mORKS.CookNodelId[loc], ORDER_STATUS.COMPLETED_COOK); | |||
var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.CookNodelId[loc]); | |||
if (res != null) | |||
if (res != null) | |||
{ | |||
NoodOrderCtrl.GetInstance.statusList(res); | |||
} | |||
} | |||
else | |||
DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】异常"); | |||
DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】制作完成"); | |||
@@ -250,6 +250,11 @@ namespace BPASmartClient.MorkSUpgradedVer | |||
/// </summary> | |||
[VariableMonitor("允许倒面", "M10.0", "400")] | |||
public bool AllowInvertedFace { get; set; } | |||
/// <summary> | |||
/// 允许倒面 | |||
/// </summary> | |||
[VariableMonitor("煮面炉状态", "M7.0", "510")] | |||
public bool[] Nsm { get; set; }=new bool[6]; | |||
/// <summary> | |||
/// 出餐完成 | |||
@@ -5,6 +5,7 @@ using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
@@ -13,21 +14,21 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
public class DeviceCtrlViewModel : NotifyBase | |||
{ | |||
public static bool startCtrl = true; | |||
public BPARelayCommand<object> ChooseSet { get; set; } | |||
public DeviceCtrlViewModel() | |||
{ | |||
NoodOrderCtrl.GetInstance.FlushNood = () => | |||
{ | |||
DoN = NoodOrderCtrl.GetInstance.doNFlush; | |||
}; | |||
ChooseSet = new BPARelayCommand<object>(o => | |||
{ | |||
if (o is string @do) | |||
{ | |||
bool re = false; | |||
Application.Current.Dispatcher.Invoke(() => | |||
{ | |||
re= MessageNotify.GetInstance.ShowDialog($"确认{Convert.ToInt32(@do)}号位煮面,时长{DoN.Min}分{DoN.Senc}秒",DialogType.Information); | |||
}); | |||
var res = doNoodles.FirstOrDefault(o => o.Reset == Convert.ToInt32(@do)); | |||
if (re) | |||
if (!res.BtnIsChecked) | |||
{ | |||
if (res != null) | |||
{ | |||
@@ -36,24 +37,54 @@ namespace BPASmartClient.ViewModel | |||
res.Senc = DoN.Senc; | |||
DoN = res; | |||
ActionManage.GetInstance.Send("Startset", res); | |||
} | |||
else | |||
{ | |||
NoodOrderCtrl.GetInstance.Show($"{res.Reset}号位置正在煮面测试中,请更换位置!"); | |||
NoodOrderCtrl.GetInstance.Show($"{res.Reset}号位置已暂停"); | |||
} | |||
} | |||
else | |||
{ | |||
if (res!=null) | |||
startCtrl = true; | |||
Application.Current.Dispatcher.Invoke(() => | |||
{ | |||
re = MessageNotify.GetInstance.ShowDialog($"确认{Convert.ToInt32(@do)}号位煮面,时长{DoN.Min}分{DoN.Senc}秒", DialogType.Information); | |||
}); | |||
if (re) | |||
{ | |||
res.Docook = false; | |||
if (res != null) | |||
{ | |||
res.Docook = true; | |||
res.Min = DoN.Min; | |||
res.Senc = DoN.Senc; | |||
DoN = res; | |||
if (startCtrl) | |||
{ | |||
Thread.Sleep(2000); | |||
startCtrl = true; | |||
res.BtnIsChecked = true; | |||
ActionManage.GetInstance.Send("Startset", res); | |||
NoodOrderCtrl.GetInstance.Show($"{res.Reset}号位置已下发!"); | |||
Task.Factory.StartNew(() => { Thread.Sleep(2000); startCtrl = false; }); | |||
} | |||
else | |||
{ | |||
res.BtnIsChecked = false; | |||
NoodOrderCtrl.GetInstance.Show($"请稍后重下!!!"); | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
if (res != null) | |||
{ | |||
res.Docook = false; | |||
res.BtnIsChecked = false; | |||
} | |||
NoodOrderCtrl.GetInstance.Show($"已取消操作"); | |||
} | |||
NoodOrderCtrl.GetInstance.Show($"已取消操作"); | |||
} | |||
} | |||
}); | |||
} | |||
private DoNoodle _doN = new DoNoodle(); | |||
public DoNoodle DoN { get { return _doN; } set { _doN = value; OnPropertyChanged(); } } | |||
@@ -73,6 +104,9 @@ namespace BPASmartClient.ViewModel | |||
public int Senc { get { return _senc; } set { _senc = value; OnPropertyChanged(); } } | |||
private int _senc=0; | |||
public bool BtnIsChecked { get { return _btnIsChecked; } set { _btnIsChecked = value; OnPropertyChanged(); } } | |||
private bool _btnIsChecked = false; | |||
} | |||
public class CtrlTurn : NotifyBase | |||
{ | |||
@@ -15,6 +15,7 @@ using System.Collections.Concurrent; | |||
using System.Threading.Tasks; | |||
using System.Threading; | |||
using BPASmartClient.CustomResource.Converters; | |||
using System.Security.RightsManagement; | |||
namespace BPASmartClient | |||
{ | |||
@@ -28,6 +29,13 @@ namespace BPASmartClient | |||
public Action<string>? showInfo; | |||
public ObservableCollection<DoNoodle> doNoodles = new ObservableCollection<DoNoodle>(); | |||
public FoodMenuModel LocalOrder { get; set; } = new FoodMenuModel(); | |||
public Action? FlushNood; | |||
public DoNoodle doNFlush { get;set; } | |||
public void Flush(DoNoodle doN) | |||
{ | |||
doNFlush = doN; | |||
FlushNood?.Invoke(); | |||
} | |||
//public void CheckOrder(object o) | |||
//{ | |||
// if (o is string x) | |||
@@ -50,7 +58,7 @@ namespace BPASmartClient | |||
{ | |||
for (int i = 0; i < 6; i++) | |||
{ | |||
doNoodles.Add(new DoNoodle() { Reset = i + 1, Docook = false }); | |||
doNoodles.Add(new DoNoodle() { Reset = i + 1, Docook = false,BtnIsChecked = false}); | |||
} | |||
for (int i = 0; i < 5; i++) | |||
{ | |||
@@ -412,6 +412,38 @@ | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="MenuCheck_1" TargetType="{x:Type CheckBox}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type CheckBox}"> | |||
<Border x:Name="Cborder" Height="{TemplateBinding Height}" Background="#dddddd" CornerRadius="20" BorderThickness="2" BorderBrush="#555555" Width="{TemplateBinding Width}" > | |||
<Grid> | |||
<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" /> | |||
<TextBlock Margin="20,5" x:Name="content" Text="{TemplateBinding ContentStringFormat}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" Foreground="White"/> | |||
</Grid> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter Property="BorderBrush" TargetName="Cborder" Value="black "/> | |||
<Setter Property="Background" TargetName="Cborder" Value="{Binding Background,RelativeSource={RelativeSource Mode=TemplatedParent}}"/> | |||
<Setter Property="Foreground" TargetName="content" Value="{Binding Foreground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter Property="BorderBrush" TargetName="Cborder" Value="#777777"/> | |||
<Setter Property="BorderBrush" TargetName="Cborder" Value="#999999"/> | |||
<Setter Property="Foreground" TargetName="content" Value="White"/> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter Property="Opacity" TargetName="Cborder" Value="0.8"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<myConvert:NoodleConvert x:Key="noodleConvert"/> | |||
<myConvert:BowConvert x:Key="BowConvert"/> | |||
<myConvert:ResetConvert x:Key="resetConvert"/> | |||
@@ -37,7 +37,7 @@ | |||
</ItemsControl.ItemsPanel> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton x:Name="ad" Grid.Row="2" FontSize="25" FontWeight="Black" Width="120" Height="50" Margin="10,5" IsChecked="{Binding Docook}" ContentStringFormat="{Binding Reset}" Command="{Binding ChooseSet,ElementName=device}" CommandParameter="{Binding ElementName=ad,Path=ContentStringFormat}" Background="#ECBB52" Foreground="Black" Style="{StaticResource MenuCheck}"/> | |||
<CheckBox x:Name="ad" IsChecked="{Binding BtnIsChecked,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Grid.Row="2" FontSize="25" FontWeight="Black" Width="120" Height="50" Margin="10,5" ContentStringFormat="{Binding Reset}" Command="{Binding ChooseSet,ElementName=device}" CommandParameter="{Binding ElementName=ad,Path=ContentStringFormat}" Background="#ECBB52" Foreground="Black" Style="{StaticResource MenuCheck_1}"/> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
@@ -63,6 +63,7 @@ | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<RadioButton x:Name="ad" Grid.Row="2" FontSize="24" FontWeight="Black" Width="120" Height="100" Margin="10,5" GroupName="name" ContentStringFormat="{Binding Set}" IsChecked="{Binding UnderSet}" Click="Turn_Click" Background="#ECBB52" Foreground="Black" Style="{StaticResource MenuCheck}"/> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
@@ -104,5 +104,6 @@ namespace BPASmartClient.Control | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -29,8 +29,10 @@ namespace BPASmartClient | |||
NoodOrderCtrl.GetInstance.Init(); | |||
NoodOrderCtrl.GetInstance.showInfo = o => | |||
{ | |||
infoGrid.Visibility = Visibility.Visible; | |||
infoText.Text = o.ToString(); | |||
App.Current.Dispatcher.Invoke(() => { | |||
infoGrid.Visibility = Visibility.Visible; | |||
infoText.Text = o.ToString(); | |||
}); | |||
Thread thread = new Thread(infoView); | |||
thread.Start(); | |||