using System.Text.Json; namespace WiDAL.DTOs; public class WiProcessDTO { public int WiProcessId { get; set; } public string WiProcessCode { get; set; } = string.Empty; public string WiProcessName { get; set; } = string.Empty; public int DepartmentId { get; set; } public string DepartmentCode { get; set; } public string DepartmentName { get; set; } public short DisplayOrder { get; set; } public string? Description { get; set; } public int IsActive { get; set; } public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } } public class WiSubProcessDTO { public int WiSubProcessId { get; set; } public int WiProcessId { get; set; } public string WiProcessCode { get; set; } = string.Empty; public string WiSubProcessCode { get; set; } = string.Empty; public string WiSubProcessName { get; set; } = string.Empty; public short DisplayOrder { get; set; } public string? Description { get; set; } public int IsActive { get; set; } public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } // Display join public string? WiProcessName { get; set; } } public class WiHeaderDTO { public int WiId { get; set; } public int WiSubProcessId { get; set; } public int WiProcessId { get; set; } public string WiCode { get; set; } = string.Empty; public string WiTitle { get; set; } = string.Empty; public ActivityType ActivityType { get; set; } public string? ActivitySubType { get; set; } public string WiVersion { get; set; } = "1.0"; public WiStatus WiStatus { get; set; } public DisplayContext DisplayContext { get; set; } public StepAdvanceMode StepAdvanceMode { get; set; } public decimal StdCycleTimeMins { get; set; } public DateTime? EffectiveDate { get; set; } public DateTime? ReviewDueDate { get; set; } public int ApprovedById { get; set; } public DateTime? ApprovedOn { get; set; } // JSON columns — stored as string in DB, serialized/deserialized in DAL public string? Tags { get; set; } public string? WiDescription { get; set; } public int IsActive { get; set; } public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } // Display joins public string? WiProcessName { get; set; } public string? WiSubProcessName { get; set; } } public class WiSectionDTO { public int WiSectionId { get; set; } public int WiId { get; set; } public short SectionSlNo { get; set; } public string SectionTitle { get; set; } = string.Empty; public string? SectionDescription { get; set; } public List? Steps { get; set; } } public class WiToolDTO { public string ToolCode { get; set; } = string.Empty; public string ToolName { get; set; } = string.Empty; public int Qty { get; set; } } public class WiZoomRegionDTO { public double X { get; set; } public double Y { get; set; } public double W { get; set; } public double H { get; set; } } public class WiStepDTO { public int WiStepId { get; set; } public int WiId { get; set; } public int WiSectionId { get; set; } public short WiStepSlNo { get; set; } public string? StepDisplayNo { get; set; } public string StepTitle { get; set; } = string.Empty; public WarningLevel WarningLevel { get; set; } public int StdDurationSecs { get; set; } // JSON column — stored as NVARCHAR(MAX) in DB public string? ToolsRequired { get; set; } public int IsOptional { get; set; } public int RequireSignOff { get; set; } public int AutoAdvanceSecs { get; set; } public int IsActive { get; set; } // Step-level workstation override (-1 = inherit from MWIASSIGNMENT) public int ContentId { get; set; } = -1; public int ContainerType { get; set; } // Child collections (populated by GetWiFullDetail) public List? Contents { get; set; } // flat list (backward compat) public List? Containers { get; set; } // grouped by container } public class WiStepContentDTO { public int WiStepContentId { get; set; } public int WiStepId { get; set; } public short WiStepContentSlNo { get; set; } public ContentType ContentType { get; set; } public ContentSource ContentSource { get; set; } public string? ContentRef { get; set; } public string? MediaCaption { get; set; } public int DisplayDurationSecs { get; set; } public int LoopMedia { get; set; } // JSON columns — stored as NVARCHAR in DB public string? ZoomRegion { get; set; } public string? ApplicableModelIds { get; set; } public int IsActive { get; set; } // Container fields (default 0/main/1 for backward-compatible single-container steps) public int ContainerId { get; set; } = 0; public WiContainerType ContainerType { get; set; } = WiContainerType.Single; public string? ContainerLabel { get; set; } public string ZoneName { get; set; } = "main"; public short BlockInContainerPos { get; set; } = 1; } public class WiStepContainerDTO { public int ContainerId { get; set; } public WiContainerType ContainerType { get; set; } public string? ContainerLabel { get; set; } public List Blocks { get; set; } = []; } public class WiAssignmentDTO { public int WiAssignmentId { get; set; } public int WiId { get; set; } public string WiCode { get; set; } public string WiTitle { get; set; } public int RoutingId { get; set; } public string RoutingCode { get; set; } public string RoutingName { get; set; } public int RoutingOperationId { get; set; } public int WorkCenterId { get; set; } public string WorkCenterCode { get; set; } public string WorkCenterName { get; set; } public int WorkStationId { get; set; } public string WorkStationCode { get; set; } public string WorkStationName { get; set; } // Was "ProductFamilyId" — repointed to WI.MITEMGROUP (item-group/family hierarchy), // since a standalone MPRODUCTFAMILY table never existed; renamed to avoid confusion. public int ItemGroupId { get; set; } public string ItemGroupCode { get; set; } public string ItemGroupName { get; set; } public int ModelId { get; set; } public string ModelCode { get; set; } public string ModelName { get; set; } public int LineId { get; set; } public string LineCode { get; set; } public string LineName { get; set; } public int EntityType { get; set; } = -1; public int EntityId { get; set; } = -1; public short SpecificityScore { get; set; } public DateTime? EffectiveFrom { get; set; } public DateTime? EffectiveTo { get; set; } public string? Remarks { get; set; } public int IsActive { get; set; } public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } public string AssignmentName { get; set; } public List? Schedules { get; set; } } public class WiActivityScheduleDTO { public int WiActivityScheduleId { get; set; } public int WiAssignmentId { get; set; } public ActivityType ActivityType { get; set; } public TriggerEvent TriggerEvent { get; set; } public int TriggerFrequencyN { get; set; } public short ExecutionOrder { get; set; } public bool IsBlockingNext { get; set; } public bool RequiresSupervisor { get; set; } public bool AllowSkip { get; set; } public int IsActive { get; set; } public string? Remarks { get; set; } } // Resolution-transparency wrapper around WiAssignmentDTO — carries which dimensions actually // matched (vs. wildcarded) for this candidate, and whether it was the winning (highest-score) // match among everything that resolved for the same request. Lets a caller see *how* the // system narrowed to a WI (or why nothing won) instead of just the final assignment. public class WiResolveMatchDTO { public WiAssignmentDTO Match { get; set; } = new(); public bool IsWinner { get; set; } public List DimensionMatches { get; set; } = []; } public class WiResolveDimensionMatchDTO { public string Dimension { get; set; } = string.Empty; public bool IsWildcard { get; set; } public short Weight { get; set; } } // Full resolve response envelope — Matches is the same annotated list ResolveForWorkstation/ // ResolveForEntity always returned; ReasonCode/ReasonMessage are filled in only when Matches // is empty, so a caller can see *why* nothing resolved instead of just an empty array. public class WiResolveResultDTO { public List Matches { get; set; } = []; public WiResolveReasonCode? ReasonCode { get; set; } public string? ReasonMessage { get; set; } } // Row shape for the zero-match diagnostic queries — dimension/entity match only, no // schedule join, no effective-date filter, so the BLL can tell which reason code applies. public class WiResolveDiagnosticDTO { public int WiAssignmentId { get; set; } public DateTime? EffectiveFrom { get; set; } public DateTime? EffectiveTo { get; set; } } // MM work order (TINDENT/TINDENTDETAIL) info as seen from WI's side — Process granularity, // matching MROUTINGVERSIONDETAIL's STAGE/STEP/PROCESSID, never a WI "step". RoutingDetailId // is -1 when not yet resolved to a specific process/workcenter combination. public class WiWorkOrderInfoDTO { public int IndentDetailId { get; set; } public int IndentId { get; set; } public int CombineIndentId { get; set; } public int ItemId { get; set; } public int SkuId { get; set; } public int WorkCenterId { get; set; } public int RoutingId { get; set; } public int RoutingDetailId { get; set; } public decimal IndentDetailQuantity { get; set; } } // One candidate (line, workstation) pair a work order's process could run on. // IsPrecise=true means it came from MLINEOPERATIONMAP (RoutingDetailId-specific); // false means the coarser WorkCenter-wide fallback (RoutingDetailId not set, or no // MLINEOPERATIONMAP row yet for it). public class WiWorkstationCandidateDTO { public int ProductionLineId { get; set; } public int WorkStationId { get; set; } public bool IsPrecise { get; set; } } // Full skill-gap view for a line/shift/date — unions the lightweight allocation-plan path // (3c) with real MM work orders (3d) for products, and WI's own roster with MM's // per-process TINDENTRESOURCE plan for employees. public class SkillGapResultDTO { public int ProductionLineId { get; set; } public DateOnly RosterDate { get; set; } public int ShiftId { get; set; } public List Employees { get; set; } = []; } public class EmployeeSkillGapDTO { public int EmployeeId { get; set; } public string? EmployeeName { get; set; } public int? WorkStationId { get; set; } public short? StartMinutes { get; set; } public short? EndMinutes { get; set; } public int ItemId { get; set; } public string? ItemName { get; set; } public int WiId { get; set; } public string? WiTitle { get; set; } public string ResolvedVia { get; set; } = string.Empty; // "Allocation" | "WorkOrder" public string EmployeeSource { get; set; } = string.Empty; // "Roster" | "IndentResource" public bool HasAnyGap { get; set; } public List Skills { get; set; } = []; } public class SkillGapDetailDTO { public int SkillId { get; set; } public string? SkillName { get; set; } public short RequiredLevel { get; set; } public short? EmployeeLevel { get; set; } public Enforcement Enforcement { get; set; } public string GapStatus { get; set; } = string.Empty; // "Met" | "Gap" | "NoProfile" } // ── Line Digital Twin / Plant Overview ─────────────────────────────────────── // ── Unified scan-verify ─────────────────────────────────────────────────────── // A work-order-detail scan has no "assignment" to match against like Workstation/Employee/WI // do — this is what VerifyScan's WOD branch returns as its Data payload. public class WorkOrderDetailVerifyDataDTO { public int EntityId { get; set; } public int IndentId { get; set; } public string? IndentNumber { get; set; } public byte IndentStatus { get; set; } public int ItemId { get; set; } public string? ItemName { get; set; } public decimal Quantity { get; set; } } public class WiScanVerifyResultDTO { public bool IsValid { get; set; } public string EntityType { get; set; } = string.Empty; // "Workstation" | "Employee" | "Wi" | "WorkOrderDetail" public int EntityId { get; set; } public string? Message { get; set; } public object? Data { get; set; } } // Push notification support — resolves the line/date/shift context for an allocation about to // be deleted (the row is gone after DeleteAllocation, so this must be looked up beforehand). public class LineAllocationContextDTO { public int ProductionLineId { get; set; } public DateOnly AllocationDate { get; set; } public int ShiftId { get; set; } } public class WiActiveExecutionDTO { public int WorkStationId { get; set; } public int WiExecutionId { get; set; } public int WiId { get; set; } public int EmployeeId { get; set; } public DateTime StartedOn { get; set; } public int? CurrentStepId { get; set; } public string? CurrentStepTitle { get; set; } public DateTime? StepStartedOn { get; set; } } public class LineDigitalTwinStationDTO { public int WorkStationId { get; set; } public string? WorkStationCode { get; set; } public string? WorkStationName { get; set; } public short PositionNo { get; set; } public List Employees { get; set; } = []; public WiActiveExecutionDTO? Live { get; set; } public WorkstationAvailabilityDTO? CurrentOutage { get; set; } } public class LineDigitalTwinDTO { public int ProductionLineId { get; set; } public string? LineName { get; set; } public DateOnly ShiftDate { get; set; } public int ShiftId { get; set; } public List Stations { get; set; } = []; } public class ProductionLineSummaryDTO { public int LineId { get; set; } public string? LineCode { get; set; } public string? LineName { get; set; } } public class PlantOverviewLineDTO { public int ProductionLineId { get; set; } public string? LineCode { get; set; } public string? LineName { get; set; } public int TotalStations { get; set; } public int OccupiedStations { get; set; } public int IdleStations { get; set; } public int TotalEmployees { get; set; } public int EmployeesWithGap { get; set; } } public class PlantOverviewDTO { public DateOnly ShiftDate { get; set; } public int ShiftId { get; set; } public List Lines { get; set; } = []; } // Internal working shape — one planned item on this line/date/shift, from either source, // before WI resolution and employee union are applied. public class WiPlannedItemDTO { public int ItemId { get; set; } public string? ItemName { get; set; } public int? WorkStationId { get; set; } public short? StartMinutes { get; set; } public short? EndMinutes { get; set; } public string ResolvedVia { get; set; } = string.Empty; // "Allocation" | "WorkOrder" public int? IndentDetailId { get; set; } // set only for WorkOrder-sourced items } public class WiItemModelGroupDTO { public int ItemId { get; set; } public string? ItemName { get; set; } public int ModelId { get; set; } public int ItemGroupId { get; set; } } public class WorkstationConfigDTO { public int WorkStationConfigId { get; set; } public int WorkStationId { get; set; } public string WorkStationCode { get; set; } = string.Empty; public DisplayMode DisplayMode { get; set; } public StepAdvanceMode StepAdvanceMode { get; set; } public int AutoAdvanceSecs { get; set; } public FontScale FontScale { get; set; } public bool ShowStepTimer { get; set; } public bool ShowCycleTimer { get; set; } public bool RequireAckPerUnit { get; set; } public string? ConnectedWoSource { get; set; } public int IsActive { get; set; } public string? Remarks { get; set; } public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } } public class WiSkillRequirementDTO { public int WiSkillRequirementId { get; set; } public int WiId { get; set; } public int SkillId { get; set; } public string? SkillName { get; set; } public short MinLevelNo { get; set; } public Enforcement Enforcement { get; set; } public bool IsMandatory { get; set; } public string? Remarks { get; set; } } public class WiCompetencyRequirementDTO { public int WiCompetencyRequirementId { get; set; } public int WiId { get; set; } public int CompetencyId { get; set; } public string? CompetencyName { get; set; } public short MinLevelNo { get; set; } public Enforcement Enforcement { get; set; } public bool IsMandatory { get; set; } public string? Remarks { get; set; } } // ── Employee's current level for one skill — read from MEMPLOYEESKILLPROFILE ── public class WiEmployeeSkillLevelDTO { public int SkillId { get; set; } public short ProficiencyNo { get; set; } } /// Skill, Competency, or a GB5Framework Validation Criterion (Quiz/ProgrammeAssessment/ /// Certification, resolved via IValidationCriteriaEvaluator) — distinguishes the requirement kinds /// in an eligibility breakdown row. public enum EligibilityRequirementType : byte { Skill = 0, Competency = 1, ValidationCriteria = 2 } /// Met (satisfies MinLevelNo), NotMet (falls short), or Unverifiable (no data exists to check against — e.g. Competency today). public enum EligibilityStatus : byte { Met = 0, NotMet = 1, Unverifiable = 2 } public class WiEligibilityRequirementDTO { public EligibilityRequirementType RequirementType { get; set; } public int RequirementId { get; set; } public string? Name { get; set; } public short RequiredLevel { get; set; } public short? EmployeeLevel { get; set; } public Enforcement Enforcement { get; set; } public bool IsMandatory { get; set; } public EligibilityStatus Status { get; set; } } public class WiEligibilityResultDTO { public int WiId { get; set; } public int EmployeeId { get; set; } public bool IsEligible { get; set; } public EligibilityEvaluationStatus EvaluationStatus { get; set; } = EligibilityEvaluationStatus.Evaluated; public List Requirements { get; set; } = []; } // Today's roster-derived workstation + process assignment for an employee — used by the // employee shop-floor entry scan (Part 3). Null when the employee has no active staffing // row for today (e.g. not rostered, or absent). public class SaveChecklistResponseRequestDTO { public int WiStepContentId { get; set; } public int EmployeeId { get; set; } public string ResponseJson { get; set; } = "[]"; } public class WiCurrentAssignmentDTO { public int WorkstationId { get; set; } public string? WorkstationCode { get; set; } public string? WorkstationName { get; set; } public int RoutingDetailId { get; set; } public string? Stage { get; set; } public string? Step { get; set; } public int WorkCenterId { get; set; } public string? WorkCenterName { get; set; } } public class WiExecutionDTO { public int WiExecutionId { get; set; } public int WiId { get; set; } public int WiActivityScheduleId { get; set; } public int WorkOrderId { get; set; } public int WorkStationId { get; set; } public int EmployeeId { get; set; } public ActivityType ActivityType { get; set; } public TriggerEvent TriggerEvent { get; set; } public string? SerialNo { get; set; } public string? LotNo { get; set; } public DateTime StartedOn { get; set; } public DateTime? CompletedOn { get; set; } public ExecStatus ExecStatus { get; set; } public StepAdvanceMode AdvanceModeUsed { get; set; } public int TotalActualSecs { get; set; } public int StdCycleSecs { get; set; } public string? FlagReason { get; set; } public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } } public class WiStepExecutionDTO { public int WiStepExecutionId { get; set; } public int WiExecutionId { get; set; } public int WiStepId { get; set; } public short SlNo { get; set; } public StepStatus StepStatus { get; set; } public DateTime? StartedOn { get; set; } public DateTime? CompletedOn { get; set; } public int ActualDurationSecs { get; set; } public int StdDurationSecs { get; set; } public StepAdvanceMode AdvanceTrigger { get; set; } public string? BarcodeScanned { get; set; } public string? SkippedReason { get; set; } public string? Remarks { get; set; } // Display-only — populated by GET_STEP_EXECUTIONS_BY_EXECUTION's join to WI.MWISTEP, // never sent on insert/update. public string? StepTitle { get; set; } } public class WiAcknowledgementDTO { public int AcknowledgementId { get; set; } public int WiId { get; set; } public int EmployeeId { get; set; } public int WorkOrderId { get; set; } public int WorkStationId { get; set; } public string WiVersion { get; set; } = string.Empty; public DateTime AcknowledgedOn { get; set; } public string? DeviceContext { get; set; } public bool IsValid { get; set; } public short Version { get; set; } public byte Status { get; set; } = 1; public short SortOrder { get; set; } = 9999; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } } public class WiVersionLogDTO { // IDENTITY PK — never set by caller public int LwiVersionId { get; set; } public int WiId { get; set; } public string WiVersion { get; set; } = string.Empty; public WiStatus WiStatus { get; set; } public string? ChangeSummary { get; set; } public int ChangedById { get; set; } public int ReviewedById { get; set; } public int ApprovedById { get; set; } public DateTime? PublishedOn { get; set; } public DateTime? ArchivedOn { get; set; } public bool IsCurrent { get; set; } public int CreatedById { get; set; } public DateTime CreatedOn { get; set; } } // 1:1 with WiVersionLogDTO (via LwiVersionId) — full GetWiFullDetail JSON as of that transition. // IDENTITY PK — never set by caller. Append-only, same as WI.LWIVERSION itself. public class WiVersionSnapshotDTO { public int LwiVersionSnapshotId { get; set; } public int LwiVersionId { get; set; } public int WiId { get; set; } public string SnapshotJson { get; set; } = string.Empty; public DateTime CreatedOn { get; set; } } public class WiListItemDTO { public int WiId { get; set; } public string WiCode { get; set; } = string.Empty; public string WiTitle { get; set; } = string.Empty; public string WiVersion { get; set; } = string.Empty; public WiStatus WiStatus { get; set; } public ActivityType ActivityType { get; set; } public string ProcessName { get; set; } = string.Empty; public string SubProcessName { get; set; } = string.Empty; public int IsActive { get; set; } } public class WiSaveRequestDTO { public WiHeaderDTO Header { get; set; } = new(); public List Sections { get; set; } = []; public List Steps { get; set; } = []; public List SkillRequirements { get; set; } = []; public List CompetencyRequirements { get; set; } = []; } public class StartExecutionRequestDTO { public int WiId { get; set; } public int WiActivityScheduleId { get; set; } public int WorkOrderId { get; set; } public int WorkStationId { get; set; } public int EmployeeId { get; set; } public ActivityType ActivityType { get; set; } public TriggerEvent TriggerEvent { get; set; } public string? SerialNo { get; set; } public string? LotNo { get; set; } } public class CompleteStepRequestDTO { public int WiStepExecutionId { get; set; } public int WiExecutionId { get; set; } public int WiStepId { get; set; } public StepStatus StepStatus { get; set; } public int ActualDurationSecs { get; set; } public StepAdvanceMode AdvanceTrigger { get; set; } public string? BarcodeScanned { get; set; } public string? SkippedReason { get; set; } public string? Remarks { get; set; } } public class PickListDTO { public int Id { get; set; } public string Code { get; set; } public string Name { get; set; } public int WarningLevel {get; set; } public int StdDuration { get; set; } } // ── Supplementary: Workstation master ──────────────────────────────────────── public class WorkstationDTO { public int WorkstationId { get; set; } public int WorkCenterId { get; set; } public string WorkCenterCode { get; set; } public string WorkCenterName { get; set; } public string WorkstationCode { get; set; } = string.Empty; public string WorkstationName { get; set; } = string.Empty; public WorkstationType WorkstationType { get; set; } public string? BayCode { get; set; } public string? FloorDescription{ get; set; } public string? IpAddress { get; set; } public string? MacAddress { get; set; } public short MaxOperators { get; set; } public string? Remarks { get; set; } public int IsActive { get; set; } } public class WorkstationListItemDTO { public int WorkstationId { get; set; } public string WorkstationCode { get; set; } = string.Empty; public string WorkstationName { get; set; } = string.Empty; public WorkstationType WorkstationType { get; set; } public int WorkCenterId { get; set; } public string? WorkCenterName { get; set; } public string BayCode { get; set; } public string FloorDescription { get; set; } public string IpAddress { get; set; } public string MacAddress { get; set; } public int MaxOperators { get; set; } public bool IsActive { get; set; } } //___---ProductionLine ------------------------ public class ProductionLineDTO { public int ProductionLineId { get; set; } public string ProductionLineCode { get; set; } = string.Empty; public string ProductionLineName { get; set; } = string.Empty; public string ProductionLineDescription { get; set; } public int ProductionLineIsActive { get; set; } public int ProductionLineVersion { get; set; } public int ProductionLineStatus { get; set; } public int ProductionLineSortOrder { get; set; } public int ProductionLineCreatedById { get; set; } public DateTime ProductionLineCreatedOn { get; set; } public int ProductionLineModifiedById { get; set; } public DateTime ProductionLineModifiedOn { get; set; } public int ProductionLineSoruceType { get; set; } public int ProductionLineTenantId { get; set; } } // ── Supplementary: Production line station (append-only) ───────────────────── public class ProductionLineStationDTO { public int ProductionLineStationId { get; set; } public int ProductionLineId { get; set; } public int WorkstationId { get; set; } public string? WorkstationCode { get; set; } public string? WorkstationName { get; set; } public short PositionNo { get; set; } public DateOnly EffectiveFrom { get; set; } public DateOnly? EffectiveTo { get; set; } public string? Remarks { get; set; } public int MaxOperators { get; set; } } // ── Supplementary: Line shift roster ───────────────────────────────────────── public class LineShiftRosterDTO { public int LineShiftRosterId { get; set; } public int ProductionLineId { get; set; } public int ShiftId { get; set; } public DateOnly RosterDate { get; set; } public RosterType RosterType { get; set; } public RosterStatus RosterStatus { get; set; } public int InChargeEmployeeId { get; set; } public int? PlannedRosterId { get; set; } public string? Remarks { get; set; } } // ── Supplementary: Line shift staffing (append-only; never delete) ──────────── public class LineShiftStaffingDTO { public int LineShiftStaffingId { get; set; } public int LineShiftRosterId { get; set; } public int WorkstationId { get; set; } public int EmployeeId { get; set; } public StaffingRole StaffingRole { get; set; } public bool IsPrimary { get; set; } public TimeSpan? PlannedStartTime { get; set; } public TimeSpan? PlannedEndTime { get; set; } public bool IsAbsent { get; set; } public string? AbsenceReason { get; set; } public int? ReplacedByEmployeeId { get; set; } public string? Remarks { get; set; } public bool OnApprovedLeave { get; set; } } // ── Supplementary: Line operation map (append-only) ────────────────────────── public class LineOperationMapDTO { public int LineOperationMapId { get; set; } public int LineProcessConfigId { get; set; } public int RoutingOperationId { get; set; } public int? CycleTimeOverrideSecs { get; set; } public int ProductionLineId { get; set; } public int RoutingDetailId { get; set; } public int WorkstationId { get; set; } public DateOnly EffectiveFrom { get; set; } public DateOnly? EffectiveTo { get; set; } public short ManpowerCount { get; set; } public bool IsActive { get; set; } public string? Remarks { get; set; } } public class LineOperationMapDetailDTO : LineOperationMapDTO { public string? LineName { get; set; } public short OperationSlNo { get; set; } public string? Stage { get; set; } public string? Step { get; set; } public int WorkCenterId { get; set; } public string? WorkCenterName { get; set; } public string? WorkstationCode { get; set; } public string? WorkstationName { get; set; } public decimal? CycleTime { get; set; } public decimal? SetupTime { get; set; } public string? BorTimeUom { get; set; } } // ── Supplementary: Query result DTOs ───────────────────────────────────────── public class LineRosterComparisonDTO { public RosterType RosterType { get; set; } public RosterStatus RosterStatus { get; set; } public int InChargeId { get; set; } public string? InChargeName { get; set; } public string? InChargeCode { get; set; } public int WorkstationId { get; set; } public string? WorkstationCode { get; set; } public string? WorkstationName { get; set; } public int EmployeeId { get; set; } public string? EmployeeName { get; set; } public string? EmployeeCode { get; set; } public StaffingRole StaffingRole { get; set; } public bool IsPrimary { get; set; } public TimeSpan? PlannedStartTime { get; set; } public TimeSpan? PlannedEndTime { get; set; } public bool IsAbsent { get; set; } public string? AbsenceReason { get; set; } public int ReplacedByEmployeeId { get; set; } public string? ReplacementName { get; set; } public string? ReplacementCode { get; set; } } public class StaffingGapDTO { public int WorkstationId { get; set; } public string WorkstationCode { get; set; } = string.Empty; public string WorkstationName { get; set; } = string.Empty; public int RequiredCount { get; set; } public int AssignedCount { get; set; } public string StaffingStatus { get; set; } = string.Empty; // "OK" or "UNDERSTAFFED" } // ── Supplementary: Workstation availability (Maintenance link + direct capture) ───── public class WorkstationOutageDTO { public int WorkstationOutageId { get; set; } public int WorkstationId { get; set; } public byte OutageType { get; set; } // 0 Breakdown, 1 Planned Maintenance public DateTime StartedOn { get; set; } public DateTime? EndedOn { get; set; } // null = still down public string? Remarks { get; set; } } // Source: 0 BreakdownCall (TCALL, via MWORKSTATION.MachineId link), 1 PlannedMaintenance // (TTASK TASKNATURE=2, same link), 2 DirectCapture (TWORKSTATIONOUTAGE — used whenever the // workstation has no MachineId link, or the outage isn't tracked in Maintenance/CRM at all). public class WorkstationAvailabilityDTO { public int WorkstationId { get; set; } public byte Source { get; set; } public byte OutageType { get; set; } public DateTime StartedOn { get; set; } public DateTime? EndedOn { get; set; } public string? Remarks { get; set; } } // ── Supplementary: Employee scan-target lookup (MEMPLOYEE, direct SQL — see EmployeeScanTargetQB) ── public sealed class EmployeeScanTargetDTO { public int EmployeeId { get; set; } public string Code { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; } // ── Supplementary: Employee leave link (PayRoll TLEAVE/TLEAVEDETAIL) ──────────────── // Reusable outside WI too — any module rostering/staffing employees for a given date can // call IEmployeeLeaveLinkBLL to find out who's on approved leave that day. public class EmployeeLeaveStatusDTO { public int EmployeeId { get; set; } public DateOnly LeaveDate { get; set; } public byte LeaveStatus { get; set; } // 0 Pending, 1 Availed, 2 Final — 1/2 count as approved public int LeaveTypeId { get; set; } } // ── Supplementary: WI swimlane step projection ─────────────────────────────── public class WiStepSwimLaneDTO { public int WiId { get; set; } public int WiStepId { get; set; } public short SlNo { get; set; } public string StepTitle { get; set; } = string.Empty; public byte WarningLevel { get; set; } public int StdDurationSecs { get; set; } public int EffectiveWorkstationId { get; set; } public bool IsStepLevelOverride { get; set; } public string? WorkstationCode { get; set; } public string? WorkstationName { get; set; } public string? SectionTitle { get; set; } } public class WiExecutionHistoryDTO { public int WiExecutionId { get; set; } public int WiId { get; set; } public string WiCode { get; set; } = string.Empty; public string WiTitle { get; set; } = string.Empty; public int WorkstationId { get; set; } public string? WorkstationCode { get; set; } public int EmployeeId { get; set; } public string? EmployeeName { get; set; } public DateTime StartedOn { get; set; } public DateTime? CompletedOn { get; set; } public byte ExecStatus { get; set; } public int TotalActualSecs { get; set; } public int StdCycleSecs { get; set; } public string? FlagReason { get; set; } } public class WiTimeStudyDTO { public int WiStepId { get; set; } public short SlNo { get; set; } public string StepTitle { get; set; } = string.Empty; public int StdDurationSecs { get; set; } public int ExecutionCount { get; set; } public int AvgActualSecs { get; set; } public int MinActualSecs { get; set; } public int MaxActualSecs { get; set; } } public class WiComplianceSummaryDTO { public int WiId { get; set; } public string WiCode { get; set; } = string.Empty; public string WiTitle { get; set; } = string.Empty; public int TotalOperators { get; set; } public int AcknowledgedCount { get; set; } public decimal ComplianceRate { get; set; } public int CompletedRuns { get; set; } public int AbandonedRuns { get; set; } public int FlaggedRuns { get; set; } } public class SaveLineRosterWithStaffingDTO { public LineShiftRosterDTO Roster { get; set; } = new(); public List Staffing { get; set; } = []; } // Bridges a real TPRODUCTIONPLANDETAIL row (Item/Qty/date-range — no Line/Shift/Workstation // dimension) down to a specific line/shift/date, optionally a specific workstation and // intra-shift time window. Many rows per (ProductionLineId, AllocationDate, ShiftId) is the // normal, expected shape — that's how multi-product/partial-shift allocation is expressed. public class LineProductionPlanAllocationDTO { public int LineAllocationId { get; set; } public int ProductionPlanDetailId { get; set; } public int ItemId { get; set; } public string? ItemCode { get; set; } public string? ItemName { get; set; } public decimal PlanTotalBatchQuantity { get; set; } public DateTime PlanFromDate { get; set; } public DateTime PlanToDate { get; set; } public int ProductionLineId { get; set; } public string? LineCode { get; set; } public string? LineName { get; set; } public int ShiftId { get; set; } public string? ShiftCode { get; set; } public DateOnly AllocationDate { get; set; } public int? WorkStationId { get; set; } public string? WorkStationCode { get; set; } public string? WorkStationName { get; set; } public short? StartMinutes { get; set; } public short? EndMinutes { get; set; } public int? AllocatedQuantity { get; set; } public string? Remarks { get; set; } public byte Status { get; set; } = 1; public int CreatedById { get; set; } public int ModifiedById { get; set; } public byte SourceType { get; set; } = 5; public int TenantId { get; set; } }