Browse Source

商品导出及商品缓存优化20241113

kitchenmanage
gwbvipvip 1 month ago
parent
commit
426a864bd7
1 changed files with 39 additions and 1 deletions
  1. +39
    -1
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs

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

@@ -2034,6 +2034,17 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var action = technologyActionList.FirstOrDefault(t => t.ActionName == child.ActionName && t.TechnologyId == technology.Id);
if (action == null)
throw Oops.Oh($"{entry.FullName} {sheetNameList[i]}的工序参数{child.ActionName}不存在");
if(child.ActionValue == null)
{
jsonList.Add(new ActionJsonModel
{
actionName = child.ActionName,
actionValue = child.ActionValue,
technologyactionId = action.Id,
index = child.Index
});
continue;
}
if (action.ActionValue != null)
{
var actionValueList = JsonConvert.DeserializeObject<List<ActionValueModel>>(action.ActionValue);
@@ -2265,6 +2276,17 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var action = technologyActionList.FirstOrDefault(t => t.ActionName == child.ActionName && t.TechnologyId == technology.Id);
if (action == null)
throw Oops.Oh($"{file.FileName} {sheetNameList[i]}的工序参数{child.ActionName}不存在");
if (child.ActionValue == null)
{
jsonList.Add(new ActionJsonModel
{
actionName = child.ActionName,
actionValue = child.ActionValue,
technologyactionId = action.Id,
index = child.Index
});
continue;
}
if (action.ActionValue != null)
{
var actionValueList = JsonConvert.DeserializeObject<List<ActionValueModel>>(action.ActionValue);
@@ -2477,6 +2499,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var deviceInfo = await _db.Queryable<BPA_DeviceInfo>().FirstAsync(t => t.Id == exportDto.DeviceId);
if (deviceInfo == null)
throw Oops.Oh("该设备不存在!");
var technologyList = await _db.Queryable<BPA_Technology>().Where(t => t.DeviceVersionId == deviceInfo.ProductVersionId).ToListAsync();
var technologyActionList = await _db.Queryable<BPA_TechnologyAction>().Where(t => technologyList.Select(a => a.Id).Contains(t.TechnologyId)).OrderBy(t => t.Sort).ToListAsync();
var recode = await _db.Queryable<BPA_TechnologyExportRecode>().FirstAsync(x => x.DeviceVersionId == deviceInfo.ProductVersionId);
if (recode == null)
throw Oops.Oh($"该设备工艺模版不存在!");
@@ -2601,15 +2625,29 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
foreach (var item in action)
{
var actionJsonList = JsonConvert.DeserializeObject<List<ActionJsonModel>>(item.ActionJson);
foreach (var actionJson in actionJsonList)
var tempActionList = technologyActionList.Where(t => t.TechnologyId == item.ChnologyId).ToList();
var k = 0;
foreach(var tempAction in tempActionList)
{
IRow actionDataRow = actionSheet.CreateRow(j);
actionDataRow.RowStyle = dataStyle;
var actionJson = actionJsonList.FirstOrDefault(t => t.technologyactionId == tempAction.Id);
if(actionJson == null)
{
actionJson = new ActionJsonModel
{
actionName = tempAction.ActionName,
actionValue = "",
technologyactionId = null,
index = k.ToString()
};
}
actionDataRow.CreateCell(0).SetCellValue(item.StepName);
actionDataRow.CreateCell(1).SetCellValue(actionJson.actionName);
actionDataRow.CreateCell(2).SetCellValue(actionJson.actionValue);
actionDataRow.CreateCell(3).SetCellValue(actionJson.index);
j++;
k++;
}
}
UpdateGoodSheet(goodSheet);


Loading…
Cancel
Save