@@ -21,12 +21,17 @@ namespace BPASmartClient.MorkCL.Model | |||||
/// 菜品类型 | /// 菜品类型 | ||||
/// </summary> | /// </summary> | ||||
public EDishType DishType { get; set; } | public EDishType DishType { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 功能配方 | /// 功能配方 | ||||
/// </summary> | /// </summary> | ||||
public ConcurrentQueue<FuncModel> ControlFuncs { get; set; } = new ConcurrentQueue<FuncModel>(); | public ConcurrentQueue<FuncModel> ControlFuncs { get; set; } = new ConcurrentQueue<FuncModel>(); | ||||
/// <summary> | |||||
/// 备注 | |||||
/// </summary> | |||||
public string Remark { get; set; } | |||||
} | } | ||||
@@ -9,6 +9,6 @@ namespace BPASmartClient.MorkCL.Model.Json | |||||
{ | { | ||||
public class RecipesInfo | public class RecipesInfo | ||||
{ | { | ||||
public ObservableCollection<LocalRecipeData> LocalRecipes { get; set; }=new ObservableCollection<LocalRecipeData>(); | |||||
public ObservableCollection<ControlData> LocalRecipes { get; set; } = new ObservableCollection<ControlData>(); | |||||
} | } | ||||
} | } |
@@ -66,13 +66,13 @@ | |||||
<TextBlock | <TextBlock | ||||
Margin="10,0" | Margin="10,0" | ||||
DockPanel.Dock="Left" | DockPanel.Dock="Left" | ||||
Text="配方ID:" /> | |||||
<TextBox | |||||
Width="100" | |||||
DockPanel.Dock="Left" | |||||
Text="菜品类型:" /> | |||||
<ComboBox | |||||
Width="150" | |||||
FontSize="18" | FontSize="18" | ||||
Foreground="DeepSkyBlue" | |||||
Text="{Binding ID}" /> | |||||
IsReadOnly="True" | |||||
ItemsSource="{Binding AllDishType}" | |||||
Text="{Binding DishType}" /> | |||||
<Button | <Button | ||||
Margin="10,0" | Margin="10,0" | ||||
Click="Button_Click" | Click="Button_Click" | ||||
@@ -173,8 +173,7 @@ | |||||
FontSize="18" | FontSize="18" | ||||
IsReadOnly="True" | IsReadOnly="True" | ||||
ItemsSource="{Binding DataContext.AllFunc, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | ItemsSource="{Binding DataContext.AllFunc, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | ||||
Text="{Binding FuncName}"> | |||||
</ComboBox> | |||||
Text="{Binding FuncName}" /> | |||||
<Border | <Border | ||||
BorderBrush="{StaticResource bordColor}" | BorderBrush="{StaticResource bordColor}" | ||||
BorderThickness="2,0,2,0" | BorderThickness="2,0,2,0" | ||||
@@ -109,6 +109,7 @@ | |||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="200" /> | <ColumnDefinition Width="200" /> | ||||
<ColumnDefinition Width="100" /> | |||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
<ColumnDefinition Width="200" /> | <ColumnDefinition Width="200" /> | ||||
<ColumnDefinition Width="200" /> | <ColumnDefinition Width="200" /> | ||||
@@ -121,6 +122,14 @@ | |||||
Text="名称" /> | Text="名称" /> | ||||
<Grid Grid.Column="1"> | <Grid Grid.Column="1"> | ||||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="菜品类型" /> | |||||
<Border | |||||
BorderBrush="{StaticResource bordColor}" | |||||
BorderThickness="1,0,1,0" | |||||
Cursor="SizeWE" /> | |||||
</Grid> | |||||
<Grid Grid.Column="2"> | |||||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="备注" /> | <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="备注" /> | ||||
<Border | <Border | ||||
BorderBrush="{StaticResource bordColor}" | BorderBrush="{StaticResource bordColor}" | ||||
@@ -129,11 +138,11 @@ | |||||
</Grid> | </Grid> | ||||
<TextBlock | <TextBlock | ||||
Grid.Column="2" | |||||
Grid.Column="3" | |||||
Style="{StaticResource TitleTextblockStyle}" | Style="{StaticResource TitleTextblockStyle}" | ||||
Text="下发" /> | Text="下发" /> | ||||
<Grid Grid.Column="3"> | |||||
<Grid Grid.Column="4"> | |||||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="编辑" /> | <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="编辑" /> | ||||
<Border | <Border | ||||
BorderBrush="{StaticResource bordColor}" | BorderBrush="{StaticResource bordColor}" | ||||
@@ -141,7 +150,7 @@ | |||||
Cursor="SizeWE" /> | Cursor="SizeWE" /> | ||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="4"> | |||||
<Grid Grid.Column="5"> | |||||
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="删除" /> | <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="删除" /> | ||||
<Border | <Border | ||||
BorderBrush="{StaticResource bordColor}" | BorderBrush="{StaticResource bordColor}" | ||||
@@ -165,6 +174,7 @@ | |||||
<Grid> | <Grid> | ||||
<Grid.ColumnDefinitions> | <Grid.ColumnDefinitions> | ||||
<ColumnDefinition Width="200" /> | <ColumnDefinition Width="200" /> | ||||
<ColumnDefinition Width="100" /> | |||||
<ColumnDefinition /> | <ColumnDefinition /> | ||||
<ColumnDefinition Width="200" /> | <ColumnDefinition Width="200" /> | ||||
<ColumnDefinition Width="200" /> | <ColumnDefinition Width="200" /> | ||||
@@ -179,6 +189,17 @@ | |||||
TextAlignment="Center" /> | TextAlignment="Center" /> | ||||
<Grid Grid.Column="1"> | <Grid Grid.Column="1"> | ||||
<TextBox | |||||
Style="{StaticResource DataShowTextBoxStyle}" | |||||
Text="{Binding DishType}" | |||||
TextAlignment="Center" MinWidth="400"/> | |||||
<Border | |||||
BorderBrush="{StaticResource bordColor}" | |||||
BorderThickness="1,0,1,0" | |||||
Cursor="SizeWE" /> | |||||
</Grid> | |||||
<Grid Grid.Column="2"> | |||||
<TextBox | <TextBox | ||||
Style="{StaticResource DataShowTextBoxStyle}" | Style="{StaticResource DataShowTextBoxStyle}" | ||||
Text="{Binding Remark}" | Text="{Binding Remark}" | ||||
@@ -189,10 +210,10 @@ | |||||
Cursor="SizeWE" /> | Cursor="SizeWE" /> | ||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="2" Margin="5"> | |||||
<Grid Grid.Column="3" Margin="5"> | |||||
<Button | <Button | ||||
Command="{Binding DataContext.IssueCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | Command="{Binding DataContext.IssueCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | ||||
CommandParameter="{Binding ID}" | |||||
CommandParameter="{Binding}" | |||||
Content="下发" | Content="下发" | ||||
FontSize="16" | FontSize="16" | ||||
Style="{StaticResource IssueRecipeButtonStyle}" /> | Style="{StaticResource IssueRecipeButtonStyle}" /> | ||||
@@ -202,7 +223,7 @@ | |||||
Cursor="SizeWE" /> | Cursor="SizeWE" /> | ||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="3" Margin="5"> | |||||
<Grid Grid.Column="4" Margin="5"> | |||||
<Button | <Button | ||||
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | ||||
CommandParameter="{Binding}" | CommandParameter="{Binding}" | ||||
@@ -215,7 +236,7 @@ | |||||
Cursor="SizeWE" /> | Cursor="SizeWE" /> | ||||
</Grid> | </Grid> | ||||
<Grid Grid.Column="4"> | |||||
<Grid Grid.Column="5"> | |||||
<Button | <Button | ||||
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" | ||||
CommandParameter="{Binding ID}" | CommandParameter="{Binding ID}" | ||||
@@ -18,17 +18,17 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
ActionManage.GetInstance.Register((object o) => | ActionManage.GetInstance.Register((object o) => | ||||
{ | { | ||||
if (o != null && o is LocalRecipeData recipe) | |||||
if (o != null && o is ControlData recipe) | |||||
{ | { | ||||
this.Name = recipe.Name; | this.Name = recipe.Name; | ||||
this.ID = recipe.ID; | |||||
this.ID = recipe.Id; | |||||
int step = 0; | int step = 0; | ||||
Functions.Clear(); | Functions.Clear(); | ||||
foreach (var func in recipe.Functions) | |||||
foreach (var func in recipe.ControlFuncs) | |||||
{ | { | ||||
step++; | step++; | ||||
Functions.Add(new FuncSet() { FuncName = Enum.GetName<EFunc>(func.Key), FuncPars = func.Value?.ToList(), Step = step }); | |||||
Functions.Add(new FuncSet() { FuncName = Enum.GetName<EFunc>(func.eFunc), FuncPars = func.funcPars, Step = step }); | |||||
} | } | ||||
} | } | ||||
}, "OpenRecipeEditView",true); | }, "OpenRecipeEditView",true); | ||||
@@ -41,6 +41,12 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
AllFunc.Add(item); | AllFunc.Add(item); | ||||
} | } | ||||
AllDishType = new ObservableCollection<string>(); | |||||
foreach (var item in Enum.GetNames(typeof(EDishType))) | |||||
{ | |||||
AllDishType.Add(item); | |||||
} | |||||
SaveParamCommand = new BPARelayCommand(() => | SaveParamCommand = new BPARelayCommand(() => | ||||
{ | { | ||||
@@ -55,30 +61,35 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
MessageNotify.GetInstance.ShowDialog("配方名称不可为空,请重新输入后重试!"); | MessageNotify.GetInstance.ShowDialog("配方名称不可为空,请重新输入后重试!"); | ||||
return; | return; | ||||
} | } | ||||
if (!int.TryParse(ID,out int Id)) | |||||
{ | |||||
MessageNotify.GetInstance.ShowDialog("配方ID不是数字,请重新输入后重试!"); | |||||
return; | |||||
} | |||||
//if (!int.TryParse(ID,out int Id)) | |||||
//{ | |||||
// MessageNotify.GetInstance.ShowDialog("配方ID不是数字,请重新输入后重试!"); | |||||
// return; | |||||
//} | |||||
if (Functions==null||Functions.Count<=0) | if (Functions==null||Functions.Count<=0) | ||||
{ | { | ||||
MessageNotify.GetInstance.ShowDialog("没有可保存的配方功能配置,请验证后重试!"); | MessageNotify.GetInstance.ShowDialog("没有可保存的配方功能配置,请验证后重试!"); | ||||
return; | return; | ||||
} | } | ||||
#endregion | #endregion | ||||
Dictionary<EFunc, FuncPar[]> TempFunces=new Dictionary<EFunc, FuncPar[]>(); | |||||
List<FuncModel> TempFunces=new List<FuncModel>(); | |||||
//查询是否是编辑现有配方。 | //查询是否是编辑现有配方。 | ||||
int index = Array.FindIndex(Json<RecipesInfo>.Data.LocalRecipes.ToArray(), p => p.ID == ID); | |||||
int index = Array.FindIndex(Json<RecipesInfo>.Data.LocalRecipes.ToArray(), p => p.Id == ID); | |||||
//修改配方 | //修改配方 | ||||
if (index>=0) | if (index>=0) | ||||
{ | { | ||||
foreach (var item in Functions) | foreach (var item in Functions) | ||||
{ | { | ||||
TempFunces.Add((EFunc)Enum.Parse(typeof(EFunc), item.FuncName), item.FuncPars?.ToArray()); | |||||
//TempFunces.Add((EFunc)Enum.Parse(typeof(EFunc), item.FuncName), item.FuncPars?.ToArray()); | |||||
TempFunces.Add(new FuncModel() | |||||
{ | |||||
eFunc = (EFunc)Enum.Parse(typeof(EFunc), item.FuncName), | |||||
funcPars = new List<FuncPar>(item.FuncPars) | |||||
}); | |||||
} | } | ||||
Json<RecipesInfo>.Data.LocalRecipes.ElementAt(index).ID = ID; | |||||
Json<RecipesInfo>.Data.LocalRecipes.ElementAt(index).Id = ID; | |||||
Json<RecipesInfo>.Data.LocalRecipes.ElementAt(index).Name = Name; | Json<RecipesInfo>.Data.LocalRecipes.ElementAt(index).Name = Name; | ||||
Json<RecipesInfo>.Data.LocalRecipes.ElementAt(index).Functions = TempFunces; | |||||
Json<RecipesInfo>.Data.LocalRecipes.ElementAt(index).ControlFuncs = new ConcurrentQueue<FuncModel>(TempFunces); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", $"修改配方:{Name} 成功!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", $"修改配方:{Name} 成功!"); | ||||
} | } | ||||
//没找到则为新增配方 | //没找到则为新增配方 | ||||
@@ -86,14 +97,19 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
{ | { | ||||
foreach (var item in Functions) | foreach (var item in Functions) | ||||
{ | { | ||||
TempFunces.Add((EFunc)Enum.Parse(typeof(EFunc), item.FuncName), item.FuncPars?.ToArray()); | |||||
//TempFunces.Add((EFunc)Enum.Parse(typeof(EFunc), item.FuncName), item.FuncPars?.ToArray()); | |||||
TempFunces.Add(new FuncModel() | |||||
{ | |||||
eFunc = (EFunc)Enum.Parse(typeof(EFunc), item.FuncName), | |||||
funcPars = new List<FuncPar>(item.FuncPars) | |||||
}); | |||||
} | } | ||||
Json<RecipesInfo>.Data.LocalRecipes.Add(new LocalRecipeData() | |||||
Json<RecipesInfo>.Data.LocalRecipes.Add(new ControlData() | |||||
{ | { | ||||
ID = ID, | |||||
Id = Guid.NewGuid().ToString(), | |||||
Name = Name, | Name = Name, | ||||
Remark = " ", | Remark = " ", | ||||
Functions = TempFunces | |||||
ControlFuncs = new ConcurrentQueue<FuncModel>(TempFunces) | |||||
}) ; | }) ; | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", $"新增配方:{Name} 成功!"); | NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", $"新增配方:{Name} 成功!"); | ||||
} | } | ||||
@@ -116,13 +132,6 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
} | } | ||||
}); | }); | ||||
FuncChangeCommand = new BPARelayCommand<object>((o) => | |||||
{ | |||||
if (o!=null && o is FuncSet funcSet) | |||||
{ | |||||
funcSet.FuncPars = InitData.FunParInit[(EFunc)Enum.Parse(typeof(EFunc), funcSet.FuncName)]?.ToList(); | |||||
} | |||||
}); | |||||
EditCommand = new BPARelayCommand<object>((o) => | EditCommand = new BPARelayCommand<object>((o) => | ||||
{ | { | ||||
if (o is FuncSet funcSet) | if (o is FuncSet funcSet) | ||||
@@ -165,10 +174,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
/// 删除功能。 | /// 删除功能。 | ||||
/// </summary> | /// </summary> | ||||
public BPARelayCommand<object> RemoveCommand { get; set; } | public BPARelayCommand<object> RemoveCommand { get; set; } | ||||
/// <summary> | |||||
/// 功能改变。 | |||||
/// </summary> | |||||
public BPARelayCommand<object> FuncChangeCommand { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 编辑功能。 | /// 编辑功能。 | ||||
@@ -212,5 +218,24 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
get { return _AllFunc; } | get { return _AllFunc; } | ||||
set { _AllFunc = value; OnPropertyChanged(); } | set { _AllFunc = value; OnPropertyChanged(); } | ||||
} | } | ||||
private ObservableCollection<string> _AllDishType; | |||||
/// <summary> | |||||
/// 所有菜品集合。 | |||||
/// </summary> | |||||
public ObservableCollection<string> AllDishType | |||||
{ | |||||
get { return _AllDishType; } | |||||
set { _AllDishType = value; OnPropertyChanged(); } | |||||
} | |||||
private EDishType _DishType; | |||||
public EDishType DishType | |||||
{ | |||||
get { return _DishType; } | |||||
set { _DishType = value;OnPropertyChanged(); } | |||||
} | |||||
} | } | ||||
} | } |
@@ -31,19 +31,19 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
{ | { | ||||
if (MessageNotify.GetInstance.ShowDialog("是否删除该配方?", DialogType.Warning)) | if (MessageNotify.GetInstance.ShowDialog("是否删除该配方?", DialogType.Warning)) | ||||
{ | { | ||||
var deleteRecipe = Recipes.FirstOrDefault(recipe => recipe.ID == id.ToString()); | |||||
var deleteRecipe = Recipes.FirstOrDefault(recipe => recipe.Id == id.ToString()); | |||||
if (deleteRecipe != null) | if (deleteRecipe != null) | ||||
{ | { | ||||
Recipes.Remove(deleteRecipe); | Recipes.Remove(deleteRecipe); | ||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", $"删除配方:{deleteRecipe.ID} 成功!"); | |||||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, Application.Current.MainWindow, "提示", $"删除配方:{deleteRecipe.Id} 成功!"); | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
IssueCommand = new((id) => | |||||
IssueCommand = new((o) => | |||||
{ | { | ||||
//参数为ControlData,需要转换。 | |||||
//参数为ControlData,可能需要转换。 | |||||
ActionManage.GetInstance.Send(NotifyTopic.FormulaDistribution, ""); | |||||
ActionManage.GetInstance.Send(NotifyTopic.FormulaDistribution, o); | |||||
}); | }); | ||||
EditCommand = new((o) => | EditCommand = new((o) => | ||||
{ | { | ||||
@@ -56,7 +56,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
/// <summary> | /// <summary> | ||||
/// 配方类,里面应该包含配方数据。 | /// 配方类,里面应该包含配方数据。 | ||||
/// </summary> | /// </summary> | ||||
public ObservableCollection<LocalRecipeData> Recipes { get; set; } | |||||
public ObservableCollection<ControlData> Recipes { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 保存参数。 | /// 保存参数。 | ||||
@@ -88,7 +88,7 @@ namespace BPASmartClient.MorkCL.ViewModel | |||||
Recipes.Clear(); | Recipes.Clear(); | ||||
for (int i = 1; i < 10; i++) | for (int i = 1; i < 10; i++) | ||||
{ | { | ||||
Recipes.Add(new LocalRecipeData() { ID = i.ToString(), Name = $"{i}道菜", Remark = $"这是第{i}道菜。" }); | |||||
//Recipes.Add(new LocalRecipeData() { ID = i.ToString(), Name = $"{i}道菜", Remark = $"这是第{i}道菜。" }); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -50,7 +50,16 @@ namespace BPASmartClient.DosingSystem | |||||
Thread.Sleep(50); | Thread.Sleep(50); | ||||
}), "读取输送线设备数据", true); | }), "读取输送线设备数据", true); | ||||
}; | }; | ||||
MySiemens.Connect(new BPA.Communication.Base.ConfigurationOptions() { IpAddress = "192.168.0.100", cpuType = BPA.Communication.CpuType.S71200, Port = 102 }); | |||||
try | |||||
{ | |||||
IsConnect = MySiemens.Connect(new BPA.Communication.Base.ConfigurationOptions() { IpAddress = "192.168.0.100", cpuType = BPA.Communication.CpuType.S71200, Port = 102 }); | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
//throw; | |||||
} | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -334,95 +334,31 @@ namespace BPASmartClient.DosingSystem.ViewModel | |||||
if (cnt >= 1 && cnt <= 6) | if (cnt >= 1 && cnt <= 6) | ||||
{ | { | ||||
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt * 2 - 1); | |||||
int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt * 2); | |||||
//int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt * 2 - 1); | |||||
//int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt * 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); | |||||
//} | |||||
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt ); | |||||
//int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt * 2); | |||||
if (a1 >= 0) | if (a1 >= 0) | ||||
{ | { | ||||
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel); | 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); | |||||
} | |||||
//if (b1 >= 0) | |||||
//{ | |||||
// Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b1).DeviceName && p.Loc == barrel); | |||||
//} | |||||
Location2 = Location1; | |||||
} | } | ||||
//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) | if (Location1 >= 0) | ||||
{ | { | ||||