예제 #1
0
        public void UpdateControls()
        {
            AddButton.IsEnabled    = false;
            RemoveButton.IsEnabled = false;

            if (stationGrid.SelectedItem != null)
            {
                StationStatus ss = (StationStatus)stationGrid.SelectedItem;
                if (ss.Connected())
                {
                    AddButton.IsEnabled    = false;
                    RemoveButton.IsEnabled = true;
                }
                else if (ss.Synchronizing())
                {
                    AddButton.IsEnabled    = false;
                    RemoveButton.IsEnabled = false;
                }
                else
                {
                    AddButton.IsEnabled    = true;
                    RemoveButton.IsEnabled = false;
                }
            }

            StartEndElectionButton.IsEnabled = false;

            foreach (StationStatus s in stationGrid.ItemsSource)
            {
                if (s.Connected())
                {
                    StartEndElectionButton.IsEnabled = true;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// The thread that updates the list
        /// </summary>
        /// <param name="ovp">
        /// this overview page
        /// </param>
        public void PopulateListThread(OverviewPage ovp)
        {
            StationStatus selected = null;

            ovp.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(delegate { selected = (StationStatus)stationGrid.SelectedItem; }));

            ovp.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(delegate { UpdateLabel.Content = "Scanning..."; }));
            ovp.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(delegate { LoadingBar.Visibility = System.Windows.Visibility.Visible; }));
            _ui.DiscoverPeers();

            ovp.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate { stationGrid.Items.Refresh(); }));

            ovp.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate { UpdateLabel.Content = string.Empty; }));
            ovp.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(delegate { LoadingBar.Visibility = System.Windows.Visibility.Hidden; }));
            ovp.Dispatcher.Invoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                new Action(delegate { RefreshButton.IsEnabled = true; UpdateControls(); }));
        }
        private ServiceResult Execute(ISystemContext context, MethodState method, IList <object> inputArguments, IList <object> outputArguments)
        {
            m_serialNumber = (ulong)inputArguments[0];

            m_cycleStartTime = DateTime.Now;

            m_currentStationStatus = StationStatus.WorkInProgress;

            ulong idealCycleTime = m_stationTelemetry.IdealCycleTime.Value;

            if (idealCycleTime < m_idealCycleTimeMinimum)
            {
                m_stationTelemetry.IdealCycleTime.Value =
                    idealCycleTime = m_idealCycleTimeMinimum;
            }
            int cycleTime = (int)(idealCycleTime + Convert.ToUInt32(Math.Abs((double)idealCycleTime * NormalDistribution(m_random, 0.0, 0.1))));

            bool stationFailure = (NormalDistribution(m_random, 0.0, 1.0) > 3.0);

            if (stationFailure)
            {
                // the simulated cycle will take longer when the station fails
                cycleTime = c_failureCycleTime + Convert.ToInt32(Math.Abs((double)c_failureCycleTime * NormalDistribution(m_random, 0.0, 1.0)));
            }

            m_simulationTimer = new Timer(SimulationFinished, stationFailure, cycleTime, Timeout.Infinite);

            UpdateNodeValues();

            return(ServiceResult.Good);
        }
예제 #4
0
        public async Task Initialize()
        {
            _devices  = new List <TurnOnOffDevice>();
            _readers  = new List <ReaderDevice>();
            _displays = new List <DisplayDevice>();

            Devices           = new List <ITurnOnOffModule>();
            Readers           = new List <IReaderModule>();
            Displays          = new List <IDisplayModule>();
            _conditions       = new List <Condition>();
            _conditionManager = new ConditionManager(_conditions, Devices);

            var config = new BridgeConfiguration(StationHelper.GetDeviceID(), "com.guybrush")
            {
                ModelName       = "Guybrush Bridge",
                DeviceName      = "Guybrush Smart Home",
                ApplicationName = "Guybrush Station",
                Vendor          = "Guybrush"
            };

            _homeDevice = new SmarthomeAdapter(config, _conditionManager);
            await AllJoynDsbServiceManager.Current.StartAsync(_homeDevice);

            Status = StationStatus.Running;
        }
        protected override void OnAfterCreate(ISystemContext context, NodeState node)
        {
            base.OnAfterCreate(context, node);

            m_numberOfManufacturedProducts = 0;
            m_numberOfDiscardedProducts    = 0;
            m_energyConsumption            = 0;
            m_pressure = c_pressureDefault;

            m_stationStartTime = DateTime.Now;
            m_faultClock.Reset();
            m_pressureStableStartTime = DateTime.Now;

            m_idealCycleTimeDefault = Program.CycleTime * 1000;
            m_idealCycleTimeMinimum = m_idealCycleTimeDefault / 2;
            m_stationTelemetry.IdealCycleTime.Value = m_idealCycleTimeDefault;
            m_actualCycleTime = m_idealCycleTimeDefault;

            StationCommands.Execute.OnCallMethod = Execute;
            StationCommands.Reset.OnCallMethod   = Reset;
            StationCommands.OpenPressureReleaseValve.OnCallMethod = OpenPressureReleaseValve;

            m_simulationContext = context;
            m_random            = new Random();

            m_currentStationStatus = StationStatus.Ready;

            UpdateNodeValues();
        }
예제 #6
0
        public void Colorlize(Rectangle rec, StationStatus status)
        {
            switch (status)
            {
                case StationStatus.Empty:
                    rec.Fill = Brushes.Silver;
                    break;
                case StationStatus.Loading:
                    rec.Fill = Brushes.Gold;
                    break;

                case StationStatus.OnService:
                    rec.Fill = Brushes.Orange;
                    break;

                case StationStatus.Blocked:
                    rec.Fill = Brushes.Red;
                    break;
                case StationStatus.BlockedAndWaitingforRobot:
                    rec.Fill = Brushes.DarkRed;
                    break;
                case StationStatus.WaitingforRobot:
                    rec.Fill = Brushes.OrangeRed;
                    break;
            }
        }
예제 #7
0
        /// <summary>
        /// What machines on the network respond that they have the digital voter list software running?
        /// </summary>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        [Pure] public void DiscoverPeers()
        {
            HashSet <IPEndPoint> potentials = new HashSet <IPEndPoint>(Communicator.DiscoverPeers().Concat(Peers.Keys));

            foreach (IPEndPoint peer in potentials)
            {
                bool listening = Communicator.IsListening(peer);
                if (listening && !Peers.Keys.Contains(peer))
                {
                    if (PeerStatuses.Keys.Contains(peer))
                    {
                        PeerStatuses[peer].ConnectionState = "Not Connected";
                    }
                    else
                    {
                        PeerStatuses[peer] = new StationStatus(peer, Communicator.GetIdentifyingStringForStation(peer), "Not Connected");
                    }
                }
                else if (!listening)
                {
                    RemovePeer(peer, false);
                }
            }

            UI.RefreshPeers();
        }
예제 #8
0
        public static List <ScheduleConstrains> GetStationConstrains(int wsid)
        {
            List <ScheduleConstrains> list = new List <ScheduleConstrains>();

            try
            {
                List <Tuple <string, object> > args = new List <Tuple <string, object> >();
                args.Add(new Tuple <string, object>("WSID", wsid));
                var ds = GetDataSet("sp_GetStationConstrains", args);

                int curStation = -1;
                int index      = -1;

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    var row = ds.Tables[0].Rows[i];

                    int           day             = (int)row["Day"];
                    int           shift           = (int)row["ShiftTime"];
                    int           id              = (int)row["StationId"];
                    int           priority        = (int)row["Priority"];
                    int           numberOfWorkers = (int)row["NumberOfWorkers"];
                    StationStatus status          = (StationStatus)row["Status"];

                    if (curStation != id)
                    {
                        index++;
                        curStation = (int)row["StationId"];
                        var sc = new ScheduleConstrains();
                        sc.WSID       = wsid;
                        sc.StationId  = id;
                        sc.Status     = status;
                        sc.Constrains = new List <StationConstrains>();
                        sc.Constrains.Add(new StationConstrains()
                        {
                            Day             = day,
                            ShiftTime       = shift,
                            Priority        = priority,
                            NumberOfWorkers = numberOfWorkers,
                            Status          = status
                        });
                        list.Add(sc);
                    }
                    else
                    {
                        list[index].Constrains.Add(new StationConstrains()
                        {
                            Day             = day,
                            ShiftTime       = shift,
                            Priority        = priority,
                            NumberOfWorkers = numberOfWorkers,
                            Status          = status
                        });
                    }
                }
            }
            catch { }

            return(list);
        }
예제 #9
0
 private static StationStatus _CreateStationStatus(CyclocityStationData stationData)
 {
     return(StationStatus.Create(
                station: _CreateStation(stationData),
                availableBikes: stationData.AvailableBikes,
                availableStands: stationData.AvailableBikeStands));
 }
예제 #10
0
        public void UpdateControls()
        {
            AddButton.IsEnabled         = false;
            RemoveButton.IsEnabled      = false;
            MakeManagerButton.IsEnabled = false;

            if (ManagerstationGrid.SelectedItem != null)
            {
                StationStatus ss = (StationStatus)ManagerstationGrid.SelectedItem;
                if (ss.Connected())
                {
                    AddButton.IsEnabled         = false;
                    RemoveButton.IsEnabled      = true;
                    MakeManagerButton.IsEnabled = true;
                }
                else if (ss.Synchronizing())
                {
                    AddButton.IsEnabled         = false;
                    RemoveButton.IsEnabled      = false;
                    MakeManagerButton.IsEnabled = false;
                }
                else
                {
                    AddButton.IsEnabled         = true;
                    RemoveButton.IsEnabled      = false;
                    MakeManagerButton.IsEnabled = false;
                }
            }
        }
예제 #11
0
    //List<FoodItemTag> _currentRecipeIngredients = new List<FoodItemTag>();

    //interact only true if the player is need to be working
    public override bool Interact(FoodItemTag item, rdEntity user)
    {
        if (user.ItemOnHand != FoodItemTag.None)
        {
            return(false);
        }
        //TODO player will manually picked what item
        user.ItemOnHand = IngredientsToPickedUp[0];
        IngredientsToPickedUp.RemoveAt(0);
        if (IngredientsToPickedUp.Count <= 0)
        {
            Status = StationStatus.Inactive;
        }

        if (IngredientsToPickedUp.Count <= 0)
        {
            rdUIManager.UpdateStationPopups(gameObject);
        }
        else
        {
            rdUIManager.UpdateStationPopups(gameObject, IngredientsToPickedUp);
        }
        rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);

        rdRecipeManager.UpdateInstruction(user.ItemOnHand);
        return(false);
    }
        private static void StartAssemblyLine()
        {
            lock (m_mesStatusLock)
            {
                m_doneAssembly = false;
                m_doneTest     = false;

                m_serialNumber[c_Assembly]++;

                Trace("<<Assembly line reset!>>");

                // reset assembly line
                m_sessionAssembly.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);
                m_sessionTest.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);
                m_sessionPackaging.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);

                // update status
                m_statusAssembly  = (StationStatus)m_sessionAssembly.ReadValue(m_station.StatusNode).Value;
                m_statusTest      = (StationStatus)m_sessionTest.ReadValue(m_station.StatusNode).Value;
                m_statusPackaging = (StationStatus)m_sessionPackaging.ReadValue(m_station.StatusNode).Value;

                Trace("#{0} Assemble ", m_serialNumber[c_Assembly]);
                // start assembly
                m_sessionAssembly.Call(m_station.RootMethodNode, m_station.ExecuteMethodNode, m_serialNumber[c_Assembly]);
            }
        }
        private static void MonitoredItem_TestStation(MonitoredItem monitoredItem, MonitoredItemNotificationEventArgs e)
        {
            try
            {
                lock (m_mesStatusLock)
                {
                    MonitoredItemNotification change = e.NotificationValue as MonitoredItemNotification;
                    m_statusTest = (StationStatus)change.Value.Value;

                    Trace("--TestStation: {0}", m_statusTest);

                    switch (m_statusTest)
                    {
                    case StationStatus.Ready:
                        // nothing to do
                        break;

                    case StationStatus.WorkInProgress:
                        // nothing to do
                        break;

                    case StationStatus.Done:
                        Trace("#{0} Tested, Passed", m_serialNumber[c_Test]);
                        m_doneTest = true;
                        break;

                    case StationStatus.Discarded:
                        Trace("#{0} Tested, not Passed, Discarded", m_serialNumber[c_Test]);
                        m_sessionTest.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);
                        break;

                    case StationStatus.Fault:
                    {
                        m_faultTest = true;
                        Task.Run(async() =>
                            {
                                Trace("<<TestStation: Fault>>");
                                await Task.Delay(c_waitTime);
                                Trace("<<TestStation: Restart from Fault>>");

                                m_faultTest = false;
                                m_sessionTest.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);
                            });
                    }
                    break;

                    default:
                    {
                        Trace("Argument error: Invalid station status type received!");
                        return;
                    }
                    }
                }
            }
            catch (Exception exception)
            {
                Trace("Exception: Error processing monitored item notification: " + exception.Message);
            }
        }
        private static void MonitoredItem_PackagingStation(MonitoredItem monitoredItem, MonitoredItemNotificationEventArgs e)
        {
            try
            {
                lock (m_mesStatusLock)
                {
                    MonitoredItemNotification change = e.NotificationValue as MonitoredItemNotification;
                    m_statusPackaging = (StationStatus)change.Value.Value;

                    Trace("---PackagingStation: {0}", m_statusPackaging);

                    switch (m_statusPackaging)
                    {
                    case StationStatus.Ready:
                        // nothing to do
                        break;

                    case StationStatus.WorkInProgress:
                        // nothing to do
                        break;

                    case StationStatus.Done:
                        Trace("#{0} Packaged", m_serialNumber[c_Packaging]);
                        // last station (packaging) is done, reset so the next product can be built
                        m_sessionPackaging.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);
                        break;

                    case StationStatus.Discarded:
                        Trace("#{0} Discarded in Packaging", m_serialNumber[c_Packaging]);
                        m_sessionPackaging.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);
                        break;

                    case StationStatus.Fault:
                    {
                        m_faultPackaging = true;
                        Task.Run(async() =>
                            {
                                Trace("<<PackagingStation: Fault>>");
                                await Task.Delay(c_waitTime);
                                Trace("<<PackagingStation: Restart from Fault>>");

                                m_faultPackaging = false;
                                m_sessionPackaging.Call(m_station.RootMethodNode, m_station.ResetMethodNode, null);
                            });
                    }
                    break;

                    default:
                        Trace("Argument error: Invalid station status type received!");
                        break;
                    }
                }
            }
            catch (Exception exception)
            {
                Trace("Exception: Error processing monitored item notification: " + exception.Message);
            }
        }
        private ServiceResult Reset(ISystemContext context, MethodState method, IList <object> inputArguments, IList <object> outputArguments)
        {
            m_faultClock.Stop();

            m_currentStationStatus = StationStatus.Ready;
            UpdateNodeValues();

            return(ServiceResult.Good);
        }
예제 #16
0
        /// <summary>
        /// Unmark a connected station in the list
        /// </summary>
        /// <param name="ip">the IP address of the station to unmark</param>
        public void UnmarkSelectedStation()
        {
            StationStatus ss = (StationStatus)ManagerstationGrid.SelectedItem;

            if (ss != null)
            {
                ss.ConnectionState = "Not Connected";
            }
            ManagerstationGrid.Items.Refresh();
        }
예제 #17
0
 void StartTask(rdEntity user)
 {
     Timer += CurrentInstruction.ProcessTime;
     Status = StationStatus.Cooking;
     User   = user;
     if (LoopSound.clip != null)
     {
         LoopSound.Play();
     }
     StartSound.PlayAtPoint(transform.position);
     //play start sound and loop sound
 }
예제 #18
0
        private List <Station> GetStationByStatus(StationStatus status)
        {
            List <Station> sdc      = clnt.GetStations(status);
            List <Station> stations = new List <Station>();

            foreach (Station s in sdc)
            {
                stations.Add(s);
            }

            return(stations);
        }
예제 #19
0
 private static object _Export(StationStatus stationStatus)
 {
     return(new
     {
         station = new
         {
             id = stationStatus.Station.Id,
         },
         availableStands = stationStatus.AvailableStands,
         availableBikes = stationStatus.AvailableBikes,
     });
 }
예제 #20
0
 public void OnNewRecipe()
 {
     RecipeMenu.Clear();
     foreach (RecipeInstruction ins in rdRecipeManager.Seele._currentRecipe.Instructions)
     {
         if (Tag == ins.Workstation)
         {
             RecipeMenu.Add(ins);
         }
     }
     Status = StationStatus.Ready;
     //UpdatePopups();
 }
예제 #21
0
 /// <summary>
 /// 默认构造函数
 /// </summary>
 public ProductStatus(string proId, string stationId, string line, string reworkCode, int testFailCount, string editor, DateTime udt, DateTime cdt, StationStatus status)
 {
     _proId = proId;
     _stationId = stationId;
     _line = line;
     _reworkCode = reworkCode;
     _editor = editor;
     _testFailCount = testFailCount;
     _udt = udt;
     _cdt = cdt;
     _status = status;
     this._tracker.MarkAsAdded(this);
 }
        public virtual void CalculateSimulationResult(bool stationFailure)
        {
            bool productDiscarded = (NormalDistribution(m_random, 0.0, 1.0) > 2.0);

            if (stationFailure)
            {
                m_numberOfDiscardedProducts++;
                m_currentStationStatus = StationStatus.Fault;
                m_faultClock.Start();
            }
            else if (productDiscarded)
            {
                m_currentStationStatus = StationStatus.Discarded;
                m_numberOfDiscardedProducts++;
            }
            else
            {
                m_currentStationStatus = StationStatus.Done;
                m_numberOfManufacturedProducts++;
            }

            m_actualCycleTime = (ulong)(DateTime.Now - m_cycleStartTime).TotalMilliseconds;

            double idealCycleTime = m_stationTelemetry.IdealCycleTime.Value;

            // The power consumption of the station increases exponentially if the ideal cycle time is reduced below the default ideal cycle time
            double cycleTimeModifier = (1 / Math.E) * (1 / Math.Exp(-(double)m_idealCycleTimeDefault / idealCycleTime));
            double powerConsumption  = Program.PowerConsumption * cycleTimeModifier;

            // assume the station consumes only power during the active cycle
            // energy consumption [kWh] = (PowerConsumption [kW] * actualCycleTime [s]) / 3600
            m_energyConsumption = (powerConsumption * ((double)m_actualCycleTime / 1000.0)) / 3600.0;

            // For stations configured to generate alerts, calculate pressure
            // Pressure will be stable for c_pressureStableTime and then will increase to c_pressureHigh and stay there until OpenPressureReleaseValve() is called
            if (Program.GenerateAlerts && (((DateTime.Now - m_pressureStableStartTime).TotalMilliseconds) > c_pressureStableTime))
            {
                // slowly increase pressure until c_pressureHigh is reached
                m_pressure += NormalDistribution(m_random, (cycleTimeModifier - 1.0) * 10.0, 10.0);

                if (m_pressure <= c_pressureDefault)
                {
                    m_pressure = c_pressureDefault * NormalDistribution(m_random, 0.0, 10.0);
                }
                if (m_pressure >= c_pressureHigh)
                {
                    m_pressure = c_pressureHigh * NormalDistribution(m_random, 0.0, 10.0);
                }
            }
        }
예제 #23
0
 public void OnNewRecipe()
 {
     foreach (var item in rdRecipeManager.Seele._currentRecipe.IngredientsToPickup)
     {
         foreach (var ing in RestrictIngredients)
         {
             if (ing == item)
             {
                 IngredientsToPickedUp.Add(ing);
             }
         }
     }
     Status = StationStatus.Ready;
     rdUIManager.UpdateStationPopups(this.gameObject, IngredientsToPickedUp);
 }
예제 #24
0
    //interact only true if the player is need to be working
    public override bool Interact(FoodItemTag item, rdEntity user)
    {
        switch (Status)
        {
        case StationStatus.Ready:
            foreach (RecipeInstruction rm in RecipeMenu)
            {
                foreach (FoodItemTag igts in rm.Ingredients)
                {
                    if (igts == item)
                    {
                        user.DropOffItem();
                        CurrentInstruction = rm;
                        rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
                        rdUIManager.UpdateStationPopups(this.gameObject);
                        //TODO multiple cooks
                        CurrentHoldItems.Add(igts);
                        FoodItemTag[] reqs         = CurrentInstruction.Ingredients;
                        bool          startCooking = CurrentHoldItems.OrderBy(x => x).SequenceEqual(reqs.OrderBy(x => x));
                        if (startCooking)
                        {
                            StartTask(user);
                        }
                        return(CurrentInstruction.Type == TaskType.Active);
                    }
                }
            }
            break;

        case StationStatus.Collect:
            if (user.CollectItem(CurrentInstruction.Result))
            {
                Status = StationStatus.Ready;
            }

            RecipeMenu.Remove(CurrentInstruction);
            CurrentHoldItems.Clear();
            //OnHoldInstructionUpdate();
            rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
            rdUIManager.UpdateStationPopups(this.gameObject);
            rdRecipeManager.UpdateInstruction(user.ItemOnHand);
            break;

        default:
            return(false);
        }
        return(false);
    }
예제 #25
0
        private ServiceResult Execute(ISystemContext context, MethodState method, IList <object> inputArguments, IList <object> outputArguments)
        {
            if (m_status == StationStatus.Fault)
            {
                ServiceResult result = new ServiceResult(new Exception("Machine is in fault state, call reset first!"));
                return(result);
            }

            m_productSerialNumber = (ulong)inputArguments[0];

            m_status = StationStatus.WorkInProgress;

            m_stationClock.Change((int)m_actualCycleTime, (int)m_actualCycleTime);

            return(ServiceResult.Good);
        }
        public void ReadStationStatus(byte[] piBytes, StationStatus expectedStationStatus)
        {
            ushort[] piRegisters = new ushort[piBytes.Length / 2];
            Buffer.BlockCopy(piBytes, 0, piRegisters, 0, piBytes.Length);

            var mock = new Mock <AlfenNG9xx.Alfen>(new Config()
            {
                Host = "192.168.1.9", Port = 502, Type = "LAN"
            }, new TestPriceProvider());

            mock.Protected()
            .Setup <ushort[]>("ReadHoldingRegisters", ItExpr.IsAny <byte>(), ItExpr.IsAny <ushort>(), ItExpr.IsAny <ushort>())
            .Returns <byte, ushort, ushort>((slave, address, count) => { return(piRegisters); });

            var ss = mock.Object.ReadStationStatus();

            Assert.Equal(expectedStationStatus.ActiveMaxCurrent, ss.ActiveMaxCurrent);
            Assert.Equal(expectedStationStatus.Temperature, ss.Temperature);
            Assert.Equal(expectedStationStatus.OCCPState, ss.OCCPState);
            Assert.Equal(expectedStationStatus.NrOfSockets, ss.NrOfSockets);
        }
예제 #27
0
    //TODO, restrict to put anything on unecessary on plates
    public override bool Interact(FoodItemTag item, rdEntity user)
    {
        switch (Status)
        {
        case StationStatus.Inactive:
            if (user.ItemOnHand == FoodItemTag.None)
            {
                return(false);
            }
            CurrentlyHolding.Add(user.ItemOnHand);
            user.DropOffItem();
            bool correctDish = CurrentlyHolding.OrderBy(x => x).SequenceEqual(_requiredMenus.OrderBy(x => x));
            //need to be checked again XD
            if (correctDish)
            {
                Status       = StationStatus.Collect;
                FinalPlating = rdRecipeManager.Seele._currentRecipe.DishName;
                rdUIManager.UpdateStationPopups(this.gameObject, FinalPlating);
                rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
                return(false);
            }
            rdUIManager.UpdateStationPopups(gameObject);
            rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
            break;

        case StationStatus.Collect:
            CurrentlyHolding.Clear();
            user.ItemOnHand = FinalPlating;
            ReadySound.PlayAtPoint(transform.position);
            Status = StationStatus.Inactive;
            rdUIManager.UpdateStationPopups(gameObject);
            rdUIManager.UpdateOnHandItem(user.ItemOnHand, user);
            break;

        default:
            break;
        }
        return(false);
    }
예제 #28
0
 void TaskDone()
 {
     User.SendMessageToBrain((int)PlayerCommand.WorkDone);
     Debug.Log(CurrentInstruction.Result + " Done");
     LoopSound.Stop();
     if (CurrentInstruction.Type == TaskType.Active)
     {
         User.CollectItem(CurrentInstruction.Result);
         RecipeMenu.Remove(CurrentInstruction);
         CurrentHoldItems.Clear();
         //OnHoldInstructionUpdate();
         rdUIManager.UpdateOnHandItem(User.ItemOnHand, User);
         rdUIManager.UpdateStationPopups(this.gameObject);
         rdRecipeManager.UpdateInstruction(User.ItemOnHand);
         Status = StationStatus.Ready;
     }
     else
     {
         rdUIManager.UpdateStationPopups(this.gameObject, CurrentInstruction.Result);
         Status = StationStatus.Collect;
     }
     User = null;
 }
예제 #29
0
파일: ModelOperate.cs 프로젝트: licanwen/op
        private Color StationStatusColor(StationStatus status)
        {
            switch (status)
            {
            case StationStatus.模组报警:
                return(Color.Red);

            case StationStatus.模组未准备好:
                return(Color.Orange);

            case StationStatus.模组准备好:
                return(Color.Blue);

            case StationStatus.模组运行中:
                return(Color.Green);

            case StationStatus.模组暂停中:
                return(Color.Purple);

            default:
                return(Color.Red);
            }
        }
예제 #30
0
        public static List <Station> GetStations(StationStatus status = StationStatus.None)
        {
            List <Tuple <string, object> > args = new List <Tuple <string, object> >();

            args.Add(new Tuple <string, object>("Status", (int)status));
            var ds = GetDataSet("sp_GetStations", args);

            List <Station> stations = new List <Station>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                stations.Add(new Station()
                {
                    Id              = int.Parse(ds.Tables[0].Rows[i][0].ToString()),
                    Name            = ds.Tables[0].Rows[i][1].ToString(),
                    Description     = ds.Tables[0].Rows[i][2].ToString(),
                    Status          = (StationStatus)int.Parse(ds.Tables[0].Rows[i][3].ToString()),
                    Priority        = int.Parse(ds.Tables[0].Rows[i][4].ToString()),
                    NumberOfWorkers = int.Parse(ds.Tables[0].Rows[i][5].ToString())
                });
            }

            return(stations);
        }
예제 #31
0
        public static List <SortedScheduleConstrains> GetSortedStationConstrains(int wsid)
        {
            List <SortedScheduleConstrains> list = new List <SortedScheduleConstrains>();

            try
            {
                List <Tuple <string, object> > args = new List <Tuple <string, object> >();
                args.Add(new Tuple <string, object>("WSID", wsid));
                var ds = GetDataSet("sp_GetSortedStationConstrains", args);

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    var row = ds.Tables[0].Rows[i];

                    int           day             = (int)row["Day"];
                    int           shift           = (int)row["ShiftTime"];
                    int           id              = (int)row["StationId"];
                    int           priority        = (int)row["Priority"];
                    int           numberOfWorkers = (int)row["NumberOfWorkers"];
                    StationStatus status          = (StationStatus)row["Status"];

                    var ssc = new SortedScheduleConstrains();
                    ssc.StationId       = id;
                    ssc.Status          = status;
                    ssc.Day             = day;
                    ssc.NumberOfWorkers = numberOfWorkers;
                    ssc.Priority        = priority;
                    ssc.ShiftTime       = shift;

                    list.Add(ssc);
                }
            }
            catch { }

            return(list);
        }
 public StationStatus WithAvailableStands(int @availableStands)
 {
     var _instance = new StationStatus(Station, AvailableBikes, @availableStands);
     return _instance;
 }
 public StationStatus WithStation(Station @station)
 {
     var _instance = new StationStatus(@station, AvailableBikes, AvailableStands);
     return _instance;
 }
 public static StationStatus Create(Station @station, int @availableBikes, int @availableStands)
 {
     var _instance = new StationStatus(@station, @availableBikes, @availableStands);
     return _instance;
 }
예제 #35
0
 public Station()
 {
     _devices = new List <TurnOnOffDevice>();
     Status   = StationStatus.Stopped;
 }