@@ -122,13 +122,6 @@ namespace BPASmartClient.JXJFoodBigStation | |||
#region 硬件设备监控 | |||
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>(); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "料仓管理", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
AssemblyName = "BPASmartClient.JXJFoodBigStation", | |||
ToggleWindowPath = "View.DeviceManageView" | |||
}); | |||
DeviceMonitor.Add(new SubMenumodel() | |||
{ | |||
SubMenuName = "设备状态", | |||
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 }, | |||
@@ -28,11 +28,17 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
private double _mRawMaterialWeight; | |||
/// <summary> | |||
/// 原料对应料仓的位置/名称 | |||
/// 原料对应料仓的位置 | |||
/// </summary> | |||
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } } | |||
private int _mRawMaterialLocation; | |||
/// <summary> | |||
/// 原料名称 | |||
/// </summary> | |||
public string RawMaterialName { get { return _rawMaterNmae; } set { _rawMaterNmae = value;OnPropertyChanged(); } } | |||
private string _rawMaterNmae; | |||
/// <summary> | |||
@@ -34,8 +34,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model | |||
/// <summary> | |||
/// 配方编码 | |||
/// </summary> | |||
public long RecipeCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } | |||
private long _mRecipCode; | |||
public string RecipeCode { get { return _mRecipCode; } set { _mRecipCode = value; OnPropertyChanged(); } } | |||
private string _mRecipCode; | |||
/// <summary> | |||
/// 托盘编号 | |||
@@ -384,9 +384,9 @@ | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.1*"/> | |||
<RowDefinition /> | |||
<RowDefinition /> | |||
<!--<RowDefinition Height="0.1*"/>--> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
@@ -461,7 +461,7 @@ | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2"> | |||
<!--<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2"> | |||
<pry:IcoButton | |||
Width="80" | |||
@@ -498,7 +498,7 @@ | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
</StackPanel>--> | |||
</Grid> | |||
</Border> | |||
@@ -547,9 +547,9 @@ | |||
<Border Margin="5" Background="Transparent"> | |||
<Grid Height="220"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.45*"/> | |||
<RowDefinition Height="0.1*"/> | |||
<RowDefinition/> | |||
<RowDefinition/> | |||
<!--<RowDefinition Height="0.1*"/>--> | |||
</Grid.RowDefinitions> | |||
<TextBlock | |||
@@ -620,7 +620,7 @@ | |||
Grid.RowSpan="2" | |||
Source="/BPASmartClient.CustomResource;component/Image/光柱.png" | |||
Stretch="Fill" /> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2"> | |||
<!--<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="2"> | |||
<pry:IcoButton | |||
Width="80" | |||
@@ -657,7 +657,7 @@ | |||
Foreground="#FFF53F62" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
</StackPanel> | |||
</StackPanel>--> | |||
</Grid> | |||
@@ -334,7 +334,7 @@ | |||
<ColumnDefinition Width="225"></ColumnDefinition> | |||
<ColumnDefinition></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"> | |||
<!--<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"> | |||
<ComboBox.ItemContainerStyle> | |||
<Style TargetType="{x:Type ComboBoxItem}"> | |||
<Setter Property="Background" Value="White" /> | |||
@@ -342,8 +342,10 @@ | |||
</Style> | |||
</ComboBox.ItemContainerStyle> | |||
</ComboBox> | |||
</ComboBox.ItemContainerStyle>--> | |||
<!--</ComboBox>--> | |||
<TextBox Text="{Binding RawMaterialName}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="190" Margin="10,0,0,10" ></TextBox> | |||
<StackPanel Grid.Column="1" Orientation="Horizontal" > | |||
<TextBox Text="{Binding RawMaterialBarrelNum}" Background="Transparent" FontSize="14" | |||
BorderBrush="#e69519" Foreground="LightGray" Width="170" Margin="35,0,0,10" ></TextBox> | |||
@@ -362,7 +364,7 @@ | |||
Background="Transparent" | |||
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right" | |||
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" | |||
CommandParameter="{Binding RawMaterialLocation}"></Button> | |||
CommandParameter="{Binding RawMaterialName}"></Button> | |||
</Grid> | |||
</ControlTemplate> | |||
</RadioButton.Template> | |||
@@ -168,7 +168,7 @@ | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
<pry:IcoButton | |||
<!--<pry:IcoButton | |||
Width="140" | |||
Margin="10" | |||
HorizontalAlignment="Left" | |||
@@ -177,7 +177,7 @@ | |||
FontSize="16" | |||
Foreground="Aqua" | |||
IcoText="" | |||
Style="{StaticResource IcoButtonStyle}" /> | |||
Style="{StaticResource IcoButtonStyle}" />--> | |||
<pry:IcoButton | |||
Grid.Column="3" | |||
@@ -241,6 +241,7 @@ | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="16" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
@@ -271,13 +272,13 @@ | |||
</RadialGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<TextBlock Text="{Binding RawMaterialLocation }" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
<TextBlock Text="{Binding RawMaterialName }" Foreground="#FF2AB2E7" VerticalAlignment="Center" FontSize="14" /> | |||
</StackPanel> | |||
</Expander.Header> | |||
<Expander.Content> | |||
<StackPanel Margin="36,0,0,0"> | |||
<StackPanel Orientation="Horizontal"> | |||
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="托盘桶号:" Foreground="#FF2AB2E7"/> | |||
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal"> | |||
@@ -473,6 +473,7 @@ | |||
<TextBlock | |||
Grid.Row="1" | |||
FontSize="16" | |||
Margin="5,0,0,0" | |||
VerticalAlignment="Top" | |||
Foreground="#FF2AB2E7" | |||
@@ -503,7 +504,7 @@ | |||
</RadialGradientBrush> | |||
</Border.Background> | |||
</Border> | |||
<TextBlock Text="{Binding RawMaterialLocation }" Foreground="#FF2AB2E7" VerticalAlignment="Center"/> | |||
<TextBlock Text="{Binding RawMaterialName }" Foreground="#FF2AB2E7" VerticalAlignment="Center" FontSize="14"/> | |||
</StackPanel> | |||
</Expander.Header> | |||
<Expander.Content> | |||
@@ -47,7 +47,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
if (name == null) | |||
{ | |||
go: | |||
long recipeCode = new Random().Next(10000, 99999); | |||
string recipeCode = new Random().Next(10000, 99999).ToString(); | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); | |||
if (res == null) | |||
{ | |||
@@ -76,6 +76,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
bom.RawMaterial.Add(item); | |||
} | |||
bom.RecipeName = RecipeName; | |||
bom.TrayCode = TrayCode; | |||
Json<LocaPar>.Save(); | |||
ActionManage.GetInstance.Send("CloseRecipeInfosView"); | |||
} | |||
@@ -88,7 +89,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
if (bom == null && rec != null)//配方名称更改 | |||
{ | |||
prop: long recipeCode = new Random().Next(10000, 99999);//配方唯一ID,后期根据实际要求更改 | |||
prop: string recipeCode = new Random().Next(10000, 99999).ToString();//配方唯一ID,后期根据实际要求更改 | |||
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode); | |||
if (res == null) | |||
{ | |||
@@ -108,9 +109,9 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
ActionManage.GetInstance.Send("CloseNewRecipeView"); | |||
}); | |||
RemoveRecipe = new RelayCommand<int>((materilaName) => { | |||
RemoveRecipe = new RelayCommand<string>((materilaName) => { | |||
var res= RawMaterialsInfo.FirstOrDefault(p=>p.RawMaterialLocation==materilaName); | |||
var res= RawMaterialsInfo.FirstOrDefault(p=>p.RawMaterialName==materilaName); | |||
if (res != null) | |||
RawMaterialsInfo.Remove(res); | |||
}); | |||
@@ -137,7 +138,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
public RelayCommand SaveAs { get; set; } | |||
public RelayCommand<int> RemoveRecipe { get; set; } | |||
public RelayCommand<string> RemoveRecipe { get; set; } | |||
public ObservableCollection<RawMaterialModel> RawMaterialsInfo { get; set; } = new ObservableCollection<RawMaterialModel>() ; | |||
} | |||
@@ -45,51 +45,51 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
RecipeInfosView nrv = new RecipeInfosView(); | |||
nrv.ShowDialog(); | |||
}); | |||
NewSimulateRecipe = new RelayCommand(() => | |||
{ | |||
RawMaterials.Clear(); | |||
string recipeName = "配方" + (Json<LocaPar>.Data.Recipes.Count + 1) + ""; | |||
go: | |||
string recipeCode = new Random().Next(10000, 99999).ToString(); | |||
foreach (var item in Recipes) | |||
{ | |||
if (item.RecipeCode == recipeCode) | |||
{ | |||
goto go; | |||
} | |||
} | |||
int trayCode = new Random().Next(1,6); | |||
for (int i = 1; i < 13; i++) | |||
{ | |||
int a = new Random().Next(1, 5); | |||
if (a == 3) | |||
{ | |||
a = 1; | |||
} | |||
RawMaterials.Add(new RawMaterialModel() | |||
{ | |||
RawMaterialWeight = new Random().Next(10, 1000), | |||
RawMaterialBarrelNum = a, | |||
RawMaterialLocation = i, | |||
}); | |||
} | |||
Json<LocaPar>.Data.Recipes.Add(new RecipeModel() | |||
{ | |||
RecipeName = recipeName, | |||
RecipeCode = recipeCode, | |||
TrayCode = trayCode, | |||
RawMaterial = RawMaterials, | |||
}); | |||
Json<LocaPar>.Save(); | |||
}); | |||
//模拟配方 | |||
//NewSimulateRecipe = new RelayCommand(() => | |||
//{ | |||
// RawMaterials.Clear(); | |||
// string recipeName = "配方" + (Json<LocaPar>.Data.Recipes.Count + 1) + ""; | |||
//go: | |||
// string recipeCode = new Random().Next(10000, 99999).ToString(); | |||
// foreach (var item in Recipes) | |||
// { | |||
// if (item.RecipeCode == recipeCode) | |||
// { | |||
// goto go; | |||
// } | |||
// } | |||
// int trayCode = new Random().Next(1,6); | |||
// for (int i = 1; i < 13; i++) | |||
// { | |||
// int a = new Random().Next(1, 5); | |||
// if (a == 3) | |||
// { | |||
// a = 1; | |||
// } | |||
// RawMaterials.Add(new RawMaterialModel() | |||
// { | |||
// RawMaterialWeight = new Random().Next(10, 1000), | |||
// RawMaterialBarrelNum = a, | |||
// RawMaterialLocation = i, | |||
// }); | |||
// } | |||
// Json<LocaPar>.Data.Recipes.Add(new RecipeModel() | |||
// { | |||
// RecipeName = recipeName, | |||
// RecipeCode = recipeCode, | |||
// TrayCode = trayCode, | |||
// RawMaterial = RawMaterials, | |||
// }); | |||
// Json<LocaPar>.Save(); | |||
//}); | |||
ClearAllRecipe = new RelayCommand(() => | |||
{ | |||
Json<LocaPar>.Data.Recipes.Clear(); | |||
Json<LocaPar>.Save(); | |||
}); | |||
RemoveCommand = new RelayCommand<long>((recipeCode) => { | |||
RemoveCommand = new RelayCommand<string>((recipeCode) => { | |||
var res = Recipes.FirstOrDefault(p=>p.RecipeCode==recipeCode); | |||
if(res!=null) | |||
@@ -107,7 +107,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel | |||
public RelayCommand NewRecipe { get; set; } | |||
public RelayCommand<long> RemoveCommand { get; set; } | |||
public RelayCommand<string> RemoveCommand { get; set; } | |||
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>(); | |||
} | |||