Asoka.Wang 21f044712c 1
2025-08-27 18:39:19 +08:00

424 lines
13 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using NPP.SmartSchedue.Api.Contracts.Services.Integration.Output;
namespace NPP.SmartSchedue.Api.Contracts.Services.Integration.Input
{
/// <summary>
/// 处理任务变更输入
/// 用于检测和处理发布后的任务变更,触发智能重新分配
/// </summary>
public class ProcessTaskChangesInput
{
/// <summary>
/// 变更的任务ID列表
/// 指定需要处理变更的任务
/// </summary>
public List<long> ChangedTaskIds { get; set; } = new();
/// <summary>
/// 整合记录ID
/// 指定要更新的整合记录
/// </summary>
public long IntegrationRecordId { get; set; }
/// <summary>
/// 变更触发源
/// TaskModification-任务修改, ResourceUnavailable-资源不可用, ConflictDetected-冲突检测, UserRequest-用户请求
/// </summary>
public string ChangeTriggerSource { get; set; } = "TaskModification";
/// <summary>
/// 处理策略
/// AutoReallocation-自动重新分配, ManualReview-手动审核, CreateNewVersion-创建新版本
/// </summary>
public string ProcessingStrategy { get; set; } = "AutoReallocation";
/// <summary>
/// 操作员用户ID
/// </summary>
public long OperatorUserId { get; set; }
/// <summary>
/// 操作员用户名
/// </summary>
public string OperatorUserName { get; set; } = string.Empty;
/// <summary>
/// 操作员真实姓名
/// </summary>
public string OperatorRealName { get; set; } = string.Empty;
/// <summary>
/// 变更原因说明
/// </summary>
public string ChangeReason { get; set; } = string.Empty;
/// <summary>
/// 是否强制重新分配
/// 即使影响评分较低也强制执行重新分配
/// </summary>
public bool ForceReallocation { get; set; } = false;
/// <summary>
/// 是否保持现有分配
/// 尽量保持当前的人员和设备分配,只调整有问题的部分
/// </summary>
public bool PreserveExistingAllocations { get; set; } = true;
/// <summary>
/// 重新分配范围
/// ChangedOnly-仅重新分配变更的任务, Affected-重新分配受影响的任务, All-重新分配所有任务
/// </summary>
public string ReallocationScope { get; set; } = "Affected";
/// <summary>
/// 优先级调整策略
/// None-不调整, Boost-提升变更任务优先级, Balance-平衡所有任务优先级
/// </summary>
public string PriorityAdjustmentStrategy { get; set; } = "None";
/// <summary>
/// 通知相关人员
/// 变更处理完成后是否通知受影响的人员
/// </summary>
public bool NotifyAffectedPersonnel { get; set; } = true;
/// <summary>
/// 创建变更日志
/// 是否详细记录变更处理过程
/// </summary>
public bool CreateChangeLog { get; set; } = true;
/// <summary>
/// 允许的最大处理时间(分钟)
/// 超时则转为手动处理
/// </summary>
public int MaxProcessingTimeMinutes { get; set; } = 30;
/// <summary>
/// 业务备注
/// </summary>
public string Remarks { get; set; } = string.Empty;
/// <summary>
/// 分析深度
/// 指定变更分析的深度级别
/// </summary>
public TaskChangeAnalysisDepth AnalysisDepth { get; set; } = TaskChangeAnalysisDepth.Standard;
/// <summary>
/// 版本创建原因
/// 当处理策略为CreateNewVersion时使用
/// </summary>
public string VersionReason { get; set; } = string.Empty;
/// <summary>
/// 是否发送通知
/// 处理完成后是否发送通知给相关人员
/// </summary>
public bool SendNotifications { get; set; } = true;
}
/// <summary>
/// 智能重新分配输入
/// 用于触发智能重新分配算法
/// </summary>
public class SmartReallocationInput
{
/// <summary>
/// 整合记录ID根版本ID
/// </summary>
public long RootIntegrationRecordId { get; set; }
/// <summary>
/// 需要重新分配的任务ID列表
/// 为空则表示重新分配所有任务
/// </summary>
public List<long> TaskIdsToReallocate { get; set; } = new();
/// <summary>
/// 重新分配策略配置
/// 可以重用原策略或指定新策略
/// </summary>
public SmartReallocationStrategyConfig Strategy { get; set; } = new();
/// <summary>
/// 约束条件
/// 指定重新分配时需要遵守的约束条件
/// </summary>
public List<ReallocationConstraint> Constraints { get; set; } = new();
/// <summary>
/// 操作员用户ID
/// </summary>
public long OperatorUserId { get; set; }
/// <summary>
/// 操作员用户名
/// </summary>
public string OperatorUserName { get; set; } = string.Empty;
/// <summary>
/// 操作员真实姓名
/// </summary>
public string OperatorRealName { get; set; } = string.Empty;
/// <summary>
/// 重新分配原因
/// </summary>
public string ReallocationReason { get; set; } = string.Empty;
/// <summary>
/// 是否创建新版本
/// true-创建新版本保留历史, false-更新当前版本
/// </summary>
public bool CreateNewVersion { get; set; } = true;
/// <summary>
/// 预期完成时间
/// 指定重新分配的预期完成时间
/// </summary>
public DateTime? ExpectedCompletionTime { get; set; }
/// <summary>
/// 质量优先级
/// 分配时的质量要求优先级Low, Medium, High, Critical
/// </summary>
public string QualityPriority { get; set; } = "Medium";
/// <summary>
/// 成本控制要求
/// 是否需要考虑成本控制
/// </summary>
public bool ConsiderCostControl { get; set; } = false;
/// <summary>
/// 最大成本预算
/// </summary>
public decimal? MaxBudget { get; set; }
/// <summary>
/// 业务备注
/// </summary>
public string Remarks { get; set; } = string.Empty;
/// <summary>
/// 整合记录ID
/// 相关的整合记录标识
/// </summary>
public long IntegrationRecordId { get; set; }
/// <summary>
/// 变更的任务ID列表
/// 需要进行重新分配的任务
/// </summary>
public List<long> ChangedTaskIds { get; set; } = new();
/// <summary>
/// 版本创建原因
/// 重新分配时创建版本的原因说明
/// </summary>
public string VersionReason { get; set; } = string.Empty;
/// <summary>
/// 受影响的任务ID列表
/// 可能受到变更影响的任务
/// </summary>
public List<long> AffectedTaskIds { get; set; } = new();
/// <summary>
/// 是否重新分配人员
/// </summary>
public bool ReallocatePersonnel { get; set; } = true;
/// <summary>
/// 是否重新分配设备
/// </summary>
public bool ReallocateEquipment { get; set; } = true;
}
/// <summary>
/// 智能重新分配策略配置
/// </summary>
public class SmartReallocationStrategyConfig
{
/// <summary>
/// 是否使用原策略
/// </summary>
public bool UseOriginalStrategy { get; set; } = true;
/// <summary>
/// 人员分配策略
/// </summary>
public string PersonnelStrategy { get; set; } = string.Empty;
/// <summary>
/// 设备分配策略
/// </summary>
public string EquipmentStrategy { get; set; } = string.Empty;
/// <summary>
/// 强制执行班次规则
/// </summary>
public bool EnforceShiftRules { get; set; } = true;
/// <summary>
/// 优化目标
/// Efficiency-效率优先, Fairness-公平优先, Balance-平衡, Quality-质量优先
/// </summary>
public string OptimizationTarget { get; set; } = "Balance";
/// <summary>
/// 变更影响最小化
/// 尽量减少对现有分配的影响
/// </summary>
public bool MinimizeChangeImpact { get; set; } = true;
/// <summary>
/// 允许跨班次调整
/// </summary>
public bool AllowCrossShiftAdjustment { get; set; } = false;
/// <summary>
/// 允许跨项目资源共享
/// </summary>
public bool AllowCrossProjectSharing { get; set; } = false;
/// <summary>
/// 高级配置参数
/// </summary>
public Dictionary<string, object> AdvancedSettings { get; set; } = new();
}
/// <summary>
/// 重新分配约束条件
/// </summary>
public class ReallocationConstraint
{
/// <summary>
/// 约束类型
/// Personnel-人员约束, Equipment-设备约束, Time-时间约束, Cost-成本约束
/// </summary>
public string ConstraintType { get; set; } = string.Empty;
/// <summary>
/// 约束目标ID
/// 人员ID、设备ID等
/// </summary>
public long? TargetId { get; set; }
/// <summary>
/// 约束操作
/// MustInclude-必须包含, MustExclude-必须排除, Prefer-优先选择, Avoid-尽量避免
/// </summary>
public string ConstraintOperation { get; set; } = string.Empty;
/// <summary>
/// 约束值
/// 具体的约束值或条件
/// </summary>
public string ConstraintValue { get; set; } = string.Empty;
/// <summary>
/// 约束优先级
/// 1-99为最高优先级
/// </summary>
public int Priority { get; set; } = 5;
/// <summary>
/// 约束说明
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// 是否为硬约束
/// true-硬约束(必须满足), false-软约束(尽量满足)
/// </summary>
public bool IsHardConstraint { get; set; } = false;
}
/// <summary>
/// 版本历史查询输入
/// </summary>
public class IntegrationVersionHistoryInput
{
/// <summary>
/// 整合记录ID
/// </summary>
public long IntegrationRecordId { get; set; }
/// <summary>
/// 根版本ID
/// </summary>
public long RootVersionId { get; set; }
/// <summary>
/// 需要比较的版本ID列表
/// </summary>
public List<long> CompareVersionIds { get; set; } = new();
/// <summary>
/// 查询开始时间
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 查询结束时间
/// </summary>
public DateTime? EndTime { get; set; }
/// <summary>
/// 版本状态过滤
/// Active-活跃版本, Inactive-非活跃版本, All-所有版本
/// </summary>
public string VersionStatusFilter { get; set; } = "All";
/// <summary>
/// 变更类型过滤
/// </summary>
public List<string> ChangeTypeFilter { get; set; } = new();
/// <summary>
/// 操作员过滤
/// </summary>
public List<long> OperatorFilter { get; set; } = new();
/// <summary>
/// 是否包含快照数据
/// </summary>
public bool IncludeSnapshotData { get; set; } = false;
/// <summary>
/// 是否包含变更详情
/// </summary>
public bool IncludeChangeDetails { get; set; } = true;
/// <summary>
/// 页码
/// </summary>
public int PageIndex { get; set; } = 1;
/// <summary>
/// 页大小
/// </summary>
public int PageSize { get; set; } = 20;
/// <summary>
/// 排序字段
/// CreatedTime, Version, ImpactScore
/// </summary>
public string SortBy { get; set; } = "CreatedTime";
/// <summary>
/// 排序方向
/// Asc, Desc
/// </summary>
public string SortDirection { get; set; } = "Desc";
/// <summary>
/// 是否包含性能指标
/// </summary>
public bool IncludePerformanceMetrics { get; set; } = false;
}
}