diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs index 3ad5943..9207ef6 100644 --- a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs @@ -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>(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>(action.ActionValue); @@ -2477,6 +2499,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services var deviceInfo = await _db.Queryable().FirstAsync(t => t.Id == exportDto.DeviceId); if (deviceInfo == null) throw Oops.Oh("该设备不存在!"); + var technologyList = await _db.Queryable().Where(t => t.DeviceVersionId == deviceInfo.ProductVersionId).ToListAsync(); + var technologyActionList = await _db.Queryable().Where(t => technologyList.Select(a => a.Id).Contains(t.TechnologyId)).OrderBy(t => t.Sort).ToListAsync(); var recode = await _db.Queryable().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>(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);