Browse Source

修复工艺导出和添加工艺bug20240717

ingredientmanage
gwbvipvip 3 months ago
parent
commit
553aa9626c
2 changed files with 5 additions and 3 deletions
  1. +2
    -2
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  2. +3
    -1
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs

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

@@ -1761,7 +1761,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
: await _db.Queryable<BPA_GoodsInfo>().Where(t => exportDto.Ids.Contains(t.Id)).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 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();
ICellStyle style = workbook.CreateCellStyle();
style.FillForegroundColor = IndexedColors.Grey25Percent.Index;
@@ -1794,7 +1794,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
headerRow.GetCell(2).CellStyle = style;
headerRow.GetCell(3).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;
for (int i = 0; i < actionList.Count; i++)
{


+ 3
- 1
BPA.SAAS.Manage.Application/DataBase/Services/GoodsTechnologyService.cs View File

@@ -82,6 +82,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
{
try
{
_db.Ado.BeginTran();
var addlist = new List<BPA_GoodsTechnologyAction>();
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();
@@ -89,7 +90,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
for (int i = 0; i < inputDto.Count; i++)
{
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()
{
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);
}
var res = await _db.Insertable(addlist).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res > 0;
}
catch (Exception e)


Loading…
Cancel
Save