101 lines
3.3 KiB
C#
101 lines
3.3 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel.DataAnnotations;
|
||
|
||
namespace NPP.SmartSchedue.Api.Contracts.Services.Integration.Input;
|
||
|
||
/// <summary>
|
||
/// 撤销整合记录输入参数
|
||
/// 包含撤销操作的所有必要信息和业务规则
|
||
///
|
||
/// 业务思考:
|
||
/// 1. 撤销是发布后的逆向操作,需要严格的权限控制
|
||
/// 2. 撤销会将任务状态从Assigned回退到PendingIntegration
|
||
/// 3. 撤销操作必须记录详细的审计信息
|
||
/// 4. 支持部分撤销,提高操作的灵活性
|
||
/// </summary>
|
||
public class CancelIntegrationRecordInput
|
||
{
|
||
/// <summary>
|
||
/// 整合记录ID
|
||
/// </summary>
|
||
[Required(ErrorMessage = "整合记录ID不能为空")]
|
||
[Range(1, long.MaxValue, ErrorMessage = "整合记录ID必须大于0")]
|
||
public long IntegrationRecordId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 撤销操作员用户ID
|
||
/// </summary>
|
||
[Required(ErrorMessage = "撤销操作员用户ID不能为空")]
|
||
[Range(1, long.MaxValue, ErrorMessage = "撤销操作员用户ID必须大于0")]
|
||
public long CancelledByUserId { get; set; }
|
||
|
||
/// <summary>
|
||
/// 撤销操作员用户名
|
||
/// </summary>
|
||
[Required(ErrorMessage = "撤销操作员用户名不能为空")]
|
||
[StringLength(50, ErrorMessage = "撤销操作员用户名长度不能超过50个字符")]
|
||
public string CancelledByUserName { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 撤销原因
|
||
/// 必填字段,用于审计和问题追踪
|
||
/// </summary>
|
||
[Required(ErrorMessage = "撤销原因不能为空")]
|
||
[StringLength(500, ErrorMessage = "撤销原因长度不能超过500个字符")]
|
||
public string CancelReason { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 是否强制撤销
|
||
/// 当存在已开始执行的任务时,是否强制撤销
|
||
/// 需要更高级别的权限
|
||
/// </summary>
|
||
public bool ForceCancelInProgressTasks { get; set; } = false;
|
||
|
||
/// <summary>
|
||
/// 是否通知相关人员
|
||
/// 撤销后是否通知已分配的人员和设备管理员
|
||
/// </summary>
|
||
public bool NotifyRelatedPersonnel { get; set; } = true;
|
||
|
||
/// <summary>
|
||
/// 撤销范围限制
|
||
/// 指定只撤销特定任务,null表示撤销整合记录中的所有任务
|
||
///
|
||
/// 业务价值:
|
||
/// - 支持部分撤销功能,提高撤销的灵活性
|
||
/// - 当某些任务需要重新分配时,可以单独撤销
|
||
/// - 减少对正常执行任务的影响
|
||
/// </summary>
|
||
public List<long>? SpecificTaskIds { get; set; }
|
||
|
||
/// <summary>
|
||
/// 撤销后处理方式
|
||
/// 控制撤销后任务的处理方式
|
||
/// </summary>
|
||
public CancelAfterProcessingType AfterProcessingType { get; set; } = CancelAfterProcessingType.ReturnToPendingIntegration;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 撤销后处理方式枚举
|
||
/// </summary>
|
||
public enum CancelAfterProcessingType
|
||
{
|
||
/// <summary>
|
||
/// 回退到待整合状态
|
||
/// 任务状态回退到PendingIntegration,等待重新整合
|
||
/// </summary>
|
||
ReturnToPendingIntegration = 0,
|
||
|
||
/// <summary>
|
||
/// 标记为需要重新分配
|
||
/// 任务保持在特殊状态,需要手动处理
|
||
/// </summary>
|
||
MarkForReassignment = 1,
|
||
|
||
/// <summary>
|
||
/// 暂停任务
|
||
/// 将任务状态设置为暂停,等待进一步决策
|
||
/// </summary>
|
||
PauseTasks = 2
|
||
} |