@@ -201,6 +201,7 @@ | |||
<None Remove="Image\组合边框1.1.png" /> | |||
<None Remove="Image\组合边框1.png" /> | |||
<None Remove="Image\组合边框2.1.png" /> | |||
<None Remove="Image\组合边框2.png" /> | |||
<None Remove="Image\维护.png" /> | |||
<None Remove="Image\背景.png" /> | |||
<None Remove="Image\背景2.png" /> | |||
@@ -362,6 +363,7 @@ | |||
<Resource Include="Image\组合边框1.1.png" /> | |||
<Resource Include="Image\组合边框1.png" /> | |||
<Resource Include="Image\组合边框2.1.png" /> | |||
<Resource Include="Image\组合边框2.png" /> | |||
<Resource Include="Image\背景2.png" /> | |||
<Resource Include="Image\背景3.jpg" /> | |||
<Resource Include="Image\背景框.png" /> | |||
@@ -0,0 +1,15 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Model | |||
{ | |||
public enum Status | |||
{ | |||
等待配料, | |||
正在配料, | |||
配料完成 | |||
} | |||
} |
@@ -104,7 +104,26 @@ namespace BPASmartClient.Model | |||
/// 3:下料完成 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public ushort RecipeStatus { get { return _mRecipeStatus; } set { _mRecipeStatus = value; OnPropertyChanged(); } } | |||
public ushort RecipeStatus | |||
{ | |||
get { return _mRecipeStatus; } | |||
set | |||
{ | |||
_mRecipeStatus = value; | |||
if (value == 1) Status = Status.等待配料; | |||
else if (value == 2) Status = Status.正在配料; | |||
else if (value == 3) Status = Status.配料完成; | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private ushort _mRecipeStatus = 1; | |||
/// <summary> | |||
/// 配料状态名称 | |||
/// </summary> | |||
[Newtonsoft.Json.JsonIgnore] | |||
public Status Status { get { return _mStatus; } set { _mStatus = value; OnPropertyChanged(); } } | |||
private Status _mStatus; | |||
} | |||
} |
@@ -81,6 +81,7 @@ namespace BPASmartClient.DosingSystem | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
DeviceNum = i + 1, | |||
IpAddress = $"192.168.1.{i + 1}", | |||
}); | |||
} | |||
@@ -102,6 +103,7 @@ namespace BPASmartClient.DosingSystem | |||
devices.Add(new Devices() | |||
{ | |||
DeviceName = $"测试设备{i + 1}", | |||
DeviceNum = i + 1, | |||
IpAddress = $"192.168.1.{i + 1}", | |||
}); | |||
} | |||
@@ -17,7 +17,7 @@ namespace BPASmartClient.DosingSystem | |||
public bool Heartbeat { get; set; } | |||
/// <summary> | |||
/// 接收完成 | |||
/// 接收配方完成 | |||
/// </summary> | |||
public bool ResComplete { get; set; } | |||
@@ -338,10 +338,6 @@ | |||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | |||
<ListBox.ItemsPanel> | |||
<ItemsPanelTemplate> | |||
<!--<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" />--> | |||
<WrapPanel Orientation="Horizontal" /> | |||
</ItemsPanelTemplate> | |||
</ListBox.ItemsPanel> | |||
@@ -351,8 +347,8 @@ | |||
<Grid | |||
Name="tt" | |||
Height="220" | |||
Width="180" | |||
Height="220" | |||
Margin="5"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
@@ -715,7 +711,7 @@ | |||
</Grid> | |||
<ScrollViewer | |||
<!--<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
@@ -777,27 +773,260 @@ | |||
</ItemsControl> | |||
</Grid> | |||
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}" | |||
--> | |||
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}" | |||
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}"> | |||
</TreeView>--> | |||
<!-- 等待和已完成 --> | |||
<TreeView | |||
<!-- 等待和已完成 --> | |||
<!--<TreeView | |||
x:Name="repiceList" | |||
HorizontalAlignment="Stretch" | |||
Background="Transparent" | |||
BorderThickness="0" | |||
ItemContainerStyle="{StaticResource recipeTreeItem}" | |||
ItemsSource="{Binding UserTreeWait}" | |||
ScrollViewer.VerticalScrollBarVisibility="Visible" /> | |||
ScrollViewer.VerticalScrollBarVisibility="Visible" />--> | |||
<!-- | |||
</Grid> | |||
</Border> | |||
</ScrollViewer>--> | |||
<!--#region 等待制作和制作完成列表显示--> | |||
<Grid | |||
Name="WaitOrCompleteGrid" | |||
Grid.Row="1" | |||
Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="0" | |||
Margin="0,5" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="100" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="序号" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="配方名称" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="状态" /> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<ScrollViewer | |||
Grid.Row="1" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl Name="Wait" ItemsSource="{Binding UserTreeWait}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="50" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="100" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding SerialNum}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
Grid.Column="1" | |||
Margin="5,0,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="Yellow" | |||
Text="等待执行" /> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 制作中设备状态监视--> | |||
<Grid | |||
Name="CookingGrid" | |||
Grid.Row="1" | |||
Margin="10" | |||
Visibility="Collapsed"> | |||
<!--<Grid.RowDefinitions> | |||
<RowDefinition Height="30"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions>--> | |||
<ItemsControl ItemsSource="{Binding recipeProcesses}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<Image | |||
Grid.RowSpan="3" | |||
Source="/BPASmartClient.CustomResource;component/Image/组合边框2.1.png" | |||
Stretch="Fill" /> | |||
<Image | |||
Grid.RowSpan="3" | |||
Source="/BPASmartClient.CustomResource;component/Image/组合边框2.png" | |||
Stretch="Fill" /> | |||
<TextBlock | |||
Grid.Row="0" | |||
Margin="10,15,0,0" | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Center" | |||
FontSize="18" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeName}" /> | |||
<!--#region 表格标题栏设置--> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="5,8" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="原料" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="状态" /> | |||
<Border | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="10" | |||
BorderBrush="{StaticResource bordColor}" | |||
BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<!--#endregion--> | |||
<ItemsControl | |||
Grid.Row="2" | |||
Margin="0,0,0,15" | |||
ItemsSource="{Binding RawMaterials}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel | |||
Margin="0,0,5,0" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="{Binding RawMaterialName}" /> | |||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text=":" /> | |||
</StackPanel> | |||
<StackPanel | |||
Grid.Column="1" | |||
Margin="2,0,0,0" | |||
Orientation="Horizontal"> | |||
<TextBlock | |||
Margin="0,0,5,0" | |||
Foreground="{Binding Status, Converter={StaticResource ForegroundConverter}}" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="{Binding Status}" /> | |||
<TextBlock | |||
FontFamily="/BPASmartClient.CustomResource;component/Fonts/#iconfont" | |||
FontSize="20" | |||
Foreground="{Binding Status, Converter={StaticResource ForegroundConverter}}" | |||
Style="{StaticResource TitleTextblockStyle}" | |||
Text="{Binding Status, Converter={StaticResource StatusIconConverter}}" /> | |||
</StackPanel> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</Grid> | |||
<!--#endregion--> | |||
</Grid> | |||
</Border> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
@@ -24,33 +24,39 @@ namespace BPASmartClient.DosingSystem.View | |||
public RecipeControlView() | |||
{ | |||
InitializeComponent(); | |||
RadioButtonWait_Click(null,null); | |||
RadioButtonWait_Click(null, null); | |||
} | |||
private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeControlViewModel.UserTreeCompelete; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
//repiceList.ItemsSource = RecipeControlViewModel.UserTreeCompelete; | |||
//repiceList.Visibility = Visibility.Visible; | |||
//repiceListMaking.Visibility = Visibility.Hidden; | |||
this.Wait.ItemsSource = RecipeControlViewModel.UserTreeCompelete; | |||
CookingGrid.Visibility = Visibility.Collapsed; | |||
WaitOrCompleteGrid.Visibility = Visibility.Visible; | |||
this.Wait.Visibility = Visibility.Hidden; | |||
} | |||
private void RadioButtonWait_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeControlViewModel.UserTreeWait; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
//repiceList.ItemsSource = RecipeControlViewModel.UserTreeWait; | |||
//repiceList.Visibility = Visibility.Visible; | |||
//repiceListMaking.Visibility = Visibility.Hidden; | |||
this.Wait.ItemsSource = RecipeControlViewModel.UserTreeWait; | |||
CookingGrid.Visibility = Visibility.Collapsed; | |||
WaitOrCompleteGrid.Visibility = Visibility.Visible; | |||
this.Wait.Visibility = Visibility.Visible; | |||
} | |||
private void RadioButtonMaking_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceListMaking.Visibility = Visibility.Visible; | |||
repiceList.Visibility = Visibility.Hidden; | |||
//repiceListMaking.Visibility = Visibility.Visible; | |||
//repiceList.Visibility = Visibility.Hidden; | |||
WaitOrCompleteGrid.Visibility = Visibility.Collapsed; | |||
this.Wait.Visibility = Visibility.Collapsed; | |||
CookingGrid.Visibility = Visibility.Visible; | |||
} | |||
} | |||
} |
@@ -41,6 +41,12 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
public string IpAddress { get { return _mIpAddress; } set { _mIpAddress = value; OnPropertyChanged(); } } | |||
private string _mIpAddress; | |||
/// <summary> | |||
/// 设备编号 | |||
/// </summary> | |||
public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } } | |||
private int _mDeviceNum; | |||
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } } | |||
private string _mDeviceName; | |||
@@ -15,6 +15,7 @@ using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.Model.柔性味魔方; | |||
using BPASmartClient.Model; | |||
using System.Diagnostics; | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
@@ -37,11 +38,11 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
string ip = Recipes.ElementAt(index).RawMaterials.ElementAt(i).DeviceIp; | |||
var device = DeviceInquire.GetInstance.GetDevice(ip); | |||
if (!device.IsConnected) | |||
{ | |||
MessageNotify.GetInstance.ShowDialog($"设备 【{device.DeviceName}】 未连接,不允许下发此配方", DialogType.Error); | |||
return; | |||
} | |||
//if (!device.IsConnected) | |||
//{ | |||
// MessageNotify.GetInstance.ShowDialog($"设备 【{device.DeviceName}】 未连接,不允许下发此配方", DialogType.Error); | |||
// return; | |||
//} | |||
} | |||
} | |||
Recipes.ElementAt(index).IsEnable = false; | |||
@@ -75,27 +76,89 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
})); | |||
CurrentRecipeName = Recipes.ElementAt(index).RecipeName; | |||
#region 配方下发到PLC操作相关 | |||
//配方数据写入到输送机 | |||
//SiemensDevice.GetInstance.MySiemens.WriteClass | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == CurrentRecipeName); | |||
List<int> recipeData = new List<int>(); | |||
if (res != null) | |||
{ | |||
//DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动并写入每个原料重量 | |||
//var res = DeviceInquire.GetInstance.GetDevice(item.DeviceIp).deviceStatus.DeviceNum; | |||
App.Current.Dispatcher.Invoke(new Action(() => | |||
var tInfo = res.RawMaterials.GroupBy(p => p.Loc);//获取桶号信息 | |||
if (tInfo != null) | |||
{ | |||
recipeProcesses.Add(new RawMaterialModel() | |||
for (int i = 0; i < tInfo.Count(); i++) | |||
{ | |||
RawMaterialName = item.RawMaterialName, | |||
RecipeStatus = item.RecipeStatus, | |||
RawMaterialSource = item.RawMaterialSource, | |||
RawMaterialId = item.RawMaterialId, | |||
}); | |||
})); | |||
int data = 0; | |||
for (int m = 0; m < tInfo.ElementAt(i).Count(); m++) | |||
{ | |||
var TempName = tInfo.ElementAt(i).ElementAt(m).RawMaterialName; | |||
var tempDevice = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == TempName); | |||
if (tempDevice != null) | |||
{ | |||
data = data.SetBitValue((byte)tempDevice.DeviceNum, true); | |||
} | |||
} | |||
recipeData.Add(data); | |||
} | |||
} | |||
} | |||
if (recipeData.Count <= 0) | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog("配方数据解析失败"); | |||
return; | |||
} | |||
int offset = 2; | |||
//写入配方数据 | |||
MessageNotify.GetInstance.ShowRunLog("开始写入配方数据"); | |||
recipeData.ForEach(item => | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBD{offset}", item); | |||
offset = offset += 4; | |||
}); | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", recipeData.Count);//配方使用桶数写入 | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX0.1", true);//配方执行启动 | |||
Stopwatch sw = new Stopwatch(); | |||
App.Current.Dispatcher.Invoke(() => { recipeProcesses.Add(Recipes.ElementAt(index)); }); | |||
sw.Restart(); | |||
while (!GlobalDevice.PlcData.ResComplete) | |||
{ | |||
if (sw.ElapsedMilliseconds >= 3000) | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog("获取配方下发反馈超时"); | |||
break; | |||
} | |||
if (GlobalDevice.PlcData.ResComplete) SiemensDevice.GetInstance.MySiemens.Write("DB3.DBX0.1", false); | |||
Thread.Sleep(100); | |||
} | |||
#endregion | |||
//foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
//{ | |||
// //DeviceInquire.GetInstance.GetDevice(item.DeviceIp)?.Start(item.RawMaterialWeight);//启动并写入每个原料重量 | |||
// //var res = DeviceInquire.GetInstance.GetDevice(item.DeviceIp).deviceStatus.DeviceNum; | |||
// App.Current.Dispatcher.Invoke(new Action(() => | |||
// { | |||
// //ObservableCollection<RawMaterialModel> rawMaterialModels = new ObservableCollection<RawMaterialModel>(); | |||
// //rawMaterialModels.Add(new RawMaterialModel() | |||
// //{ | |||
// // RawMaterialName = item.RawMaterialName, | |||
// // RecipeStatus = item.RecipeStatus, | |||
// // RawMaterialSource = item.RawMaterialSource, | |||
// // RawMaterialId = item.RawMaterialId, | |||
// //}); | |||
// //if (recipeProcesses.Count > 0) | |||
// //{ | |||
// // recipeProcesses.ElementAt(0).RawMaterials.Add(new RawMaterialModel() | |||
// // { | |||
// // RawMaterialName = item.RawMaterialName, | |||
// // RecipeStatus = item.RecipeStatus, | |||
// // RawMaterialSource = item.RawMaterialSource, | |||
// // RawMaterialId = item.RawMaterialId, | |||
// // }); | |||
// //} | |||
// })); | |||
//} | |||
Recipes.ElementAt(index).Are.WaitOne();//阻塞,直到当前配方完成 | |||
RecipeNames.TryDequeue(out string deviceName); | |||
@@ -126,34 +189,57 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
//设备状态显示 | |||
if (Recipes.ElementAt(i).RecipeName == CurrentRecipeName) | |||
{ | |||
string deviceName = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).DeviceName; | |||
int index = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == deviceName); | |||
if (index >= 0 && index < recipeProcesses.Count) | |||
string tempRawMaterialName = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp).DeviceName; | |||
//int index = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == tempRawMaterialName); | |||
int recIndex = recipeProcesses.ToList().FindIndex(p => p.RecipeName == CurrentRecipeName); | |||
if (recIndex >= 0 && recIndex < recipeProcesses.Count) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.ElementAt(index).RecipeStatus = RunStatus; })); | |||
} | |||
} | |||
int index = recipeProcesses.ElementAt(recIndex).RawMaterials.ToList().FindIndex(p => p.RawMaterialName == tempRawMaterialName); | |||
if (index >= 0 && index < recipeProcesses.ElementAt(recIndex).RawMaterials.Count) | |||
{ | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(index).RecipeStatus = RunStatus; })); | |||
} | |||
//App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.ElementAt(index).RecipeStatus = RunStatus; })); | |||
var proc = recipeProcesses.Where(p => p.RecipeStatus == 3).ToList(); | |||
if (proc != null && proc.Count > 0 && proc.Count == recipeProcesses.Count) | |||
{ | |||
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | |||
if (recipIndex >= 0 && recipIndex < Recipes.Count) | |||
{ | |||
for (int n = 0; n < recipeProcesses.Count; n++) | |||
var proc = recipeProcesses.ElementAt(recIndex).RawMaterials.Where(p => p.RecipeStatus == 3).ToList(); | |||
if (proc != null && proc.Count > 0 && proc.Count == recipeProcesses.Count) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp); | |||
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | |||
if (recipIndex >= 0 && recipIndex < Recipes.Count) | |||
{ | |||
for (int n = 0; n < recipeProcesses.Count; n++) | |||
{ | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp); | |||
} | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
Recipes.ElementAt(recipIndex).IsEnable = true; | |||
Recipes.ElementAt(recipIndex).Are.Set(); | |||
} | |||
} | |||
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
Recipes.ElementAt(recipIndex).IsEnable = true; | |||
Recipes.ElementAt(recipIndex).Are.Set(); | |||
} | |||
} | |||
//var proc = recipeProcesses.Where(p => p.RecipeStatus == 3).ToList(); | |||
//var proc = recipeProcesses.Where(p => p.RecipeStatus == 3).ToList(); | |||
//if (proc != null && proc.Count > 0 && proc.Count == recipeProcesses.Count) | |||
//{ | |||
// int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName); | |||
// if (recipIndex >= 0 && recipIndex < Recipes.Count) | |||
// { | |||
// for (int n = 0; n < recipeProcesses.Count; n++) | |||
// { | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp).StatusReset();//完成配料的设备运行状态地址写0 | |||
// MessageNotify.GetInstance.ShowRunLog(Recipes.ElementAt(recipIndex).RawMaterials.ElementAt(n).DeviceIp); | |||
// } | |||
// App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); })); | |||
// Recipes.ElementAt(recipIndex).IsEnable = true; | |||
// Recipes.ElementAt(recipIndex).Are.Set(); | |||
// } | |||
//} | |||
@@ -173,15 +259,6 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
} | |||
Thread.Sleep(100); | |||
}), "RecipeControlViewModelStatusInquire"); | |||
//测试数据 | |||
/* RawMaterialModel rawMaterial_1 = new RawMaterialModel { RawMaterialName = "香料_1" }; | |||
RawMaterialModel rawMaterial_2 = new RawMaterialModel { RawMaterialName = "香料_2" }; | |||
RawMaterialModel rawMaterial_3 = new RawMaterialModel { RawMaterialName = "香料_3" }; | |||
RawMaterialModel rawMaterial_4 = new RawMaterialModel { RawMaterialName = "香料_4" }; | |||
ObservableCollection<RawMaterialModel> rawMaterials = new ObservableCollection<RawMaterialModel> { rawMaterial_1, rawMaterial_2, rawMaterial_3, rawMaterial_4 }; | |||
UserTreeCompelete.Add(new RecipeModel { RecipeName = "完成的香料1", RawMaterials = rawMaterials }); | |||
UserTreeCompelete.Add(new RecipeModel { RecipeName = "完成的香料2", RawMaterials = rawMaterials });*/ | |||
} | |||
public RelayCommand<object> StartCommand { get; set; } | |||
@@ -196,8 +273,9 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
/// <summary> | |||
/// 当前正在制作的配方 | |||
/// </summary> | |||
public static ObservableCollection<RecipeModel> recipeProcesses { get; set; } = new ObservableCollection<RecipeModel>(); | |||
//public static ObservableCollection<RawMaterialModel> recipeProcesses { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
public static ObservableCollection<RawMaterialModel> recipeProcesses { get; set; } = new ObservableCollection<RawMaterialModel>(); | |||
/// <summary> | |||
/// 等待制作的配方 | |||
/// </summary> | |||
@@ -213,18 +291,34 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
if (o == null) return; | |||
if (o is string id) | |||
{ | |||
var res = recipeProcesses.FirstOrDefault(p => p.RawMaterialId == id); | |||
if (res != null) | |||
var Recipe = recipeProcesses.FirstOrDefault(p => p.RecipeName == CurrentRecipeName); | |||
if (Recipe != null) | |||
{ | |||
if (res.RecipeStatus == 3) | |||
{ | |||
res.RecipeStatus = 1; | |||
} | |||
else | |||
var res = Recipe.RawMaterials.FirstOrDefault(p => p.RawMaterialId == id); | |||
if (res != null) | |||
{ | |||
res.RecipeStatus = 3; | |||
if (res.RecipeStatus == 3) | |||
{ | |||
res.RecipeStatus = 1; | |||
} | |||
else | |||
{ | |||
res.RecipeStatus = 3; | |||
} | |||
} | |||
} | |||
//var res = recipeProcesses.FirstOrDefault(p => p.RawMaterialId == id); | |||
//if (res != null) | |||
//{ | |||
// if (res.RecipeStatus == 3) | |||
// { | |||
// res.RecipeStatus = 1; | |||
// } | |||
// else | |||
// { | |||
// res.RecipeStatus = 3; | |||
// } | |||
//} | |||
} | |||
} | |||
} | |||
@@ -158,10 +158,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeDesignerSCADA", "BeDesign | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.RecipeManagement", "BPASmart.RecipeManagement\BPASmart.RecipeManagement.csproj", "{28EBFC11-184A-4B88-A7B3-84F3FD768520}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PermissionManagement", "PermissionManagement\PermissionManagement.csproj", "{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.SmallBatchingSystem", "BPASmart.SmallBatchingSystem\BPASmart.SmallBatchingSystem.csproj", "{DB6DC970-859C-4C63-AE9B-BA415D56CECD}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.ConfigurationSoftware", "BPASmart.ConfigurationSoftware\BPASmart.ConfigurationSoftware.csproj", "{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.UserManagement", "BPASmart.UserManagement\BPASmart.UserManagement.csproj", "{06F30619-AD37-4CA0-838F-0431867E0932}" | |||
@@ -174,8 +170,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.SmallBatchin | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkMOC", "BPASmartClient.MorkMOC\BPASmartClient.MorkMOC.csproj", "{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingHKProject", "BPASmartClient.DosingProject\BPASmartClient.DosingHKProject.csproj", "{6763F73A-555C-41E2-91F7-ADF26C59A946}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmart.MenuLoad", "BPASmart.MenuLoad\BPASmart.MenuLoad.csproj", "{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}" | |||
EndProject | |||
Global | |||
@@ -1492,46 +1486,6 @@ Global | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x64.Build.0 = Release|Any CPU | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x86.ActiveCfg = Release|Any CPU | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520}.Release|x86.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x64.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Debug|x86.Build.0 = Debug|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|ARM64.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x64.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x64.Build.0 = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x86.ActiveCfg = Release|Any CPU | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401}.Release|x86.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x64.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Debug|x86.Build.0 = Debug|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|ARM64.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x64.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x64.Build.0 = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x86.ActiveCfg = Release|Any CPU | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD}.Release|x86.Build.0 = Release|Any CPU | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -1652,26 +1606,6 @@ Global | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x64.Build.0 = Release|Any CPU | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x86.ActiveCfg = Release|Any CPU | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2}.Release|x86.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM64.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|ARM64.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x64.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x64.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x86.ActiveCfg = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Debug|x86.Build.0 = Debug|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM64.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|ARM64.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x64.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x64.Build.0 = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x86.ActiveCfg = Release|Any CPU | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946}.Release|x86.Build.0 = Release|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B}.Debug|ARM.ActiveCfg = Debug|Any CPU | |||
@@ -1764,15 +1698,12 @@ Global | |||
{06F0B369-0483-46DD-82D2-70431FB505C1} = {7B0175AD-BB74-4A98-B9A7-1E289032485E} | |||
{DF8B4C38-39DE-4220-AB60-885CAE6D1E47} = {06F0B369-0483-46DD-82D2-70431FB505C1} | |||
{28EBFC11-184A-4B88-A7B3-84F3FD768520} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{BE6E7BC1-F250-4D11-8051-1B0F93AD2401} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{DB6DC970-859C-4C63-AE9B-BA415D56CECD} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{897F8379-3301-4CBE-9BCA-AF7FD2F963A9} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{06F30619-AD37-4CA0-838F-0431867E0932} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{2DB084E8-B951-4D71-A203-FD0902EBA2C6} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{E7CC45BF-7393-4BA7-A9AD-B1A1F5B265F3} = {CDC1E762-5E1D-4AE1-9DF2-B85761539086} | |||
{BA588F22-87FB-4124-AF62-CA8DC492ED7D} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{D5081D7B-3EBB-42C7-8FB9-A889870D08C2} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F} | |||
{6763F73A-555C-41E2-91F7-ADF26C59A946} = {8712125E-14CD-4E1B-A1CE-4BDE03805942} | |||
{7A7547D3-F2EF-4DA4-AD45-D1B49210082B} = {06F0B369-0483-46DD-82D2-70431FB505C1} | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||