Browse Source

Merge branch 'master' into kitchenmanage

tmp
zhaoy 8 months ago
parent
commit
81e472e11e
3 changed files with 42 additions and 20 deletions
  1. +1
    -4
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  2. +39
    -14
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs
  3. +2
    -2
      BPA.SAAS.Manage.Application/Device/Services/ProductService.cs

+ 1
- 4
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs View File

@@ -288,10 +288,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
BomId= b.BoomId, BomId= b.BoomId,
IsMain = a.IsMain, IsMain = a.IsMain,
GoodsAttributeValueId=b.GoodsAttributeValueId, GoodsAttributeValueId=b.GoodsAttributeValueId,
}).Mapper(x =>
{
var AttributeValue = _db.Queryable<BPA_GoodsAttributeValue>().Where(p => x.GoodsAttributeValueId.Contains(p.Id)).Select(p=>p.AttributeValue).ToArray();
x.GoodsAttributeValue =string.Join("-", AttributeValue);
GoodsAttributeValue=b.GoodsAttributeValue,
}) })
.ToPageListAsync(dto.Current, dto.PageSize, total); .ToPageListAsync(dto.Current, dto.PageSize, total);
PageUtil util = new PageUtil() PageUtil util = new PageUtil()


+ 39
- 14
BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs View File

@@ -122,17 +122,42 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
Id = x.Id.SelectAll(), Id = x.Id.SelectAll(),
}).OrderBy(x => x.Sort, OrderByType.Asc).ToList(); }).OrderBy(x => x.Sort, OrderByType.Asc).ToList();
var Devicelist = await _db.Queryable<BPA_DeviceInfo>().ToListAsync(); var Devicelist = await _db.Queryable<BPA_DeviceInfo>().ToListAsync();
var s = list.GroupBy(x => x.DeviceId).ToList();
for (int i = 0; i < s.Count; i++)
var GoodsAttributeValue = await _db.Queryable<BPA_GoodsAttributeValue>().ToListAsync();
var sf = list.GroupBy(x => x.GoodsAttributeId).ToList();
for (int i = 0; i < sf.Count; i++)
{ {
GoodsTechnologyActionListView item = new()
var sd = GoodsAttributeValue?.Where(x => sf[i].Key.Contains(x.Id)).Select(x => x.AttributeValue).ToArray();
var nane =string.Join('-', sd);
var s = sf[i].AsQueryable().ToList().GroupBy(x => x.DeviceId).ToList();
for (int t = 0; t < s.Count; t++)
{ {
DeviceId = s[i].Key,
DeviceName = Devicelist?.FirstOrDefault(x => x.Id == s[i].Key).DeviceName,
Data = s[i].AsQueryable().ToList(),
};
goodsTechnologyActionListViews.Add(item);
GoodsTechnologyActionListView item = new()
{
DeviceId = s[t].Key,
DeviceName = Devicelist?.FirstOrDefault(x => x.Id == s[t].Key).DeviceName+ "【"+ nane+"】",
Data = s[t].AsQueryable().ToList(),
};
goodsTechnologyActionListViews.Add(item);
}
//GoodsTechnologyActionListView item = new()
//{
// DeviceId = sf[i].Key,
// DeviceName = Devicelist?.FirstOrDefault(x => x.Id == sf[i].Key).DeviceName,
// Data = sf[i].AsQueryable().ToList(),
//};
//goodsTechnologyActionListViews.Add(item);
} }
//var s = list.GroupBy(x => x.DeviceId).ToList();
//for (int i = 0; i < s.Count; i++)
//{
// GoodsTechnologyActionListView item = new()
// {
// DeviceId = s[i].Key,
// DeviceName = Devicelist?.FirstOrDefault(x => x.Id == s[i].Key).DeviceName,
// Data = s[i].AsQueryable().ToList(),
// };
// goodsTechnologyActionListViews.Add(item);
//}
return goodsTechnologyActionListViews; return goodsTechnologyActionListViews;
} }
public async Task<bool> DeleteGoodsTechnologyAction(string id) public async Task<bool> DeleteGoodsTechnologyAction(string id)
@@ -178,12 +203,12 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
Id = x.Id.SelectAll(), Id = x.Id.SelectAll(),
}).Mapper(a => }).Mapper(a =>
{ {
a.GoodsTechnologyInfo = _db.Queryable<BPA_ProductFunction>().Where(d => d.DeviceVersionKey == a.ProductVersionId && d.Type==1).Select(d => new GoodsTechnologyInfo()
{
DeviceTechnologyId = d.Id,
DeviceVersionKey = d.DeviceVersionKey,
Name = d.Name,
}).ToList();
//a.GoodsTechnologyInfo = _db.Queryable<BPA_ProductFunction>().Where(d => d.DeviceVersionKey == a.ProductVersionId && d.Type==1).Select(d => new GoodsTechnologyInfo()
//{
// DeviceTechnologyId = d.Id,
// DeviceVersionKey = d.DeviceVersionKey,
// Name = d.Name,
//}).ToList();
}).ToListAsync(); }).ToListAsync();
return list; return list;
} }


+ 2
- 2
BPA.SAAS.Manage.Application/Device/Services/ProductService.cs View File

@@ -98,8 +98,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<bool> UpdateProduct(ProductBaseDto inputDto) public async Task<bool> UpdateProduct(ProductBaseDto inputDto)
{ {
var data = await _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.Id).FirstAsync(); var data = await _db.Queryable<BPA_Product>().Where(x => x.Id == inputDto.Id).FirstAsync();
//var check = _db.Queryable<BPA_Product>().Where(x => x.Name == inputDto.Name || x.Code == inputDto.Code).Any();
//if (check) throw Oops.Oh("产品名称和标识不能重复");
var check = _db.Queryable<BPA_Product>().Where(x => (x.Name == inputDto.Name || x.Code == inputDto.Code) && x.Id != inputDto.Id).Any();
if (check) throw Oops.Oh("产品名称和标识不能重复");
if (data != null) if (data != null)
{ {
var res = _db.Updateable<BPA_Product>() var res = _db.Updateable<BPA_Product>()


Loading…
Cancel
Save