@@ -1761,7 +1761,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
: await _db.Queryable<BPA_GoodsInfo>().Where(t => exportDto.Ids.Contains(t.Id)).ToListAsync(); | : await _db.Queryable<BPA_GoodsInfo>().Where(t => exportDto.Ids.Contains(t.Id)).ToListAsync(); | ||||
var goodsAttributeList = await _db.Queryable<BPA_GoodsAttribute>().ToListAsync(); | var goodsAttributeList = await _db.Queryable<BPA_GoodsAttribute>().ToListAsync(); | ||||
var goodsAttributeValueList = await _db.Queryable<BPA_GoodsAttributeValue>().Where(t => goodsAttributeList.Select(a => a.Id).Contains(t.GoodsAttributeId)).OrderBy(a => a.Sort).ToListAsync(); | var goodsAttributeValueList = await _db.Queryable<BPA_GoodsAttributeValue>().Where(t => goodsAttributeList.Select(a => a.Id).Contains(t.GoodsAttributeId)).OrderBy(a => a.Sort).ToListAsync(); | ||||
var actionList = await _db.Queryable<BPA_GoodsTechnologyAction>().Where(t => t.DeviceId == exportDto.DeviceId).ToListAsync(); | |||||
var goodsTechnologyActionList = await _db.Queryable<BPA_GoodsTechnologyAction>().Where(t => t.DeviceId == exportDto.DeviceId).ToListAsync(); | |||||
IWorkbook workbook = new XSSFWorkbook(); | IWorkbook workbook = new XSSFWorkbook(); | ||||
ICellStyle style = workbook.CreateCellStyle(); | ICellStyle style = workbook.CreateCellStyle(); | ||||
style.FillForegroundColor = IndexedColors.Grey25Percent.Index; | style.FillForegroundColor = IndexedColors.Grey25Percent.Index; | ||||
@@ -1794,7 +1794,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
headerRow.GetCell(2).CellStyle = style; | headerRow.GetCell(2).CellStyle = style; | ||||
headerRow.GetCell(3).CellStyle = style; | headerRow.GetCell(3).CellStyle = style; | ||||
headerRow.GetCell(4).CellStyle = style; | headerRow.GetCell(4).CellStyle = style; | ||||
actionList = actionList.Where(t => t.GoodsId == good.Id).OrderBy(a => a.GoodsAttributeId).OrderBy(a => a.Order).ToList(); | |||||
var actionList = goodsTechnologyActionList.Where(t => t.GoodsId == good.Id).OrderBy(a => a.GoodsAttributeId).OrderBy(a => a.Order).ToList(); | |||||
var k = 1; | var k = 1; | ||||
for (int i = 0; i < actionList.Count; i++) | for (int i = 0; i < actionList.Count; i++) | ||||
{ | { | ||||
@@ -82,6 +82,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
_db.Ado.BeginTran(); | |||||
var addlist = new List<BPA_GoodsTechnologyAction>(); | var addlist = new List<BPA_GoodsTechnologyAction>(); | ||||
var maxOrder = _db.Queryable<BPA_GoodsTechnologyAction>().Where(t => t.GoodsId == inputDto[0].GoodsId).Max(a => a.Order); | var maxOrder = _db.Queryable<BPA_GoodsTechnologyAction>().Where(t => t.GoodsId == inputDto[0].GoodsId).Max(a => a.Order); | ||||
var goodsTechnologyActionList = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == inputDto[0].GoodsId && x.DeviceId == inputDto[0].DeviceId && x.WarehousrTemplateId == inputDto[0].WarehousrTemplateId && x.GoodsAttributeId == inputDto[0].GoodsAttributeId).ToList(); | var goodsTechnologyActionList = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == inputDto[0].GoodsId && x.DeviceId == inputDto[0].DeviceId && x.WarehousrTemplateId == inputDto[0].WarehousrTemplateId && x.GoodsAttributeId == inputDto[0].GoodsAttributeId).ToList(); | ||||
@@ -89,7 +90,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
for (int i = 0; i < inputDto.Count; i++) | for (int i = 0; i < inputDto.Count; i++) | ||||
{ | { | ||||
var goodsinfo = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == inputDto[i].GoodsId).First(); | var goodsinfo = _db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == inputDto[i].GoodsId).First(); | ||||
var maxsort = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == inputDto[i].GoodsId && x.DeviceId == inputDto[i].DeviceId && x.WarehousrTemplateId == inputDto[i].WarehousrTemplateId && x.GoodsAttributeId == inputDto[0].GoodsAttributeId).Max(x => x.Sort); | |||||
var maxsort = _db.Queryable<BPA_GoodsTechnologyAction>().Where(x => x.GoodsId == inputDto[i].GoodsId && x.DeviceId == inputDto[i].DeviceId && x.WarehousrTemplateId == inputDto[i].WarehousrTemplateId && x.GoodsAttributeId == inputDto[i].GoodsAttributeId).Max(x => x.Sort); | |||||
var data = new BPA_GoodsTechnologyAction() | var data = new BPA_GoodsTechnologyAction() | ||||
{ | { | ||||
Id = string.IsNullOrEmpty(inputDto[i].Id) ? Guid.NewGuid().ToString() : inputDto[i].Id, | Id = string.IsNullOrEmpty(inputDto[i].Id) ? Guid.NewGuid().ToString() : inputDto[i].Id, | ||||
@@ -115,6 +116,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
addlist.Add(data); | addlist.Add(data); | ||||
} | } | ||||
var res = await _db.Insertable(addlist).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | var res = await _db.Insertable(addlist).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); | ||||
_db.Ado.CommitTran(); | |||||
return res > 0; | return res > 0; | ||||
} | } | ||||
catch (Exception e) | catch (Exception e) | ||||