namespace QMSDAL.DTO { // ── TPCSCARD — main card header ────────────────────────────────────────── public class PcsCardDTO { public int PcsCardId { get; set; } public int OuId { get; set; } public int PeriodId { get; set; } public int BizTransactionTypeId { get; set; } public string CardNo { get; set; } = string.Empty; // WO traceability public int IndentId { get; set; } public int IndentDetailId { get; set; } // Item / variant (denormalised from WO line) public int ItemId { get; set; } public int SkuId { get; set; } public int RoutingId { get; set; } public int RoutingVersionId { get; set; } // Serial / lot public string SerialNo { get; set; } = string.Empty; public string CustomerSerial { get; set; } = string.Empty; public string SetSlNo { get; set; } = string.Empty; // Customer / project public int CustomerId { get; set; } public string ProjectName { get; set; } = string.Empty; public string CustomerPo { get; set; } = string.Empty; // Quantity public decimal PlannedQuantity { get; set; } public int UomId { get; set; } // Specification snapshot (captured at card creation) public string ColourCode { get; set; } = string.Empty; public string DrawingNo { get; set; } = string.Empty; public string DrawingRev { get; set; } = string.Empty; // Dates public DateTime? PlannedStart { get; set; } public DateTime? PlannedEnd { get; set; } public DateTime? ActualStart { get; set; } public DateTime? ActualEnd { get; set; } // Progress (denormalised — updated by service, not trigger) public short TotalStages { get; set; } public short CompletedStages { get; set; } public short CurrentStage { get; set; } // Overall status / result // OverallStatus: 0=NotStarted 1=InProgress 2=Complete 3=OnHold 4=Rejected 5=Cancelled public byte OverallStatus { get; set; } // OverallResult: 0=Pending 1=Pass 2=Fail 3=ReworkRequired public byte OverallResult { get; set; } public string? Remarks { get; set; } // Standard fields public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int TenantId { get; set; } public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } public DateTime ModifiedOn { get; set; } // ── Joined / computed — not persisted ──────────────────────────────── public string? ItemName { get; set; } public string? VariantCode { get; set; } public string? CustomerName { get; set; } public string? UomName { get; set; } public string? CurrentStageName { get; set; } } // ── Slim list projection — used by GetPcsCardList ──────────────────────── public class PcsCardListDTO { public int PcsCardId { get; set; } public string CardNo { get; set; } = string.Empty; public string SerialNo { get; set; } = string.Empty; public string CustomerSerial { get; set; } = string.Empty; public string? ItemName { get; set; } public string? VariantCode { get; set; } public string? CustomerName { get; set; } public string ProjectName { get; set; } = string.Empty; public string ColourCode { get; set; } = string.Empty; public string? WoRef { get; set; } public DateTime? PlannedEnd { get; set; } public short TotalStages { get; set; } public short CompletedStages { get; set; } public short CurrentStage { get; set; } public string? CurrentStageName { get; set; } public byte OverallStatus { get; set; } public byte OverallResult { get; set; } public int TotalCount { get; set; } } // ── Full card — card + all stages + all materials ───────────────────────── public class PcsCardFullDTO { public PcsCardDTO? Card { get; set; } public IEnumerable Stages { get; set; } = []; public IEnumerable Materials { get; set; } = []; } // ── Analytics DTOs ──────────────────────────────────────────────────────── public class PcsKpiDTO { public int ActiveCards { get; set; } public int CompletedCards { get; set; } public int NotStarted { get; set; } public int NcrCount { get; set; } public int OpenStages { get; set; } public double AvgCycleDays { get; set; } } public class PcsBottleneckDTO { public string StageCode { get; set; } = string.Empty; public string StageName { get; set; } = string.Empty; public int EstimatedDur { get; set; } public int ActualDur { get; set; } public double PctVariance { get; set; } } public class PcsMaterialTraceDTO { public string MaterialName { get; set; } = string.Empty; public string GradeCode { get; set; } = string.Empty; public string BatchNo { get; set; } = string.Empty; public int CardCount { get; set; } public string? StageName { get; set; } public DateTime? DateOfManufacture { get; set; } public DateTime? DateOfExpiry { get; set; } public byte IsExpired { get; set; } } }