@@ -133,6 +133,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
} | |||
} | |||
} | |||
//验证配方数据是否下发 | |||
Thread.Sleep(200); | |||
if (!ReadPlcRecipeData(recipe)) | |||
{ | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
MessageNotify.GetInstance.ShowDialog($"配方{recipe.RecipeCode},plc配方数据和西门子配方数据不一致!", DialogType.Error); | |||
}); | |||
} | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},配方数据验证成功"); | |||
} | |||
} | |||
/// <summary> | |||
@@ -197,7 +207,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
{ | |||
string Address = ""; | |||
float ReadWeight = (float)0.0; | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},位置:{loc},重量:{recipe.RawMaterial.ElementAt(index).RawMaterialWeight}"); | |||
switch (barrel) | |||
{ | |||
case 1: | |||
@@ -219,6 +228,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC | |||
default: | |||
break; | |||
} | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号:{recipe.TrayCode},桶号:{barrel},地址:{Address},重量:{ReadWeight}"); | |||
if (Math.Floor(recipe.RawMaterial.ElementAt(index).RawMaterialWeight) != Math.Floor(ReadWeight)) | |||
{ | |||
return false; | |||
@@ -225,20 +225,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
{ | |||
GVL_BigStation.BarrelWasherSign = true; | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶 | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},订单类型为洗桶"); | |||
HKDevice.WritePlcRecipeData(LocalRecipes.ElementAt(index)); | |||
Thread.Sleep(200); | |||
if (!HKDevice.ReadPlcRecipeData(LocalRecipes.ElementAt(index))) | |||
{ | |||
App.Current.Dispatcher.Invoke(() => | |||
{ | |||
MessageNotify.GetInstance.ShowDialog($"plc配方数据和西门子配方数据不一致!", DialogType.Error); | |||
}); | |||
}; | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true); | |||
GVL_BigStation.Recipe1DosingStatus = 1; | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},下发完成"); | |||
} | |||
} | |||
else | |||
@@ -246,7 +238,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
HKDevice.WritePlcRecipeData(LocalRecipes.ElementAt(index)); | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true); | |||
GVL_BigStation.Recipe1DosingStatus = 1; | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},下发完成"); | |||
} | |||
} | |||
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1) | |||
@@ -254,12 +246,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
if (LocalRecipes.ElementAt(index).IsWashingBarrel) | |||
{ | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位 | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},洗桶信号复位"); | |||
} | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false); | |||
StockBinParReset(); | |||
GVL_BigStation.Recipe1DosingStatus = 2; | |||
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},PLC接收配方完成"); | |||
} | |||
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish) | |||
{ | |||
@@ -288,7 +280,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
default: | |||
break; | |||
} | |||
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},配料完成"); | |||
foreach (var item in LocalRecipes.ElementAt(index).RawMaterial) | |||
{ | |||
if (item.RawMaterialLocation == 1) | |||
@@ -1001,7 +993,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
} | |||
else | |||
{ | |||
if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1) | |||
if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1) | |||
{ | |||
SiemensRecipeQueue1.Enqueue(data.RecipeCode); | |||
MessageNotify.GetInstance.ShowRunLog($"本地配方,配方:{data.RecipeCode},加入队列1"); | |||
@@ -1346,7 +1338,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
} | |||
GVL_BigStation.Recipe1DosingFinish = true; | |||
GVL_BigStation.Recipe1DosingStatus = 3; | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,配方编号:{code},托盘编号:{trayCode},配料完成"); | |||
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); | |||
if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe) | |||
{ | |||
@@ -1368,7 +1360,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe1Time).TotalSeconds; | |||
FinishData.ProcessTime = Convert.ToInt16(a); | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,{code}配方配料完成,将信号反馈给西门子"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); | |||
} | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.4", true); | |||
GVL_BigStation.Recipe1DosingStatus = 3; | |||
@@ -1382,7 +1374,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
}); | |||
GVL_BigStation.Recipe1DosingStatus = 0; | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,{code}配方配料完成,复位plc配料完成信号"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方1,,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); | |||
} | |||
} | |||
} | |||
@@ -1459,7 +1451,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
GVL_BigStation.BarrelWasherSign = false; | |||
} | |||
GVL_BigStation.Recipe2DosingFinish = true; | |||
MessageNotify.GetInstance.ShowRunLog($"配方2,配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},配料完成"); | |||
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); | |||
if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe) | |||
{ | |||
@@ -1481,7 +1473,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe2Time).TotalSeconds; | |||
FinishData.ProcessTime = Convert.ToInt16(a); | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | |||
MessageNotify.GetInstance.ShowRunLog($"配方2,{code}配方配料完成,将信号反馈给西门子"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); | |||
} | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", true); | |||
GVL_BigStation.Recipe2DosingStatus = 3; | |||
@@ -1496,7 +1488,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
}); | |||
GVL_BigStation.Recipe2DosingStatus = 0; | |||
MessageNotify.GetInstance.ShowRunLog($"配方2,{code}配方配料完成,复位plc配料完成信号"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方2,,配方编号:{code},托盘编号:{trayCode},,复位plc配料完成信号"); | |||
} | |||
} | |||
} | |||
@@ -1573,7 +1565,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
} | |||
GVL_BigStation.Recipe3DosingFinish = true; | |||
GVL_BigStation.Recipe3DosingStatus = 3; | |||
MessageNotify.GetInstance.ShowRunLog($"配方3,配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},配料完成"); | |||
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); | |||
if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe) | |||
{ | |||
@@ -1595,7 +1587,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe3Time).TotalSeconds; | |||
FinishData.ProcessTime = Convert.ToInt16(a); | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | |||
MessageNotify.GetInstance.ShowRunLog($"配方3,{code}配方配料完成,将信号反馈给西门子"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方3,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); | |||
} | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.6", true); | |||
GVL_BigStation.Recipe3DosingStatus = 3; | |||
@@ -1609,7 +1601,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
}); | |||
GVL_BigStation.Recipe3DosingStatus = 0; | |||
MessageNotify.GetInstance.ShowRunLog($"配方3,{code}配方配料完成,复位plc配料完成信号"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方3,,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); | |||
} | |||
} | |||
} | |||
@@ -1686,7 +1678,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
} | |||
GVL_BigStation.Recipe4DosingFinish = true; | |||
GVL_BigStation.Recipe4DosingStatus = 3; | |||
MessageNotify.GetInstance.ShowRunLog($"配方4,配方状态:{code}配料完成"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},配料完成"); | |||
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index)); | |||
if (SiemensDevice.IsConnected && !GVL_BigStation.IsUseLocalRecipe) | |||
{ | |||
@@ -1708,7 +1700,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
double a = DateTime.Now.Subtract(GVL_BigStation.DosingRecipe4Time).TotalSeconds; | |||
FinishData.ProcessTime = Convert.ToInt16(a); | |||
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361); | |||
MessageNotify.GetInstance.ShowRunLog($"配方4,{code}配方配料完成,将信号反馈给西门子"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},配料完成,将信号反馈给西门子"); | |||
} | |||
HKDevice.HK_PLC_S7.Write("DB99.DBX1.7", true); | |||
GVL_BigStation.Recipe4DosingStatus = 3; | |||
@@ -1722,7 +1714,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方 | |||
}); | |||
GVL_BigStation.Recipe4DosingStatus = 0; | |||
MessageNotify.GetInstance.ShowRunLog($"配方4,{code}配方配料完成,复位plc配料完成信号"); | |||
MessageNotify.GetInstance.ShowRunLog($"配方4,配方编号:{code},托盘编号:{trayCode},复位plc配料完成信号"); | |||
} | |||
} | |||
} | |||
@@ -7,7 +7,7 @@ | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodBigStation.ViewModel" | |||
Title="RecipeInfosView" | |||
Width="800" | |||
Width="1000" | |||
Height="620" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
@@ -305,17 +305,20 @@ | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition/> | |||
<ColumnDefinition Width="120"/> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock Grid.Column="0" Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<TextBlock Grid.Column="0" Text="原料位置" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter></GridSplitter> | |||
<TextBlock Grid.Column="1" Text="原料位置" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<TextBlock Grid.Column="1" Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter Grid.Column="1"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="原料中文名" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter Grid.Column="1"></GridSplitter> | |||
<TextBlock Grid.Column="2" Text="托盘桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<TextBlock Grid.Column="3" Text="托盘桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<GridSplitter Grid.Column="2"></GridSplitter> | |||
<TextBlock Grid.Column="3" Text="原料重量" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"></TextBlock> | |||
<TextBlock Grid.Column="4" Text="原料重量" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"></TextBlock> | |||
<GridSplitter Grid.Column="3"></GridSplitter> | |||
<TextBlock Grid.Column="4" Text="操作" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
<TextBlock Grid.Column="5" Text="操作" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"/> | |||
</Grid> | |||
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden"> | |||
<ItemsControl ItemsSource="{Binding RawMaterialsInfo}"> | |||
@@ -335,6 +338,7 @@ | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition></ColumnDefinition> | |||
<ColumnDefinition Width="120"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<!--<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding RawMaterialLocation}" Margin="10,0,0,10" Width="190" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus"> | |||
@@ -356,36 +360,40 @@ | |||
FontSize="14" | |||
Foreground="LightGray" | |||
IsEditable="False" | |||
ItemsSource="{Binding DataContext.RawMaterialNames, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedIndex="{Binding RawMaterialCount}" | |||
ItemsSource="{Binding DataContext.RawMaterialLocation, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | |||
SelectedValue="{Binding RawMaterialLocation}" | |||
MouseLeave="ComboBox_MouseLeave" | |||
Style="{StaticResource ComboBoxStyle}" | |||
Text="{Binding RawMaterialName}"/> | |||
Text="{Binding RawMaterialLocation}"/> | |||
<StackPanel | |||
VerticalAlignment="Center" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock Grid.Column="1" Text="{Binding RawMaterialLocation}" Background="Transparent" FontSize="14" Foreground="LightGray" ></TextBlock> | |||
<TextBlock Grid.Column="1" Text="{Binding RawMaterialName}" Background="Transparent" FontSize="14" Foreground="LightGray" ></TextBlock> | |||
</StackPanel> | |||
<StackPanel | |||
VerticalAlignment="Center" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center" > | |||
<TextBlock Grid.Column="1" Text="{Binding RawMaterialChineseName}" Background="Transparent" FontSize="14" Foreground="LightGray" ></TextBlock> | |||
</StackPanel> | |||
<!--<TextBox Text="{Binding RawMaterialName}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="190" Margin="10,0,0,10" ></TextBox>--> | |||
<StackPanel | |||
Margin="3" Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Center"> | |||
Margin="3" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Center"> | |||
<TextBox Text="{Binding RawMaterialBarrelNum}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="120" ></TextBox> | |||
</StackPanel> | |||
<StackPanel | |||
Margin="3" Orientation="Horizontal" Grid.Column="3" HorizontalAlignment="Center"> | |||
Margin="3" Orientation="Horizontal" Grid.Column="4" HorizontalAlignment="Center"> | |||
<TextBox Text="{Binding RawMaterialWeight}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="120" ></TextBox> | |||
<TextBlock FontSize="14" VerticalAlignment="Center" Margin="4,0,0,0" Text="Kg" Foreground="#e69519" ></TextBlock> | |||
</StackPanel> | |||
<Button Grid.Column="4" | |||
<Button Grid.Column="5" | |||
Content="删除" | |||
Width="94" | |||
FontSize="14" | |||
Background="Transparent" | |||
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Center" | |||
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RawMaterialCount}"></Button> | |||
CommandParameter="{Binding RawMaterialLocation}"></Button> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
@@ -37,69 +37,72 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
} | |||
Thread.Sleep(100); | |||
}), "plc变量读取",true); | |||
foreach (PropertyInfo mi in properties) | |||
if (PlcInfo.Count == 0) | |||
{ | |||
PropertyInfo a = GVL_BigStation.HKPlc_Read.GetType().GetProperty(mi.Name); | |||
object ab = a.GetValue(GVL_BigStation.HKPlc_Read, null); | |||
if (mi.PropertyType.Name == "Int16") | |||
foreach (PropertyInfo mi in properties) | |||
{ | |||
addressPos = "DBW"; | |||
Offset = Math.Ceiling(Offset); | |||
if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0) | |||
PropertyInfo a = GVL_BigStation.HKPlc_Read.GetType().GetProperty(mi.Name); | |||
object ab = a.GetValue(GVL_BigStation.HKPlc_Read, null); | |||
if (mi.PropertyType.Name == "Int16") | |||
{ | |||
addressPos = "DBW"; | |||
Offset = Math.Ceiling(Offset); | |||
if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0) | |||
{ | |||
Offset += 1.0; | |||
} | |||
} | |||
else if (mi.PropertyType.Name == "Boolean") | |||
{ | |||
Offset += 1.0; | |||
addressPos = "DBX"; | |||
Offset = Math.Round(Offset, 1); | |||
if ((Offset - Math.Floor(Offset)) >= 0.8) | |||
{ | |||
Offset = Math.Ceiling(Offset); | |||
} | |||
} | |||
} | |||
else if (mi.PropertyType.Name == "Boolean") | |||
{ | |||
addressPos = "DBX"; | |||
Offset = Math.Round(Offset, 1); | |||
if ((Offset - Math.Floor(Offset)) >= 0.8) | |||
else if (mi.PropertyType.Name == "Single") | |||
{ | |||
addressPos = "DBD"; | |||
Offset = Math.Ceiling(Offset); | |||
if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0) | |||
{ | |||
Offset += 1.0; | |||
} | |||
} | |||
} | |||
else if (mi.PropertyType.Name == "Single") | |||
{ | |||
addressPos = "DBD"; | |||
Offset = Math.Ceiling(Offset); | |||
if (Offset / 2.0 - Math.Floor(Offset / 2.0) > 0.0) | |||
var num = GVL_BigStation.HKPlc_Read; | |||
var res = a.GetCustomAttribute<PlcCommAttribute>(); | |||
string describe = ""; | |||
if (res != null) | |||
{ | |||
Offset += 1.0; | |||
describe = res.Describe; | |||
} | |||
} | |||
var num = GVL_BigStation.HKPlc_Read; | |||
var res = a.GetCustomAttribute<PlcCommAttribute>(); | |||
string describe = ""; | |||
if (res != null) | |||
{ | |||
describe = res.Describe; | |||
} | |||
else | |||
{ | |||
describe = ""; | |||
} | |||
PlcInfo.Add(new PlcVarMonitor() | |||
{ | |||
SerialNum = PlcInfo.Count + 1, | |||
Variable = mi.Name, | |||
Address = "DB98." + addressPos + string.Format("{0:N1}", Offset), | |||
Type = mi.PropertyType.Name, | |||
Describe = describe, | |||
NowValue = ab.ToString(), | |||
}); | |||
else | |||
{ | |||
describe = ""; | |||
} | |||
PlcInfo.Add(new PlcVarMonitor() | |||
{ | |||
SerialNum = PlcInfo.Count + 1, | |||
Variable = mi.Name, | |||
Address = "DB98." + addressPos + string.Format("{0:N1}", Offset), | |||
Type = mi.PropertyType.Name, | |||
Describe = describe, | |||
NowValue = ab.ToString(), | |||
}); | |||
if (mi.PropertyType.Name == "Int16") | |||
{ | |||
Offset += 2; | |||
} | |||
else if (mi.PropertyType.Name == "Boolean") | |||
{ | |||
Offset += 0.1; | |||
} | |||
else if (mi.PropertyType.Name == "Single") | |||
{ | |||
Offset += 4; | |||
if (mi.PropertyType.Name == "Int16") | |||
{ | |||
Offset += 2; | |||
} | |||
else if (mi.PropertyType.Name == "Boolean") | |||
{ | |||
Offset += 0.1; | |||
} | |||
else if (mi.PropertyType.Name == "Single") | |||
{ | |||
Offset += 4; | |||
} | |||
} | |||
} | |||
@@ -22,7 +22,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
foreach (var item in ProcessControl.GetInstance.RawMaterialsInfo) | |||
{ | |||
RawMaterialNames.Add(item.RawMaterialName); | |||
RawMaterialLocation.Add(item.RawMaterialLocation); | |||
} | |||
ActionManage.GetInstance.Register(new Action<object>((o) => | |||
{ | |||
@@ -34,7 +34,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
IsWashingBarrel = rm.IsWashingBarrel; | |||
foreach (var item in rm.RawMaterial) | |||
{ | |||
item.RawMaterialCount = Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == item.RawMaterialName); | |||
//item.RawMaterialCount = Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == item.RawMaterialName); | |||
RawMaterialsInfo.Add(item); | |||
} | |||
} | |||
@@ -43,10 +43,11 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
{ | |||
foreach (var item in RawMaterialsInfo) | |||
{ | |||
if (RawMaterialNames.Contains(item.RawMaterialName)) | |||
if (RawMaterialLocation.Contains(item.RawMaterialLocation)) | |||
{ | |||
int index = Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == item.RawMaterialName); | |||
item.RawMaterialLocation = ProcessControl.GetInstance.RawMaterialsInfo.ElementAt(index).RawMaterialLocation; | |||
int index = Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialLocation == item.RawMaterialLocation); | |||
item.RawMaterialName = ProcessControl.GetInstance.RawMaterialsInfo.ElementAt(index).RawMaterialName; | |||
item.RawMaterialChineseName = ProcessControl.GetInstance.RawMaterialsInfo.ElementAt(index).RawMaterialChineseName; | |||
} | |||
} | |||
}), "RawMaterialNames",true); | |||
@@ -111,7 +112,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
}); | |||
RemoveRecipe = new RelayCommand<int>((index) => { | |||
var res = RawMaterialsInfo.FirstOrDefault(p => p.RawMaterialCount == index); | |||
var res = RawMaterialsInfo.FirstOrDefault(p => p.RawMaterialLocation == index); | |||
if (res != null) | |||
RawMaterialsInfo.Remove(res); | |||
}); | |||
@@ -141,6 +142,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
public ObservableCollection<RawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RawMaterial>() ; | |||
public ObservableCollection<string> RawMaterialNames { get; set; } = new ObservableCollection<string>(); | |||
public ObservableCollection<int> RawMaterialLocation { get; set; } = new ObservableCollection<int>(); | |||
} | |||
} |
@@ -1,6 +1,7 @@ | |||
using BPASmartClient.JXJFoodSmallStation.Model.GVL; | |||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | |||
using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | |||
using BPASmartClient.JXJFoodSmallStation.Model.WindSend; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
@@ -18,6 +19,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
private GVL_SmallStation() { } | |||
public PlcReadAddressDB3 plcReadDataDB3 { get; set; } = new PlcReadAddressDB3(); | |||
public WindSend_Write WindSendDB95 { get; set; } = new WindSend_Write(); | |||
public WindSend_Read WindSendDB94 { get; set; } = new WindSend_Read(); | |||
/// <summary> | |||
/// 配料站料仓数目 | |||
/// </summary> | |||
@@ -161,11 +167,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
public bool HeartBeatToPlc { get; set; } = false; | |||
[VarComm("Global", "来自plc的心跳")] | |||
[VarComm("Global", "屏蔽小料站料仓不足15个报警")] | |||
public bool DisEnableStockAlarm { get; set; } = false; | |||
[VarComm("Global", "配方制作完成数量")] | |||
/// <summary> | |||
/// 配方制作完成数量 | |||
/// </summary> | |||
public int RecipeDosingCompleNum { get; set; } = 0; | |||
[VarComm("Global", "来自plc的心跳")] | |||
@@ -15,6 +15,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Par | |||
private bool _mWindSendConnect; | |||
public bool HKPlcConnect { get { return _mHKPlcConnect; } set { _mHKPlcConnect = value; OnPropertyChanged(); } } | |||
private bool _mHKPlcConnect; | |||
public bool ShieldStockbinAlarm { get { return _mShieldStockbinAlarm; } set { _mShieldStockbinAlarm = value; OnPropertyChanged(); } } | |||
private bool _mShieldStockbinAlarm; | |||
public short AxisLoadSpeed { get { return _mAxisLoadSpeed; } set { _mAxisLoadSpeed = value; OnPropertyChanged(); } } | |||
private short _mAxisLoadSpeed; | |||
@@ -85,6 +85,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GVL_SmallStation.GetInstance.DisEnableStockAlarm = Json<DevicePar>.Data.deviceConnectPar.ShieldStockbinAlarm; | |||
if (HKDevice.IsConnected) | |||
{ | |||
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc; | |||
@@ -195,6 +196,59 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
} | |||
} | |||
if (WindSendDevice.IsConnected) | |||
{ | |||
foreach (PropertyInfo item in typeof(WindSend_Write).GetProperties()) | |||
{ | |||
int index = Array.FindIndex(CommData.ToArray(), p => p.Name == item.Name); | |||
if (index >= 0) | |||
{ | |||
if (item.PropertyType.IsArray) | |||
{ | |||
CommData.ElementAt(index).Value = ""; | |||
Array array = (Array)item.GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3, null); | |||
foreach (var values in array) | |||
{ | |||
string data = values.ToString(); | |||
if (data.ToLower() == "false") | |||
data = "0"; | |||
if (data.ToLower() == "true") | |||
data = "1"; | |||
CommData.ElementAt(index).Value = CommData.ElementAt(index).Value + data + ","; | |||
} | |||
} | |||
else | |||
{ | |||
CommData.ElementAt(index).Value = GVL_SmallStation.GetInstance.WindSendDB95.GetType().GetProperty(item.Name).GetValue(GVL_SmallStation.GetInstance.WindSendDB95, null).ToString(); | |||
} | |||
} | |||
} | |||
foreach (PropertyInfo item in typeof(WindSend_Read).GetProperties()) | |||
{ | |||
int index = Array.FindIndex(CommData.ToArray(), p => p.Name == item.Name); | |||
if (index >= 0) | |||
{ | |||
if (item.PropertyType.IsArray) | |||
{ | |||
CommData.ElementAt(index).Value = ""; | |||
Array array = (Array)item.GetValue(GVL_SmallStation.GetInstance.plcReadDataDB3, null); | |||
foreach (var values in array) | |||
{ | |||
string data = values.ToString(); | |||
if (data.ToLower() == "false") | |||
data = "0"; | |||
if (data.ToLower() == "true") | |||
data = "1"; | |||
CommData.ElementAt(index).Value = CommData.ElementAt(index).Value + data + ","; | |||
} | |||
} | |||
else | |||
{ | |||
CommData.ElementAt(index).Value = GVL_SmallStation.GetInstance.WindSendDB94.GetType().GetProperty(item.Name).GetValue(GVL_SmallStation.GetInstance.WindSendDB94, null).ToString(); | |||
} | |||
} | |||
} | |||
} | |||
foreach (PropertyInfo item in typeof(GVL_SmallStation).GetProperties()) | |||
{ | |||
int index = Array.FindIndex(ProcessVar.ToArray(), p => p.Name == item.Name); | |||
@@ -701,60 +755,42 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
if (GVL_SmallStation.GetInstance.WindSendDosingStatus == 1) | |||
{ | |||
WindSendReset(); | |||
WindSendData.TargetRecipeCode = code; | |||
WindSendData.IsAllowDosing = true; | |||
WindSend_Write WindSendData111 = new WindSend_Write(); | |||
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData111, 95); | |||
Thread.Sleep(200); | |||
WindSendData111.TargetRecipeCode = code; | |||
WindSendData111.IsAllowDosing = true; | |||
foreach (var item in RemoteRecipes.ElementAt(index).WindSend) | |||
{ | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(0).RawMaterialName || item.Location == 1) | |||
{ | |||
WindSendData.RawMaterial1_SetWeight = item.RawMaterialWeight; | |||
WindSendData111.RawMaterial1_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial1_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(1).RawMaterialName || item.Location == 2) | |||
{ | |||
WindSendData.RawMaterial2_SetWeight = item.RawMaterialWeight; | |||
WindSendData111.RawMaterial2_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial2_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(2).RawMaterialName || item.Location == 3) | |||
{ | |||
WindSendData.RawMaterial3_SetWeight = item.RawMaterialWeight; | |||
WindSendData111.RawMaterial3_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial3_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(3).RawMaterialName || item.Location == 4) | |||
{ | |||
WindSendData.RawMaterial4_SetWeight = item.RawMaterialWeight; | |||
WindSendData111.RawMaterial4_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial4_SetWeight = 0; | |||
} | |||
if (item.RawMaterialName == Json<DevicePar>.Data.windSendRawMaterial.ElementAt(4).RawMaterialName || item.Location == 5) | |||
{ | |||
WindSendData.RawMaterial5_SetWeight = item.RawMaterialWeight; | |||
WindSendData111.RawMaterial5_SetWeight = item.RawMaterialWeight; | |||
MessageNotify.GetInstance.ShowRunLog($"风送料仓{item.RawMaterialName},设定重量{item.RawMaterialWeight}"); | |||
} | |||
else | |||
{ | |||
WindSendData.RawMaterial5_SetWeight = 0; | |||
} | |||
} | |||
GVL_SmallStation.GetInstance.WindSendDosing = true; | |||
GVL_SmallStation.GetInstance.WindSendDosingStatus = 2; | |||
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData, 95); | |||
WindSendDevice.Siemens_PLC_S7.WriteClass<WindSend_Write>(WindSendData111, 95); | |||
} | |||
} | |||
else | |||
@@ -891,6 +927,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
bool DosingComple = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX6." + recipeNum); | |||
if ((RTrig.GetInstance("配方配料完成").Start(DosingComple)) || (GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] > 0 && DosingComple)) | |||
{ | |||
GVL_SmallStation.GetInstance.RecipeDosingCompleNum = GVL_SmallStation.GetInstance.RecipeDosingCompleNum + 1; | |||
GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum] = 0; | |||
if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum] > 0) | |||
{ | |||
@@ -1008,6 +1045,40 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
} | |||
} | |||
foreach (PropertyInfo item in typeof(WindSend_Read).GetProperties()) | |||
{ | |||
if (Attribute.IsDefined(item, typeof(VarCommAttribute))) | |||
{ | |||
string type = item.PropertyType.ToString(); | |||
CommData.Add(new PlcInfos() | |||
{ | |||
Count = CommData.Count + 1, | |||
Name = item.Name, | |||
Address = item.GetCustomAttribute<VarCommAttribute>().Address, | |||
Type = type.Substring(type.IndexOf(".") + 1), | |||
Describe = item.GetCustomAttribute<VarCommAttribute>().Describe, | |||
Value = item.GetValue(GVL_SmallStation.GetInstance.WindSendDB94).ToString(), | |||
}); | |||
} | |||
} | |||
foreach (PropertyInfo item in typeof(WindSend_Write).GetProperties()) | |||
{ | |||
if (Attribute.IsDefined(item, typeof(VarCommAttribute))) | |||
{ | |||
string type = item.PropertyType.ToString(); | |||
CommData.Add(new PlcInfos() | |||
{ | |||
Count = CommData.Count + 1, | |||
Name = item.Name, | |||
Address = item.GetCustomAttribute<VarCommAttribute>().Address, | |||
Type = type.Substring(type.IndexOf(".") + 1), | |||
Describe = item.GetCustomAttribute<VarCommAttribute>().Describe, | |||
Value = item.GetValue(GVL_SmallStation.GetInstance.WindSendDB95).ToString(), | |||
}); | |||
} | |||
} | |||
foreach (PropertyInfo item in typeof(GVL_SmallStation).GetProperties()) | |||
{ | |||
if (Attribute.IsDefined(item, typeof(VarCommAttribute))) | |||
@@ -1518,6 +1589,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD4", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD8", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD12", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBD16", weight); | |||
WindSendDevice.Siemens_PLC_S7.Write("DB95.DBX38.1", false); | |||
} | |||
public void RawMaterialNameWithCode() | |||
@@ -24,9 +24,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
{ | |||
if (IsConnected) | |||
{ | |||
var res0 = this.Siemens_PLC_S7.ReadClass<WindSend_Write>(95); | |||
if (res0 != null && res0 is WindSend_Write WriteData) | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendDB95 = WriteData; | |||
} | |||
var res1 = this.Siemens_PLC_S7.ReadClass<WindSend_Read>(94); | |||
if (res1 != null && res1 is WindSend_Read readData) | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendDB94 = readData; | |||
GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet = readData.HoodLiftInPlace; | |||
Siemens_PLC_S7.Write<bool>("DB95.DBX38.2", GVL_SmallStation.GetInstance.Station1HaveTray);//工站1有托盘 | |||
switch (GVL_SmallStation.GetInstance.WindSendDosingStatus) | |||
@@ -30,5 +30,18 @@ namespace BPASmartClient.JXJFoodSmallStation.Model | |||
/// </summary> | |||
public float DosingCompleWeight { get { return _mDosingCompleWeight; } set { _mDosingCompleWeight = value; OnPropertyChanged(); } } | |||
private float _mDosingCompleWeight; | |||
/// <summary> | |||
/// 原料对应的桶号 | |||
/// </summary> | |||
public short RawMaterialBarrelNum { get { return _mRawMaterialBarrelNum; } set { _mRawMaterialBarrelNum = value; OnPropertyChanged(); } } | |||
private short _mRawMaterialBarrelNum; | |||
/// <summary> | |||
/// 原料类型 | |||
/// </summary> | |||
public string RawMaterialType { get { return _mRawMaterialType; } set { _mRawMaterialType = value; OnPropertyChanged(); } } | |||
private string _mRawMaterialType; | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.S7Net; | |||
using BPASmartClient.JXJFoodSmallStation.Model.GVL; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -7,74 +8,106 @@ using System.Threading.Tasks; | |||
namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||
{ | |||
internal class WindSend_Read | |||
public class WindSend_Read | |||
{ | |||
[VarComm("DB94.DBX0.0", "吸风罩提升到位")] | |||
/// <summary> | |||
/// 吸风罩提升到位 | |||
/// </summary> | |||
public bool HoodLiftInPlace { get; set; } | |||
[VarComm("DB94.DBX0.1", "配方接收完成")] | |||
/// <summary> | |||
/// 配方接收完成 | |||
/// </summary> | |||
public bool RecipeReceiveFinish { get; set; } | |||
[VarComm("DB94.DBX0.2", "制作完成信号")] | |||
/// <summary> | |||
/// 制作完成信号 | |||
/// </summary> | |||
public bool CurrentCompleteSign { get; set; } | |||
[VarComm("DB94.DBX0.3", "允许下发信号")] | |||
/// <summary> | |||
/// 允许下发信号 | |||
/// </summary> | |||
public bool IsAllowIssue { get; set; } | |||
[VarComm("DB94.DBX0.4", "排料完成信号")] | |||
/// <summary> | |||
/// 排料完成信号 | |||
/// </summary> | |||
public bool DisChargeComple { get; set; } | |||
[VarComm("DB94.DBW2", "当前配方编码")] | |||
/// <summary> | |||
/// 当前配方编码 | |||
/// </summary> | |||
[Siemens(16)] | |||
public string CurrentRecipeCode { get; set; } = ""; | |||
[VarComm("DB94.DBW20", "系统状态")] | |||
/// <summary> | |||
/// 系统状态 | |||
/// </summary> | |||
public short SystemRunStatus { get; set; } | |||
[VarComm("DB94.DBD22", "原料1下料完成重量")] | |||
/// <summary> | |||
/// 原料1下料完成重量 | |||
/// </summary> | |||
public float RawMaterial1_FinishWeight { get; set; } | |||
[VarComm("DB94.DBD26", "原料2下料完成重量")] | |||
/// <summary> | |||
/// 原料2下料完成重量 | |||
/// </summary> | |||
public float RawMaterial2_FinishWeight { get; set; } | |||
[VarComm("DB94.DBD30", "原料3下料完成重量")] | |||
/// <summary> | |||
/// 原料3下料完成重量 | |||
/// </summary> | |||
public float RawMaterial3_FinishWeight { get; set; } | |||
[VarComm("DB94.DBD34", "原料4下料完成重量")] | |||
/// <summary> | |||
/// 原料4下料完成重量 | |||
/// </summary> | |||
public float RawMaterial4_FinishWeight { get; set; } | |||
[VarComm("DB94.DBD38", "原料5下料完成重量")] | |||
/// <summary> | |||
/// 原料5下料完成重量 | |||
/// </summary> | |||
public float RawMaterial5_FinishWeight { get; set; } | |||
[VarComm("DB94.DBD42", "原料1料仓重量")] | |||
/// <summary> | |||
/// 原料1料仓重量 | |||
/// </summary> | |||
public float RawMaterial1_StockBinWeight { get; set; } | |||
[VarComm("DB94.DBD46", "原料2料仓重量")] | |||
/// <summary> | |||
/// 原料2料仓重量 | |||
/// </summary> | |||
public float RawMaterial2_StockBinWeight { get; set; } | |||
[VarComm("DB94.DBD50", "原料3料仓重量")] | |||
/// <summary> | |||
/// 原料3料仓重量 | |||
/// </summary> | |||
public float RawMaterial3_StockBinWeight { get; set; } | |||
[VarComm("DB94.DBD54", "原料4料仓重量")] | |||
/// <summary> | |||
/// 原料4料仓重量 | |||
/// </summary> | |||
public float RawMaterial4_StockBinWeight { get; set; } | |||
[VarComm("DB94.DBD58", "原料5料仓重量")] | |||
/// <summary> | |||
/// 原料5料仓重量 | |||
/// </summary> | |||
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.S7Net; | |||
using BPASmartClient.JXJFoodSmallStation.Model.GVL; | |||
using BPASmartClient.S7Net; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
@@ -9,39 +10,56 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.WindSend | |||
{ | |||
public class WindSend_Write | |||
{ | |||
[VarComm("DB95.DBD0", "原料1设定重量")] | |||
/// <summary> | |||
/// 原料1设定重量 | |||
/// </summary> | |||
public float RawMaterial1_SetWeight { get; set; } | |||
[VarComm("DB95.DBD4", "原料2设定重量")] | |||
/// <summary> | |||
/// 原料2设定重量 | |||
/// </summary> | |||
public float RawMaterial2_SetWeight { get; set; } | |||
[VarComm("DB95.DBD8", "原料3设定重量")] | |||
/// <summary> | |||
/// 原料3设定重量 | |||
/// </summary> | |||
public float RawMaterial3_SetWeight { get; set; } | |||
[VarComm("DB95.DBD12", "原料4设定重量")] | |||
/// <summary> | |||
/// 原料4设定重量 | |||
/// </summary> | |||
public float RawMaterial4_SetWeight { get; set; } | |||
[VarComm("DB95.DBD16", "原料5设定重量")] | |||
/// <summary> | |||
/// 原料5设定重量 | |||
/// </summary> | |||
public float RawMaterial5_SetWeight { get; set; } | |||
[VarComm("DB95.DBW20", "目标配方编码")] | |||
/// <summary> | |||
/// 目标配方编码 | |||
/// </summary> | |||
[Siemens(16)] | |||
public string TargetRecipeCode { get; set; } = ""; | |||
[VarComm("DB95.DBX38.0", "允许配料")] | |||
/// <summary> | |||
/// 允许配料 | |||
/// </summary> | |||
public bool IsAllowDosing { get; set; } | |||
[VarComm("DB95.DBX38.1", "配方制作完成接收")] | |||
/// <summary> | |||
/// 配方制作完成接收 | |||
/// </summary> | |||
public bool RecipeCompleRec { get; set; } | |||
[VarComm("DB95.DBX38.2", "工位1有信号")] | |||
/// <summary> | |||
/// 工位1有信号 | |||
/// </summary> | |||
@@ -66,7 +66,7 @@ | |||
VerticalAlignment="Center" | |||
FontSize="25" | |||
Foreground="#FF2AB2E7" /> | |||
<Button | |||
<!--<Button | |||
Width="200" | |||
Height="40" | |||
Margin="5" | |||
@@ -74,7 +74,7 @@ | |||
Command="{Binding Test5Command}" | |||
Content="粉料仓提升到位" | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
Style="{StaticResource ImageButtonStyle}" />--> | |||
<Button | |||
Width="200" | |||
Height="40" | |||
@@ -454,6 +454,22 @@ | |||
FontSize="20" | |||
Style="{StaticResource ImageButtonStyle}" /> | |||
</WrapPanel> | |||
<WrapPanel Grid.Row="2" Grid.Column="2"> | |||
<TextBlock | |||
Margin="10,0,5,0" | |||
VerticalAlignment="Center" | |||
FontSize="25" | |||
Foreground="#FF2AB2E7" | |||
Text="配方制作完成数目:" /> | |||
<TextBlock | |||
Width="150" | |||
Margin="10" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="25" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RecipeDosingCompleNum}" /> | |||
</WrapPanel> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
@@ -145,6 +145,7 @@ | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="2*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
@@ -174,6 +175,13 @@ | |||
FontSize="16"> | |||
原料重量 | |||
</TextBlock> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="16"> | |||
原料类型 | |||
</TextBlock> | |||
</Grid> | |||
<ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Hidden"> | |||
<ItemsControl Width="548" ItemsSource="{Binding RawMaterialsInfo}"> | |||
@@ -185,6 +193,7 @@ | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="2*" /> | |||
<ColumnDefinition Width="2*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
@@ -214,6 +223,13 @@ | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RawMaterialWeight}" /> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Top" | |||
FontSize="20" | |||
Foreground="#FF2AB2E7" | |||
Text="{Binding RawMaterialType}" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
@@ -184,6 +184,16 @@ | |||
Foreground="Aqua" | |||
IsChecked="{Binding HKPlcConnect}" /> | |||
<CheckBox | |||
Margin="0,10,10,0" | |||
VerticalAlignment="Center" | |||
Content="屏蔽小料仓数量读取报警" | |||
FontFamily="楷体" | |||
FontSize="20" | |||
Foreground="Aqua" | |||
IsChecked="{Binding ShieldStockbinAlarm}" /> | |||
</StackPanel> | |||
<Grid | |||
Grid.Row="1" | |||
@@ -72,11 +72,11 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,气缸收紧错位复位"); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,气缸收紧错位复位"); | |||
}); | |||
Test5Command = new RelayCommand(() => | |||
{ | |||
GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet = true; | |||
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓提升到位"); | |||
}); | |||
//Test5Command = new RelayCommand(() => | |||
//{ | |||
// GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet = true; | |||
// MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓提升到位"); | |||
//}); | |||
Test6Command = new RelayCommand(() => | |||
{ | |||
ActionManage.GetInstance.Send("AGVPutTrayFinish"); | |||
@@ -149,6 +149,7 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
}); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
RecipeDosingCompleNum = GVL_SmallStation.GetInstance.RecipeDosingCompleNum; | |||
Recipe1DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[0].ToBinString(); | |||
Recipe2DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[1].ToBinString(); | |||
Recipe3DosingComplete = GVL_SmallStation.GetInstance.RecipeStockBinDosing[2].ToBinString(); | |||
@@ -326,6 +327,9 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
public static int StockbinDosingCompleNum { get { return _StockbinDosingCompleNum; } set { _StockbinDosingCompleNum = value; OnStaticPropertyChanged(); } } | |||
private static int _RecipeDosingCompleNum { get; set; } | |||
public static int RecipeDosingCompleNum { get { return _RecipeDosingCompleNum; } set { _RecipeDosingCompleNum = value; OnStaticPropertyChanged(); } } | |||
public static Visibility VisibilityBtn1 { get { return _VisibilityBtn1; } set { _VisibilityBtn1 = value; OnStaticPropertyChanged(); } } | |||
private static Visibility _VisibilityBtn1 = Visibility.Visible; | |||
public static Visibility VisibilityBtn2 { get { return _VisibilityBtn2; } set { _VisibilityBtn2 = value; OnStaticPropertyChanged(); } } | |||
@@ -35,11 +35,11 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
AllRawMaterial.Add(new RemoteRecipeRawMaterial() | |||
{ | |||
RawMaterialType = "粉料", | |||
RawMaterialType = item1.RawMaterialType, | |||
RawMaterialName = item1.RawMaterialName, | |||
RawMaterialWeight = item1.RawMaterialWeight, | |||
RawMaterialLocation = item1.Location, | |||
RawMaterialBarrelNum = 3, | |||
RawMaterialBarrelNum = item1.RawMaterialBarrelNum, | |||
}); | |||
} | |||
} | |||
@@ -156,6 +156,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
RawMaterialName = item.RawMaterialName, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
Location = item.RawMaterialLocation, | |||
RawMaterialType =item.RawMaterialType, | |||
RawMaterialBarrelNum=item.RawMaterialBarrelNum, | |||
}); | |||
} | |||
} | |||
@@ -188,6 +190,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
RawMaterialName = item.RawMaterialName, | |||
RawMaterialWeight = item.RawMaterialWeight, | |||
Location = item.RawMaterialLocation, | |||
RawMaterialType = item.RawMaterialType, | |||
RawMaterialBarrelNum = item.RawMaterialBarrelNum, | |||
}); | |||
} | |||
} | |||
@@ -29,6 +29,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
{ | |||
RawMaterialsInfo.Add(item); | |||
} | |||
foreach (var item1 in rm.WindSend) | |||
{ | |||
RawMaterialsInfo.Add(new RemoteRecipeRawMaterial() { RawMaterialName= item1.RawMaterialName, RawMaterialLocation= item1.Location,RawMaterialBarrelNum= item1.RawMaterialBarrelNum,RawMaterialWeight= item1.RawMaterialWeight,RawMaterialType=item1.RawMaterialType}); | |||
} | |||
} | |||
}), "RecipeInfo"); | |||
@@ -24,6 +24,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
SiemensConnect = Json<DevicePar>.Data.deviceConnectPar.SiemensConnect; | |||
WindSendConnect = Json<DevicePar>.Data.deviceConnectPar.WindSendConnect; | |||
HKPlcConnect = Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect; | |||
ShieldStockbinAlarm = Json<DevicePar>.Data.deviceConnectPar.ShieldStockbinAlarm; | |||
AxisLoadSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisLoadSpeed; | |||
AxisMidSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed; | |||
AxisUnLoadSpeed = Json<DevicePar>.Data.deviceConnectPar.AxisUnLoadSpeed; | |||
@@ -35,6 +37,8 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
Json<DevicePar>.Data.deviceConnectPar.SiemensConnect = SiemensConnect; | |||
Json<DevicePar>.Data.deviceConnectPar.WindSendConnect = WindSendConnect; | |||
Json<DevicePar>.Data.deviceConnectPar.HKPlcConnect = HKPlcConnect; | |||
Json<DevicePar>.Data.deviceConnectPar.ShieldStockbinAlarm = ShieldStockbinAlarm; | |||
Json<DevicePar>.Data.deviceConnectPar.AxisLoadSpeed = AxisLoadSpeed; | |||
Json<DevicePar>.Data.deviceConnectPar.AxisMidSpeed = AxisMidSpeed; | |||
Json<DevicePar>.Data.deviceConnectPar.AxisUnLoadSpeed = AxisUnLoadSpeed; | |||
@@ -69,7 +73,9 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel | |||
private bool _mWindSendConnect; | |||
public bool HKPlcConnect { get { return _mHKPlcConnect; } set { _mHKPlcConnect = value; OnPropertyChanged(); } } | |||
private bool _mHKPlcConnect; | |||
public bool ShieldStockbinAlarm { get { return _mShieldStockbinAlarm; } set { _mShieldStockbinAlarm = value; OnPropertyChanged(); } } | |||
private bool _mShieldStockbinAlarm; | |||
public short AxisLoadSpeed { get { return _mAxisLoadSpeed; } set { _mAxisLoadSpeed = value; OnPropertyChanged(); } } | |||
private short _mAxisLoadSpeed; | |||
public short AxisMidSpeed { get { return _mAxisMidSpeed; } set { _mAxisMidSpeed = value; OnPropertyChanged(); } } | |||