mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 07:13:12 +00:00
150 lines
6.9 KiB
C#
150 lines
6.9 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Data.SeaHavenIndustries.Enums;
|
|
|
|
namespace Data.SeaHavenIndustries
|
|
{
|
|
public class WorkOrder : FullAuditEntity
|
|
{
|
|
// --- Core slice ---
|
|
public string? InternalWONumber { get; set; }
|
|
public string? ExternalWorkOrderId { get; set; }
|
|
public DateTimeOffset? ExternalLastOccurredAt { get; set; }
|
|
[MaxLength(128)]
|
|
public string? ExternalSource { get; set; }
|
|
public DateTimeOffset? ExternalUpdatedAt { get; set; }
|
|
[MaxLength(64)]
|
|
public string? ExternalVersionHash { get; set; }
|
|
[MaxLength(450)]
|
|
public string? ExternalAssignedTo { get; set; }
|
|
[MaxLength(64)]
|
|
public string? ExternalRecordType { get; set; }
|
|
public string? WorkerOrderNumber { get; set; }
|
|
public string? WorkerOrderTitle { get; set; }
|
|
public string? Description { get; set; }
|
|
public string? Customer { get; set; }
|
|
/// <summary>CRM account (customer) boundary for server-derived media/tenant scope (SH-221).</summary>
|
|
public int? AccountId { get; set; }
|
|
[ForeignKey(nameof(AccountId))]
|
|
public virtual Accounts? Account { get; set; }
|
|
public string? SiteCode { get; set; }
|
|
public string? Building { get; set; }
|
|
public string? Severity { get; set; }
|
|
public DateTime? DueDate { get; set; }
|
|
public string? AssignTo { get; set; }
|
|
[ForeignKey(nameof(AssignTo))]
|
|
public virtual ApplicationUser? AssignToUser { get; set; }
|
|
public int? LocationId { get; set; }
|
|
[ForeignKey(nameof(LocationId))]
|
|
public virtual Locations? Locations { get; set; }
|
|
public LifecycleStatus? LifecycleStatus { get; set; }
|
|
public string? LegacyStatus { get; set; }
|
|
public WorkOrderType? WorkOrderType { get; set; }
|
|
/// <summary>SHOC board "Service" column (PM type label). Not Trade/Problem.</summary>
|
|
[MaxLength(128)]
|
|
public string? Service { get; set; }
|
|
public int? ServiceId { get; set; }
|
|
[MaxLength(200)]
|
|
public string? ServiceNameSnapshot { get; set; }
|
|
[ForeignKey(nameof(ServiceId))]
|
|
public virtual Service? ServiceDefinition { get; set; }
|
|
public int? PrimaryDispatchId { get; set; }
|
|
[ForeignKey(nameof(PrimaryDispatchId))]
|
|
public virtual Dispatch? PrimaryDispatch { get; set; }
|
|
|
|
// --- Service & Notes / POC (structured create) ---
|
|
[MaxLength(200)]
|
|
public string? PocName { get; set; }
|
|
[MaxLength(50)]
|
|
public string? PocPhone { get; set; }
|
|
[MaxLength(2000)]
|
|
public string? PocNotes { get; set; }
|
|
/// <summary>JSON array of additional POC contacts beyond primary (name, phone, notes?).</summary>
|
|
[MaxLength(4000)]
|
|
public string? AdditionalContacts { get; set; }
|
|
/// <summary>JSON array of extra service labels beyond primary (Trade).</summary>
|
|
[MaxLength(2000)]
|
|
public string? ExtraServices { get; set; }
|
|
[MaxLength(4000)]
|
|
public string? ServiceNotes { get; set; }
|
|
/// <summary>
|
|
/// Per-WO Aveta compliance flag. Distinct from legacy AvettaTask string.
|
|
/// </summary>
|
|
public bool AvetaRequired { get; set; }
|
|
/// <summary>Tech/crew phone when no primary dispatch; otherwise prefer Dispatch.TechPhone.</summary>
|
|
[MaxLength(50)]
|
|
public string? TechPhone { get; set; }
|
|
/// <summary>Vendor instructions when no primary dispatch; otherwise prefer Dispatch.VendorNotes.</summary>
|
|
[MaxLength(2000)]
|
|
public string? VendorNotes { get; set; }
|
|
|
|
// --- Scheduling slice ---
|
|
public DateTime? ScheduledDate { get; set; }
|
|
public DateTime? ScheduledStart { get; set; }
|
|
public DateTime? ScheduledEnd { get; set; }
|
|
public DateOnly? TargetWeek { get; set; }
|
|
public bool? ScheduleWeekOnly { get; set; }
|
|
|
|
// --- Tracking slice (set-once) ---
|
|
public DateOnly? OriginalWeek { get; set; }
|
|
public DateOnly? OriginalDate { get; set; }
|
|
|
|
// --- Analytics slice ---
|
|
public int RescheduleCount { get; set; }
|
|
public int CarriedOver { get; set; }
|
|
/// <summary>Recalculated on schedule set/change/clear (SH-184); create hint when unscheduled. Board/search facet.</summary>
|
|
public bool IsAddOn { get; set; }
|
|
public OperationalFlags OperationalFlags { get; set; }
|
|
|
|
// --- Completion slice ---
|
|
public DocStatus? DocStatus { get; set; }
|
|
/// <summary>JSON site snapshot captured on the first transition to Completed.</summary>
|
|
public string? FrozenSite { get; set; }
|
|
/// <summary>JSON live-vendor snapshot captured on the first transition to Completed.</summary>
|
|
public string? FrozenCompany { get; set; }
|
|
/// <summary>JSON effective POC snapshot captured on the first transition to Completed.</summary>
|
|
public string? FrozenPoc { get; set; }
|
|
|
|
/// <summary>Board flag color (#RRGGBB from fixed palette). Null = no flag.</summary>
|
|
[MaxLength(7)]
|
|
public string? FlagColor { get; set; }
|
|
|
|
// --- Legacy SQL columns (drift reconciliation) ---
|
|
public string? AvettaTask { get; set; }
|
|
public DateOnly? AssignDate { get; set; }
|
|
|
|
// --- Legacy fields (retained for Blazor / coexistence) ---
|
|
public DateTime? DateReported { get; set; }
|
|
public string? SourceEmailS3Key { get; set; }
|
|
public string? Problem { get; set; }
|
|
public string? Trade { get; set; }
|
|
public string? SubTrade { get; set; }
|
|
public decimal? VendorNTE { get; set; }
|
|
public DateTime? CompletedDate { get; set; }
|
|
public string? Source { get; set; }
|
|
public bool? istemplate { get; set; }
|
|
public string? PO { get; set; }
|
|
public string? TT { get; set; }
|
|
public string? Priority { get; set; }
|
|
public string? Status { get; set; }
|
|
public string? Attachments { get; set; }
|
|
public string? BeforPhotoIssue { get; set; }
|
|
public string? BeforPhotoAttachment { get; set; }
|
|
public string? AfterPhotoIssue { get; set; }
|
|
public string? AfterPhotoAttachment { get; set; }
|
|
public string? SignOffName { get; set; }
|
|
public string? SignOffAttachment { get; set; }
|
|
public string? SignOffSignature { get; set; }
|
|
|
|
[Timestamp]
|
|
public byte[]? RowVersion { get; set; }
|
|
|
|
public ICollection<Comments>? Comments { get; set; }
|
|
public ICollection<Quotes>? Quotes { get; set; }
|
|
public ICollection<WorkOrderContacts>? WorkOrderContacts { get; set; }
|
|
public ICollection<WorkOrderAttachments>? workOrderAttachments { get; set; }
|
|
public ICollection<WorkOrderCategories>? WorkOrderCategories { get; set; }
|
|
public ICollection<Dispatch>? Dispatches { get; set; }
|
|
public ICollection<WorkOrderFieldLock>? FieldLocks { get; set; }
|
|
}
|
|
}
|