@@ -419,17 +419,18 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public async Task<List<DeviceTechnologyActionListView>> GetDeviceTechnologyAction(DeviceQueryDto param)
public async Task<List<DeviceTechnologyActionListView>> GetDeviceTechnologyAction(DeviceQueryDto param)
{
List<DeviceTechnologyActionListView> goodsTechnologyActionListViews = new List<DeviceTechnologyActionListView>();
var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.DeviceId ==param.DeviceId).Select(x => new DeviceTechnologyActionListView()
{
Id = x.Id.SelectAll(),
}).ToList();
var list = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.DeviceId == param.DeviceId)
.Select(x => new DeviceTechnologyActionListView()
{
Id = x.Id.SelectAll(),
}).ToList();
var Goodlist = await _db.Queryable<BPA_GoodsInfo>().ToListAsync();
var Devicelist = await _db.Queryable<BPA_DeviceInfo>().ToListAsync();
var GoodsAttributeValue = await _db.Queryable<BPA_GoodsAttributeValue>().ToListAsync();
var sf = list.GroupBy(x => (x.GoodsAttributeId, x.WarehousrTemplateId)).ToList();
var sf = list.GroupBy(x => (x.GoodsId, x.Goods AttributeId, x.WarehousrTemplateId)).OrderBy(t => t.Key.GoodsId).ThenBy(t => t.Key.GoodsAttributeId ).ToList();
for (int i = 0; i < sf.Count; i++)
{
var sd = GoodsAttributeValue?.Where(x => sf[i].Key.GoodsAttributeId.Contains(x.Id)).OrderBy(x => sf[i].Key.GoodsAttributeId.IndexOf(x.Id)).Select(x => x.AttributeValue).ToArray();
@@ -439,20 +440,20 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
for (int t = 0; t < s.Count; t++)
{
DeviceTechnologyActionListView item = new()
{
DeviceId =param.DeviceId ,
{
DeviceId = param.DeviceId,
GoodsId = s[t].Key,
GoodsName= Goodlist?.FirstOrDefault(x => x.Id == s[t].Key).Name,
GoodsName = Goodlist?.FirstOrDefault(x => x.Id == s[t].Key).Name,
GoodsAttributeId = string.Join(',', sdw),
DeviceName = Devicelist?.FirstOrDefault(x => x.Id ==param.DeviceId).DeviceName,
TechnologyName = Goodlist?.FirstOrDefault(x => x.Id == s[t].Key).Name + "【" + name + "】",
DeviceName = Devicelist?.FirstOrDefault(x => x.Id == param.DeviceId).DeviceName,
TechnologyName = Goodlist?.FirstOrDefault(x => x.Id == s[t].Key).Name + "【" + name + "】",
};
goodsTechnologyActionListViews.Add(item);
}
}
if (!string.IsNullOrWhiteSpace(param.TechnologyName))
{
goodsTechnologyActionListViews=goodsTechnologyActionListViews.Where(x => x.TechnologyName.Contains(param.TechnologyName)).ToList();
goodsTechnologyActionListViews = goodsTechnologyActionListViews.Where(x => x.TechnologyName.Contains(param.TechnologyName)).ToList();
}
return goodsTechnologyActionListViews;
}
@@ -464,11 +465,11 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
.Select(x => new GoodsTechnologyActionView()
{
Id = x.Id.SelectAll(),
}).OrderBy(x => x.GoodsAttributeId, OrderByType.Asc). ToList();
}).ToList();
var Devicelist = await _db.Queryable<BPA_DeviceInfo>().ToListAsync();
var goodlist = await _db.Queryable<BPA_GoodsInfo>().ToListAsync();
var GoodsAttributeValue = await _db.Queryable<BPA_GoodsAttributeValue>().ToListAsync();
var sf = list.GroupBy(x => (x.GoodsAttributeId, x.WarehousrTemplateId)).ToList();
var sf = list.GroupBy(x => (x.GoodsAttributeId, x.WarehousrTemplateId)).OrderBy(t => t.Key.GoodsAttributeId). ToList();
for (int i = 0; i < sf.Count; i++)
{
var sd = GoodsAttributeValue?.Where(x => sf[i].Key.GoodsAttributeId.Contains(x.Id)).OrderBy(x => sf[i].Key.GoodsAttributeId.IndexOf(x.Id)).Select(x => x.AttributeValue).ToArray();
@@ -493,7 +494,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
{
result = result.Where(x => x.DeviceName.Contains(dto.DeviceName)).ToList();
}
result = result.OrderBy(t => t.Order).ToList();
PageUtil util = new PageUtil()
{
Total = result.Count,