@@ -8,6 +8,7 @@ using BPASmartClient.MorkCL.Model.DB; | |||
using BPASmartClient.MorkCL.Model.Json; | |||
using BPASmartClient.MorkCL.Server; | |||
using Newtonsoft.Json.Linq; | |||
using Opc.Ua; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -651,7 +652,7 @@ namespace BPASmartClient.MorkCL | |||
device.DiningOutStart = false; | |||
DeviceProcessLogShow($"{cd.Name}-【{et}#】任务执行-{fm.eFunc.ToString()}-设置机器人取空盆。"); | |||
robot.IsIdle.Wait(Cts: TaskList[et].Cts); | |||
//TODO:暂时修改,后期优化。 | |||
while (!TaskList[et].Cts.IsCancellationRequested) | |||
@@ -763,7 +764,9 @@ namespace BPASmartClient.MorkCL | |||
{ | |||
propertyInfos = morkCL.GetType().GetProperties().ToList(); | |||
} | |||
morkCL.RecipeQueueCount = morkCL.cds.Count; | |||
morkCL.FryingPanTaskCount_1 = morkCL.cds.Count(data => data.DeviceType == EDeviceType.炒锅1); | |||
morkCL.FryingPanTaskCount_2 = morkCL.cds.Count(data => data.DeviceType == EDeviceType.炒锅2); | |||
var fryingPan1 = (FryingPanServer)devices[EDeviceType.炒锅1]; | |||
var fryingPan2 = (FryingPanServer)devices[EDeviceType.炒锅2]; | |||
@@ -1048,12 +1051,18 @@ namespace BPASmartClient.MorkCL | |||
var weghier = (OtherServer)devices[EDeviceType.外部设备]; | |||
if (weghier.WeigherTare()) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "去皮成功", $"电子秤除皮操作成功。"); | |||
Application.Current.Dispatcher.Invoke(() => | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "去皮成功", $"电子秤除皮操作成功。"); | |||
}); | |||
DeviceProcessLogShow($"电子秤除皮操作成功。"); | |||
} | |||
else | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "去皮失败", $"电子秤除皮操作失败。"); | |||
Application.Current.Dispatcher.Invoke(() => | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "去皮失败", $"电子秤除皮操作失败。"); | |||
}); | |||
DeviceProcessLogShow($"电子秤除皮操作失败。"); | |||
} | |||
@@ -1137,6 +1146,15 @@ namespace BPASmartClient.MorkCL | |||
DeviceProcessLogShow($"复位所有由上位机下发至机器人的变量失败。"); | |||
} | |||
}, "InitRobotAllVar", true); | |||
ActionManage.GetInstance.Register<Func<object>>(() => | |||
{ | |||
if (morkCL.RecipeQueueCount > 0 || morkCL.FryingPanTaskCount_1 > 0 || morkCL.FryingPanTaskCount_2 > 0) | |||
{ | |||
return true; | |||
} | |||
return false; | |||
},"SystemIsBusy",true); | |||
} | |||
Func<object, object> frypanIsIdle => (o) => | |||
@@ -1151,5 +1169,7 @@ namespace BPASmartClient.MorkCL | |||
} | |||
return false; | |||
}; | |||
} | |||
} |
@@ -394,11 +394,32 @@ namespace BPASmartClient.MorkCL | |||
[VariableMonitor("出餐箱子在位检测", "LW630")] | |||
public bool[] BoxDetection { get; set; } = new bool[4]; | |||
#region 其他变量 | |||
/// <summary> | |||
/// 入库操作许可 | |||
/// </summary> | |||
[VariableMonitor("入库操作许可")] | |||
public bool CanItemStorage { get; set; } | |||
/// <summary> | |||
/// 总任务排队数量 | |||
/// </summary> | |||
[VariableMonitor("总任务排队数量")] | |||
public int RecipeQueueCount { get; set; } | |||
/// <summary> | |||
/// 炒锅1#排队任务数量 | |||
/// </summary> | |||
[VariableMonitor("炒锅1#排队任务数量")] | |||
public int FryingPanTaskCount_1 { get; set; } | |||
/// <summary> | |||
/// 炒锅2#排队任务数量 | |||
/// </summary> | |||
[VariableMonitor("炒锅2#排队任务数量")] | |||
public int FryingPanTaskCount_2 { get; set; } | |||
#endregion | |||
#endregion | |||
} | |||
} | |||
} |
@@ -77,5 +77,7 @@ namespace BPASmartClient.MorkCL.Model.Json | |||
/// 炒锅2辅料最大位置。 | |||
/// </summary> | |||
public int FryPanAccessoriesMax_2 { get; set; } = 8; | |||
//public float IngredientsDeviation { get; set; } | |||
} | |||
} |
@@ -41,7 +41,7 @@ namespace BPASmartClient.MorkCL.Server | |||
Thread.Sleep(50); | |||
myDevice.SlaveAddress = 2; | |||
myDevice.Read<float>("LW8".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; }); | |||
myDevice.Read<float>("LW6".ToModbusAdd()).OnSuccess(s => { CurrentWeight = s; }); | |||
Thread.Sleep(50); | |||
}), $"其它外部设备-{PortName}", true); | |||
@@ -62,7 +62,7 @@ namespace BPASmartClient.MorkCL.Server | |||
{ | |||
ModbusRtu weigher = (ModbusRtu)MyModbus; | |||
weigher.SlaveAddress = 2; | |||
return weigher.Write<bool>("LB4", false).IsSuccess; | |||
return weigher.Write<bool>("LB4".ToModbusAdd(), true).IsSuccess; | |||
} | |||
else | |||
return false; | |||
@@ -77,7 +77,7 @@ namespace BPASmartClient.MorkCL.Server | |||
{ | |||
ModbusRtu weigher = (ModbusRtu)MyModbus; | |||
weigher.SlaveAddress = 2; | |||
return weigher.Write<bool>("LB3", false).IsSuccess; | |||
return weigher.Write<bool>("LB3".ToModbusAdd(), true).IsSuccess; | |||
} | |||
else | |||
return false; | |||
@@ -1,12 +1,12 @@ | |||
<Window | |||
x:Class="BPASmartClient.MorkCL.View.EditFunctionParamView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:Behavior="http://schemas.microsoft.com/xaml/behaviors" | |||
xmlns:converter="clr-namespace:BPASmartClient.MorkCL.Converter" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel" | |||
xmlns:Behavior="http://schemas.microsoft.com/xaml/behaviors" | |||
Title="EditFunctionView" | |||
Width="450" | |||
Height="350" | |||
@@ -96,22 +96,23 @@ | |||
Height="30" | |||
BorderBrush="DeepSkyBlue" | |||
BorderThickness="1" | |||
DisplayMemberPath="Name" | |||
FontSize="18" | |||
IsEditable="False" | |||
ItemsSource="{Binding ComboBoxItemsSource}" | |||
Text="{Binding ParValue}" DisplayMemberPath="Name" | |||
Text="{Binding ParValue}" | |||
Visibility="{Binding IsUseComboBox, Converter={StaticResource Bool2VisibilityConverter}}"> | |||
<!--<ComboBox.Resources> | |||
<converter:MyDataTemplateSelector | |||
x:Key="TemplateSelector" | |||
ClassTemplate="{StaticResource ClassTemplate}" | |||
IntTemplate="{StaticResource IntTemplate}" /> | |||
</ComboBox.Resources> | |||
<ComboBox.ItemTemplateSelector> | |||
<StaticResource ResourceKey="TemplateSelector" /> | |||
</ComboBox.ItemTemplateSelector>--> | |||
</ComboBox> | |||
<TextBlock | |||
Margin="5,0" | |||
@@ -7,6 +7,7 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel" | |||
xmlns:converter="clr-namespace:BPASmartClient.MorkCL.Converter" | |||
Name="库位状态" | |||
d:DesignHeight="900" | |||
d:DesignWidth="1200" | |||
@@ -19,6 +20,7 @@ | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.MorkCL;component/CustomStyle/CustomStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
<converter:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter" /> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
@@ -34,13 +36,28 @@ | |||
<!--#region 入库电子称状态--> | |||
<pry:ImageBorder Margin="5,15" /> | |||
<StackPanel Margin="15,20"> | |||
<TextBlock Width="200" Text="{Binding ScaleCurrentWeight, StringFormat=当前重量:{0:F2} g}" /> | |||
<TextBlock Width="200" Text="{Binding ScaleCurrentWeight, StringFormat=当前重量:{0:F2} Kg}" /> | |||
<Button | |||
Height="40" | |||
Margin="0,30" | |||
Command="{Binding InitialStorageCommand}" | |||
Content="清空库位" /> | |||
Content="清空全部库位" /> | |||
<Button | |||
Height="50" | |||
Margin="0,10" | |||
Command="{Binding ModifySelectStorageCommand}" | |||
CommandParameter="{Binding ElementName=List_Ingre, Path=SelectedIndex}" | |||
Content="修改所选库位信息" /> | |||
<Button | |||
Height="40" | |||
Command="{Binding ClearSelectStorageCommand}" | |||
CommandParameter="{Binding ElementName=List_Ingre, Path=SelectedIndex}" | |||
Content="清空所选库位信息" /> | |||
</StackPanel> | |||
<!--#endregion--> | |||
@@ -58,15 +75,18 @@ | |||
ItemsSource="{Binding Ingredients}" /> | |||
<Button | |||
Height="40" | |||
Margin="0,10" | |||
Command="{Binding InStorageCommand}" | |||
CommandParameter="{Binding ElementName=cmbSelectName, Path=SelectedItem}" | |||
Content="入库" /> | |||
<Button | |||
<!--<Button | |||
Height="40" | |||
Margin="0,30,0,10" | |||
Command="{Binding WeigherTareCommand}" | |||
Content="电子秤除皮" /> | |||
Content="电子秤除皮"/>--> | |||
<Button | |||
Height="40" | |||
Margin="0,10" | |||
Command="{Binding WeigherZeroCommand}" | |||
Content="电子秤置零" /> | |||
@@ -141,11 +161,13 @@ | |||
Grid.RowSpan="2" | |||
Grid.Column="1" /> | |||
<ListView | |||
x:Name="List_Ingre" | |||
Grid.Row="0" | |||
Grid.RowSpan="2" | |||
Grid.Column="1" | |||
Margin="3" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemsSource="{Binding IngredientsItorage}" | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" | |||
@@ -196,7 +218,7 @@ | |||
HorizontalAlignment="Center" | |||
FontSize="20" | |||
Foreground="#FF0084FF" | |||
Text="{Binding Weight, StringFormat={}{0} g}" /> | |||
Text="{Binding Weight, StringFormat={}{0} Kg}" /> | |||
<!--<StackPanel | |||
Grid.Row="1" | |||
@@ -17,7 +17,7 @@ | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.DataContext> | |||
<vm:ManualSetItemStorageViewModel/> | |||
<vm:ManualSetItemStorageViewModel /> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
@@ -33,5 +33,81 @@ | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹框/biankuang_.png" /> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="1*" /> | |||
<RowDefinition Height="50" /> | |||
</Grid.RowDefinitions> | |||
<!--#region 标题栏--> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Foreground="DeepSkyBlue" | |||
Text="主料库仓位信息编辑" /> | |||
<!--#endregion--> | |||
<!--#region 操作栏--> | |||
<!--<Border | |||
Grid.Row="1" | |||
BorderBrush="#3099E5" | |||
BorderThickness="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
FontSize="18" | |||
Foreground="DeepSkyBlue" | |||
Text="{Binding FuncName, StringFormat={}{0} 参数设置}" /> | |||
</Border>--> | |||
<!--#endregion--> | |||
<!--#region 内容--> | |||
<StackPanel Grid.Row="2" Orientation="Vertical"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Margin="10,15" Text="物料名称:" /> | |||
<ComboBox | |||
Width="250" | |||
Height="40" | |||
d:Text="青椒" | |||
DisplayMemberPath="Name" | |||
FontSize="25" | |||
IsEditable="False" | |||
ItemsSource="{Binding Ingredients}" | |||
Text="{Binding Storage.Name}" /> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Margin="10,15" Text="重量(Kg):" /> | |||
<TextBox | |||
Width="250" | |||
Height="40" | |||
d:Text="25" | |||
FontSize="25" | |||
Text="{Binding Storage.Weight}" /> | |||
</StackPanel> | |||
</StackPanel> | |||
<!--#endregion--> | |||
<!--#region 底部按钮栏--> | |||
<Grid Grid.Row="3"> | |||
<Button | |||
Width="100" | |||
Height="35" | |||
Margin="50,0" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SaveCommand}" | |||
Content="保存设置" /> | |||
<Button | |||
Width="100" | |||
Height="35" | |||
Margin="50,0" | |||
HorizontalAlignment="Right" | |||
Click="Button_Click" | |||
Content="取消并关闭" /> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -24,6 +24,18 @@ namespace BPASmartClient.MorkCL.View | |||
InitializeComponent(); | |||
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); }; | |||
ActionManage.GetInstance.Register((object b) => | |||
{ | |||
this.DialogResult = (bool)b; | |||
this.Close(); | |||
}, "CloseManualSetStorageView", true); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
this.DialogResult = false; | |||
this.Close(); | |||
} | |||
} | |||
} |
@@ -6,10 +6,14 @@ | |||
xmlns:local="clr-namespace:BPASmartClient.MorkCL.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.MorkCL.ViewModel" | |||
Name="参数设置" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:ParSetViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
@@ -19,9 +23,82 @@ | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<pry:ImageBorder Margin="10" /> | |||
<TextBlock HorizontalAlignment="Center" Text="暂时没有参数需要调整" /> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="1*" /> | |||
<RowDefinition Height="1*" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="1*" /> | |||
<ColumnDefinition Width="1*" /> | |||
</Grid.ColumnDefinitions> | |||
<pry:ImageBorder Grid.ColumnSpan="9" Grid.RowSpan="9"/> | |||
<StackPanel | |||
Margin="5" | |||
Grid.ColumnSpan="2" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<TextBlock Style="{StaticResource TextBlockStyle}" Text="请点击按钮保存参数:" /> | |||
<Button | |||
Grid.Column="5" | |||
Width="100" | |||
Height="40" | |||
HorizontalAlignment="Left" | |||
Command="{Binding SaveInfoCommand}" | |||
Content="保存配置" | |||
FontSize="16" /> | |||
</StackPanel> | |||
<StackPanel Grid.Row="1" Margin="5"> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接炒锅1#" | |||
FontSize="16" | |||
IsChecked="{Binding Param.FryPanConnect_1}" /> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接炒锅2#" | |||
FontSize="16" | |||
IsChecked="{Binding Param.FryPanConnect_2}" /> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接机器人" | |||
FontSize="16" | |||
IsChecked="{Binding Param.RobotConnet}" /> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接外部设备(电子秤以及空盘仓位传感器)" | |||
FontSize="16" | |||
IsChecked="{Binding Param.OtherDeviceConnect}" /> | |||
</StackPanel> | |||
<!--<StackPanel Grid.Row="1" Grid.Column="2"> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接炒锅1#" | |||
FontSize="16" /> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接炒锅2#" | |||
FontSize="16" /> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接机器人" | |||
FontSize="16" /> | |||
<CheckBox | |||
Margin="5" | |||
Content="连接外部设备(电子秤以及空盘仓位传感器)" | |||
FontSize="16" /> | |||
</StackPanel>--> | |||
<!--<StackPanel Grid.Row="2" Margin="5"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="主料重量偏差值(Kg):"/> | |||
<TextBox Text="{Binding Param.IngredientsDeviation}" Width="100" Height="30" d:Text="1.23" FontSize="22"/> | |||
</StackPanel> | |||
</StackPanel>--> | |||
</Grid> | |||
</UserControl> |
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.MorkCL.HelpClass; | |||
using System.Reflection.Metadata; | |||
using System.Windows.Markup; | |||
@@ -14,11 +15,14 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
WriteAgitaParamCommand = new(async () => | |||
{ | |||
if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//{ | |||
// return; | |||
//} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
ActionManage.GetInstance.Send("WriteUshort", new WriteModel<ushort>(FryingPanSelect, "LW1", (ushort)(AgitaFrequency*100))); | |||
await SendWriteRequest("LB10"); | |||
@@ -32,12 +36,20 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB0", true)); | |||
ShowNotify($"写入搅拌启动成功。"); | |||
}); | |||
StopAgitateCommand = new(() => | |||
{ | |||
if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//{ | |||
// return; | |||
//} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
@@ -47,7 +59,11 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
WriteHeatParamCommand = new(async () => | |||
{ | |||
if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//{ | |||
// return; | |||
//} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
@@ -63,13 +79,21 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
ActionManage.GetInstance.Send("WriteBool", new WriteModel<bool>(FryingPanSelect, "LB3", true)); | |||
ShowNotify($"写入加热启动成功。"); | |||
}); | |||
StopHeatCommand = new(() => | |||
{ | |||
if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//{ | |||
// return; | |||
//} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
@@ -90,6 +114,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
object[] para = new object[3]; | |||
para[0]= FryingPanSelect; | |||
para[1] = ChannelSelect+1; | |||
@@ -105,6 +133,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
var loc = StirFryLocSelect + 17; | |||
await SendWriteRequest($"LB{loc}"); | |||
@@ -116,6 +148,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
await SendWriteRequest("LB12"); | |||
ShowNotify($"写入回原点成功。"); | |||
}); | |||
@@ -125,6 +161,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
await SendWriteRequest("LB16"); | |||
ShowNotify($"写入去调料投料位成功。"); | |||
}); | |||
@@ -135,6 +175,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
await SendWriteRequest("LB13"); | |||
ShowNotify($"写入出餐启动成功。"); | |||
}); | |||
@@ -145,6 +189,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
await SendWriteRequest("LB14"); | |||
ShowNotify($"写入炒锅清洗成功。"); | |||
}); | |||
@@ -171,6 +219,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
return; | |||
} | |||
//复位所有变量。 | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
ResetFryPanVariable(FryingPanSelect); | |||
await SendWriteRequest("LB21"); | |||
ShowNotify($"设置设备初始化成功。"); | |||
@@ -178,7 +230,11 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
StopDeviceCommand = new(async () => | |||
{ | |||
if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//if (!GetDeviceIsIdle(FryingPanSelect)) | |||
//{ | |||
// return; | |||
//} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
@@ -192,7 +248,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
return; | |||
} | |||
if (!MessageNotify.GetInstance.ShowDialog("确认是否进行手动操作?")) | |||
{ | |||
return; | |||
} | |||
await SendWriteRequest("LB23"); | |||
ShowNotify($"设置设备复位成功。"); | |||
}); | |||
@@ -69,7 +69,16 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"失败,物料位置应为正整数!"); | |||
return; | |||
} | |||
if (CurrentMaterialType == "调料" && (MaterialLoc <= 0 || MaterialLoc>3)) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"失败,调料位置应大于0 且小于等于 3 !"); | |||
return; | |||
} | |||
if (CurrentMaterialType == "辅料" && (MaterialLoc <= 0 || MaterialLoc > 8)) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "提示", $"失败,调料位置应大于0 且小于等于 8 !"); | |||
return; | |||
} | |||
#endregion 数据验证 | |||
//新增 | |||
@@ -26,10 +26,10 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
ActionManage.GetInstance.Register((object o) => | |||
{ | |||
if (o != null) | |||
if (o != null && o is float f) | |||
{ | |||
#if !FORMAL | |||
ScaleCurrentWeight = (float)o; | |||
ScaleCurrentWeight = f; | |||
#else | |||
ScaleCurrentWeight = 1.23f; | |||
#endif | |||
@@ -115,11 +115,91 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
}); | |||
WeigherTareCommand = new(() => | |||
{ | |||
ActionManage.GetInstance.Send("WeighrTare"); | |||
if (MessageNotify.GetInstance.ShowDialog("请确认是否执行电子秤【除皮】操作?")) | |||
{ | |||
Task.Run(() => | |||
{ | |||
ActionManage.GetInstance.Send("WeighrTare"); | |||
}); | |||
} | |||
}); | |||
WeigherZeroCommand = new(() => | |||
{ | |||
ActionManage.GetInstance.Send("WeighrZero"); | |||
if (MessageNotify.GetInstance.ShowDialog("请确认是否执行电子秤【置零】操作?")) | |||
{ | |||
Task.Run(() => | |||
{ | |||
ActionManage.GetInstance.Send("WeighrZero"); | |||
}); | |||
} | |||
}); | |||
ModifySelectStorageCommand = new((o) => | |||
{ | |||
if (o is not null && o is int index) | |||
{ | |||
if (ActionManage.GetInstance.SendResult("SystemIsBusy") is bool isBusy) | |||
{ | |||
if (isBusy == true) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "失败", $"当前还有配方任务在排队制作,请稍后后再试。"); | |||
return; | |||
} | |||
if (MessageNotify.GetInstance.ShowDialog($"确认修改库位【{index + 1}】的库位信息吗?")) | |||
{ | |||
if (index >= 0 && index < Json<ItemStorageInfo>.Data.IngredientsStorage.Length) | |||
{ | |||
ManualSetItemStorageView view = new(); | |||
ActionManage.GetInstance.Send("SendItemStorageInfo", index); | |||
var result= view.ShowDialog(); | |||
ActionManage.GetInstance.Send("RefreshItemStorage"); | |||
if (result==true) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "成功", $"修改库位【{index + 1}】信息成功。"); | |||
} | |||
} | |||
else | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "失败", $"未找到库位【{index + 1}】,请确认后重试。"); | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
ClearSelectStorageCommand = new((o) => | |||
{ | |||
if (o is not null && o is int index) | |||
{ | |||
if (ActionManage.GetInstance.SendResult("SystemIsBusy") is bool isBusy) | |||
{ | |||
if (isBusy == true) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "失败", $"当前还有配方任务在排队制作,请稍后后再试。"); | |||
return; | |||
} | |||
if (MessageNotify.GetInstance.ShowDialog($"确认清除库位【{index + 1}】的库位信息吗?")) | |||
{ | |||
if (index >= 0 && index < Json<ItemStorageInfo>.Data.IngredientsStorage.Length) | |||
{ | |||
Json<ItemStorageInfo>.Data.IngredientsStorage[index] = new ItemStorage(); | |||
Json<ItemStorageInfo>.Save(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "成功", $"清除库位【{index+1}】信息成功。"); | |||
ActionManage.GetInstance.Send("RefreshItemStorage"); | |||
} | |||
else | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, Application.Current.MainWindow, "失败", $"未找到库位【{index + 1}】,请确认后重试。"); | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
@@ -147,11 +227,20 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
/// <summary> | |||
/// 电子秤除皮。 | |||
/// </summary> | |||
[Obsolete("除皮功能弃用,不会用这个功能。")] | |||
public BPARelayCommand WeigherTareCommand { get; set; } | |||
/// <summary> | |||
/// 电子秤置零。 | |||
/// </summary> | |||
public BPARelayCommand WeigherZeroCommand { get; set; } | |||
/// <summary> | |||
/// 修改指定库位信息。 | |||
/// </summary> | |||
public BPARelayCommand<object> ModifySelectStorageCommand { get; set; } | |||
/// <summary> | |||
/// 清空指定库位信息。 | |||
/// </summary> | |||
public BPARelayCommand<object> ClearSelectStorageCommand { get; set; } | |||
private float _ScaleCurrentWeight; | |||
@@ -193,13 +282,15 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
set { _Ingredients = value; OnPropertyChanged(); } | |||
} | |||
private bool _CanItemStorage; | |||
//private int _storageIndex; | |||
///// <summary> | |||
///// 库位选择的Index。 | |||
///// </summary> | |||
//public int StorageIndex | |||
//{ | |||
// get { return _storageIndex; } | |||
// set { _storageIndex = value;OnPropertyChanged(); } | |||
//} | |||
/// <summary>入库许可。</summary> | |||
public bool CanItemStorage | |||
{ | |||
get { return _CanItemStorage; } | |||
set { _CanItemStorage = value; OnPropertyChanged(); } | |||
} | |||
} | |||
} |
@@ -1,4 +1,9 @@ | |||
using System; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.MorkCL.Model.DB; | |||
using BPASmartClient.MorkCL.Model.Json; | |||
using BPASmartClient.MorkCL.Server; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -8,6 +13,92 @@ namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
public class ManualSetItemStorageViewModel:NotifyBase | |||
{ | |||
public ManualSetItemStorageViewModel() | |||
{ | |||
ActionManage.GetInstance.Register((object o) => | |||
{ | |||
if (o is not null && o is int storageIndex) | |||
{ | |||
if (storageIndex >= 0 && storageIndex <= 11) | |||
{ | |||
var storage = Json<ItemStorageInfo>.Data.IngredientsStorage[storageIndex]; | |||
if (storage is not null) | |||
{ | |||
Storage = new(); | |||
StorageIndex = storageIndex; | |||
Storage.Weight = storage.Weight; | |||
Storage.Name = storage.Name; | |||
Storage.IsEmploy = storage.IsEmploy; | |||
Storage.MaterialID = storage.MaterialID; | |||
} | |||
} | |||
} | |||
}, "SendItemStorageInfo", true); | |||
//获取所有主料。 | |||
Ingredients = new ObservableCollection<IngredientsTB>(SqliteHelper.GetInstance.GetIngredients()); | |||
SaveCommand = new(() => | |||
{ | |||
if (Storage.Weight is float f) | |||
{ | |||
if (f > 0) | |||
{ | |||
if (StorageIndex >= 0 && StorageIndex <= 11) | |||
{ | |||
var storage = Json<ItemStorageInfo>.Data.IngredientsStorage[StorageIndex]; | |||
storage.Name = Storage.Name; | |||
storage.Weight = Storage.Weight; | |||
storage.MaterialID = Ingredients.FirstOrDefault(material => material.Name == Storage.Name).Id; | |||
storage.IsEmploy = true; | |||
Json<ItemStorageInfo>.Save(); | |||
ActionManage.GetInstance.Send("CloseManualSetStorageView", true); | |||
} | |||
else | |||
{ | |||
} | |||
} | |||
else | |||
MessageNotify.GetInstance.ShowDialog("重量不应小于零,请确认后再试。"); | |||
} | |||
else | |||
MessageNotify.GetInstance.ShowDialog("重量因为数字,请确认后再试。"); | |||
}); | |||
} | |||
private ItemStorage _storage; | |||
/// <summary> | |||
/// 仓位信息 | |||
/// </summary> | |||
public ItemStorage Storage | |||
{ | |||
get { return _storage; } | |||
set { _storage = value; OnPropertyChanged(); } | |||
} | |||
private int _storageIndex; | |||
/// <summary> | |||
/// 仓位索引。 | |||
/// </summary> | |||
public int StorageIndex | |||
{ | |||
get { return _storageIndex; } | |||
set { _storageIndex = value; OnPropertyChanged(); } | |||
} | |||
private ObservableCollection<IngredientsTB> _Ingredients; | |||
/// <summary>所有的主料数据。作为ComboBox的数据源。</summary> | |||
public ObservableCollection<IngredientsTB> Ingredients | |||
{ | |||
get { return _Ingredients; } | |||
set { _Ingredients = value; OnPropertyChanged(); } | |||
} | |||
public BPARelayCommand SaveCommand { get; set; } | |||
} | |||
} |
@@ -0,0 +1,41 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.MorkCL.Model.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkCL.ViewModel | |||
{ | |||
public class ParSetViewModel:NotifyBase | |||
{ | |||
public ParSetViewModel() | |||
{ | |||
Param = Json<ConnectPar>.Data; | |||
SaveInfoCommand = new(() => | |||
{ | |||
if (MessageNotify.GetInstance.ShowDialog("确认保存配置文件?")) | |||
{ | |||
Json<ConnectPar>.Save(); | |||
} | |||
}); | |||
} | |||
private ConnectPar _param; | |||
/// <summary> | |||
/// 配置参数。 | |||
/// </summary> | |||
public ConnectPar Param | |||
{ | |||
get { return _param; } | |||
set { _param = value; OnPropertyChanged(); } | |||
} | |||
/// <summary> | |||
/// 保存配置信息 | |||
/// </summary> | |||
public BPARelayCommand SaveInfoCommand { get; set; } | |||
} | |||
} |