void ElevatorTasks_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { if (e.NewItems != null) { ElevatorTask etNew = null; foreach (ElevatorTask newTask in e.NewItems) { newTask.SourceLoadAConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.SourceLoadA); newTask.SourceLoadBConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.SourceLoadB); newTask.DestinationLoadAConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.DestinationLoadA); newTask.DestinationLoadBConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.DestinationLoadB); newTask.Elevator = this; etNew = newTask; } ///// Check for repeated tasks This shouldn't happen however the controller/WMS may issue repeated tasks ////// List <ElevatorTask> listET = ElevatorTasks.ToList(); if (CurrentTask != null) { listET.Add(CurrentTask); } listET.Remove(etNew); foreach (ElevatorTask st in listET) { if (st.Equals(etNew)) // Already have this task { ElevatorTasks.Remove(etNew); //etNew = null; } } /////// Log.Write(etNew.ToString()); if (CurrentTask == null && etNew != null) //elevator not doing a task add this to the current task { CurrentTask = etNew; } } } }
void ElevatorTasks_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) { if (e.NewItems != null) { ElevatorTask etNew = null; foreach (ElevatorTask newTask in e.NewItems) { newTask.SourceLoadAConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.SourceLoadA); newTask.SourceLoadBConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.SourceLoadB); newTask.DestinationLoadAConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.DestinationLoadA); newTask.DestinationLoadBConv = ParentMultiShuttle.GetConveyorFromLocName(newTask.DestinationLoadB); newTask.Elevator = this; etNew = newTask; } ///// Check for repeated tasks This shouldn't happen however the controller/WMS may issue repeated tasks ////// List <ElevatorTask> listET = ElevatorTasks.ToList(); if (CurrentTask != null) { listET.Add(CurrentTask); } listET.Remove(etNew); foreach (ElevatorTask st in listET) { if (st.Equals(etNew)) // Already have this task { ElevatorTasks.Remove(etNew); //etNew = null; } } //BG Changing this so that the controller and control have full control over what the elevator chooses to do next //ParentMultiShuttle.ElevatorTasksStatusChanged(new ElevatorTasksStatusChangedEventArgs(this)); SetNewElevatorTask(); } } }
void theMultishuttle_OnArrivedAtOutfeedRackConvPosA(object sender, RackConveyorArrivalEventArgs e) { DCICaseData caseData = e._caseLoad.Case_Data as DCICaseData; caseData.Current = FormatRackConvLocation(e._locationName, ConveyorTypes.OutfeedRack); //Update the location if (BaseDCIController.GetLocFields(caseData.Destination, PSDSRackLocFields.ConvType) == "D") { string sendMessage = controller.CreateTelegramFromLoad(TelegramTypes.TUNotification, e._caseLoad); controller.SendTelegram(sendMessage); //Always Send a notification at location A //Combine a task with an existing task but only if the final destination is a drop station because if destination is the rack conveyor then we need to wait for another message from the WMS if (e._elevator.CurrentTask != null && e._rackConveyor.LocationB.Active && !e._elevator.CurrentTask.RelevantElevatorTask(e._rackConveyor.LocationB.ActiveLoad)) { string aisle = e._elevator.AisleNumber.ToString().PadLeft(2, '0'); string level = BaseDCIController.GetLocFields(caseData.Destination, PSDSRackLocFields.Level); string destLoadA = string.Format("{0}{1}{2}{3}A", aisle, (char)ExtensionMethods.Side(e._locationName), level, (char)ConveyorTypes.Drop); //Create the task but do not add it to elevator tasks list ElevatorTask et = new ElevatorTask(e._caseLoad.Identification, null) { SourceLoadA = e._locationName, DestinationLoadA = destLoadA, SourceLoadAConv = theMultishuttle.GetConveyorFromLocName(e._locationName), DestinationLoadAConv = theMultishuttle.GetConveyorFromLocName(destLoadA), Elevator = e._elevator }; //This task should just be added and not combined as the combining is now done later //TODO: Make it so that direct outfeed loads still work et.CreateNewDoubleLoadCycleTask(et, e._rackConveyor.LocationB.ActiveLoad.Identification); } } else { string sendMessage = controller.CreateTelegramFromLoad(TelegramTypes.TUReport, e._caseLoad); controller.SendTelegram(sendMessage); //Always Send a notification at location A } }
internal void MoveShuttle(float position) { if (CurrentTask.Source.ConvType() == ConveyorTypes.InfeedRack) { RackConveyor sourceConv = ParentMultiShuttle.GetConveyorFromLocName(CurrentTask.Source) as RackConveyor; if (CurrentTask.Level == Level && sourceConv != null && (shuttleAP.Active || (!shuttleAP.Active && (sourceConv.LocationB.Active && sourceConv.LocationB.ActiveLoad.Identification == CurrentTask.LoadID)))) { //continue....temp debug code! } else { Log.Write("Error in CurrentTask removing current task", Color.Red); CurrentTask = null; return; } } float currentDistance = trackRail.Destination.Distance; if (trackRail.Destination.Distance != position) { trackRail.Destination.Distance = position; if (trackRail.Destination.Distance < currentDistance) { trackRail.Route.Motor.Backward(); } else if (trackRail.Destination.Distance > currentDistance) { trackRail.Route.Motor.Forward(); } trackRail.Route.Motor.Start(); trackRail.ShuttleCar.Release(); } else //no need to move as already at the correct location { ShuttleOnArrived(); } }