namespace MMDAL.DTO.Scheduling { public enum DemandType { ProductionIndent = 0, BatchPlan = 1, ProcessGroup = 2, WorkPlan = 3, ReworkJob = 4, AdhocCorrection = 5, NpdTrial = 6, NestingPlan = 7 } public class ExecutionUnit { public int EuId { get; set; } public DemandType DemandType { get; set; } public int SourceDocumentId { get; set; } public int SourceDetailId { get; set; } public int ItemId { get; set; } public int SkuId { get; set; } public int RoutingVersionDetailId { get; set; } public int WorkCenterId { get; set; } public int? FixedMachineId { get; set; } public int? FixedPatternId { get; set; } public decimal Quantity { get; set; } public int DurationMinutes { get; set; } // 0=InHouse 1=Subcontract 2=Either public byte ExecutionMode { get; set; } // 0=Yes (interruptible) 1=No (not interruptible) — matches IS* TINYINT convention public byte IsInterruptible { get; set; } = 1; public int MinimumRunMinutes { get; set; } public int MaxWaitMinutes { get; set; } // 0=Reform 1=CarryForward public byte BatchContinuity { get; set; } // 0=Yes (IS monitor-only) 1=No — matches IS* TINYINT convention public byte IsMonitorOnly { get; set; } = 1; // 0=Production 1=Rework 2=Trial public byte PlanNature { get; set; } public DateTime EarliestStart { get; set; } public DateTime Deadline { get; set; } public List PredecessorEuIds { get; set; } = new(); // Lower number = higher priority; 0 = RedCard (always scheduled first) public int Priority { get; set; } // Set by DependencyGraph after partial-dependency offset is applied public DateTime ComputedEarliestStart { get; set; } public string? MonitorGroup { get; set; } // 0=Yes (IS group output step) 1=No — matches IS* TINYINT convention public byte IsGroupOutputStep { get; set; } = 1; // 1=Machine 2=Pattern 3=Die 6=Subcontract 7=InternalTransfer — set for nesting plans public byte ResourceLevel { get; set; } = 1; // Batch grouping — populated by BatchEngine public string? RootBatchNumber { get; set; } public int ProcessId { get; set; } // Resolved schedule (set after SlotFinder commits) public DateTime? ScheduledStart { get; set; } public DateTime? ScheduledEnd { get; set; } // Duration origin — 0=RoutingLeadTime 1=ManualOverride 2=SubcontractLeadTime public byte DurationSource { get; set; } // Batch context — set by BatchGroup.ToMergedEU(); 1 = singleton public int BatchItemCount { get; set; } = 1; public List BatchedSourceDetailIds { get; set; } = new(); public List BatchedItemQtys { get; set; } = new(); // From MUOM.DECIMALPLACES — used by SplitQty for UOM-aware rounding public int QuantityDecimalPlaces { get; set; } = 2; // 0=Yes (pattern required for this process) 1=No — from MPROCESS.ISPATTERNREQUIRED; default 1 = not required public byte IsPatternRequired { get; set; } = 1; // Number of parallel machines required — from MROUTINGVERSIONDETAIL.SPLITS; default 1 = single machine public byte Splits { get; set; } = 1; } }