Exemple #1
0
        public override void ProcessRouting(MachineRouter router)
        {
            var routingProcess = Processes
                                 .OfType <ProcessRouting>()
                                 .FirstOrDefault();

            if (routingProcess == null)
            {
                throw new Exception("Order not for ROUTING");
            }

            switch (CurrentProcess)
            {
            case ProcessPreRoute preRoute:
                if (!preRoute.EndTime.HasValue)
                {
                    preRoute.EndTime = DateTime.Now;
                }

                preRoute.IsCurrent = false;

                routingProcess.StartTime = DateTime.Now;
                routingProcess.MachineId = router.Id;
                routingProcess.IsCurrent = true;
                break;

            case ProcessRouting routing:
                if (routing.EndTime.HasValue)
                {
                    throw new Exception("Order has already been ROUTED");
                }

                if (routing.MachineId != router.Id)
                {
                    throw new Exception($"Order is currently on Router {routing.MachineRouter.Name}");
                }

                routing.EndTime = DateTime.Now;
                break;

            default:
                throw new Exception("Order not valid for ROUTING");
            }
        }
Exemple #2
0
 public abstract void ProcessRouting(MachineRouter router);