diff --git a/DOAN.Model/Factory_Model/BaseDeviceAccountExtensions.cs b/DOAN.Model/Factory_Model/BaseDeviceAccountExtensions.cs deleted file mode 100644 index d3f45b1..0000000 --- a/DOAN.Model/Factory_Model/BaseDeviceAccountExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace DOAN.Model.Factory_Model -{ - public static class BaseDeviceAccountExtensions - { - - } -} diff --git a/DOAN.Model/Factory_Model/Dto/DevicecCombination.cs b/DOAN.Model/Factory_Model/Dto/DevicecCombination.cs new file mode 100644 index 0000000..a882c8d --- /dev/null +++ b/DOAN.Model/Factory_Model/Dto/DevicecCombination.cs @@ -0,0 +1,23 @@ +using DOAN.Model.huate_group.recipe; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DOAN.Model.Factory_Model.Dto +{ + /// + /// 将配方和设备组合 + /// + public class DevicecCombination + { + public BaseDeviceAccount _account { set; get; } + public Recipee _recipee { set; get; } + + + + } + + +} diff --git a/DOAN.Model/huate_group/recipe/Dto/ProductLineChildrenDevice.cs b/DOAN.Model/huate_group/recipe/Dto/ProductLineChildrenDevice.cs index e88aec3..942f73b 100644 --- a/DOAN.Model/huate_group/recipe/Dto/ProductLineChildrenDevice.cs +++ b/DOAN.Model/huate_group/recipe/Dto/ProductLineChildrenDevice.cs @@ -1,4 +1,5 @@ using DOAN.Model.Factory_Model; +using DOAN.Model.Factory_Model.Dto; using System; using System.Collections.Generic; using System.Linq; @@ -23,7 +24,7 @@ namespace DOAN.Model.huate_group.recipe.Dto public int? Status { get; set; } - public BaseDeviceAccount[] Children { get; set; } + public DevicecCombination[] Children { get; set; } } } diff --git a/DOAN.Service/huate_group/Recipe/RecipeService.cs b/DOAN.Service/huate_group/Recipe/RecipeService.cs index b73c8b0..550c208 100644 --- a/DOAN.Service/huate_group/Recipe/RecipeService.cs +++ b/DOAN.Service/huate_group/Recipe/RecipeService.cs @@ -6,6 +6,7 @@ using DOAN.Model.huate_group.recipe.Dto; using DOAN.Repository; using Aliyun.OSS; using DOAN.Model.Factory_Model; +using DOAN.Model.Factory_Model.Dto; namespace DOAN.Service.huate_group.Recipe @@ -162,7 +163,26 @@ namespace DOAN.Service.huate_group.Recipe List accounts = Context.Queryable().Where(it => it.FkLineId == line.Id).ToList(); if (accounts != null && accounts.Count() > 0) { - LineItem.Children = accounts.ToArray(); + + List DevicecCombinationList = new List(); + // 获取每台设备的配方 + foreach (BaseDeviceAccount device in accounts) + { + Recipee recipee = Context.Queryable() + .Where(it => it.FkDeviceId == device.Id) + .Where(it => it.IsSelected == true).First(); + if (recipee != null) + { + DevicecCombination devicecCombination = new DevicecCombination(); + devicecCombination._recipee = recipee; + devicecCombination._account = device; + DevicecCombinationList.Add(devicecCombination); + + } + + } + + LineItem.Children = DevicecCombinationList.ToArray(); } productLineChildrenDevices.Add(LineItem);