@@ -67,7 +67,6 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||
} | |||
Thread.Sleep(100); | |||
}), $"{typeof(AlarmT).Name},报警通用模块监听"); | |||
} | |||
/// <summary> | |||
@@ -284,7 +284,7 @@ namespace BPASmartClient.Device | |||
foreach (var faces in res) | |||
{ | |||
if (faces.Name == "IStatus") | |||
{ | |||
{ | |||
InterfaceStatus = item.GetValue(this) as IStatus; | |||
GetMonitorData(InterfaceStatus); | |||
} | |||
@@ -185,6 +185,126 @@ namespace BPASmartClient.Helper | |||
return false; | |||
} | |||
public static string ToBinString(this object value) | |||
{ | |||
int num = 0; | |||
int num2 = 0; | |||
int num3 = 0; | |||
string text = ""; | |||
long num4 = 0L; | |||
try | |||
{ | |||
if (value.GetType().Name.IndexOf("[]") < 0) | |||
{ | |||
string a = value.GetType().Name; | |||
switch (a) | |||
{ | |||
case "Byte": | |||
num3 = 7; | |||
num4 = (byte)value; | |||
break; | |||
case "UInt16": | |||
num3 = 15; | |||
num4 = (ushort)value; | |||
break; | |||
case "Int16": | |||
num3 = 15; | |||
num4 = (short)value; | |||
break; | |||
case "UInt32": | |||
num3 = 31; | |||
num4 = (uint)value; | |||
break; | |||
case "Int32": | |||
num3 = 31; | |||
num4 = (int)value; | |||
break; | |||
case "Int64": | |||
num3 = 63; | |||
num4 = (long)value; | |||
break; | |||
default: | |||
throw new Exception(); | |||
} | |||
for (num = num3; num >= 0; num += -1) | |||
{ | |||
if ((num + 1) % 4 == 0) text = text + " "; | |||
text = (((num4 & (long)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1")); | |||
} | |||
} | |||
else | |||
{ | |||
switch (value.GetType().Name) | |||
{ | |||
case "Byte[]": | |||
{ | |||
num3 = 7; | |||
byte[] array4 = (byte[])value; | |||
for (num2 = 0; num2 <= array4.Length - 1; num2++) | |||
{ | |||
for (num = num3; num >= 0; num += -1) | |||
{ | |||
text = (((array4[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1")); | |||
} | |||
} | |||
break; | |||
} | |||
case "Int16[]": | |||
{ | |||
num3 = 15; | |||
short[] array2 = (short[])value; | |||
for (num2 = 0; num2 <= array2.Length - 1; num2++) | |||
{ | |||
for (num = num3; num >= 0; num += -1) | |||
{ | |||
text = (((array2[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1")); | |||
} | |||
} | |||
break; | |||
} | |||
case "Int32[]": | |||
{ | |||
num3 = 31; | |||
int[] array3 = (int[])value; | |||
for (num2 = 0; num2 <= array3.Length - 1; num2++) | |||
{ | |||
for (num = num3; num >= 0; num += -1) | |||
{ | |||
text = (((array3[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1")); | |||
} | |||
} | |||
break; | |||
} | |||
case "Int64[]": | |||
{ | |||
num3 = 63; | |||
byte[] array = (byte[])value; | |||
for (num2 = 0; num2 <= array.Length - 1; num2++) | |||
{ | |||
for (num = num3; num >= 0; num += -1) | |||
{ | |||
text = (((array[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1")); | |||
} | |||
} | |||
break; | |||
} | |||
default: | |||
throw new Exception(); | |||
} | |||
} | |||
return text; | |||
} | |||
catch | |||
{ | |||
return ""; | |||
} | |||
} | |||
@@ -201,5 +201,4 @@ namespace BPASmartClient.Helper | |||
return false; | |||
} | |||
} | |||
} |
@@ -62,6 +62,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||
/// </summary> | |||
public static int Recipe4DosingStatus { get; set; } | |||
public static int[] RecipeDosingStatus { get; set; } = new int[4] { 0, 0, 0, 0 }; | |||
public static bool[] AllowIssueRecipe { get; set; } = new bool[4] { false, false, false, false }; | |||
public static bool[] ReceviceFinishRecipe { get; set; } = new bool[4] { false, false, false, false }; | |||
public static bool[] DosingFinishRecipe { get; set; } = new bool[4] { false, false, false, false }; | |||
public static bool[] IsTrayArrive { get; set; } = new bool[5] { false, false, false, false,false }; | |||
public static DateTime[] RecipeDosingTime { get; set; } = new DateTime[4] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now }; | |||
/// <summary> | |||
/// 是否处于手动下发配方 | |||
/// </summary> | |||
@@ -58,6 +58,25 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
/// </summary> | |||
public bool Tray5InPlace { get; set; } | |||
/// <summary> | |||
/// 配方1配料完成 | |||
/// </summary> | |||
public bool Recipe1DoisngFinish { get; set; } | |||
/// <summary> | |||
/// 配方2配料完成 | |||
/// </summary> | |||
public bool Recipe2DoisngFinish { get; set; } | |||
/// <summary> | |||
/// 配方3配料完成 | |||
/// </summary> | |||
public bool Recipe3DoisngFinish { get; set; } | |||
/// <summary> | |||
/// 配方4配料完成 | |||
/// </summary> | |||
public bool Recipe4DoisngFinish { get; set; } | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public short RecipeCode { get; set; } | |||
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
public class HKPlcCommAddress | |||
{ | |||
} | |||
} |
@@ -44,5 +44,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// 原料数据 | |||
/// </summary> | |||
public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>(); | |||
public RecipeSource RecipesSource { get { return _mRecipesSource; } set { _mRecipesSource = value; OnPropertyChanged(); } } | |||
private RecipeSource _mRecipesSource = RecipeSource.远程; | |||
} | |||
public enum RecipeSource | |||
{ | |||
本地, | |||
远程 | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
public class RecipeDosing | |||
{ | |||
public string RecipeCode { get; set; } | |||
public int RecipeTray { get; set; } | |||
public int DosingStatus { get; set; } | |||
public bool IsAllowIssue { get; set; } | |||
public bool IsAGVArrive { get; set; } | |||
public bool IsReceviceFinish { get; set; } | |||
public bool IsDosingFinish { get; set; } | |||
public DateTime DosingStartTime { get; set; } | |||
} | |||
} |
@@ -17,7 +17,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
public bool IsConnected => Siemens_PLC_S7.IsConnected; | |||
public DL_Status_DB DL_Status = new DL_Status_DB(); | |||
bool a = false; | |||
bool printFirstLog = false; | |||
public void Init() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
@@ -30,14 +30,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens | |||
//var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391); | |||
if (res != null && res is DL_Start_DB start) | |||
{ | |||
if (GVL_BigStation.Order_Request && GVL_BigStation.SiemensSendRecipeStatus == 0) | |||
if (GVL_BigStation.SiemensSendRecipeStatus == 0) | |||
{ | |||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true); | |||
MessageNotify.GetInstance.ShowRunLog($"向西门子请求订单"); | |||
GVL_BigStation.SiemensSendRecipeStatus = 1; | |||
if (GVL_BigStation.Order_Request) | |||
{ | |||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true); | |||
MessageNotify.GetInstance.ShowRunLog($"向西门子请求订单"); | |||
GVL_BigStation.SiemensSendRecipeStatus = 1; | |||
} | |||
else | |||
{ | |||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false); | |||
if (!printFirstLog) | |||
{ | |||
printFirstLog = true; | |||
MessageNotify.GetInstance.ShowRunLog($"plc不允许下发订单"); | |||
} | |||
} | |||
} | |||
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1) | |||
{ | |||
printFirstLog = false; | |||
ActionManage.GetInstance.Send("SiemensSendRecipe", start); | |||
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false); | |||
MessageNotify.GetInstance.ShowRunLog($"西门子下发订单:{start.RecipeCode}"); | |||
@@ -374,7 +374,7 @@ | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" | |||
Columns="7" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
@@ -386,7 +386,7 @@ | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<!--<RowDefinition />--> | |||
<!--<RowDefinition Height="0.1*"/>--> | |||
</Grid.RowDefinitions> | |||
<!--<TextBox | |||
@@ -465,7 +465,7 @@ | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Button Grid.Row="2" | |||
<!--<Button Grid.Row="2" | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
@@ -474,7 +474,7 @@ | |||
Content="修改原料名称" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
Style="{StaticResource ImageButtonStyle}"></Button>--> | |||
<Image | |||
@@ -536,7 +536,7 @@ | |||
Height="{Binding ElementName=gr, Path=ActualHeight}" | |||
Margin="10,0,30,0" | |||
ConveyorBeltWidth="70" | |||
Direction="2" | |||
Direction="0" | |||
StrokeBrush="#00BEFA" | |||
StrokeDashArray="1.5 1.5" | |||
StrokeFillBrush="#00BEFA" | |||
@@ -558,7 +558,7 @@ | |||
<UniformGrid | |||
HorizontalAlignment="Left" | |||
VerticalAlignment="Top" | |||
Columns="6" | |||
Columns="7" | |||
Rows="1" /> | |||
</ItemsPanelTemplate> | |||
</ListView.ItemsPanel> | |||
@@ -568,7 +568,6 @@ | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
<!--<RowDefinition Height="0.1*"/>--> | |||
@@ -637,7 +636,7 @@ | |||
Foreground="#FF0084FF" | |||
Text=" 号仓" /> | |||
</StackPanel> | |||
<Button Grid.Row="2" | |||
<!--<Button Grid.Row="2" | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
@@ -645,7 +644,7 @@ | |||
CommandParameter="{Binding DeviceName}" | |||
Content="修改原料名称" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
Style="{StaticResource ImageButtonStyle}"></Button>--> | |||
<Image | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
@@ -13,6 +13,8 @@ | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="100" /> | |||
<RowDefinition Height="1*" /> | |||
</Grid.RowDefinitions> | |||
@@ -23,7 +25,8 @@ | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding Tray1InPlace}" | |||
Command="{Binding TrayInPlace}" | |||
CommandParameter="1" | |||
Content="AGV到达工位1" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
@@ -32,7 +35,8 @@ | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding Tray2InPlace}" | |||
Command="{Binding TrayInPlace}" | |||
CommandParameter="2" | |||
Content="AGV到达工位2" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
@@ -41,7 +45,8 @@ | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding Tray3InPlace}" | |||
Command="{Binding TrayInPlace}" | |||
CommandParameter="3" | |||
Content="AGV到达工位3" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
@@ -50,7 +55,8 @@ | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding Tray4InPlace}" | |||
Command="{Binding TrayInPlace}" | |||
CommandParameter="4" | |||
Content="AGV到达工位4" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
@@ -59,11 +65,71 @@ | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding Tray5InPlace}" | |||
Command="{Binding TrayInPlace}" | |||
CommandParameter="5" | |||
Content="AGV到达工位5" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
</StackPanel> | |||
</Grid> | |||
<Grid Grid.Row="1"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center"> | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding TrayLeave}" | |||
CommandParameter="1" | |||
Content="AGV离开工位1" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding TrayLeave}" | |||
CommandParameter="2" | |||
Content="AGV离开工位2" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding TrayLeave}" | |||
CommandParameter="3" | |||
Content="AGV离开工位3" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding TrayLeave}" | |||
CommandParameter="4" | |||
Content="AGV离开工位4" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding TrayLeave}" | |||
CommandParameter="5" | |||
Content="AGV离开工位5" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
</StackPanel> | |||
</Grid> | |||
<Grid Grid.Row="2"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center"> | |||
<Button | |||
Width="200" | |||
Height="40" | |||
@@ -84,10 +150,11 @@ | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
</StackPanel> | |||
</Grid> | |||
<Grid Grid.Row="1"> | |||
<Grid Grid.Row="3"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel> | |||
<WrapPanel> | |||
@@ -100,66 +167,66 @@ | |||
<Button Style="{StaticResource ImageButtonStyle}" Width="120" Height="40" FontSize="20" Content="取消订单" Margin="5" Command="{Binding CancelRecipeCommand}"></Button> | |||
</WrapPanel> | |||
</StackPanel> | |||
<StackPanel Grid.Column="1"> | |||
<StackPanel Grid.Column="3"> | |||
<WrapPanel> | |||
<TextBlock Text="料仓名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBinName}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBinName}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓1名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin1Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin1Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓2名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin2Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin2Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓3名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin3Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin3Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓4名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin4Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin4Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓5名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin5Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin5Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓6名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin6Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin6Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓7名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin7Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin7Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓8名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin8Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin8Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓9名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin9Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin9Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓10名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin10Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin10Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓11名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin11Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin11Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓12名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin12Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin12Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓13名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin13Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin13Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel> | |||
<TextBlock Text="料仓14名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding StockBin14Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="{Binding StockBin14Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock> | |||
</WrapPanel> | |||
</StackPanel> | |||
</Grid> | |||
@@ -159,11 +159,23 @@ | |||
<CheckBox | |||
x:Name="IsUseLocalRecipe" | |||
Margin="0,0,10,0" | |||
Content="本地配方" | |||
Content="使用本地配方配料" | |||
FontFamily="楷体" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
IsChecked="{Binding IsUseLocalRecipe}" /> | |||
<!--<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
Command="{Binding RefreshRecipe}" | |||
Content="刷新配方" | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" />--> | |||
<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
@@ -419,7 +419,6 @@ | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.25*" /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Name="ggr" Margin="10"> | |||
@@ -822,7 +821,7 @@ | |||
</Grid> | |||
<Grid | |||
<!--<Grid | |||
Name="gr" | |||
Grid.Column="1" | |||
Margin="10"> | |||
@@ -924,11 +923,11 @@ | |||
</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 | |||
x:Name="repiceList" | |||
@@ -945,6 +944,6 @@ | |||
</Grid> | |||
</Border> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid>--> | |||
</Grid> | |||
</UserControl> |
@@ -28,24 +28,24 @@ namespace BPASmartClient.JXJFoodBigStation.View | |||
private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
//repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete; | |||
//repiceList.Visibility = Visibility.Visible; | |||
//repiceListMaking.Visibility = Visibility.Hidden; | |||
} | |||
private void RadioButtonWait_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait; | |||
repiceList.Visibility = Visibility.Visible; | |||
repiceListMaking.Visibility = Visibility.Hidden; | |||
//repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait; | |||
//repiceList.Visibility = Visibility.Visible; | |||
//repiceListMaking.Visibility = Visibility.Hidden; | |||
} | |||
private void RadioButtonMaking_Click(object sender, RoutedEventArgs e) | |||
{ | |||
repiceListMaking.Visibility = Visibility.Visible; | |||
repiceList.Visibility = Visibility.Hidden; | |||
//repiceListMaking.Visibility = Visibility.Visible; | |||
//repiceList.Visibility = Visibility.Hidden; | |||
} | |||
} | |||
@@ -12,6 +12,8 @@ using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.JXJFoodBigStation.Model; | |||
using BPASmartClient.JXJFoodBigStation.View; | |||
using System.Windows.Forms; | |||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | |||
using System.Reflection; | |||
namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
@@ -19,101 +21,30 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
public HardwareStatusViewModel() | |||
{ | |||
for (int i = 6; i > 0; i--) | |||
{ | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
DeviceName = i.ToString(), | |||
DeviceNum = i, | |||
RunStatus = true, | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
for (int i = 7; i < 13; i++) | |||
foreach (PropertyInfo mi in typeof(StockBinName).GetProperties()) | |||
{ | |||
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
object ab = GVL_BigStation.stockBinName.GetType().GetProperty(mi.Name).GetValue(GVL_BigStation.stockBinName, null); | |||
if (mi.Name=="RawMaterialName1" || mi.Name == "RawMaterialName2" || mi.Name == "RawMaterialName3" || mi.Name == "RawMaterialName4" || mi.Name == "RawMaterialName5" || mi.Name == "RawMaterialName6" || mi.Name == "RawMaterialName7") | |||
{ | |||
DeviceName = i.ToString(), | |||
DeviceNum = i, | |||
RunStatus = false, | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
StartCommand = new RelayCommand<string>((deviceName) => | |||
{ | |||
if (deviceName != null) | |||
{ | |||
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (top != null) | |||
{ | |||
ActionManage.GetInstance.Send("StartTopDevice", deviceName); | |||
} | |||
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (bottom != null) | |||
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
ActionManage.GetInstance.Send("StartBottomDevice", deviceName); | |||
} | |||
DeviceName = ab.ToString(), | |||
DeviceNum = TopDeviceCurrentStatuses.Count + 1, | |||
RunStatus = true, | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
}); | |||
StopCommand = new RelayCommand<string>((deviceName) => | |||
{ | |||
if (deviceName != null) | |||
else | |||
{ | |||
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (top != null) | |||
{ | |||
ActionManage.GetInstance.Send("StopTopDevice", deviceName); | |||
} | |||
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
if (bottom != null) | |||
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() | |||
{ | |||
ActionManage.GetInstance.Send("StopBottomDevice", deviceName); | |||
} | |||
DeviceName = ab.ToString(), | |||
DeviceNum = BottomDeviceCurrentStatuses.Count + 8, | |||
RunStatus = false, | |||
Weight = new Random().Next(0, 100) | |||
}); | |||
} | |||
}); | |||
UpdateRawMaterName = new RelayCommand<string>((deviceName) => | |||
{ | |||
ActionManage.GetInstance.CancelRegister("UpdateDeviceName"); | |||
ActionManage.GetInstance.Register(new Action<object>((res) => | |||
{ | |||
if (res != null && res is string newName) | |||
{ | |||
int cnt = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName); | |||
if (cnt >= 0) | |||
{ | |||
int index = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | |||
int index1 = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | |||
if (index == -1 && index1 == -1) | |||
{ | |||
var obj = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
obj.DeviceName = newName; | |||
} | |||
else | |||
{ | |||
System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
} | |||
} | |||
else | |||
{ | |||
int index = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | |||
int index1 = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName); | |||
if (index == -1 && index1 == -1) | |||
{ | |||
var obj = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName); | |||
obj.DeviceName = newName; | |||
} | |||
else | |||
{ | |||
System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); | |||
} | |||
} | |||
} | |||
}), "UpdateDeviceName"); | |||
ChangeDeviceNameView view = new ChangeDeviceNameView(); | |||
view.ShowDialog(); | |||
}); | |||
} | |||
} | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>(); | |||
@@ -21,25 +21,21 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
public ManualFlowViewModel() | |||
{ | |||
Tray1InPlace = new RelayCommand(() => | |||
TrayInPlace = new RelayCommand<object>((o) => | |||
{ | |||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(1, true); | |||
}); | |||
Tray2InPlace = new RelayCommand(() => | |||
{ | |||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(2, true); | |||
}); | |||
Tray3InPlace = new RelayCommand(() => | |||
{ | |||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(3, true); | |||
}); | |||
Tray4InPlace = new RelayCommand(() => | |||
{ | |||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(4, true); | |||
if (o != null) | |||
{ | |||
byte loc = Convert.ToByte(o); | |||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, true); | |||
} | |||
}); | |||
Tray5InPlace = new RelayCommand(() => | |||
TrayLeave = new RelayCommand<object>((o) => | |||
{ | |||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(5, true); | |||
if (o!=null) | |||
{ | |||
byte loc = Convert.ToByte(o); | |||
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, false); | |||
} | |||
}); | |||
ClearTrayInPlace = new RelayCommand(() => | |||
{ | |||
@@ -82,11 +78,8 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
StockBin14Name = GVL_BigStation.stockBinName.RawMaterialName14; | |||
}), "设备状态读取",true); | |||
} | |||
public RelayCommand Tray1InPlace { get; set; } | |||
public RelayCommand Tray2InPlace { get; set; } | |||
public RelayCommand Tray3InPlace { get; set; } | |||
public RelayCommand Tray4InPlace { get; set; } | |||
public RelayCommand Tray5InPlace { get; set; } | |||
public RelayCommand<object> TrayInPlace { get; set; } | |||
public RelayCommand<object> TrayLeave { get; set; } | |||
public RelayCommand ClearTrayInPlace { get; set; } | |||
public RelayCommand ClearAllRecipe { get; set; } | |||
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } } | |||
@@ -94,34 +87,35 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
public string CancelRecipeCode { get { return _CancelRecipeCode; } set { _CancelRecipeCode = value; OnPropertyChanged(); } } | |||
public string _CancelRecipeCode { get; set; } | |||
public static string StockBin1Name { get { return _StockBin1Name; } set { _StockBin1Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin1Name { get; set; } | |||
private static string _StockBin1Name { get; set; } | |||
public static string StockBin2Name { get { return _StockBin2Name; } set { _StockBin2Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin2Name { get; set; } | |||
private static string _StockBin2Name { get; set; } | |||
public static string StockBin3Name { get { return _StockBin3Name; } set { _StockBin3Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin3Name { get; set; } | |||
private static string _StockBin3Name { get; set; } | |||
public static string StockBin4Name { get { return _StockBin4Name; } set { _StockBin4Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin4Name { get; set; } | |||
private static string _StockBin4Name { get; set; } | |||
public static string StockBin5Name { get { return _StockBin5Name; } set { _StockBin5Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin5Name { get; set; } | |||
private static string _StockBin5Name { get; set; } | |||
public static string StockBin6Name { get { return _StockBin6Name; } set { _StockBin6Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin6Name { get; set; } | |||
private static string _StockBin6Name { get; set; } | |||
public static string StockBin7Name { get { return _StockBin7Name; } set { _StockBin7Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin7Name { get; set; } | |||
private static string _StockBin7Name { get; set; } | |||
public static string StockBin8Name { get { return _StockBin8Name; } set { _StockBin8Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin8Name { get; set; } | |||
private static string _StockBin8Name { get; set; } | |||
public static string StockBin9Name { get { return _StockBin9Name; } set { _StockBin9Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin9Name { get; set; } | |||
private static string _StockBin9Name { get; set; } | |||
public static string StockBin10Name { get { return _StockBin10Name; } set { _StockBin10Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin10Name { get; set; } | |||
private static string _StockBin10Name { get; set; } | |||
public static string StockBin11Name { get { return _StockBin11Name; } set { _StockBin11Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin11Name { get; set; } | |||
private static string _StockBin11Name { get; set; } | |||
public static string StockBin12Name { get { return _StockBin12Name; } set { _StockBin12Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin12Name { get; set; } | |||
private static string _StockBin12Name { get; set; } | |||
public static string StockBin13Name { get { return _StockBin13Name; } set { _StockBin13Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin13Name { get; set; } | |||
private static string _StockBin13Name { get; set; } | |||
public static string StockBin14Name { get { return _StockBin14Name; } set { _StockBin14Name = value; OnStaticPropertyChanged(); } } | |||
public static string _StockBin14Name { get; set; } | |||
private static string _StockBin14Name { get; set; } | |||
public RelayCommand CancelRecipeCommand { get; set; } | |||
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged; | |||
@@ -46,6 +46,27 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
RecipeInfosView nrv = new RecipeInfosView(); | |||
nrv.ShowDialog(); | |||
}); | |||
//RefreshRecipe = new RelayCommand(() => | |||
//{ | |||
// foreach (var item in ProcessControl.GetInstance.RawMaterialsInfo) | |||
// { | |||
// RawMaterialNames.Add(item.RawMaterialName); | |||
// } | |||
// foreach (var item in Json<LocalRecipe>.Data.Recipes) | |||
// { | |||
// foreach (var tep in item.RawMaterial) | |||
// { | |||
// if (RawMaterialNames.Contains(tep.RawMaterialName)) | |||
// { | |||
// int index = Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == tep.RawMaterialName); | |||
// tep.RawMaterialLocation = ProcessControl.GetInstance.RawMaterialsInfo.ElementAt(index).RawMaterialLocation; | |||
// } | |||
// } | |||
// } | |||
//}); | |||
//模拟配方 | |||
//NewSimulateRecipe = new RelayCommand(() => | |||
//{ | |||
@@ -104,9 +125,12 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
// public RelayCommand NewSimulateRecipe { get; set; } | |||
public RelayCommand ClearAllRecipe { get; set; } | |||
public RelayCommand NewRecipe { get; set; } | |||
public RelayCommand RefreshRecipe { get; set; } | |||
public bool IsUseLocalRecipe { get { return _isUseLocalRecipe; } set { _isUseLocalRecipe = value; OnPropertyChanged(); } } | |||
public bool _isUseLocalRecipe { get; set; } | |||
public RelayCommand<string> RemoveCommand { get; set; } | |||
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>(); | |||
public ObservableCollection<string> RawMaterialNames { get; set; } = new ObservableCollection<string>(); | |||
} | |||
} |
@@ -3,6 +3,7 @@ using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodBigStation.Model; | |||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
@@ -44,9 +45,10 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName); | |||
if (res != null) | |||
{ | |||
if (!ProcessControl.GetInstance.LocalRecipes.Contains(res)) | |||
if (!Json<RemoteRecipe>.Data.Recipes.Contains(res)) | |||
{ | |||
ProcessControl.GetInstance.LocalRecipes.Add(res); | |||
res.RecipesSource = RecipeSource.本地; | |||
Json<RemoteRecipe>.Data.Recipes.Add(res); | |||
MessageNotify.GetInstance.ShowRunLog($"手动下发配方:{recipeName}完成"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"配方下发完成"); | |||
} | |||
@@ -78,21 +78,21 @@ namespace BPASmartClient.JXJFoodSmallStation | |||
#region 配方管理菜单 | |||
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>(); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "味魔方配方管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.RecipeSettingsView" | |||
}); | |||
//RecipeManage.Add(new SubMenumodel() | |||
//{ | |||
// SubMenuName = "味魔方配方管理", | |||
// SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
// AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
// ToggleWindowPath = "View.RecipeSettingsView" | |||
//}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "味魔方配方下发", | |||
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.RecipeControlView" | |||
}); | |||
//RecipeManage.Add(new SubMenumodel() | |||
//{ | |||
// SubMenuName = "味魔方配方下发", | |||
// SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 }, | |||
// AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
// ToggleWindowPath = "View.RecipeControlView" | |||
//}); | |||
RecipeManage.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "本地配方管理", | |||
@@ -120,7 +120,7 @@ namespace BPASmartClient.JXJFoodSmallStation | |||
ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>(); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "柔性味魔方参数设置", | |||
SubMenuName = "味魔方参数设置", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.DeviceMaterialParView" | |||
@@ -141,11 +141,19 @@ namespace BPASmartClient.JXJFoodSmallStation | |||
}); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "原料与料仓对应设置", | |||
SubMenuName = "原料与料仓管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.StockBinRawMaterialView" | |||
}); | |||
ParSet.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "西门子物料管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.BomOfMaterialView" | |||
}); | |||
MenuManage.GetInstance.menuModels.Add(new MenuModel() | |||
{ | |||
MainMenuIcon = "", | |||
@@ -252,12 +260,19 @@ namespace BPASmartClient.JXJFoodSmallStation | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "变量监控", | |||
SubMenuName = "Plc变量监控", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.PlcVarMonitorView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "流程变量监控", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodSmallStation", | |||
ToggleWindowPath = "View.ProcessMonitorView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "设备状态", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
@@ -26,6 +26,9 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Compile Update="View\BomOfMaterialView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
<Compile Update="View\RobotView.xaml.cs"> | |||
<SubType>Code</SubType> | |||
</Compile> | |||
@@ -38,6 +41,10 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Page Update="View\BomOfMaterialView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
<SubType>Designer</SubType> | |||
</Page> | |||
<Page Update="View\ChangeDeviceNameView.xaml"> | |||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime> | |||
</Page> | |||
@@ -0,0 +1,21 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.Bom | |||
{ | |||
public class BomMaterial:ObservableObject | |||
{ | |||
public int Count { get { return _count; } set { _count = value; OnPropertyChanged(); } } | |||
public int _count { get; set; } | |||
public string MaterialCode { get { return _materialCode; }set { _materialCode = value;OnPropertyChanged(); } } | |||
private string _materialCode=""; | |||
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } } | |||
private string _materialName=""; | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
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.JXJFoodSmallStation.Model.Bom | |||
{ | |||
public class BomMaterialData | |||
{ | |||
public ObservableCollection<BomMaterial> Materials { get; set; } = new ObservableCollection<BomMaterial>(); | |||
} | |||
} |
@@ -7,9 +7,9 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.GVL | |||
{ | |||
[AttributeUsage(AttributeTargets.Property)] | |||
public sealed class PlcCommAttribute:Attribute | |||
public sealed class VarCommAttribute:Attribute | |||
{ | |||
public PlcCommAttribute(string address,string des) | |||
public VarCommAttribute(string address,string des) | |||
{ | |||
Address = address; | |||
Describe = des; |
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||
using BPASmartClient.JXJFoodSmallStation.Model.GVL; | |||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | |||
using System; | |||
using System.Collections.Concurrent; | |||
@@ -16,181 +17,270 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation()); | |||
private GVL_SmallStation() { } | |||
public static PlcReadAddressDB3 plcReadDataDB3 { get; set; } = new PlcReadAddressDB3(); | |||
public PlcReadAddressDB3 plcReadDataDB3 { get; set; } = new PlcReadAddressDB3(); | |||
/// <summary> | |||
/// 配料站料仓数目 | |||
/// </summary> | |||
public const int Max_DosingSotckBinNum = 15; | |||
/// <summary> | |||
/// 风送料仓数目 | |||
/// </summary> | |||
public const int Max_PowderSotckBinNum = 5; | |||
[VarComm("Global", "订单取消")] | |||
/// <summary> | |||
/// 订单取消 | |||
/// </summary> | |||
public static bool Order_Cancel { get; set; } | |||
public bool NotUseSmallDosing { get; set; } | |||
[VarComm("Global", "订单取消")] | |||
/// <summary> | |||
/// 取消订单的编号 | |||
/// 订单取消 | |||
/// </summary> | |||
public static string Order_CancelRecipeCode { get; set; } = ""; | |||
public bool Order_Cancel { get; set; } | |||
[VarComm("Global", "订单取消的配方编号")] | |||
/// <summary> | |||
/// 托盘1托盘到位 逻辑完成 | |||
/// 订单取消的配方编号 | |||
/// </summary> | |||
public static int Tray1LogicFinish { get; set; } = 0; | |||
public string Order_CancelRecipeCode { get; set; } = ""; | |||
[VarComm("Global", "柔性配料料仓配料情况")] | |||
/// <summary> | |||
/// 托盘2托盘到位 逻辑完成 | |||
/// 料仓配料情况 | |||
/// </summary> | |||
public static int Tray2LogicFinish { get; set; } = 0; | |||
public ushort StockBinDosing { get; set; } = 0; | |||
[VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] | |||
/// <summary> | |||
/// 托盘1有货架 | |||
/// 托盘1托盘到位情况 | |||
/// </summary> | |||
public static bool Station1HaveTray { get; set; } | |||
public int Tray1LogicFinish { get; set; } = 0; | |||
[VarComm("Global", "托盘2托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")] | |||
/// <summary> | |||
/// 托盘2有货架 | |||
/// 托盘2托盘到位 逻辑完成 | |||
/// </summary> | |||
public int Tray2LogicFinish { get; set; } = 0; | |||
[VarComm("Global", "托盘1有货架")] | |||
/// <summary> | |||
/// 托盘1有货架 | |||
/// </summary> | |||
public static bool Station2HaveTray { get; set; } | |||
public bool Station1HaveTray { get; set; } | |||
[VarComm("Global", "托盘2有货架")] | |||
/// <summary> | |||
/// 托盘2有货架 | |||
/// </summary> | |||
public static int nStep { get; set; } | |||
public bool Station2HaveTray { get; set; } | |||
[VarComm("Global", "托盘1传感器信号")] | |||
/// <summary> | |||
/// 托盘1传感器信号 | |||
/// </summary> | |||
public static bool Station1Sensor { get; set; } | |||
public bool Station1Sensor { get; set; } | |||
[VarComm("Global", "托盘2传感器信号")] | |||
/// <summary> | |||
/// 托盘2传感器信号 | |||
/// </summary> | |||
public static bool Station2Sensor { get; set; } | |||
public bool Station2Sensor { get; set; } | |||
[VarComm("Global", "托盘1气缸信号")] | |||
/// <summary> | |||
/// 托盘1气缸信号 | |||
/// </summary> | |||
public static bool Station1Cylinder { get; set; } | |||
public bool Station1Cylinder { get; set; } | |||
[VarComm("Global", "托盘2气缸信号")] | |||
/// <summary> | |||
/// 托盘2气缸信号 | |||
/// </summary> | |||
public static bool Station2Cylinder { get; set; } | |||
public bool Station2Cylinder { get; set; } | |||
[VarComm("Global", "AGV放托盘1完成")] | |||
/// <summary> | |||
/// AGV放托盘1完成 | |||
/// </summary> | |||
public static bool AGV_PutTray1Finish { get; set; } | |||
public bool AGV_PutTray1Finish { get; set; } | |||
[VarComm("Global", "AGV取托盘1完成")] | |||
/// <summary> | |||
/// AGV取托盘1完成 | |||
/// </summary> | |||
public static bool AGV_GetTray1Finish { get; set; } | |||
public bool AGV_GetTray1Finish { get; set; } | |||
[VarComm("Global", "AGV放托盘2完成")] | |||
/// <summary> | |||
/// AGV放托盘1完成 | |||
/// </summary> | |||
public bool AGV_PutTray2Finish { get; set; } | |||
public static bool AGV_PutTray2Finish { get; set; } | |||
public static bool AGV_GetTray2Finish { get; set; } | |||
[VarComm("Global", "AGV取托盘2完成")] | |||
/// <summary> | |||
/// AGV取托盘2完成 | |||
/// </summary> | |||
public bool AGV_GetTray2Finish { get; set; } | |||
public static bool CylinderReset { get; set; } | |||
[VarComm("Global", "托盘1气缸复位")] | |||
/// <summary> | |||
/// 配料站料仓数目 | |||
/// 托盘1气缸复位 | |||
/// </summary> | |||
public const int Max_DosingSotckBinNum = 15; | |||
public bool CylinderReset { get; set; } | |||
[VarComm("Global", "发送给plc的心跳")] | |||
/// <summary> | |||
/// 风送料仓数目 | |||
/// 发送给plc的心跳 | |||
/// </summary> | |||
public const int Max_PowderSotckBinNum = 5; | |||
public bool HeartBeatToPlc { get; set; } = false; | |||
[VarComm("Global", "来自plc的心跳")] | |||
/// <summary> | |||
/// 来自plc的心跳 | |||
/// </summary> | |||
public bool HeartBeatFromPlc { get; set; } = false; | |||
[VarComm("Global", "是否允许西门子下发配方")] | |||
/// <summary> | |||
/// 是否允许西门子下发配方 | |||
/// </summary> | |||
public static bool IsAllowSiemensSendRecipe { get; set; } = false; | |||
public bool IsAllowSiemensSendRecipe { get; set; } = false; | |||
[VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")] | |||
/// <summary> | |||
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收配方完成 4:上位机向西门子请求配料 5:西门子确认开始配料 6:西门子确认开始配料 信号复位 | |||
/// </summary> | |||
public static int SiemensSendRecipeStatus { get; set; } = 0; | |||
public int SiemensSendRecipeStatus { get; set; } = 0; | |||
[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 | |||
/// </summary> | |||
public int RecipeStatusIDTray1 { get; set; } = 0; | |||
/// <summary> | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方 | |||
/// </summary> | |||
public int RecipeStatusIDTray2 { get; set; } = 0; | |||
[VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")] | |||
/// <summary> | |||
/// Tray1的柔性味魔方配料标志(下发配方时,若柔性味魔方的状态=3,复位该状态) | |||
/// </summary> | |||
public bool DosingTray1 { get; set; } = false;//默认为true,初始时,判断柔性味魔方的状态。 | |||
/// <summary> | |||
/// Tray2的柔性味魔方配料标志 | |||
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料 | |||
/// </summary> | |||
public bool DosingTray2 { get; set; } = false; | |||
public int RecipeStatusIDTray2 { get; set; } = 0; | |||
public int DosingTray1Loc { get; set; } = 0; | |||
public int DosingTray2Loc { get; set; } = 0; | |||
[VarComm("Global", "当前配方正在配料位置")] | |||
/// <summary> | |||
/// 当前料仓的位置 | |||
/// </summary> | |||
public int StockInIsWork { get; set; } = 0; | |||
[VarComm("Global", "是否使用粉仓配料")] | |||
/// <summary> | |||
/// 记录AGV进站送货的指令顺序 | |||
/// </summary> | |||
public int AgvDeliveryPosition { get; set; }= 0; | |||
/// <summary> | |||
/// 记录AGV进站取货的指令顺序 | |||
/// 是否使用粉仓配料 | |||
/// </summary> | |||
public int AgvPickUpPosition { get; set; } = 0; | |||
public bool RequestOrder { get; set; } = false; | |||
[VarComm("Global", "是否使用粉仓配料")] | |||
/// <summary> | |||
/// 是否使用粉仓 | |||
/// 是否使用粉仓配料 | |||
/// </summary> | |||
public bool IsUseWindSend { get; set; } = false; | |||
[VarComm("Global", "粉仓正在配料")] | |||
/// <summary> | |||
/// 风送配料完成标志 | |||
/// 粉仓正在配料 | |||
/// </summary> | |||
public bool WindSendDosingFinish { get; set; } = false; | |||
public bool WindSendDosing { get; set; } = false; | |||
/// <summary> | |||
/// 顶升气缸的信号 | |||
/// 所有气缸的信号 | |||
/// </summary> | |||
public bool[] Cylinder_JackInfo = new bool[15]; | |||
public bool[] Cylinder_JackInfo { get; set; } = new bool[30]; | |||
#region 本地模拟配方 | |||
[VarComm("Global", "是否使用本地模拟配方")] | |||
/// <summary> | |||
/// 是否使用本地模拟配方 | |||
/// </summary> | |||
public bool IsUseLocalRecipe { get; set; } | |||
/// <summary> | |||
/// 是否使用本地模拟订单+风送配方 | |||
/// 配料时间 | |||
/// </summary> | |||
public bool IsUseWindSendDosing { get; set; } | |||
public static int test1 = 1; | |||
public DateTime time1; | |||
/// <summary> | |||
/// 原料的名称和原料编号对应,Mes提供的信息 | |||
/// </summary> | |||
public ConcurrentDictionary<string, string> RawMaterialsNameCode { get; set; } = new ConcurrentDictionary<string, string>(); | |||
[VarComm("Global", "风送是否允许AGV到工站")] | |||
/// <summary> | |||
/// 风送是否允许AGV到工站 | |||
/// </summary> | |||
public static bool WindSendAllowAGVPutGet { get; set; } = false; | |||
public bool WindSendAllowAGVPutGet { get; set; } = false; | |||
[VarComm("Global", "粉料仓配料完成")] | |||
/// <summary> | |||
/// 粉料仓配料完成 | |||
/// </summary> | |||
public static bool WindSendDosingComple { get; set; } = false; | |||
public bool WindSendDosingComple { get; set; } = false; | |||
[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")] | |||
/// <summary> | |||
/// 系统模式 | |||
/// PLC的系统模式 DB44.DBX0.1 | |||
/// </summary> | |||
public static bool SystemMode { get; set; } = false; | |||
public bool PlcSystemMode { get; set; } = false; | |||
[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")] | |||
/// <summary> | |||
/// 系统状态 | |||
/// 不使用15个料仓报警 | |||
/// </summary> | |||
public static bool SystemStatus { get; set; } = false; | |||
public bool DisEnableStockBinAlarm { get; set; } = false; | |||
[VarComm("Global", "PLC的系统自动启停 DB44.DBX0.0")] | |||
/// <summary> | |||
/// 系统运行状态 | |||
/// PLC的系统自动启停 DB44.DBX0.0 | |||
/// </summary> | |||
public static bool SystemRunStatus { get; set; } = false; | |||
public bool PlcSystemIsAutoRun { get; set; } = false; | |||
[VarComm("Global", "PLC的系统自动暂停/开始 DB44.DBX0.2")] | |||
/// <summary> | |||
/// 系统运行状态 | |||
/// PLC的系统自动暂停/开始 DB44.DBX0.2 | |||
/// </summary> | |||
public static int Time { get; set; } = 1000; | |||
public bool PlcSystemIsPause { get; set; } = false; | |||
[VarComm("Global", "延迟采集料仓的配料完成重量")] | |||
/// <summary> | |||
/// 延迟采集料仓的配料完成重量 | |||
/// </summary> | |||
public int Time { get; set; } = 1000; | |||
[VarComm("Global", "取消订单的步骤号")] | |||
/// <summary> | |||
/// 取消订单的步骤: 1-9:配料过程中配方1取消配方 10-19:配料过程中配方2取消配方 20-29:下发订单的过程中取消订单(订单未到达上位机) 30-39:下发订单的过程中取消订单(订单未到达PLC) | |||
/// </summary> | |||
public static int OrderCancelStep = 0; | |||
public int OrderCancelStep { get; set; } = 0; | |||
[VarComm("Global", "机器人的状态")] | |||
/// <summary> | |||
/// 机器人的状态 | |||
/// </summary> | |||
public static ushort RobotStatus = 0; | |||
public ushort RobotStatus { get; set; } = 0; | |||
[VarComm("Global", "机器人的程序号")] | |||
/// <summary> | |||
/// 机器人的状态 | |||
/// 机器人的程序号 | |||
/// </summary> | |||
public static byte RobotProgramNum = 0; | |||
public byte RobotProgramNum { get; set; } = 0; | |||
#endregion | |||
} | |||
public enum IssueRecipeCondition | |||
@@ -0,0 +1,41 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Modbus; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||
{ | |||
public class DataComm | |||
{ | |||
public volatile static DataComm Instance; | |||
public static DataComm GetInstance => Instance ?? (new DataComm()); | |||
public DataComm() { } | |||
/// <summary> | |||
/// 是否允许配料 | |||
/// </summary> | |||
public bool IsAllowDosing { get { return _mIsAllowDosing; } set { _mIsAllowDosing = value; } } | |||
private bool _mIsAllowDosing; | |||
public bool DosingFinishToPLC { get { return _mDosingFinishToPLC; } set { _mDosingFinishToPLC = value; } } | |||
private bool _mDosingFinishToPLC; | |||
private int _mStockBinLocationToPLC; | |||
public int StockBinLocationToPLC { get { return _mStockBinLocationToPLC; } set { _mStockBinLocationToPLC = value; } } | |||
public bool StatusSignToBPA { get { return _mStatusSignToBPA; } set { _mStatusSignToBPA = value; } } | |||
private bool _mStatusSignToBPA; | |||
private int _mStockBinLocationToBPA; | |||
public int StockBinLocationToBPA { get { return _mStockBinLocationToBPA; } set { _mStockBinLocationToBPA = value; } } | |||
private int _mBarrelNumToPLC; | |||
public int BarrelNumToPLC { get { return _mBarrelNumToPLC; } set { _mBarrelNumToPLC = value; } } | |||
/*public ConcurrentDictionary<int, StockBinLocations> DeviceLists = new ConcurrentDictionary<int, StockBinLocations>();*/ | |||
} | |||
} |
@@ -30,9 +30,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||
var res1 = this.HK_PLC_S7.ReadClass<PlcReadAddressDB3>(3); | |||
if (res1 != null && res1 is PlcReadAddressDB3 data1) | |||
{ | |||
GVL_SmallStation.plcReadDataDB3 = data1; | |||
GVL_SmallStation.GetInstance.plcReadDataDB3 = data1; | |||
} | |||
} | |||
Thread.Sleep(10); | |||
}),"海科PLC设备状态",true); | |||
} | |||
///// <summary> | |||
@@ -0,0 +1,23 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||
{ | |||
public class HKDeviceWrite | |||
{ | |||
public string Address { get; set; } | |||
public PlcVarType PlcVarType { get; set; } = PlcVarType.Bool; | |||
public object Value { get; set; } | |||
} | |||
public enum PlcVarType | |||
{ | |||
Bool, | |||
Byte, | |||
Int, | |||
Dint, | |||
Real, | |||
} | |||
} |
@@ -9,170 +9,170 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||
{ | |||
public class PlcReadAddressDB3 | |||
{ | |||
[PlcComm("DB3.DBX0.0","心跳")] | |||
[VarComm("DB3.DBX0.0","心跳")] | |||
public bool HeartBeat { get; set; } | |||
[PlcComm("DB3.DBX0.1", "备用1")] | |||
[VarComm("DB3.DBX0.1", "备用1")] | |||
public bool Standby1 { get; set; } | |||
[PlcComm("DB3.DBX0.2", "备用2")] | |||
[VarComm("DB3.DBX0.2", "备用2")] | |||
public bool Standby2 { get; set; } | |||
[PlcComm("DB3.DBX0.3", "备用3")] | |||
[VarComm("DB3.DBX0.3", "备用3")] | |||
public bool Standby3 { get; set; } | |||
[PlcComm("DB3.DBX0.4", "备用4")] | |||
[VarComm("DB3.DBX0.4", "备用4")] | |||
public bool Standby4 { get; set; } | |||
[PlcComm("DB3.DBX0.5", "备用5")] | |||
[VarComm("DB3.DBX0.5", "备用5")] | |||
public bool Standby5 { get; set; } | |||
[PlcComm("DB3.DBX0.6", "备用6")] | |||
[VarComm("DB3.DBX0.6", "备用6")] | |||
public bool Standby6 { get; set; } | |||
[PlcComm("DB3.DBX0.7", "工站1有托盘")] | |||
[VarComm("DB3.DBX0.7", "工站1有托盘")] | |||
public bool WorkStation1HaveTray { get; set; } | |||
[PlcComm("DB3.DBX1.0", "工站2有托盘")] | |||
[VarComm("DB3.DBX1.0", "工站2有托盘")] | |||
public bool WorkStation2HaveTray { get; set; } | |||
[PlcComm("DB3.DBX1.1", "工站1配料完成")] | |||
[VarComm("DB3.DBX1.1", "工站1配料完成")] | |||
public bool WorkStation1DosingComplete { get; set; } | |||
[PlcComm("DB3.DBX1.2", "工站2配料完成")] | |||
[VarComm("DB3.DBX1.2", "工站2配料完成")] | |||
public bool WorkStation2DosingComplete { get; set; } | |||
[PlcComm("DB3.DBX1.3", "工站1接收配方完成")] | |||
[VarComm("DB3.DBX1.3", "工站1接收配方完成")] | |||
public bool WorkStation1ReceviceRecipeComplete { get; set; } | |||
[PlcComm("DB3.DBX1.4", "工站2接收配方完成")] | |||
[VarComm("DB3.DBX1.4", "工站2接收配方完成")] | |||
public bool WorkStation2ReceviceRecipeComplete { get; set; } | |||
[PlcComm("DB3.DBX1.5", "工站1气缸报警")] | |||
[VarComm("DB3.DBX1.5", "工站1气缸报警")] | |||
public bool WorkStation1CylinderAlarm { get; set; } | |||
[PlcComm("DB3.DBX1.6", "工站2气缸报警")] | |||
[VarComm("DB3.DBX1.6", "工站2气缸报警")] | |||
public bool WorkStation2CylinderAlarm { get; set; } | |||
[PlcComm("DB3.DBX1.7", "允许配方1下发配方")] | |||
[VarComm("DB3.DBX1.7", "允许配方1下发配方")] | |||
public bool AllowRecipe1Issue { get; set; } | |||
[PlcComm("DB3.DBX2.0", "允许配方2下发配方")] | |||
[VarComm("DB3.DBX2.0", "允许配方2下发配方")] | |||
public bool AllowRecipe2Issue { get; set; } | |||
[PlcComm("DB3.DBX2.1", "工站1传感器信号")] | |||
[VarComm("DB3.DBX2.1", "工站1传感器信号")] | |||
public bool WorkStation1Sensor { get; set; } | |||
[PlcComm("DB3.DBX2.2", "工站2传感器信号")] | |||
[VarComm("DB3.DBX2.2", "工站2传感器信号")] | |||
public bool WorkStation2Sensor { get; set; } | |||
[PlcComm("DB3.DBX2.3", "工站1气缸信号,false=伸出")] | |||
[VarComm("DB3.DBX2.3", "工站1气缸信号,false=伸出")] | |||
public bool WorkStation1Cylinder { get; set; } | |||
[PlcComm("DB3.DBX2.4", "工站2气缸信号,false=伸出")] | |||
[VarComm("DB3.DBX2.4", "工站2气缸信号,false=伸出")] | |||
public bool WorkStation2Cylinder { get; set; } | |||
[PlcComm("DB3.DBX2.5", "工站1取消订单")] | |||
[VarComm("DB3.DBX2.5", "工站1取消订单")] | |||
public bool WorkStation1OrderCancel { get; set; } | |||
[PlcComm("DB3.DBX2.6", "工站2取消订单")] | |||
[VarComm("DB3.DBX2.6", "工站2取消订单")] | |||
public bool WorkStation2OrderCancel { get; set; } | |||
[PlcComm("DB3.DBX2.7", "备用7")] | |||
[VarComm("DB3.DBX2.7", "备用7")] | |||
public bool Standby7 { get; set; } | |||
[PlcComm("DB3.DBB3", "备用")] | |||
[VarComm("DB3.DBB3", "备用")] | |||
public byte Standby81 { get; set; } | |||
[PlcComm("DB3.DBB4", "备用")] | |||
[VarComm("DB3.DBB4", "备用")] | |||
public byte Standby82 { get; set; } | |||
[PlcComm("DB3.DBB5", "备用")] | |||
[VarComm("DB3.DBB5", "备用")] | |||
public byte Standby83 { get; set; } | |||
[PlcComm("DB3.DBW6", "备用")] | |||
[VarComm("DB3.DBW6", "备用")] | |||
public int Standby9 { get; set; } | |||
[PlcComm("DB3.DBD10", "工站1_1号桶的位置")] | |||
[VarComm("DB3.DBD10", "工站1_1号桶的位置")] | |||
public float WorkStation1Barrel1Pos { get; set; } | |||
[PlcComm("DB3.DBD14", "工站1_2号桶的位置")] | |||
[VarComm("DB3.DBD14", "工站1_2号桶的位置")] | |||
public float WorkStation1Barrel2Pos { get; set; } | |||
[PlcComm("DB3.DBD18", "工站1_3号桶的位置")] | |||
[VarComm("DB3.DBD18", "工站1_3号桶的位置")] | |||
public float WorkStation1Barrel3Pos { get; set; } | |||
[PlcComm("DB3.DBD22", "工站1_4号桶的位置")] | |||
[VarComm("DB3.DBD22", "工站1_4号桶的位置")] | |||
public float WorkStation1Barrel4Pos { get; set; } | |||
[PlcComm("DB3.DBD26", "工站2_1号桶的位置")] | |||
[VarComm("DB3.DBD26", "工站2_1号桶的位置")] | |||
public float WorkStation2Barrel1Pos { get; set; } | |||
[PlcComm("DB3.DBD30", "工站2_2号桶的位置")] | |||
[VarComm("DB3.DBD30", "工站2_2号桶的位置")] | |||
public float WorkStation2Barrel2Pos { get; set; } | |||
[PlcComm("DB3.DBD34", "工站2_3号桶的位置")] | |||
[VarComm("DB3.DBD34", "工站2_3号桶的位置")] | |||
public float WorkStation2Barrel3Pos { get; set; } | |||
[PlcComm("DB3.DBD38", "工站2_4号桶的位置")] | |||
[VarComm("DB3.DBD38", "工站2_4号桶的位置")] | |||
public float WorkStation2Barrel4Pos { get; set; } | |||
[PlcComm("DB3.DBD42", "备用")] | |||
[VarComm("DB3.DBD42", "备用")] | |||
public int StandBy42 { get; set; } | |||
[PlcComm("DB3.DBD46", "备用")] | |||
[VarComm("DB3.DBD46", "备用")] | |||
public int StandBy46 { get; set; } | |||
[PlcComm("DB3.DBX50.0", "工站1_1号桶允许配料")] | |||
[VarComm("DB3.DBX50.0", "工站1_1号桶允许配料")] | |||
public bool WorkStation1Barrel1AllowDosing { get; set; } | |||
[PlcComm("DB3.DB50.1", "工站1_2号桶允许配料")] | |||
[VarComm("DB3.DB50.1", "工站1_2号桶允许配料")] | |||
public bool WorkStation1Barrel2AllowDosing { get; set; } | |||
[PlcComm("DB3.DB50.2", "工站1_3号桶允许配料")] | |||
[VarComm("DB3.DB50.2", "工站1_3号桶允许配料")] | |||
public bool WorkStation1Barrel3AllowDosing { get; set; } | |||
[PlcComm("DB3.DB50.3", "工站1_4号桶允许配料")] | |||
[VarComm("DB3.DB50.3", "工站1_4号桶允许配料")] | |||
public bool WorkStation1Barrel4AllowDosing { get; set; } | |||
[PlcComm("DB3.DB50.4", "工站2_1号桶允许配料")] | |||
[VarComm("DB3.DB50.4", "工站2_1号桶允许配料")] | |||
public bool WorkStation2Barrel1AllowDosing { get; set; } | |||
[PlcComm("DB3.DB50.5", "工站2_2号桶允许配料")] | |||
[VarComm("DB3.DB50.5", "工站2_2号桶允许配料")] | |||
public bool WorkStation2Barrel2AllowDosing { get; set; } | |||
[PlcComm("DB3.DB50.6", "工站2_3号桶允许配料")] | |||
[VarComm("DB3.DB50.6", "工站2_3号桶允许配料")] | |||
public bool WorkStation2Barrel3AllowDosing { get; set; } | |||
[PlcComm("DB3.DB50.7", "工站2_4号桶允许配料")] | |||
[VarComm("DB3.DB50.7", "工站2_4号桶允许配料")] | |||
public bool WorkStation2Barrel4AllowDosing { get; set; } | |||
[PlcComm("DB3.DBD52", "备用")] | |||
[VarComm("DB3.DBD52", "备用")] | |||
public int Standby15 { get; set; } | |||
[PlcComm("DB3.DBD56", "备用")] | |||
[VarComm("DB3.DBD56", "备用")] | |||
public int Standby16 { get; set; } | |||
[PlcComm("DB3.DBD60", "备用")] | |||
[VarComm("DB3.DBD60", "备用")] | |||
public int Standby17 { get; set; } | |||
[PlcComm("DB3.DBD64", "备用")] | |||
[VarComm("DB3.DBD64", "备用")] | |||
public int Standby18 { get; set; } | |||
[PlcComm("DB3.DBD68", "备用")] | |||
[VarComm("DB3.DBD68", "备用")] | |||
public int Standby19 { get; set; } | |||
[PlcComm("DB3.DBD72", "备用")] | |||
[VarComm("DB3.DBD72", "备用")] | |||
public int Standby20 { get; set; } | |||
[PlcComm("DB3.DBD76", "备用")] | |||
[VarComm("DB3.DBD76", "备用")] | |||
public int Standby21 { get; set; } | |||
[PlcComm("DB3.DBD80", "备用")] | |||
[VarComm("DB3.DBD80", "备用")] | |||
public int Standby22 { get; set; } | |||
[PlcComm("DB3.DBD84", "备用")] | |||
[VarComm("DB3.DBD84", "备用")] | |||
public int Standby23 { get; set; } | |||
[PlcComm("DB3.DBD88", "备用")] | |||
[VarComm("DB3.DBD88", "备用")] | |||
public int Standby24 { get; set; } | |||
[PlcComm("DB3.DBD92", "备用")] | |||
[VarComm("DB3.DBD92", "备用")] | |||
public int Standby25 { get; set; } | |||
[PlcComm("DB3.DBD96", "备用")] | |||
[VarComm("DB3.DBD96", "备用")] | |||
public int Standby26 { get; set; } | |||
[PlcComm("DB3.DBX100.0", "机器人运行模式")] | |||
[VarComm("DB3.DBX100.0", "机器人运行模式")] | |||
public bool RobotRunMode { get; set; } | |||
[PlcComm("DB3.DBX100.1", "机器人自动运行")] | |||
[VarComm("DB3.DBX100.1", "机器人自动运行")] | |||
public bool RobotAutoRun { get; set; } | |||
[PlcComm("DB3.DBX100.2", "机器人停止")] | |||
[VarComm("DB3.DBX100.2", "机器人停止")] | |||
public bool RobotStop { get; set; } | |||
[PlcComm("DB3.DBX100.3", "机器人运行")] | |||
[VarComm("DB3.DBX100.3", "机器人运行")] | |||
public bool RobotRun { get; set; } | |||
[PlcComm("DB3.DBX100.4", "机器人运行报警")] | |||
[VarComm("DB3.DBX100.4", "机器人运行报警")] | |||
public bool RobotRunAlarm { get; set; } | |||
[PlcComm("DB3.DBX100.5", "机器人在原点")] | |||
[VarComm("DB3.DBX100.5", "机器人在原点")] | |||
public bool RobotInHomed { get; set; } | |||
[PlcComm("DB3.DBX100.6", "机器人备用")] | |||
[VarComm("DB3.DBX100.6", "机器人备用")] | |||
public bool Standby30 { get; set; } | |||
[PlcComm("DB3.DBX100.7", "机器人取空桶完成")] | |||
[VarComm("DB3.DBX100.7", "机器人取空桶完成")] | |||
public bool RobotGetEmptyBarrelComplete { get; set; } | |||
[PlcComm("DB3.DBX101.0", "机器人放空桶完成")] | |||
[VarComm("DB3.DBX101.0", "机器人放空桶完成")] | |||
public bool RobotPutEmptyBarrelComplete { get; set; } | |||
[PlcComm("DB3.DBX101.1", "机器人取满桶完成")] | |||
[VarComm("DB3.DBX101.1", "机器人取满桶完成")] | |||
public bool RobotGetFullBarrelComplete { get; set; } | |||
[PlcComm("DB3.DBX101.2", "机器人放满桶完成")] | |||
[VarComm("DB3.DBX101.2", "机器人放满桶完成")] | |||
public bool RobotPutFullBarrelComplete { get; set; } | |||
[PlcComm("DB3.DBX101.3", "备用")] | |||
[VarComm("DB3.DBX101.3", "备用")] | |||
public bool Standby31 { get; set; } | |||
[PlcComm("DB3.DBX101.4", "备用")] | |||
[VarComm("DB3.DBX101.4", "备用")] | |||
public bool Standby32 { get; set; } | |||
[PlcComm("DB3.DBX101.5", "备用")] | |||
[VarComm("DB3.DBX101.5", "备用")] | |||
public bool Standby33 { get; set; } | |||
[PlcComm("DB3.DBX101.6", "备用")] | |||
[VarComm("DB3.DBX101.6", "备用")] | |||
public bool Standby34 { get; set; } | |||
[PlcComm("DB3.DBX101.7", "备用")] | |||
[VarComm("DB3.DBX101.7", "备用")] | |||
public bool Standby35 { get; set; } | |||
[PlcComm("DB3.DBB102", "机器人运行的程序号")] | |||
[VarComm("DB3.DBB102", "机器人运行的程序号")] | |||
public byte RobotProgramNum { get; set; } | |||
[PlcComm("DB3.DBB103", "备用")] | |||
[VarComm("DB3.DBB103", "备用")] | |||
public byte Standby36 { get; set; } | |||
[PlcComm("DB3.DBB104", "备用")] | |||
[VarComm("DB3.DBB104", "备用")] | |||
public byte Standby37 { get; set; } | |||
[PlcComm("DB3.DBB105", "备用")] | |||
[VarComm("DB3.DBB105", "备用")] | |||
public byte Standby38 { get; set; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC | |||
{ | |||
public class PlcWriteAddressDB7 | |||
{ | |||
} | |||
} |
@@ -52,7 +52,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum; | |||
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).RunStatus = DeviceLists.ElementAt(i).Value.deviceStatus.RunStatus; | |||
} | |||
int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName); | |||
if (deviceIndex >= 0 && deviceIndex < devices.Count) | |||
{ | |||
@@ -7,6 +7,7 @@ using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Par; | |||
using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Bom; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
@@ -17,6 +18,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
private ConnectParMode _mdeviceConnectPar = new ConnectParMode(); | |||
public ObservableCollection<RawMaterialStockBin> rawMaterialStockBin { get; set; } = new ObservableCollection<RawMaterialStockBin>(); | |||
public ObservableCollection<WindSendRawMaterial> windSendRawMaterial { get; set; } = new ObservableCollection<WindSendRawMaterial>(); | |||
public ObservableCollection<BomMaterial> BomMaterial { get; set; } = new ObservableCollection<BomMaterial>(); | |||
} | |||
} |
@@ -29,13 +29,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
//var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291); | |||
if (Start != null && Start is XL_Start_DB st) | |||
{ | |||
switch (GVL_SmallStation.SiemensSendRecipeStatus) | |||
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus) | |||
{ | |||
case 0: | |||
if (GVL_SmallStation.IsAllowSiemensSendRecipe) | |||
if (GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe) | |||
{ | |||
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true); | |||
GVL_SmallStation.SiemensSendRecipeStatus = 1; | |||
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 1; | |||
} | |||
break; | |||
case 1: | |||
@@ -43,7 +43,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
{ | |||
if (!string.IsNullOrEmpty(st.RecipeCode)) | |||
{ | |||
GVL_SmallStation.SiemensSendRecipeStatus = 2; | |||
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 2; | |||
ActionManage.GetInstance.Send("SiemensRecipeRecive", st); | |||
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false); | |||
} | |||
@@ -52,23 +52,23 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
case 2: | |||
if (Start.Order_Request_ACK == false) | |||
{ | |||
GVL_SmallStation.IsAllowSiemensSendRecipe = false; | |||
GVL_SmallStation.SiemensSendRecipeStatus = 3; | |||
GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe = false; | |||
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 3; | |||
} | |||
break; | |||
} | |||
if (RTrig.GetInstance("Order_Cancel").Start(st.Order_Cancel)) //订单取消 | |||
{ | |||
if (GVL_SmallStation.Order_Cancel == false) | |||
if (GVL_SmallStation.GetInstance.Order_Cancel == false) | |||
{ | |||
GVL_SmallStation.Order_Cancel = true; | |||
GVL_SmallStation.Order_CancelRecipeCode = st.RecipeCode; | |||
GVL_SmallStation.OrderCancelStep = 0; | |||
GVL_SmallStation.GetInstance.Order_Cancel = true; | |||
GVL_SmallStation.GetInstance.Order_CancelRecipeCode = st.RecipeCode; | |||
GVL_SmallStation.GetInstance.OrderCancelStep = 0; | |||
MessageNotify.GetInstance.ShowRunLog($"西门子下发取消工单指令:{st.RecipeName}"); | |||
} | |||
else | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog($"订单正在取消,请等待订单{ GVL_SmallStation.Order_CancelRecipeCode}取消完成,再取消订单:{st.RecipeName}"); | |||
MessageNotify.GetInstance.ShowRunLog($"订单正在取消,请等待订单{ GVL_SmallStation.GetInstance.Order_CancelRecipeCode}取消完成,再取消订单:{st.RecipeName}"); | |||
} | |||
} | |||
} | |||
@@ -101,6 +101,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens | |||
XL_Status = state; | |||
} | |||
//从海科plc的数采 发送给西门子plc | |||
var res = ProcessControl.GetInstance.HKDevice.DeviceStatus; | |||
if (res != null) | |||
{ | |||
@@ -27,15 +27,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
var res1 = this.Siemens_PLC_S7.ReadClass<WindSend_Read>(94); | |||
if (res1 != null && res1 is WindSend_Read readData) | |||
{ | |||
GVL_SmallStation.WindSendAllowAGVPutGet = readData.HoodLiftInPlace; | |||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.2", GVL_SmallStation.Station1HaveTray);//工站1有托盘 | |||
GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet = readData.HoodLiftInPlace; | |||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.2", GVL_SmallStation.GetInstance.Station1HaveTray);//工站1有托盘 | |||
if (res1.RecipeReceiveFinish) | |||
{ | |||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.0", false); | |||
} | |||
if (RTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign)) | |||
{ | |||
GVL_SmallStation.WindSendDosingComple = true; | |||
GVL_SmallStation.GetInstance.WindSendDosingComple = true; | |||
Siemens_PLC_S7.Write("DB95.DBX38.1", true); | |||
} | |||
if (TTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign)) | |||
@@ -108,6 +108,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
Thread.Sleep(10);*/ | |||
} | |||
Thread.Sleep(10); | |||
}),"监听粉料数据",true); | |||
} | |||
@@ -16,10 +16,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
private int _mLocation; | |||
public string RawMaterialChineseName { get { return _mRawMaterialChineseName; } set { _mRawMaterialChineseName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialChineseName; | |||
private string _mRawMaterialChineseName = ""; | |||
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialName; | |||
private string _mRawMaterialName = ""; | |||
/// <summary> | |||
/// 需要原料重量 | |||
/// </summary> | |||
@@ -0,0 +1,250 @@ | |||
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.BomOfMaterialView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:con="clr-namespace:BPASmartClient.JXJFoodSmallStation.Converter" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||
<UserControl.DataContext> | |||
<vm:BomOfMaterialViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" /> | |||
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />--> | |||
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" /> | |||
<con:DataTableRedundantConverter x:Key="tabConvert" /> | |||
<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type RadioButton}"> | |||
<Border | |||
x:Name="NvaBor" | |||
Background="Transparent" | |||
BorderBrush="#FF2AB2E7" | |||
BorderThickness="0"> | |||
<ContentControl | |||
Margin="10,4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
HorizontalContentAlignment="Center" | |||
VerticalContentAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
FontSize="16" /> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="True"> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" /> | |||
</Trigger> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsChecked" Value="false" /> | |||
<Condition Property="IsMouseOver" Value="True" /> | |||
</MultiTrigger.Conditions> | |||
<MultiTrigger.Setters> | |||
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" /> | |||
</MultiTrigger.Setters> | |||
</MultiTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="InputTextboxStyle" TargetType="TextBox"> | |||
<Setter Property="Margin" Value="5,0,0,0" /> | |||
<Setter Property="BorderThickness" Value="0" /> | |||
<Setter Property="HorizontalAlignment" Value="Left" /> | |||
<Setter Property="Width" Value="150" /> | |||
<Setter Property="Height" Value="40" /> | |||
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="ControlButtonStyle" TargetType="Button"> | |||
<Setter Property="Margin" Value="0" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="#FFF53F62" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="VerticalContentAlignment" Value="Center" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="Button"> | |||
<Border | |||
Name="TitleBarBr" | |||
BorderBrush="#00c2f4" | |||
BorderThickness="0" | |||
CornerRadius="0" | |||
Opacity="0.8"> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Margin}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> | |||
<Border.Background> | |||
<ImageBrush | |||
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png" | |||
Opacity="0.8" | |||
Stretch="Fill" /> | |||
</Border.Background> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="TitleTextblockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontSize" Value="16" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Foreground" Value="{StaticResource tabColor}" /> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontWeight" Value="SemiBold" /> | |||
</Style> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60" /> | |||
<RowDefinition Height="40" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<!--#region 表格标题栏设置--> | |||
<Grid> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<Button | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding GetBomMaterialData}" | |||
Content="拉取本地数据" | |||
FontSize="28" | |||
Foreground="Aqua" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding DeleteAllMaterial}" | |||
Content="删除所有数据" | |||
FontSize="28" | |||
Foreground="Aqua" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding AddMaterial}" | |||
Content="新增数据" | |||
FontSize="28" | |||
Foreground="Aqua" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding SaveMaterials}" | |||
Content="保存参数" | |||
FontSize="28" | |||
Foreground="Aqua" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</StackPanel> | |||
</Grid> | |||
<Grid | |||
Grid.Row="1" | |||
Margin="0,10,0,0" | |||
Background="#ff0C255F"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
<ColumnDefinition Width="1*"/> | |||
</Grid.ColumnDefinitions> | |||
<Grid Grid.Column="0"> | |||
<TextBlock Text="序号" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/> | |||
<!--<Border BorderThickness="1,1,1,1" Cursor="SizeWE" | |||
BorderBrush="{StaticResource bordColor}" />--> | |||
</Grid> | |||
<TextBlock Grid.Column="1" FontSize="24" Text="原料编号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" /> | |||
<TextBlock Grid.Column="2" FontSize="24" Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" /> | |||
<TextBlock Grid.Column="3" FontSize="24" Text="操作" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" /> | |||
</Grid> | |||
<Grid Grid.Row="2"> | |||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Visible" > | |||
<ItemsControl ItemsSource="{Binding RawMaterialInfo}" Foreground="Aqua"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid Name="gr" > | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid Grid.Column="0" Margin="5"> | |||
<TextBlock | |||
FontSize="16" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Text="{Binding Count}" /> | |||
</Grid> | |||
<Grid Grid.Column="1" Margin="5"> | |||
<TextBox | |||
Width="50" | |||
FontSize="16" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Text="{Binding MaterialCode}" /> | |||
</Grid> | |||
<Grid Grid.Column="2" Margin="5"> | |||
<TextBox | |||
Width="200" | |||
FontSize="16" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Text="{Binding MaterialName}" /> | |||
</Grid> | |||
<Grid Grid.Column="3" Margin="5"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<pry:IcoButton | |||
Margin="3,4,4,0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Background="#11F53F62" | |||
BorderThickness="0" | |||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
CommandParameter="{Binding Count}" | |||
Content="删除" | |||
EnterBackground="#22F53F62" | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</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.JXJFoodSmallStation.View | |||
{ | |||
/// <summary> | |||
/// HKPlcCommMonitor.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class BomOfMaterialView : UserControl | |||
{ | |||
public BomOfMaterialView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -9,8 +9,9 @@ | |||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||
<UserControl.DataContext> | |||
<vm:ManualFlowViewModel /> | |||
</UserControl.DataContext> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="100" /> | |||
@@ -23,7 +24,7 @@ | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Margin="5" | |||
Command="{Binding Test1Command}" | |||
Content="AGV送托盘完成" | |||
FontSize="20" | |||
@@ -32,7 +33,7 @@ | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Margin="5" | |||
Command="{Binding Test2Command}" | |||
Content="粉料仓配料完成" | |||
FontSize="20" | |||
@@ -41,7 +42,7 @@ | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Margin="5" | |||
Command="{Binding Test3Command}" | |||
Content="AGV取托盘完成" | |||
FontSize="20" | |||
@@ -50,7 +51,7 @@ | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Margin="5" | |||
Command="{Binding Test4Command}" | |||
Content="气缸收紧错位复位" | |||
FontSize="20" | |||
@@ -59,7 +60,7 @@ | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Margin="5" | |||
Command="{Binding Test5Command}" | |||
Content="粉料仓提升到位" | |||
FontSize="20" | |||
@@ -68,7 +69,7 @@ | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Margin="5" | |||
Command="{Binding Test6Command}" | |||
Content="AGV放货架流程完成" | |||
FontSize="20" | |||
@@ -77,15 +78,12 @@ | |||
<Button | |||
Width="200" | |||
Height="40" | |||
Margin="50,0,50,0" | |||
Margin="5" | |||
Command="{Binding BPAResetCommand}" | |||
Content="上位机初始化" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
</StackPanel> | |||
</Grid> | |||
<Grid Grid.Row="1"> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center"> | |||
@@ -103,7 +101,7 @@ | |||
Height="40" | |||
Margin="5,0,5,0" | |||
Command="{Binding CLearRecipeInfo}" | |||
Content="配方清零" | |||
Content="PLC配方清零" | |||
FontSize="20" | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
@@ -114,10 +112,10 @@ | |||
<Grid Grid.Row="2"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Grid.RowDefinitions> | |||
<RowDefinition></RowDefinition> | |||
@@ -127,17 +125,25 @@ | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<WrapPanel> | |||
<TextBlock Text="心跳:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<WrapPanel Grid.Column="1"> | |||
<TextBlock Text="海科plc心跳:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding Heartbeat}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel Grid.Row="1"> | |||
<WrapPanel Grid.Row="0"> | |||
<TextBlock Text="西门子 连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding SiemensIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="海科plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding HKPlcIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="风送plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding WindSendIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel Grid.Row="2"> | |||
<TextBlock Text="当前下发配方状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding OrderStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
<TextBlock Text="当前配料状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding OrderDosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
</WrapPanel> | |||
<WrapPanel Grid.Row="2"> | |||
<WrapPanel Grid.Row="4"> | |||
<TextBlock Text="柔性味魔方配料完成,延迟复位时间:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBox Text="{Binding time}" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBox> | |||
<TextBlock Text="ms" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
@@ -151,6 +157,11 @@ | |||
Panel.ZIndex="0" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
</WrapPanel> | |||
<WrapPanel Grid.Column="1" Grid.Row="2"> | |||
<TextBlock Text="配料情况:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock> | |||
<TextBlock Text="{Binding DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock> | |||
</WrapPanel> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
@@ -24,5 +24,10 @@ namespace BPASmartClient.JXJFoodSmallStation.View | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@@ -55,7 +55,7 @@ | |||
<ItemsControl ItemsSource="{Binding plcInfos}" Foreground="Aqua"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid Name="gr"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="3*"></ColumnDefinition> | |||
<ColumnDefinition Width="8*"></ColumnDefinition> | |||
@@ -89,6 +89,11 @@ | |||
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
@@ -0,0 +1,90 @@ | |||
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.ProcessMonitorView" | |||
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.JXJFoodSmallStation.View" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel" | |||
mc:Ignorable="d" | |||
d:DesignHeight="1080" d:DesignWidth="1920"> | |||
<UserControl.DataContext> | |||
<vm:ProcessMonitorViewModel /> | |||
</UserControl.DataContext> | |||
<Border BorderThickness="0" BorderBrush="{StaticResource bordColor}"> | |||
<Grid Margin="0,10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="60"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"></ColumnDefinition> | |||
<ColumnDefinition Width="4*"></ColumnDefinition> | |||
<ColumnDefinition Width="4*"></ColumnDefinition> | |||
<ColumnDefinition Width="14*"></ColumnDefinition> | |||
<ColumnDefinition Width="4*"></ColumnDefinition> | |||
<ColumnDefinition Width="17"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Grid> | |||
<TextBlock Text="序号" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Text="名称" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="2"> | |||
<TextBlock Text="类型" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Text="描述" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="4"> | |||
<TextBlock Text="当前值" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
</Grid> | |||
<Grid Grid.Row="1"> | |||
<ScrollViewer> | |||
<ItemsControl ItemsSource="{Binding plcInfos}" Foreground="Aqua"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"></ColumnDefinition> | |||
<ColumnDefinition Width="4*"></ColumnDefinition> | |||
<ColumnDefinition Width="4*"></ColumnDefinition> | |||
<ColumnDefinition Width="14*"></ColumnDefinition> | |||
<ColumnDefinition Width="4*"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<Grid> | |||
<TextBlock Margin="5" Text="{Binding Count}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Margin="5" Text="{Binding Name}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="2"> | |||
<TextBlock Margin="5" Text="{Binding Type}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="3"> | |||
<TextBlock Margin="5" Text="{Binding Describe}" FontSize="14" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
<Grid Grid.Column="4"> | |||
<TextBlock Margin="5" Text="{Binding Value}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock> | |||
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border> | |||
</Grid> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
</ScrollViewer> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</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.JXJFoodSmallStation.View | |||
{ | |||
/// <summary> | |||
/// ProcessMonitorView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class ProcessMonitorView : UserControl | |||
{ | |||
public ProcessMonitorView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -49,17 +49,33 @@ | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> | |||
<CheckBox | |||
x:Name="AskRecipeFormSiemens" | |||
Margin="0,0,10,0" | |||
Content="向西门子请求订单" | |||
FontFamily="楷体" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
IsChecked="{Binding AskRecipeFormSiemens}" /> | |||
<CheckBox | |||
x:Name="NotUseSmallDosing" | |||
Margin="0,0,10,0" | |||
Content="不使用小料仓配料" | |||
FontFamily="楷体" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
IsChecked="{Binding NotUseSmallDosing}" /> | |||
<CheckBox | |||
x:Name="IsUseWindSend" | |||
Margin="0,0,10,0" | |||
Content="使用粉料仓配料模拟" | |||
Content="使用粉料仓配料" | |||
FontFamily="楷体" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
IsChecked="{Binding IsUseWindSendDosing}" /> | |||
<CheckBox | |||
x:Name="IsUseStockBin" | |||
Content="本地小料仓配方模拟" | |||
Content="本地小料仓配方配料" | |||
FontFamily="楷体" | |||
VerticalAlignment="Center" | |||
Foreground="Aqua" | |||
@@ -25,8 +25,10 @@ namespace BPASmartClient.JXJFoodSmallStation.View | |||
public RecipeReceiveView() | |||
{ | |||
InitializeComponent(); | |||
this.AskRecipeFormSiemens.Click += (o, e) => { GVL_SmallStation.GetInstance.RequestOrder = (bool)AskRecipeFormSiemens.IsChecked; }; | |||
this.IsUseWindSend.Click += (o, e) => { GVL_SmallStation.GetInstance.IsUseWindSend = (bool)IsUseWindSend.IsChecked; }; | |||
this.IsUseStockBin.Click += (o, e) => { GVL_SmallStation.GetInstance.IsUseLocalRecipe = (bool)IsUseStockBin.IsChecked; }; | |||
this.NotUseSmallDosing.Click += (o, e) => { GVL_SmallStation.GetInstance.NotUseSmallDosing = (bool)NotUseSmallDosing.IsChecked; }; | |||
} | |||
} | |||
} |
@@ -180,11 +180,9 @@ | |||
</Grid> | |||
<Button | |||
Grid.Row="2" | |||
Grid.ColumnSpan="2" | |||
Margin="20,15" | |||
Margin="20,5" | |||
Command="{Binding TestRobotRun}" | |||
Content="测试抓桶程序" | |||
Width="300" | |||
FontSize="32" | |||
Style="{StaticResource ImageButtonStyle}"></Button> | |||
</Grid> | |||
@@ -20,20 +20,22 @@ | |||
<!--#region 表格标题栏设置--> | |||
<Grid> | |||
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal"> | |||
<pry:IcoButton | |||
Margin="10" | |||
<Button | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding UpdateRawMaterial}" | |||
Content="新增数据" | |||
FontSize="28" | |||
Foreground="Aqua" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
Margin="10" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
<Button | |||
Height="50" | |||
Margin="5" | |||
Command="{Binding SaveRawMaterialPara}" | |||
Content="保存参数" | |||
FontSize="28" | |||
Foreground="Aqua" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
Style="{StaticResource ImageButtonStyle}"/> | |||
</StackPanel> | |||
</Grid> | |||
@@ -101,18 +101,18 @@ | |||
</Grid> | |||
<Grid Grid.Column="2" Margin="5"> | |||
<TextBox | |||
Name="name" | |||
Width="50" | |||
FontSize="16" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Text="{Binding RawMaterialName}" /> | |||
Text="{Binding RawMaterialName}"/> | |||
<Border | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<Grid Grid.Column="3" Margin="5"> | |||
<TextBox | |||
Width="50" | |||
<TextBlock | |||
FontSize="16" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.JXJFoodSmallStation.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -0,0 +1,85 @@ | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.JXJFoodSmallStation.Model; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Bom; | |||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
public class BomOfMaterialViewModel : ObservableObject | |||
{ | |||
public BomOfMaterialViewModel() | |||
{ | |||
RawMaterialInfo = Json<DevicePar>.Data.BomMaterial; | |||
AddMaterial = new RelayCommand(() => | |||
{ | |||
RawMaterialInfo.Add(new BomMaterial() | |||
{ | |||
Count = Json<DevicePar>.Data.BomMaterial.Count +1 , | |||
}); | |||
}); | |||
SaveMaterials = new RelayCommand(() => | |||
{ | |||
if (MessageNotify.GetInstance.ShowDialog("请确认是否保存!") == true) | |||
{ | |||
Json<DevicePar>.Save(); | |||
MessageNotify.GetInstance.ShowUserLog($"西门子物料清单保存成功"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功"); | |||
} | |||
}); | |||
GetBomMaterialData = new RelayCommand(() => | |||
{ | |||
Json<DevicePar>.Data.BomMaterial.Clear(); | |||
ProcessControl.GetInstance.RawMaterialNameWithCode();//原料的名称和编码对应 :西门子mes定义的物料编码 | |||
foreach (var item in GVL_SmallStation.GetInstance.RawMaterialsNameCode) | |||
{ | |||
Json<DevicePar>.Data.BomMaterial.Add(new BomMaterial() { Count = Json<DevicePar>.Data.BomMaterial.Count + 1, MaterialCode = item.Key, MaterialName = item.Value }); | |||
} | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"读取程序的Bom清单"); | |||
}); | |||
DeleteAllMaterial = new RelayCommand(() => | |||
{ | |||
if (MessageNotify.GetInstance.ShowDialog("请确认是否删除所有原料数据!") == true) | |||
{ | |||
Json<DevicePar>.Data.BomMaterial.Clear(); | |||
MessageNotify.GetInstance.ShowUserLog($"西门子物料清单删除完成"); | |||
} | |||
}); | |||
RemoveCommand = new RelayCommand<int>((Count) => | |||
{ | |||
if (Count is int cnt) | |||
{ | |||
var res = RawMaterialInfo.FirstOrDefault(p => p.Count == cnt); | |||
if (res != null) | |||
{ | |||
if (MessageNotify.GetInstance.ShowDialog($"请确认是否删除[{res.MaterialCode}],[{res.MaterialName}]!") == true) | |||
{ | |||
RawMaterialInfo.Remove(res); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"删除成功"); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
public ObservableCollection<BomMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<BomMaterial>(); | |||
public RelayCommand AddMaterial { get; set; } | |||
public RelayCommand SaveMaterials { get; set; } | |||
public RelayCommand<int> RemoveCommand { get; set; } | |||
public RelayCommand GetBomMaterialData { get; set; } | |||
public RelayCommand DeleteAllMaterial { get; set; } | |||
} | |||
} |
@@ -21,9 +21,9 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
BottomDeviceCurrentStatuses = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses; | |||
TopDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(TopDeviceCurrentStatuses.OrderByDescending(item => item.DeviceNum)); | |||
/*TopDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(TopDeviceCurrentStatuses.OrderByDescending(item => item.DeviceNum)); | |||
BottomDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(BottomDeviceCurrentStatuses.OrderBy(item => item.DeviceNum)); | |||
BottomDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(BottomDeviceCurrentStatuses.OrderBy(item => item.DeviceNum));*/ | |||
} | |||
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } | |||
@@ -11,6 +11,8 @@ using BPASmartClient.JXJFoodSmallStation.Model; | |||
using System.Threading; | |||
using System.ComponentModel; | |||
using System.Runtime.CompilerServices; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
@@ -20,10 +22,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
SystemMode = GVL_SmallStation.SystemMode ? "手动" : "自动"; | |||
if (GVL_SmallStation.SystemStatus) | |||
SystemMode = GVL_SmallStation.GetInstance.PlcSystemMode ? "手动" : "自动"; | |||
if (GVL_SmallStation.GetInstance.PlcSystemIsAutoRun) | |||
{ | |||
if (GVL_SmallStation.SystemRunStatus) | |||
if (GVL_SmallStation.GetInstance.PlcSystemIsPause) | |||
{ | |||
SystemStatus = "暂停"; | |||
} | |||
@@ -36,56 +38,182 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
SystemStatus = "停止"; | |||
} | |||
for (int i = 0; i < 15; i++) | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[i]) | |||
{ | |||
cylinderModels.ElementAt(i).LeftTog = true; | |||
cylinderModels.ElementAt(i).RightTog = false; | |||
} | |||
else | |||
{ | |||
cylinderModels.ElementAt(i).LeftTog = false; | |||
cylinderModels.ElementAt(i).RightTog = true; | |||
} | |||
} | |||
foreach (var item in PalletCylinders) | |||
{ | |||
if (item.Name == "进料桶顶升气缸") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[20]) | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
else | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
} | |||
if (item.Name == "出料桶顶升气缸1") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[21]) | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
else | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
} | |||
if (item.Name == "出料桶顶升气缸2") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[22]) | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
else | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
} | |||
if (item.Name == "出料桶顶升气缸3") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[23]) | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
else | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
} | |||
if (item.Name == "托盘气缸1_1") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[24]) | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
else | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
} | |||
if (item.Name == "托盘气缸1_2") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[25]) | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
else | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
} | |||
if (item.Name == "托盘气缸2_1") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[26]) | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
else | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
} | |||
if (item.Name == "托盘气缸2_2") | |||
{ | |||
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[27]) | |||
{ | |||
item.LeftTog = false; | |||
item.RightTog = true; | |||
} | |||
else | |||
{ | |||
item.LeftTog = true; | |||
item.RightTog = false; | |||
} | |||
} | |||
} | |||
Thread.Sleep(200); | |||
}), "获取系统状态", true); | |||
for (int i = 0; i < 15; i++) | |||
if (cylinderModels.Count < 15) | |||
{ | |||
cylinderModels.Add(new CylinderModel() | |||
for (int i = 0; i < 15; i++) | |||
{ | |||
Name = $"升降气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
cylinderModels.Add(new CylinderModel() | |||
{ | |||
Name = $"升降气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
BlockCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"阻挡气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
BlockCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"阻挡气缸 {i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
} | |||
for (int i = 1; i < 3; i++) | |||
if (PalletCylinders.Count < 8) | |||
{ | |||
PalletCylinders.Add(new CylinderModel() | |||
for (int i = 1; i < 3; i++) | |||
{ | |||
Name = $"托盘气缸1_{(i + 1)%2 +1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
for (int i = 1; i < 3; i++) | |||
{ | |||
PalletCylinders.Add(new CylinderModel() | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"托盘气缸1_{(i + 1) % 2 + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
for (int i = 1; i < 3; i++) | |||
{ | |||
Name = $"托盘气缸2_{(i + 1) % 2 + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"进料桶顶升气缸", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
for (int i = 0; i < 3; i++) | |||
{ | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"托盘气缸2_{(i + 1) % 2 + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"出料桶顶升气缸{i+1}", | |||
Name = $"进料桶顶升气缸", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
for (int i = 0; i < 3; i++) | |||
{ | |||
PalletCylinders.Add(new CylinderModel() | |||
{ | |||
Name = $"出料桶顶升气缸{i + 1}", | |||
LeftTog = false, | |||
RightTog = false, | |||
}); | |||
} | |||
} | |||
Open = new RelayCommand<object>((o) => | |||
{ | |||
@@ -139,18 +267,22 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
SystemStartCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("SystemStart"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统启动!"); | |||
}); | |||
SystemStopCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("SystemStop"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统停止!"); | |||
}); | |||
SystemPauseCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("SystemPause"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统暂停!"); | |||
}); | |||
SystemResetCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("SystemReset"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统暂停后复位!"); | |||
}); | |||
DebugMode = new RelayCommand(() => | |||
{ | |||
@@ -165,17 +297,17 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
/// <summary> | |||
/// 升降气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>(); | |||
public static ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>(); | |||
/// <summary> | |||
/// 阻挡气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
public static ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
/// <summary> | |||
/// 托盘气缸 | |||
/// </summary> | |||
public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
public static ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>(); | |||
public static string SystemMode { get { return _mSystemMode; } set { _mSystemMode = value; OnStaticPropertyChanged(); } } | |||
private static string _mSystemMode =String.Empty; | |||
@@ -24,30 +24,38 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
public ManualFlowViewModel() | |||
{ | |||
time = GVL_SmallStation.Time; | |||
time = GVL_SmallStation.GetInstance.Time; | |||
Test1Command = new RelayCommand(() => | |||
{ | |||
GVL_SmallStation.AGV_PutTray1Finish = true; | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成"); | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX0.7", PlcVarType = PlcVarType.Bool, Value = true }); | |||
//GVL_SmallStation.GetInstance.AGV_PutTray1Finish = true; | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,AGV送托盘完成"); | |||
}); | |||
Test2Command = new RelayCommand(() => | |||
{ | |||
GVL_SmallStation.WindSendDosingComple = true; | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.7", PlcVarType = PlcVarType.Bool, Value = true }); | |||
//GVL_SmallStation.GetInstance.WindSendDosingComple = true; | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓配料完成"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,粉料仓配料完成"); | |||
}); | |||
Test3Command = new RelayCommand(() => | |||
{ | |||
GVL_SmallStation.AGV_GetTray1Finish = true; | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.1", PlcVarType = PlcVarType.Bool, Value = true }); | |||
//GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true; | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV取托盘完成"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,AGV取托盘完成"); | |||
}); | |||
Test4Command = new RelayCommand(() => | |||
{ | |||
GVL_SmallStation.CylinderReset = true; | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.5", PlcVarType = PlcVarType.Bool, Value = true }); | |||
//GVL_SmallStation.GetInstance.CylinderReset = true; | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,气缸收紧错位复位"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,气缸收紧错位复位"); | |||
}); | |||
Test5Command = new RelayCommand(() => | |||
{ | |||
GVL_SmallStation.WindSendAllowAGVPutGet = true; | |||
GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet = true; | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓提升到位"); | |||
}); | |||
Test6Command = new RelayCommand(() => | |||
@@ -72,8 +80,9 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
DosingComplete = GVL_SmallStation.GetInstance.StockBinDosing.ToBinString(); | |||
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc; | |||
switch (GVL_SmallStation.SiemensSendRecipeStatus) | |||
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus) | |||
{ | |||
case 0: | |||
OrderStatus = IssueRecipeCondition.等待小料站PLC允许下配方.ToString(); | |||
@@ -118,10 +127,13 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
}), "流程手动设备状态读取",true); | |||
TimeSet = new RelayCommand(() => | |||
{ | |||
GVL_SmallStation.Time = time; | |||
GVL_SmallStation.GetInstance.Time = time; | |||
MessageNotify.GetInstance.ShowUserLog($"设置柔性味魔方复位时间:{time}s"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{time.ToString()}:设置成功!"); | |||
}); | |||
SiemensIsConnect = ProcessControl.GetInstance.SiemensDevice.IsConnected; | |||
HKPlcIsConnect = ProcessControl.GetInstance.HKDevice.IsConnected; | |||
WindSendIsConnect = ProcessControl.GetInstance.WindSendDevice.IsConnected; | |||
} | |||
public RelayCommand Test1Command { get; set; } | |||
public RelayCommand Test2Command { get; set; } | |||
@@ -132,7 +144,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
public RelayCommand TimeSet { get; set; } | |||
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } } | |||
private static bool _mHeartbeat; | |||
public int time { get { return _mtime; } set { _mtime = value; OnStaticPropertyChanged(); } } | |||
private int _mtime; | |||
public static string OrderStatus { get { return _mOrderStatus; } set { _mOrderStatus = value; OnStaticPropertyChanged(); } } | |||
@@ -147,5 +159,14 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
public RelayCommand CLearRecipeInfo { get; set; } | |||
public RelayCommand SystemReset { get; set; } | |||
public RelayCommand BPAResetCommand { get; set; } | |||
private bool _SiemensIsConnect { get; set; } | |||
public bool SiemensIsConnect { get { return _SiemensIsConnect; } set { _SiemensIsConnect = value; OnPropertyChanged(); } } | |||
private bool _HKPlcIsConnect { get; set; } | |||
public bool HKPlcIsConnect { get { return _HKPlcIsConnect; } set { _HKPlcIsConnect = value; OnPropertyChanged(); } } | |||
private bool _WindSendIsConnect { get; set; } | |||
public bool WindSendIsConnect { get { return _WindSendIsConnect; } set { _WindSendIsConnect = value; OnPropertyChanged(); } } | |||
private static string _DosingComplete { get; set; } | |||
public static string DosingComplete { get { return _DosingComplete; } set { _DosingComplete = value; OnStaticPropertyChanged(); } } | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using BPASmartClient.JXJFoodSmallStation.Model; | |||
using BPASmartClient.JXJFoodSmallStation.Model.GVL; | |||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
public class ProcessMonitorViewModel : ObservableObject | |||
{ | |||
public ProcessMonitorViewModel() | |||
{ | |||
} | |||
public ObservableCollection<PlcInfos> plcInfos => ProcessControl.GetInstance.ProcessVar; | |||
} | |||
} |
@@ -27,6 +27,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
//ObservableCollection<RemoteRecipeRawMaterial> RawMaterials { get; set; } = new ObservableCollection<RemoteRecipeRawMaterial>(); | |||
public RecipeReceiveViewModel() | |||
{ | |||
AskRecipeFormSiemens = GVL_SmallStation.GetInstance.RequestOrder; | |||
NotUseSmallDosing = GVL_SmallStation.GetInstance.NotUseSmallDosing; | |||
IsUseLocalRecipe = GVL_SmallStation.GetInstance.IsUseLocalRecipe; | |||
IsUseWindSendDosing = GVL_SmallStation.GetInstance.IsUseWindSend; | |||
Recipes = Json<LocalRecipeDataColl>.Data.Recipes; | |||
@@ -150,9 +152,19 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
public bool IsUseLocalRecipe { get { return _mIsUseLocalRecipe; }set { _mIsUseLocalRecipe = value; OnPropertyChanged(); } } | |||
private bool _mIsUseLocalRecipe ; | |||
public bool NotUseSmallDosing { get { return _mNotUseSmallDosing; } set { _mNotUseSmallDosing = value; OnPropertyChanged(); } } | |||
private bool _mNotUseSmallDosing; | |||
public bool IsUseWindSendDosing { get { return _mIsUseWindSendDosing; } set { _mIsUseWindSendDosing = value;OnPropertyChanged(); } } | |||
private bool _mIsUseWindSendDosing ; | |||
public bool AskRecipeFormSiemens { get { return _mAskRecipeFormSiemens; } set { _mAskRecipeFormSiemens = value; OnPropertyChanged(); } } | |||
private bool _mAskRecipeFormSiemens; | |||
public RelayCommand<object> DetailsCommand { get; set; } | |||
public RelayCommand<object> IssueRecipe { get; set; } | |||
public RelayCommand<object> RemoveRecipe { get; set; } | |||
@@ -25,17 +25,19 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
ThreadManage.GetInstance().StartLong(() => | |||
{ | |||
IsRunProgramNum = GVL_SmallStation.RobotProgramNum; | |||
RobotIsAutoMode = GVL_SmallStation.RobotStatus.GetBitValue(1); | |||
RobotIsAutoRun = GVL_SmallStation.RobotStatus.GetBitValue(2); | |||
RobotIsStop = GVL_SmallStation.RobotStatus.GetBitValue(3); | |||
RobotIsRun = GVL_SmallStation.RobotStatus.GetBitValue(4); | |||
RobotIsAlarm = GVL_SmallStation.RobotStatus.GetBitValue(5); | |||
RobotIsHomed = GVL_SmallStation.RobotStatus.GetBitValue(6); | |||
RobotGetEmptyBarrelComplete = GVL_SmallStation.RobotStatus.GetBitValue(8); | |||
RobotPutEmptyBarrelComplete = GVL_SmallStation.RobotStatus.GetBitValue(9); | |||
RobotGetFullBarrelComplete = GVL_SmallStation.RobotStatus.GetBitValue(10); | |||
RobotPutFullBarrelComplete = GVL_SmallStation.RobotStatus.GetBitValue(11); | |||
IsRunProgramNum = GVL_SmallStation.GetInstance.RobotProgramNum; | |||
RobotIsAutoMode = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(1); | |||
RobotIsAutoRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(2); | |||
RobotIsStop = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(3); | |||
RobotIsRun = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(4); | |||
RobotIsAlarm = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(5); | |||
RobotIsHomed = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(6); | |||
RobotGetEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(8); | |||
RobotPutEmptyBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(9); | |||
RobotGetFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(10); | |||
RobotPutFullBarrelComplete = GVL_SmallStation.GetInstance.RobotStatus.GetBitValue(11); | |||
Thread.Sleep(10); | |||
},"机器人状态",true); | |||
SystemStart = new RelayCommand(() => { | |||
@@ -13,6 +13,7 @@ using BPASmartClient.CustomResource.UserControls; | |||
using System.Diagnostics; | |||
using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Par; | |||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
@@ -45,11 +46,17 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
}); | |||
SetParCommand = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("AxisLoadSpeedSet", AxisLoadSpeed); | |||
ActionManage.GetInstance.Send("AxisMidSpeedSet", AxisMidSpeed); | |||
ActionManage.GetInstance.Send("AxisUnLoadSpeedSet", AxisUnLoadSpeed); | |||
ActionManage.GetInstance.Send("Axis1SpeedSet", Axis1Speed); | |||
ActionManage.GetInstance.Send("Axis2SpeedSet", Axis2Speed); | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBD0", PlcVarType = PlcVarType.Real, Value = Axis1Speed }); | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBD4", PlcVarType = PlcVarType.Real, Value = Axis2Speed }); | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBW8", PlcVarType = PlcVarType.Int, Value = AxisLoadSpeed }); | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBW10", PlcVarType = PlcVarType.Int, Value = AxisMidSpeed }); | |||
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB47.DBW12", PlcVarType = PlcVarType.Int, Value = AxisUnLoadSpeed }); | |||
//ActionManage.GetInstance.Send("AxisLoadSpeedSet", AxisLoadSpeed); | |||
//ActionManage.GetInstance.Send("AxisMidSpeedSet", AxisMidSpeed); | |||
//ActionManage.GetInstance.Send("AxisUnLoadSpeedSet", AxisUnLoadSpeed); | |||
//ActionManage.GetInstance.Send("Axis1SpeedSet", Axis1Speed); | |||
//ActionManage.GetInstance.Send("Axis2SpeedSet", Axis2Speed); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"参数设置成功!"); | |||
}); | |||
} | |||
@@ -12,6 +12,7 @@ using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.CustomResource.UserControls; | |||
using System.Diagnostics; | |||
using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | |||
using System.Threading; | |||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
@@ -30,14 +31,14 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
}); | |||
} | |||
} | |||
SaveCommand = new RelayCommand(() => | |||
SaveRawMaterialPara = new RelayCommand(() => | |||
{ | |||
Json<DevicePar>.Save(); | |||
}); | |||
} | |||
public ObservableCollection<WindSendRawMaterial> WindSendRawMaterial => Json<DevicePar>.Data.windSendRawMaterial; | |||
public RelayCommand SaveCommand { get; set; } | |||
public RelayCommand SaveRawMaterialPara { get; set; } | |||
} | |||
} |
@@ -316,7 +316,7 @@ namespace BPASmartClient.MorkS | |||
private void DataParse() | |||
{ | |||
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | |||
{ | |||
{ | |||
if (@event == null) return; | |||
if (@event is DoOrderEvent order) | |||
{ | |||
@@ -404,6 +404,10 @@ namespace BPASmartClient.MorkS | |||
WriteControl("M260.0", data.ToArray()); | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COOKING); | |||
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK); | |||
} | |||
private void BowlControl(OrderLocInfo orderLocInfo) | |||
@@ -697,7 +701,8 @@ namespace BPASmartClient.MorkS | |||
mORKS.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKS.TurntableLocLists.Count > 0 && !mORKS.TurntableLowerLimit, 4); | |||
//mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); | |||
mORKS.RobotTaskInterlock = isok && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment); | |||
mORKS.InvertedNoodlesOpenBusy = Json<MorksPar>.Data.InvertedNoodles_OpenBusyNum; | |||
mORKS.RobotTaskInterlock = isok && mORKS.AllowFallNoodle && (mlCount >= mORKS.InvertedNoodlesOpenBusy || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment) && !mORKS.TakeMealDetect;//加个取餐口检测判断是否去面 | |||
} | |||
@@ -324,6 +324,9 @@ namespace BPASmartClient.MorkS | |||
[VariableMonitor("制作完成标志")] | |||
public bool CookCompleteFlatBit { get; set; } | |||
[VariableMonitor("到面条件,煮面口忙碌数量")] | |||
public int InvertedNoodlesOpenBusy { get; set; } = 5; | |||
#region 订单ID记录 | |||
/// <summary> | |||
@@ -17,5 +17,9 @@ namespace BPASmartClient.MorkS.Model | |||
/// 加汤时间,单位秒 | |||
/// </summary> | |||
public float AddSoupTime { get; set; } = 2; | |||
/// <summary> | |||
/// 倒面条件 煮面口忙碌数量 | |||
/// </summary> | |||
public int InvertedNoodles_OpenBusyNum { get; set; } = 5; | |||
} | |||
} |
@@ -78,7 +78,7 @@ | |||
<Grid Grid.Row="2"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition /> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="150" /> | |||
</Grid.RowDefinitions> | |||
<ItemsControl Grid.Row="0" ItemsSource="{Binding parSets}"> | |||
@@ -130,7 +130,7 @@ | |||
<StackPanel Grid.Row="1" Orientation="Horizontal"> | |||
<TextBlock | |||
FontSize="21" | |||
Margin="40 0 0 0" | |||
Margin="40 0 0 0" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="加汤时间:" /> | |||
<TextBox | |||
@@ -151,7 +151,7 @@ | |||
Text="(秒)" /> | |||
<TextBlock | |||
FontSize="21" | |||
Margin="40 0 0 0" | |||
Margin="40 0 0 0" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="清洗加汤管道时间:" /> | |||
<TextBox | |||
@@ -172,6 +172,27 @@ | |||
Text="(秒)" /> | |||
<Button Content="启动" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5" Foreground="Aqua" | |||
Style="{StaticResource ButtonStyle}" Command="{Binding CommandStart}" /> | |||
<TextBlock | |||
FontSize="21" | |||
Margin="40 0 0 0" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="倒面条件,煮面口使用数量:" /> | |||
<TextBox | |||
Width="100" | |||
Margin="10,0,0,0" | |||
VerticalAlignment="Center" | |||
Background="Transparent" | |||
BorderBrush="#FF23CACA" | |||
CaretBrush="Aqua" | |||
FontFamily="楷体" | |||
FontSize="21" | |||
Foreground="#ff34f7f7" | |||
Text="{Binding OpenUseNumber}" /> | |||
<TextBlock | |||
FontSize="21" | |||
Margin="10 0 0 0" | |||
Style="{StaticResource TextBlockStyle}" | |||
Text="(个)" /> | |||
</StackPanel> | |||
</Grid> | |||
@@ -36,9 +36,13 @@ namespace BPASmartClient.MorkS.ViewModel | |||
/// 加汤时间设置 | |||
/// </summary> | |||
public float AddSoup { get { return Json<MorksPar>.Data.AddSoupTime; } set { Json<MorksPar>.Data.AddSoupTime = value; OnPropertyChanged(); } } | |||
public int OpenUseNumber { get { return Json<MorksPar>.Data.InvertedNoodles_OpenBusyNum; } set { Json<MorksPar>.Data.InvertedNoodles_OpenBusyNum = value; OnPropertyChanged(); } } | |||
public float DelayTime { get { return _DelayTime; } set { _DelayTime = value; OnPropertyChanged(); } } | |||
private float _DelayTime; | |||
private void SaveSettingData() | |||
{ | |||
List<ushort> values = new List<ushort>(); | |||
@@ -7,9 +7,9 @@ | |||
<add key="IsEnableTest" value="false"/> | |||
<!--测试环境--> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="test1_HostComputer"/> | |||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | |||
<add key ="Namespaces" value="DEV.test1.Config"/> | |||
<!--开发环境--> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
@@ -17,9 +17,9 @@ | |||
<add key ="Namespaces" value="DEV.Config"/>--> | |||
<!--正式环境--> | |||
<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<add key="appid" value="hostcomputer"/> | |||
<add key ="namespaces" value="test1.config"/> | |||
<add key ="namespaces" value="test1.config"/>--> | |||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | |||
@@ -0,0 +1,18 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using BPASmartClient.Model; | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
public class LocaPar | |||
{ | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>(); | |||
} | |||
} |
@@ -308,273 +308,100 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
} | |||
for (int j = 0; j < GlobalDevice.PlcData.IsAllowIngredients.Length; j++) | |||
{ | |||
//if (GlobalDevice.PlcData.IsAllowIngredients[j]) | |||
//{ | |||
// int barrel = j + 1;//桶号 | |||
// int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 0~6 | |||
// if (RTrig.GetInstance("a").Start(GlobalDevice.PlcData.IsAllowIngredients[j])) | |||
// { | |||
// MessageNotify.GetInstance.ShowRunLog($"桶号:{barrel},位置:{cnt},允许配料"); | |||
// } | |||
// int Location1 = 0; | |||
// int Location2 = 0; | |||
// if (cnt == -1) | |||
// { | |||
// MessageNotify.GetInstance.ShowRunLog("错误"); | |||
// return; | |||
// } | |||
// else | |||
// { | |||
// switch (cnt) | |||
// { | |||
// case 1: | |||
// int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1); | |||
// int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2); | |||
// if (a1 >= 0) | |||
// { | |||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||
// } | |||
// if (b1 >= 0) | |||
// { | |||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b1).DeviceName && p.Loc == barrel); | |||
// } | |||
// break; | |||
// case 2: | |||
// int a2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 3); | |||
// int b2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 4); | |||
// if (a2 >= 0) | |||
// { | |||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a2).DeviceName && p.Loc == barrel); | |||
// } | |||
// if (b2 >= 0) | |||
// { | |||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b2).DeviceName && p.Loc == barrel); | |||
// } | |||
// break; | |||
// case 3: | |||
// int a3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 5); | |||
// int b3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 6); | |||
// if (a3 >= 0) | |||
// { | |||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a3).DeviceName && p.Loc == barrel); | |||
// } | |||
// if (b3 >= 0) | |||
// { | |||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b3).DeviceName && p.Loc == barrel); | |||
// } | |||
// break; | |||
// case 4: | |||
// int a4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 7); | |||
// int b4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 8); | |||
// if (a4 >= 0) | |||
// { | |||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a4).DeviceName && p.Loc == barrel); | |||
// } | |||
// if (b4 >= 0) | |||
// { | |||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b4).DeviceName && p.Loc == barrel); | |||
// } | |||
// break; | |||
// case 5: | |||
// int a5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 9); | |||
// int b5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 10); | |||
// if (a5 >= 0) | |||
// { | |||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a5).DeviceName && p.Loc == barrel); | |||
// } | |||
// if (b5 >= 0) | |||
// { | |||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b5).DeviceName && p.Loc == barrel); | |||
// } | |||
// break; | |||
// case 6: | |||
// int a6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 11); | |||
// int b6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 12); | |||
// if (a6 >= 0) | |||
// { | |||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a6).DeviceName && p.Loc == barrel); | |||
// } | |||
// if (b6 >= 0) | |||
// { | |||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b6).DeviceName && p.Loc == barrel); | |||
// } | |||
// break; | |||
// default: | |||
// break; | |||
// } | |||
// } | |||
// if (Location1 >= 0) | |||
// { | |||
// string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||
// int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||
// int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||
// if (DeviceNum > 0) | |||
// { | |||
// float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialWeight; | |||
// int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||
// if (loc >= 0 && RawName != null && weight >= 0) | |||
// { | |||
// int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index < 0) | |||
// { | |||
// StockStatus.Add(new StockStatusModel() | |||
// { | |||
// MaterialName = RawName, | |||
// IssueWeight = weight, | |||
// IssueStatus = 0, | |||
// }); | |||
// } | |||
// St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index >= 0) | |||
// { | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||
// { | |||
// StockStatus.ElementAt(St_index).IssueStatus = 1; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||
// } | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||
// { | |||
// //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||
// StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
// int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
// byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||
// int item = test1.ToInt(); | |||
// string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item,2); | |||
// MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
// MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
// } | |||
// } | |||
// } | |||
// } | |||
// } | |||
// if (Location1 >= 0) | |||
// { | |||
// string RawName111 = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||
// int St_index111 = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName111); | |||
// if (Location2 >= 0 && ((Location1 >= 0 && StockStatus.ElementAt(St_index111).IssueStatus == 2))) | |||
// { | |||
// string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||
// int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||
// int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||
// if (DeviceNum > 0) | |||
// { | |||
// float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||
// int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||
// if (loc >= 0 && RawName != null && weight >= 0) | |||
// { | |||
// int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index < 0) | |||
// { | |||
// StockStatus.Add(new StockStatusModel() | |||
// { | |||
// MaterialName = RawName, | |||
// IssueWeight = weight, | |||
// IssueStatus = 0, | |||
// }); | |||
// } | |||
// St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index >= 0) | |||
// { | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||
// { | |||
// StockStatus.ElementAt(St_index).IssueStatus = 1; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||
// } | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||
// { | |||
// //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||
// StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
// int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
// byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||
// int item = test1.ToInt(); | |||
// string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||
// MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
// //MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||
// MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item}"); | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
// } | |||
// } | |||
// } | |||
// } | |||
// } | |||
// } | |||
// else | |||
// { | |||
// if (Location2 >= 0) | |||
// { | |||
// string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||
// int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||
// int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||
// if (DeviceNum >= 0) | |||
// { | |||
// float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||
// int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||
// if (cnt > 0 && loc >= 0 && RawName != null && weight >= 0) | |||
// { | |||
// int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index < 0) | |||
// { | |||
// StockStatus.Add(new StockStatusModel() | |||
// { | |||
// MaterialName = RawName, | |||
// IssueWeight = weight, | |||
// IssueStatus = 0, | |||
// }); | |||
// } | |||
// St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index >= 0) | |||
// { | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||
// { | |||
// StockStatus.ElementAt(St_index).IssueStatus = 1; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||
// } | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||
// { | |||
// //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||
// StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
// int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
// byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||
// int item = test1.ToInt(); | |||
// string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||
// recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).UpLimtWeightFeedback = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).deviceStatus.NowWeightFeedback; | |||
// MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
// MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
// } | |||
// } | |||
// } | |||
// } | |||
// } | |||
// } | |||
//} | |||
//508配料项目代码 | |||
if (GlobalDevice.PlcData.IsAllowIngredients[j]) | |||
{ | |||
int barrel = j + 1;//桶号 | |||
int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 1~10 | |||
int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 0~6 | |||
if (RTrig.GetInstance("a").Start(GlobalDevice.PlcData.IsAllowIngredients[j])) | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog($"桶号:{barrel},位置:{cnt},允许配料"); | |||
} | |||
int Location1 = 0; | |||
int Location2 = 0; | |||
if (cnt == -1) | |||
{ | |||
MessageNotify.GetInstance.ShowRunLog("没有读取到配料的位置"); | |||
MessageNotify.GetInstance.ShowRunLog("错误"); | |||
return; | |||
} | |||
else | |||
{ | |||
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt); | |||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||
switch (cnt) | |||
{ | |||
case 1: | |||
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1); | |||
int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2); | |||
if (a1 >= 0) | |||
{ | |||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||
} | |||
if (b1 >= 0) | |||
{ | |||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b1).DeviceName && p.Loc == barrel); | |||
} | |||
break; | |||
case 2: | |||
int a2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 3); | |||
int b2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 4); | |||
if (a2 >= 0) | |||
{ | |||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a2).DeviceName && p.Loc == barrel); | |||
} | |||
if (b2 >= 0) | |||
{ | |||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b2).DeviceName && p.Loc == barrel); | |||
} | |||
break; | |||
case 3: | |||
int a3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 5); | |||
int b3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 6); | |||
if (a3 >= 0) | |||
{ | |||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a3).DeviceName && p.Loc == barrel); | |||
} | |||
if (b3 >= 0) | |||
{ | |||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b3).DeviceName && p.Loc == barrel); | |||
} | |||
break; | |||
case 4: | |||
int a4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 7); | |||
int b4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 8); | |||
if (a4 >= 0) | |||
{ | |||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a4).DeviceName && p.Loc == barrel); | |||
} | |||
if (b4 >= 0) | |||
{ | |||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b4).DeviceName && p.Loc == barrel); | |||
} | |||
break; | |||
case 5: | |||
int a5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 9); | |||
int b5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 10); | |||
if (a5 >= 0) | |||
{ | |||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a5).DeviceName && p.Loc == barrel); | |||
} | |||
if (b5 >= 0) | |||
{ | |||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b5).DeviceName && p.Loc == barrel); | |||
} | |||
break; | |||
case 6: | |||
int a6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 11); | |||
int b6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 12); | |||
if (a6 >= 0) | |||
{ | |||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a6).DeviceName && p.Loc == barrel); | |||
} | |||
if (b6 >= 0) | |||
{ | |||
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b6).DeviceName && p.Loc == barrel); | |||
} | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
if (Location1 >= 0) | |||
{ | |||
@@ -611,34 +438,207 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
/*int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||
int item = test1.ToInt();*/ | |||
if (DeviceNum >= 1 && DeviceNum <= 8) | |||
int item = test1.ToInt(); | |||
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 2); | |||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
if (Location1 >= 0) | |||
{ | |||
string RawName111 = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||
int St_index111 = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName111); | |||
if (Location2 >= 0 && ((Location1 >= 0 && StockStatus.ElementAt(St_index111).IssueStatus == 2))) | |||
{ | |||
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||
if (DeviceNum > 0) | |||
{ | |||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||
if (loc >= 0 && RawName != null && weight >= 0) | |||
{ | |||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
if (St_index < 0) | |||
{ | |||
StockStatus.Add(new StockStatusModel() | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX130." + (DeviceNum - 1), true); | |||
}else if (DeviceNum >= 9 && DeviceNum <= 16) | |||
MaterialName = RawName, | |||
IssueWeight = weight, | |||
IssueStatus = 0, | |||
}); | |||
} | |||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
if (St_index >= 0) | |||
{ | |||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX131." + (DeviceNum - 9), true); | |||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||
} | |||
else if (DeviceNum >=17 && DeviceNum <= 24) | |||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX132." + (DeviceNum - 17), true); | |||
}else if (DeviceNum >= 25 && DeviceNum <= 32) | |||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||
int item = test1.ToInt(); | |||
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
//MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item}"); | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
else | |||
{ | |||
if (Location2 >= 0) | |||
{ | |||
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName; | |||
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||
if (DeviceNum >= 0) | |||
{ | |||
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight; | |||
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||
if (cnt > 0 && loc >= 0 && RawName != null && weight >= 0) | |||
{ | |||
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
if (St_index < 0) | |||
{ | |||
StockStatus.Add(new StockStatusModel() | |||
{ | |||
MaterialName = RawName, | |||
IssueWeight = weight, | |||
IssueStatus = 0, | |||
}); | |||
} | |||
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
if (St_index >= 0) | |||
{ | |||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||
{ | |||
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX133." + (DeviceNum - 25), true); | |||
StockStatus.ElementAt(St_index).IssueStatus = 1; | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||
} | |||
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||
{ | |||
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||
StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||
int item = test1.ToInt(); | |||
string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 5); | |||
recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).UpLimtWeightFeedback = DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).deviceStatus.NowWeightFeedback; | |||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}"); | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
} | |||
MessageNotify.GetInstance.ShowRunLog($"料仓:{DeviceNum},配料完成"); | |||
/*string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 2); | |||
MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}");*/ | |||
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
//508配料项目代码 | |||
//if (GlobalDevice.PlcData.IsAllowIngredients[j]) | |||
//{ | |||
// int barrel = j + 1;//桶号 | |||
// int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 1~10 | |||
// if (RTrig.GetInstance("a").Start(GlobalDevice.PlcData.IsAllowIngredients[j])) | |||
// { | |||
// MessageNotify.GetInstance.ShowRunLog($"桶号:{barrel},位置:{cnt},允许配料"); | |||
// } | |||
// int Location1 = 0; | |||
// if (cnt == -1) | |||
// { | |||
// MessageNotify.GetInstance.ShowRunLog("没有读取到配料的位置"); | |||
// return; | |||
// } | |||
// else | |||
// { | |||
// int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt); | |||
// Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | |||
// } | |||
// if (Location1 >= 0) | |||
// { | |||
// string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName; | |||
// int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName); | |||
// int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum; | |||
// if (DeviceNum > 0) | |||
// { | |||
// float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialWeight; | |||
// int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName); | |||
// if (loc >= 0 && RawName != null && weight >= 0) | |||
// { | |||
// int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index < 0) | |||
// { | |||
// StockStatus.Add(new StockStatusModel() | |||
// { | |||
// MaterialName = RawName, | |||
// IssueWeight = weight, | |||
// IssueStatus = 0, | |||
// }); | |||
// } | |||
// St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName); | |||
// if (St_index >= 0) | |||
// { | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0) | |||
// { | |||
// StockStatus.ElementAt(St_index).IssueStatus = 1; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight); | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料"); | |||
// } | |||
// if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1) | |||
// { | |||
// //GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用 | |||
// StockStatus.ElementAt(St_index).IssueStatus = 2; | |||
// DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset(); | |||
// /*int a = 0.SetBitValue((byte)(DeviceNum), true); | |||
// byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD); | |||
// int item = test1.ToInt();*/ | |||
// if (DeviceNum >= 1 && DeviceNum <= 8) | |||
// { | |||
// SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX130." + (DeviceNum - 1), true); | |||
// }else if (DeviceNum >= 9 && DeviceNum <= 16) | |||
// { | |||
// SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX131." + (DeviceNum - 9), true); | |||
// } | |||
// else if (DeviceNum >=17 && DeviceNum <= 24) | |||
// { | |||
// SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX132." + (DeviceNum - 17), true); | |||
// }else if (DeviceNum >= 25 && DeviceNum <= 32) | |||
// { | |||
// SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX133." + (DeviceNum - 25), true); | |||
// } | |||
// MessageNotify.GetInstance.ShowRunLog($"料仓:{DeviceNum},配料完成"); | |||
// /*string res = SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item, 2); | |||
// MessageNotify.GetInstance.ShowRunLog($"{res}"); | |||
// MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}");*/ | |||
// MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位"); | |||
// } | |||
// } | |||
// } | |||
// } | |||
// } | |||
//} | |||
} | |||
int Finish_Count = StockStatus.Where(s => s.IssueStatus == 2).Count(); | |||
if (StockStatus.Count >= Recipes.ElementAt(i).RawMaterials.Count && Finish_Count >= Recipes.ElementAt(i).RawMaterials.Count) //配方配料完成 | |||