设备加配方

This commit is contained in:
qianhao.xu 2024-08-27 09:34:52 +08:00
parent 98f581c35d
commit 94eca8aba6
4 changed files with 46 additions and 15 deletions

View File

@ -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
{
}
}

View File

@ -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
{
/// <summary>
/// 将配方和设备组合
/// </summary>
public class DevicecCombination
{
public BaseDeviceAccount _account { set; get; }
public Recipee _recipee { set; get; }
}
}

View File

@ -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; }
}
}

View File

@ -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<BaseDeviceAccount> accounts = Context.Queryable<BaseDeviceAccount>().Where(it => it.FkLineId == line.Id).ToList();
if (accounts != null && accounts.Count() > 0)
{
LineItem.Children = accounts.ToArray();
List<DevicecCombination> DevicecCombinationList = new List<DevicecCombination>();
// 获取每台设备的配方
foreach (BaseDeviceAccount device in accounts)
{
Recipee recipee = Context.Queryable<Recipee>()
.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);