diff --git a/YD_Event.Application/Scoring/ScoreSheetCalculationService.cs b/YD_Event.Application/Scoring/ScoreSheetCalculationService.cs index 0a3cb5b..bf18017 100644 --- a/YD_Event.Application/Scoring/ScoreSheetCalculationService.cs +++ b/YD_Event.Application/Scoring/ScoreSheetCalculationService.cs @@ -353,6 +353,25 @@ public static class ScoreSheetCalculationService : Math.Clamp(Math.Round(raw, 0, MidpointRounding.AwayFromZero), dimension.MinValue, dimension.MaxValue); weighted += value * dimension.DimensionWeight!.Value; + if (performanceFailureCount > 0m) + { + result.Lines.Add(new ScoreSheetLine + { + ScoreRuleItemId = dimension.Item.Id, + ItemCode = $"{dimension.DimensionCode}_FAILURE_MINUS", + ItemName = $"{dimension.Item.ItemName}(失误联动减数量)", + ItemType = dimension.Item.ItemType, + ScoreDimension = dimension.Item.ScoreDimension, + CountValue = performanceFailureCount, + UnitValue = dimension.Item.UnitValue ?? 1m, + Subtotal = -performanceFailureCount * (dimension.Item.UnitValue ?? 1m), + Sort = dimension.Item.Sort, + IsAutoGenerated = true, + ParentItemCode = failure?.ItemCode, + SubjectCode = dimension.SubjectCode + }); + } + result.Lines.Add(new ScoreSheetLine { ScoreRuleItemId = dimension.Item.Id, ItemCode = dimension.ItemCode, ItemName = dimension.Item.ItemName, diff --git a/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs b/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs index 0918c73..9669812 100644 --- a/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs +++ b/YD_Event.Application/Workbench/Dtos/WorkbenchDtos.cs @@ -611,6 +611,16 @@ public class WorkbenchScoreItemDto /// public decimal Subtotal { get; set; } + /// + /// 是否由服务端联动生成 + /// + public bool IsAutoGenerated { get; set; } + + /// + /// 联动来源评分项编码 + /// + public string? ParentItemCode { get; set; } + /// /// 排序号 /// diff --git a/YD_Event.Application/Workbench/WorkbenchController.cs b/YD_Event.Application/Workbench/WorkbenchController.cs index f1af823..54e42e2 100644 --- a/YD_Event.Application/Workbench/WorkbenchController.cs +++ b/YD_Event.Application/Workbench/WorkbenchController.cs @@ -395,6 +395,8 @@ public class WorkbenchController : IDynamicApiController d.CountValue, d.InputValue, d.Subtotal, + d.IsAutoGenerated, + d.ParentItemCode, d.Sort }).ToListAsync(); @@ -445,6 +447,8 @@ public class WorkbenchController : IDynamicApiController CountValue = d.CountValue, InputValue = d.InputValue, Subtotal = d.Subtotal, + IsAutoGenerated = d.IsAutoGenerated, + ParentItemCode = d.ParentItemCode, Sort = d.Sort }).ToList() };