using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models.Agv
{
///
/// AGV 任务状态与报文日志(每次状态变更/关键动作写一条)
/// 对应《平库AGV方案流程(AGV自调度版).md》9.6 / 10.2 DDL 第 4 段
///
[Index(nameof(TaskNo), nameof(CreateTime))]
[Index(nameof(OrderId))]
[Table("AgvTaskLog")]
public class AgvTaskLog : BasePoco
{
// 必须声明 public new int ID,否则 EF 会用 BasePoco 的 Guid 主键
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public new int ID { get; set; }
///
/// WMS 任务号
///
[Display(Name = "AGV.TaskNo", Description = "WMS任务号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
[Required(ErrorMessage = "Validate.{0}required")]
public string TaskNo { get; set; }
///
/// AGV 返回运单号(与 TaskNo 一致,原值留痕)
///
[Display(Name = "AGV.OrderId", Description = "AGV运单号")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string OrderId { get; set; }
///
/// 变更前状态
///
[Display(Name = "AGV.FromStatus", Description = "变更前状态")]
public AgvTaskStatusEnum? FromStatus { get; set; }
///
/// 变更后状态
///
[Display(Name = "AGV.ToStatus", Description = "变更后状态")]
public AgvTaskStatusEnum? ToStatus { get; set; }
///
/// 回调事件(如 Loaded/Unloaded/Exception/Canceled)
///
[Display(Name = "AGV.Event", Description = "回调事件")]
[StringLength(30, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Event { get; set; }
///
/// 方向:down=下发,up=回调
///
[Display(Name = "AGV.Direction", Description = "方向(down/up)")]
[StringLength(10, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Direction { get; set; }
///
/// 事件发生时间
///
[Display(Name = "AGV.EventTime", Description = "事件发生时间")]
public DateTime? EventTime { get; set; }
///
/// 来源 IP
///
[Display(Name = "AGV.SourceIp", Description = "来源IP")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string SourceIp { get; set; }
///
/// 耗时(毫秒)
///
[Display(Name = "AGV.DurationMs", Description = "耗时(毫秒)")]
public int? DurationMs { get; set; }
///
/// 请求报文
///
[Display(Name = "AGV.RequestJson", Description = "请求报文")]
public string RequestJson { get; set; }
///
/// 响应报文
///
[Display(Name = "AGV.ResponseJson", Description = "响应报文")]
public string ResponseJson { get; set; }
///
/// 操作人(AGV 回调记 AGV)
///
[Display(Name = "AGV.Operator", Description = "操作人")]
[StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Operator { get; set; }
///
/// 备注/异常信息
///
[Display(Name = "AGV.Remark", Description = "备注")]
[StringLength(500, ErrorMessage = "Validate.{0}stringmax{1}")]
public string Remark { get; set; }
}
}