using System;
using System.Collections.Generic;
using NPP.SmartSchedue.Api.Contracts.Services.Work.Output;
using NPP.SmartSchedue.Api.Contracts.Services.Integration.Models;
namespace NPP.SmartSchedue.Api.Contracts.Services.Integration.Output
{
///
/// 智能重新分配结果
/// 记录重新分配操作的详细结果和统计信息
///
/// 业务价值:
/// 1. 结果追踪:详细记录重新分配的执行结果
/// 2. 性能评估:提供重新分配后的效果评估
/// 3. 问题诊断:记录失败原因和改进建议
/// 4. 决策支持:为后续优化提供数据支撑
///
public class SmartReallocationResult
{
///
/// 重新分配是否成功
///
public bool IsSuccess { get; set; }
///
/// 成功消息
///
public string SuccessMessage { get; set; } = string.Empty;
///
/// 错误消息
///
public string ErrorMessage { get; set; } = string.Empty;
///
/// 重新分配执行时间
///
public DateTime ReallocationTime { get; set; } = DateTime.Now;
///
/// 新创建的整合记录ID
/// 如果创建了新版本
///
public long? NewIntegrationRecordId { get; set; }
///
/// 新版本号
///
public int? NewVersionNumber { get; set; }
///
/// 原整合记录ID
///
public long OriginalIntegrationRecordId { get; set; }
///
/// 人员重新分配结果
///
public PersonnelReallocationResult PersonnelReallocation { get; set; } = new();
///
/// 设备重新分配结果
///
public EquipmentReallocationResult EquipmentReallocation { get; set; } = new();
///
/// 任务处理结果
///
public TaskReallocationResult TaskReallocation { get; set; } = new();
///
/// 重新分配统计信息
///
public ReallocationStatistics Statistics { get; set; } = new();
///
/// 性能对比分析
/// 与原方案的对比
///
public PerformanceComparison PerformanceComparison { get; set; } = new();
///
/// 质量评估
///
public QualityAssessment QualityAssessment { get; set; } = new();
///
/// 通知发送结果
///
public List NotificationResults { get; set; } = new();
///
/// 验证结果
/// 重新分配后的验证检查结果
///
public ReallocationValidationResult ValidationResult { get; set; } = new();
///
/// 警告信息
///
public List WarningMessages { get; set; } = new();
///
/// 改进建议
///
public List ImprovementSuggestions { get; set; } = new();
///
/// 重新分配原因
///
public string ReallocationReason { get; set; } = string.Empty;
///
/// 操作员信息
///
public OperatorInfo Operator { get; set; } = new();
///
/// 重新分配ID
/// 标识本次重新分配操作
///
public string ReallocationId { get; set; } = Guid.NewGuid().ToString();
///
/// 受影响的任务数量
///
public int AffectedTaskCount { get; set; }
}
///
/// 人员重新分配结果
///
public class PersonnelReallocationResult
{
///
/// 重新分配的人员任务数量
///
public int ReallocatedTaskCount { get; set; }
///
/// 成功的人员分配列表
///
public List SuccessfulAllocations { get; set; } = new();
///
/// 失败的人员分配列表
///
public List FailedAllocations { get; set; } = new();
///
/// 保持不变的分配列表
///
public List UnchangedAllocations { get; set; } = new();
///
/// 人员工作负载分析
///
public List WorkloadAnalysis { get; set; } = new();
///
/// 新的公平性评分
///
public int NewFairnessScore { get; set; }
///
/// 公平性改善程度
///
public int FairnessImprovement { get; set; }
///
/// 分配摘要
///
public string AllocationSummary { get; set; } = string.Empty;
}
///
/// 人员重新分配详情
///
public class PersonnelReallocationDetail
{
///
/// 任务ID
///
public long TaskId { get; set; }
///
/// 任务代码
///
public string TaskCode { get; set; } = string.Empty;
///
/// 原分配人员ID
///
public long? PreviousPersonnelId { get; set; }
///
/// 原分配人员姓名
///
public string PreviousPersonnelName { get; set; } = string.Empty;
///
/// 新分配人员ID
///
public long NewPersonnelId { get; set; }
///
/// 新分配人员姓名
///
public string NewPersonnelName { get; set; } = string.Empty;
///
/// 重新分配原因
///
public string ReallocationReason { get; set; } = string.Empty;
///
/// 匹配评分
///
public int MatchScore { get; set; }
///
/// 预期效率
///
public decimal ExpectedEfficiency { get; set; }
///
/// 重新分配时间
///
public DateTime ReallocationTime { get; set; } = DateTime.Now;
///
/// 质量改善评估
///
public string QualityImprovement { get; set; } = string.Empty;
}
///
/// 失败的人员重新分配
///
public class FailedPersonnelReallocation
{
///
/// 任务ID
///
public long TaskId { get; set; }
///
/// 任务代码
///
public string TaskCode { get; set; } = string.Empty;
///
/// 失败原因
///
public string FailureReason { get; set; } = string.Empty;
///
/// 详细错误信息
///
public List DetailedErrors { get; set; } = new();
///
/// 冲突详情
///
public List ConflictDetails { get; set; } = new();
///
/// 建议解决方案
///
public List SuggestedSolutions { get; set; } = new();
///
/// 当前分配状态
///
public string CurrentAllocationStatus { get; set; } = string.Empty;
}
///
/// 保持不变的人员分配
///
public class UnchangedPersonnelAllocation
{
///
/// 任务ID
///
public long TaskId { get; set; }
///
/// 任务代码
///
public string TaskCode { get; set; } = string.Empty;
///
/// 分配的人员ID
///
public long PersonnelId { get; set; }
///
/// 分配的人员姓名
///
public string PersonnelName { get; set; } = string.Empty;
///
/// 保持不变的原因
///
public string UnchangedReason { get; set; } = string.Empty;
///
/// 匹配评分
///
public int MatchScore { get; set; }
}
///
/// 设备重新分配结果
///
public class EquipmentReallocationResult
{
///
/// 重新分配的设备任务数量
///
public int ReallocatedTaskCount { get; set; }
///
/// 成功的设备分配列表
///
public List SuccessfulAllocations { get; set; } = new();
///
/// 失败的设备分配列表
///
public List FailedAllocations { get; set; } = new();
///
/// 保持不变的分配列表
///
public List UnchangedAllocations { get; set; } = new();
///
/// 设备利用率分析
///
public List UtilizationAnalysis { get; set; } = new();
///
/// 新的整体利用率
///
public decimal NewOverallUtilizationRate { get; set; }
///
/// 利用率改善程度
///
public decimal UtilizationImprovement { get; set; }
///
/// 分配摘要
///
public string AllocationSummary { get; set; } = string.Empty;
}
///
/// 设备重新分配详情
///
public class EquipmentReallocationDetail
{
///
/// 任务ID
///
public long TaskId { get; set; }
///
/// 任务代码
///
public string TaskCode { get; set; } = string.Empty;
///
/// 原分配设备ID
///
public long? PreviousEquipmentId { get; set; }
///
/// 原分配设备名称
///
public string PreviousEquipmentName { get; set; } = string.Empty;
///
/// 新分配设备ID
///
public long NewEquipmentId { get; set; }
///
/// 新分配设备名称
///
public string NewEquipmentName { get; set; } = string.Empty;
///
/// 重新分配原因
///
public string ReallocationReason { get; set; } = string.Empty;
///
/// 利用率
///
public decimal UtilizationRate { get; set; }
///
/// 预期性能
///
public decimal ExpectedPerformance { get; set; }
///
/// 重新分配时间
///
public DateTime ReallocationTime { get; set; } = DateTime.Now;
///
/// 效率改善评估
///
public string EfficiencyImprovement { get; set; } = string.Empty;
}
///
/// 失败的设备重新分配
///
public class FailedEquipmentReallocation
{
///
/// 任务ID
///
public long TaskId { get; set; }
///
/// 任务代码
///
public string TaskCode { get; set; } = string.Empty;
///
/// 失败原因
///
public string FailureReason { get; set; } = string.Empty;
///
/// 详细错误信息
///
public List DetailedErrors { get; set; } = new();
///
/// 冲突详情
///
public List ConflictDetails { get; set; } = new();
///
/// 建议解决方案
///
public List SuggestedSolutions { get; set; } = new();
///
/// 当前分配状态
///
public string CurrentAllocationStatus { get; set; } = string.Empty;
}
///
/// 保持不变的设备分配
///
public class UnchangedEquipmentAllocation
{
///
/// 任务ID
///
public long TaskId { get; set; }
///
/// 任务代码
///
public string TaskCode { get; set; } = string.Empty;
///
/// 分配的设备ID
///
public long EquipmentId { get; set; }
///
/// 分配的设备名称
///
public string EquipmentName { get; set; } = string.Empty;
///
/// 保持不变的原因
///
public string UnchangedReason { get; set; } = string.Empty;
///
/// 利用率
///
public decimal UtilizationRate { get; set; }
}
///
/// 任务重新分配结果
///
public class TaskReallocationResult
{
///
/// 总任务数
///
public int TotalTaskCount { get; set; }
///
/// 成功重新分配的任务数
///
public int SuccessfulReallocationCount { get; set; }
///
/// 失败的任务数
///
public int FailedReallocationCount { get; set; }
///
/// 保持不变的任务数
///
public int UnchangedTaskCount { get; set; }
///
/// 重新分配成功率
///
public decimal ReallocationSuccessRate { get; set; }
///
/// 任务状态分布
///
public Dictionary TaskStatusDistribution { get; set; } = new();
///
/// 任务复杂度分布
///
public Dictionary ComplexityDistribution { get; set; } = new();
///
/// 优先级分布
///
public Dictionary PriorityDistribution { get; set; } = new();
}
///
/// 重新分配统计信息
///
public class ReallocationStatistics
{
///
/// 总执行时间(毫秒)
///
public long TotalElapsedMilliseconds { get; set; }
///
/// 分析阶段耗时(毫秒)
///
public long AnalysisElapsedMilliseconds { get; set; }
///
/// 算法执行耗时(毫秒)
///
public long AlgorithmElapsedMilliseconds { get; set; }
///
/// 验证阶段耗时(毫秒)
///
public long ValidationElapsedMilliseconds { get; set; }
///
/// 涉及的人员数量
///
public int InvolvedPersonnelCount { get; set; }
///
/// 涉及的设备数量
///
public int InvolvedEquipmentCount { get; set; }
///
/// 涉及的项目数量
///
public int InvolvedProjectCount { get; set; }
///
/// 算法迭代次数
///
public int AlgorithmIterations { get; set; }
///
/// 约束条件数量
///
public int ConstraintCount { get; set; }
///
/// 满足的约束数量
///
public int SatisfiedConstraintCount { get; set; }
///
/// 约束满足率
///
public decimal ConstraintSatisfactionRate { get; set; }
///
/// 成功重新分配的任务数
///
public int SuccessfulReallocationCount { get; set; }
///
/// 失败的重新分配数
///
public int FailedReallocationCount { get; set; }
///
/// 人员分配成功率
///
public decimal PersonnelAllocationSuccessRate { get; set; }
///
/// 设备分配成功率
///
public decimal EquipmentAllocationSuccessRate { get; set; }
}
///
/// 性能对比分析
///
public class PerformanceComparison
{
///
/// 原方案性能评分
///
public decimal OriginalPerformanceScore { get; set; }
///
/// 新方案性能评分
///
public decimal NewPerformanceScore { get; set; }
///
/// 性能改善程度
///
public decimal PerformanceImprovement { get; set; }
///
/// 效率指标对比
///
public EfficiencyMetricsComparison EfficiencyComparison { get; set; } = new();
///
/// 资源利用率对比
///
public ResourceUtilizationComparison ResourceUtilizationComparison { get; set; } = new();
///
/// 公平性对比
///
public FairnessComparison FairnessComparison { get; set; } = new();
///
/// 质量指标对比
///
public QualityMetricsComparison QualityComparison { get; set; } = new();
///
/// 改善摘要
///
public string ImprovementSummary { get; set; } = string.Empty;
}
///
/// 效率指标对比
///
public class EfficiencyMetricsComparison
{
///
/// 原预期完成时间(小时)
///
public decimal OriginalEstimatedCompletionTime { get; set; }
///
/// 新预期完成时间(小时)
///
public decimal NewEstimatedCompletionTime { get; set; }
///
/// 时间节省(小时)
///
public decimal TimeSaved { get; set; }
///
/// 效率提升百分比
///
public decimal EfficiencyImprovementPercentage { get; set; }
///
/// 平均任务完成效率
///
public decimal AverageTaskCompletionEfficiency { get; set; }
}
///
/// 资源利用率对比
///
public class ResourceUtilizationComparison
{
///
/// 原人员利用率
///
public decimal OriginalPersonnelUtilization { get; set; }
///
/// 新人员利用率
///
public decimal NewPersonnelUtilization { get; set; }
///
/// 人员利用率改善
///
public decimal PersonnelUtilizationImprovement { get; set; }
///
/// 原设备利用率
///
public decimal OriginalEquipmentUtilization { get; set; }
///
/// 新设备利用率
///
public decimal NewEquipmentUtilization { get; set; }
///
/// 设备利用率改善
///
public decimal EquipmentUtilizationImprovement { get; set; }
///
/// 整体资源利用率改善
///
public decimal OverallUtilizationImprovement { get; set; }
}
///
/// 公平性对比
///
public class FairnessComparison
{
///
/// 原公平性评分
///
public int OriginalFairnessScore { get; set; }
///
/// 新公平性评分
///
public int NewFairnessScore { get; set; }
///
/// 公平性改善程度
///
public int FairnessImprovement { get; set; }
///
/// 工作负载方差改善
///
public decimal WorkloadVarianceImprovement { get; set; }
///
/// 最大工作负载差异改善
///
public decimal MaxWorkloadDifferenceImprovement { get; set; }
}
///
/// 质量指标对比
///
public class QualityMetricsComparison
{
///
/// 原技能匹配度
///
public decimal OriginalSkillMatchRate { get; set; }
///
/// 新技能匹配度
///
public decimal NewSkillMatchRate { get; set; }
///
/// 技能匹配度改善
///
public decimal SkillMatchImprovement { get; set; }
///
/// 原质量风险评分
///
public int OriginalQualityRiskScore { get; set; }
///
/// 新质量风险评分
///
public int NewQualityRiskScore { get; set; }
///
/// 质量风险改善程度
///
public int QualityRiskImprovement { get; set; }
}
///
/// 质量评估
///
public class QualityAssessment
{
///
/// 总体质量评分(0-100)
///
public int OverallQualityScore { get; set; }
///
/// 分配合理性评分
///
public int AllocationReasonabilityScore { get; set; }
///
/// 资源匹配度评分
///
public int ResourceMatchScore { get; set; }
///
/// 约束满足度评分
///
public int ConstraintSatisfactionScore { get; set; }
///
/// 优化效果评分
///
public int OptimizationEffectivenessScore { get; set; }
///
/// 风险控制评分
///
public int RiskControlScore { get; set; }
///
/// 质量改善点
///
public List QualityImprovements { get; set; } = new();
///
/// 潜在问题点
///
public List PotentialIssues { get; set; } = new();
///
/// 质量评估摘要
///
public string QualityAssessmentSummary { get; set; } = string.Empty;
}
///
/// 重新分配验证结果
///
public class ReallocationValidationResult
{
///
/// 验证是否通过
///
public bool IsValid { get; set; } = true;
///
/// 验证执行时间
///
public DateTime ValidationTime { get; set; } = DateTime.Now;
///
/// 验证错误列表
///
public List ValidationErrors { get; set; } = new();
///
/// 验证警告列表
///
public List ValidationWarnings { get; set; } = new();
///
/// 冲突检测结果
///
public List ConflictDetails { get; set; } = new();
///
/// 业务规则验证结果
///
public List BusinessRuleValidations { get; set; } = new();
///
/// 验证摘要
///
public string ValidationSummary { get; set; } = string.Empty;
///
/// 验证耗时(毫秒)
///
public long ValidationElapsedMilliseconds { get; set; }
}
///
/// 业务规则验证
///
public class BusinessRuleValidation
{
///
/// 规则名称
///
public string RuleName { get; set; } = string.Empty;
///
/// 验证是否通过
///
public bool IsPassed { get; set; }
///
/// 验证消息
///
public string ValidationMessage { get; set; } = string.Empty;
///
/// 严重程度
///
public string SeverityLevel { get; set; } = "Medium";
///
/// 受影响的任务ID列表
///
public List AffectedTaskIds { get; set; } = new();
}
///
/// 操作员信息
///
public class OperatorInfo
{
///
/// 操作员用户ID
///
public long UserId { get; set; }
///
/// 操作员用户名
///
public string UserName { get; set; } = string.Empty;
///
/// 操作员真实姓名
///
public string RealName { get; set; } = string.Empty;
///
/// 操作时间
///
public DateTime OperationTime { get; set; } = DateTime.Now;
///
/// 操作类型
///
public string OperationType { get; set; } = string.Empty;
}
}