public override void ProcessPressing(MachinePresser presser) { var pressingProcess = Processes .OfType <ProcessPressing>() .FirstOrDefault(); if (pressingProcess == null) { throw new Exception("Order not for PRESSING"); } switch (CurrentProcess) { case ProcessRouting routing: if (!routing.EndTime.HasValue) { throw new Exception($"Order is currently being routed on Router {routing.MachineRouter.Name}"); } routing.IsCurrent = false; pressingProcess.StartTime = DateTime.Now; pressingProcess.MachineId = presser.Id; pressingProcess.IsCurrent = true; break; case ProcessPressing pressing: if (pressing.EndTime.HasValue) { throw new Exception("Order has already been PRESSED"); } if (pressing.MachineId != presser.Id) { throw new Exception($"Order is currently on Presser {pressing.MachinePresser.Name}"); } pressing.EndTime = DateTime.Now; break; default: throw new Exception("Order not valid for PRESSING"); } }
public abstract void ProcessPressing(MachinePresser presser);