Exemplo n.º 1
0
        private void ReleasePreviousLoad()
        {
            if (previousLoadWaitingStatus != null && previousLoadWaitingStatus.LoadWaiting)
            {
                Load previousLoad = previousLoadWaitingStatus.WaitingLoad;

                // Check if load is a tray if not let the load pass through
                if (previousLoad == null && previousLoad.GetType() != typeof(Tray))
                {
                    forcePassThrough = true;
                    StackLoads();
                }
                else
                {
                    Tray previousTrayLoad = (Tray)previousLoad;
                    if (previousTrayLoad.Status != TrayStatus.Empty)
                    {
                        forcePassThrough = true;
                        StackLoads();
                    }
                    else
                    {
                        forcePassThrough = false;
                    }
                }
                if (ThisRouteStatus != null && ThisRouteStatus.Available == RouteStatuses.Request && !loadActive)
                {
                    ChangeStatusToAvailable();
                }
            }
        }
        public void Work()
        {
            while (true)
            {
                if (Monitor.TryEnter(Tray))
                {
                    int amount = rng.Next(1, 4);

                    for (int i = 0; i < amount; i++)
                    {
                        if (Tray.Position == 0)
                        {
                            break;
                        }

                        Drink drink = Tray.Pull();
                        Thread.Sleep(rng.Next(100, 250));
                        PulledDrink?.Invoke(drink);
                    }
                    Monitor.Pulse(Tray);
                    Monitor.Exit(Tray);
                }
                Thread.Sleep(3000);
            }
        }
Exemplo n.º 3
0
 private void StackLoads()
 {
     loadStacks++;
     stackedLoad = GetStackedLoad();
     currentLoad = GetCurrentLoad();
     if (currentLoad != null)
     {
         if (stackedLoad != null)
         {
             loadStacks = stackedLoad.Grouped.Items.Count + 2;
         }
         // Check whether the load entering is already a stack or loaded
         // If so allow it to pass through
         if (currentLoad.Status == TrayStatus.Stacked || currentLoad.Status == TrayStatus.Loaded)
         {
             currentLoad.UserDeletable = true;
             loadStacks = stackerInfo.StackLimit;
         }
     }
     if (loadStacks < stackerInfo.StackLimit && !forcePassThrough)
     {
         // Switch the load from the current conveyor into the stack conveyor
         MoveLoadToStack();
     }
     else
     {
         // Move the stack back on the conveyor
         MoveLoadBackToConveyor();
     }
 }
Exemplo n.º 4
0
 private void MoveLoadBackToConveyor()
 {
     currentLoad = GetCurrentLoad();
     stackedLoad = GetStackedLoad();
     if (stackedLoad != null)
     {
         var stackedLoads      = stackedLoad.Grouped.Items;
         var stackedLoadsCount = stackedLoads.Count;
         stackedLoad.UnGroup();
         // First move the stacked load itself
         stackedLoad.Switch(TransportSection.Route, stackedLoad.Distance - 0.001f, true);
         if (currentLoad != null)
         {
             currentLoad.Group(stackedLoad, new Vector3(0, TrayHeight + 0.005f, 0));
         }
         // Second move all the loads that were previously grouped to it
         for (int i = 0; i < stackedLoadsCount; i++)
         {
             stackedLoads[i].Switch(TransportSection.Route, true);
             if (currentLoad != null)
             {
                 currentLoad.Group(stackedLoads[i], new Vector3(0, (TrayHeight + 0.005f) * (i + 2), 0));
             }
             else
             {
                 stackedLoad.Group(stackedLoads[i], new Vector3(0, (TrayHeight + 0.005f) * (i + 1), 0));
             }
         }
     }
     ReleaseLoad();
 }
Exemplo n.º 5
0
        public async Task <TrayDto> AddTray(Guid userId, long boxId, TrayCreationData data)
        {
            using (Context)
            {
                var user = await GetUserById(userId);

                var box = await Context.Boxes
                          .Include(b => b.User)
                          .Where(b => b.Id == boxId && b.User == user)
                          .FirstOrDefaultAsync();

                ExceptionExtensions.ThrowIfNull(
                    () => box,
                    e => new TrayNotFoundException(TrayNotFoundException.NoTrayId, e));

                var tray = new Tray
                {
                    Box      = box,
                    Interval = data.Interval,
                    Name     = data.Name,
                    User     = user
                };

                var newTray = await Context.AddAsync(tray);

                await Context.SaveChangesAsync();

                return(newTray.Entity.ToTrayDto());
            }
        }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (Trays.Where(t => t.Category == TrayViewModel.Category && t.TrayNb == TrayViewModel.TrayNb).Count() != 0)
            {
                return;
            }
            Tray tray = new Tray()
            {
                Id = Trays.Count + 1,
                // 表示未放置到料架上
                Status           = TrayStatus.TS_Idle,
                UseCmmNo         = -1,
                Category         = TrayViewModel.Category,
                TrayNb           = TrayViewModel.TrayNb,
                CmmNo            = TrayViewModel.CmmNo,
                SlotNb           = -1,
                ColumnCount      = TrayViewModel.ColumnCount,
                RowCount         = TrayViewModel.RowCount,
                ColumnOffset     = TrayViewModel.ColumnOffset,
                RowOffset        = TrayViewModel.RowOffset,
                BaseColumnOffset = TrayViewModel.BaseColumnOffset,
                BaseRowOffset    = TrayViewModel.BaseRowOffset,
                Placed           = false,
                Parts            = new ObservableCollection <Part>()
            };

            for (int i = 0; i < tray.ColumnCount * tray.RowCount; i++)
            {
                tray.Parts.Add(new Part()
                {
                    Id = i, SlotNb = i + 1, Status = PartStatus.PS_Empty
                });
            }
            Trays.Add(tray);
        }
Exemplo n.º 7
0
 public void Edit([FromBody] Tray tray)
 {
     if (ModelState.IsValid)
     {
         objtray.UpdateTray(tray);
     }
 }
Exemplo n.º 8
0
        /* This is a signal handler for console signals.
         * It is called by the system in a separate thread so we have to be careful here.
         * "When the signal is received, the system creates a new thread in the process to execute
         * the function."
         * https://docs.microsoft.com/en-us/windows/console/handlerroutine
         * Note .NET can handle CTRL_C and CTRL_BREAK events via Console.CancelKeyPress but it can't
         * handle CTRL_CLOSE which is why I used this handler routine and the Win32 API instead.
         */
        private static bool ConsoleCtrlHandlerRoutine(CtrlTypes ctrlType)
        {
            switch (ctrlType)
            {
            case CtrlTypes.CTRL_C_EVENT:
            case CtrlTypes.CTRL_BREAK_EVENT:
                /* We handle these for consistency. Application.Exit() causes Application.Run()
                 * in the main thread to return followed by a graceful cleanup. If we didn't
                 * handle these signals then ExitProcess may or may not be called, depending on
                 * whether or not any other handlers handle these signals.
                 */
                Application.Exit();
                return(true);

            case CtrlTypes.CTRL_CLOSE_EVENT:
                /* For this event it appears ExitProcess is imminent even if the event is
                 * handled. Instead we just won't handle it and we'll assume an impending exit.
                 * The system will wait several seconds for this handler before terminating the
                 * process (observed in Windows 8.1). There's basically nothing guaranteed to
                 * finish at this point but we make an attempt at disposing of the tray icon so
                 * it doesn't linger.
                 */
                UISyncContext.Send(delegate { if (Tray != null)
                                              {
                                                  Tray.Dispose();
                                              }
                                   }, null);
                return(false);
            }
            return(false);
        }
Exemplo n.º 9
0
 private void DestackLoads()
 {
     // Check whether the load entering is loaded and if so allow it to pass through
     currentLoad = GetCurrentLoad();
     currentLoad.UserDeletable = true;
     if (currentLoad.Status != TrayStatus.Loaded)
     {
         var currentStackedLoads = currentLoad.Grouped.Items;
         currentLoad.DetachStackedTrays();
         currentLoad.Status = TrayStatus.Empty;
         stackedLoad        = GetStackedLoad();
         if (stackedLoad == null)
         {
             // Take first from stack and add to stacker conveyor
             if (currentStackedLoads.Count > 0)
             {
                 currentStackedLoads[0].Switch(stackConveyor.TransportSection.Route, currentLoad.Distance, true);
                 stackedLoad = GetStackedLoad();
                 // Then group the rest with the load just added
                 for (int i = 1; i < currentStackedLoads.Count; i++)
                 {
                     currentStackedLoads[i].Switch(stackConveyor.TransportSection.Route, currentLoad.Distance, true);
                     stackedLoad.Group(currentStackedLoads[i], new Vector3(0, (TrayHeight + 0.005f) * i, 0));
                 }
             }
         }
     }
     //// Add short delay before releasing first load from the stack
     releaseLoadTimer.OnElapsed += ReleaseLoad_OnElapsed;
     releaseLoadTimer.Start();
 }
Exemplo n.º 10
0
        internal async Task <JsonResult> DeleteTray(Tray tray)
        {
            SqlConnection cn = null;

            try
            {
                cn = Connection.GetConnection();
                SqlCommand smd = new SqlCommand("tray_delete", cn)
                {
                    CommandType = CommandType.StoredProcedure
                };
                smd.Parameters.AddWithValue("@location_id", tray.LocationId);
                smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output;
                smd.Parameters.AddWithValue("@tray_id", tray.TrayID);
                await smd.ExecuteNonQueryAsync().ConfigureAwait(false);

                string json = smd.Parameters["@jsonOutput"].Value.ToString();
                smd.Dispose();
                JArray arr = JArray.Parse(json);
                return(new JsonResult(arr));
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Connection.CloseConnection(ref cn);
            }
        }
Exemplo n.º 11
0
 public void Create([FromBody] Tray tray)
 {
     if (ModelState.IsValid)
     {
         objtray.AddTray(tray);
     }
 }
Exemplo n.º 12
0
 public override void LineReleasePhotocell_OnPhotocellStatusChanged(object sender, PhotocellStatusChangedEventArgs e)
 {
     if (e._PhotocellStatus == PhotocellState.Blocked)
     {
         e._Load.UserDeletable     = false;
         ThisRouteStatus.Available = RouteStatuses.Blocked;
         DestackLoads();
         SetLoadWaiting(true, false, e._Load);
     }
     else if (e._PhotocellStatus == PhotocellState.Clear)
     {
         if (e._Load != null)
         {
             e._Load.UserDeletable = true;
         }
         stackedLoad = GetStackedLoad();
         if (stackedLoad != null)
         {
             // Add short delay before making next available load available
             ThisRouteStatus.Available       = RouteStatuses.Blocked;
             repositionLoadsTimer.OnElapsed += RepositionLoads_OnElapsed;
             repositionLoadsTimer.Start();
         }
         else
         {
             SetLoadWaiting(false, false, e._Load);
             ThisRouteStatus.Available = RouteStatuses.Available;
         }
     }
 }
Exemplo n.º 13
0
    public static void Main(string[] args)
    {
        Factory factory = Factory.GetFactory(args[0]);

        Link jpGoogle = factory.CreateLink("google-jp", "https://www.google.co.jp");
        Link jpYahoo  = factory.CreateLink("yahoo-jp", "http://www.yahoo.co.jp");

        Link usGoogle = factory.CreateLink("google-us", "https://www.google.com");
        Link usYahoo  = factory.CreateLink("yahoo-us", "http://www.yahoo.com");

        Tray trayGoogle = factory.CreateTray("Google");

        trayGoogle.Add(jpGoogle);
        trayGoogle.Add(usGoogle);

        Tray trayYahoo = factory.CreateTray("Yahoo");

        trayYahoo.Add(jpYahoo);
        trayYahoo.Add(usYahoo);

        Tray traySearch = factory.CreateTray("Search Engine");

        traySearch.Add(trayGoogle);
        traySearch.Add(trayYahoo);

        Page page = factory.CreatePage("LinkPage", "John Smith");

        page.Add(traySearch);
        page.OutPut();
    }
Exemplo n.º 14
0
        static private void getMissTasks()
        {
            int    n    = 0;
            string text = "";

            string[,] list = Network.Task_List(1, 0, DateTime.Now.Ticks, 3, -1, "%All%", "");
            for (int i = 0; i < list.Length / 10; i++)
            {
                if (Convert.ToInt64(list[i, 4]) < DateTime.Now.Ticks)
                {
                    n++;
                    text += n.ToString() + ". " + list[i, 0] + "\r\n";
                }
            }
            if (text.Length > 2)
            {
                text = text.Substring(0, text.Length - 2);
            }

            if (n != 0)
            {
                Tray.SetStatusMiss(n, text);
                Thread.Sleep(15000);
            }
            else
            {
                Tray.SetStatusNormal();
            }
        }
Exemplo n.º 15
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     Tray.ShowBalloonTip(5);
     this.WindowState   = FormWindowState.Minimized;
     this.ShowInTaskbar = false;
     e.Cancel           = true;
 }
Exemplo n.º 16
0
 private void UnloadTraysFromSlot()
 {
     if (SelectedTypeId == 0)
     {
         if (SelectedTrayInRack == null ||
             SelectedTrayInRack.Status == TrayStatus.TS_Empty)
         {
             return;
         }
         // 测量过程中不能调整料库
         if (Racks[0].Status == RackStatus.RS_Busy)
         {
             return;
         }
         int  index = SelectedTrayInRack.SlotNb - 1;
         Tray tray  = SelectedTrayInRack;
         //tray.Status = TrayStatus.TS_Idle;
         tray.SlotNb = -1;
         tray.Placed = false;
         Tray emptyTray = new Tray()
         {
             SlotNb = index + 1,
             Status = TrayStatus.TS_Empty
         };
         Racks[0].Trays[index] = emptyTray;
     }
 }
Exemplo n.º 17
0
 private void trayShowStatistic_Click(object sender, EventArgs e)
 {
     Tray.BalloonTipIcon  = ToolTipIcon.Info;
     Tray.BalloonTipTitle = "Statistics";
     Tray.BalloonTipText  = Helper.RawStatisitc();
     Tray.ShowBalloonTip(5000);
 }
Exemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        _door = GameObject.Find("Door").GetComponent <Door>();
        _tray = GameObject.Find("Tray").GetComponent <Tray>();

        oneThirdDaySeconds = dayLengthSeconds / 3;
    }
Exemplo n.º 19
0
        private void UnloadTrayFromRack()
        {
            if (SelectedTray == null ||
                SelectedTray.Status == TrayStatus.TS_Empty)
            {
                return;
            }
            if (Rack.Status == RackStatus.RS_Busy)
            {
                return;
            }
            int  index = SelectedTray.SlotNb - 1;
            Tray tray  = SelectedTray;

            //tray.Status = TrayStatus.TS_Idle;
            tray.SlotNb = -1;
            tray.Placed = false;
            Tray emptyTray = new Tray()
            {
                SlotNb = index + 1,
                Status = TrayStatus.TS_Empty
            };

            Rack.Trays[index] = emptyTray;
        }
Exemplo n.º 20
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     Tray.ShowBalloonTip(5);
     this.WindowState   = FormWindowState.Minimized;
     this.ShowInTaskbar = false;
     e.Cancel           = true;
     logger.Info("Tekla_Interaction свернута в трей");
 }
Exemplo n.º 21
0
 public TestBindable()
 {
     Tray = new Tray()
     {
         Id = 2
     };
     xxx = 500;
 }
Exemplo n.º 22
0
 private void NotiInit()
 {
     Tray.Visible         = true;
     Tray.BalloonTipTitle = "KAC For CSGO";
     Tray.BalloonTipText  = "Welcome To KAC Official Server Program For CSGO";
     Tray.BalloonTipIcon  = ToolTipIcon.Info;
     Tray.ShowBalloonTip(1);
 }
Exemplo n.º 23
0
 public void Quit()
 {
     _quitting = true;
     MainWindow?.Close();
     Tray?.Dispose();
     Tray = null;
     Discord?.Quit();
     Current?.Shutdown();
 }
Exemplo n.º 24
0
    //EVERYTHING IN THIS SCRIPT USES LOCALPOSITION

    void Awake()
    {
        traySlot      = transform.FindChild("TraySlot");
        eyeSlot       = transform.FindChild("EyeSlot");
        _tray         = GameObject.Find("Tray").GetComponent <Tray>();
        dramaLight    = GameObject.Find("DramaLight");
        r_sleepScript = GameObject.Find("Player").GetComponent <SleepingAndWaking>();
        audio         = GetComponent <AudioSource>();
    }
Exemplo n.º 25
0
 public void Create()
 {
     for (int i = 0; i < size; i++)
     {
         Tray newTray = Instantiate(trayPrefab, this.transform);
         GameManager.INSTANCE.trayList.Add(newTray);
         newTray.gameObject.SetActive(false);
     }
 }
Exemplo n.º 26
0
 void notification(string ip, string steamid)
 {
     Tray.Visible         = true;
     Tray.BalloonTipTitle = "KAC";
     Tray.BalloonTipTitle = "New Connection";
     Tray.BalloonTipText  = "SteamID : " + steamid + " IP : " + ip;
     Tray.BalloonTipIcon  = ToolTipIcon.Info;
     Tray.ShowBalloonTip(1);
 }
Exemplo n.º 27
0
        private void OnLeftMouseUp(object sender, RoutedEventArgs e)
        {
            // Act as if right click. Open menu.
            Tray.ContextMenu.IsOpen = true;

            // Give focus back to the tray so that the TrayMouseDoubleClick event
            // can still be triggered.
            Tray.Focus();
        }
Exemplo n.º 28
0
        static private void Authentification()
        {
            if (Config.UserConID == -1)
            {
                Connected = false;
                int r = -1;
                if (Config.user_NameMain != "" && Config.user_Pass != "" && Config.login_Auto == true)
                {
                    r = Network.User_Auth(Config.user_NameMain, Config.user_Pass);

                    if (r == -1)
                    {
                        Tray.SetStatusError();
                        Thread.Sleep(5000);
                    }
                    else if (r == 0)
                    {
                        if (Login() == false)
                        {
                            return;
                        }
                    }
                    else if (r == 1)
                    {
                        Connected = true;
                        Tray.SetStatusNormal();
                    }
                    else if (r == 2)
                    {
                        if (ChangePassword() == false)
                        {
                            return;
                        }
                    }
                    else if (r == 3)
                    {
                        DialogResult dr = new Tasks.Update.Changelog().ShowDialog();
                        if (dr == DialogResult.Yes)
                        {
                            new Tasks.Update.Progress(0).ShowDialog();
                            Application.Exit();
                        }
                    }
                }
                else
                {
                    if (Login() == false)
                    {
                        return;
                    }
                }
            }
            else
            {
                Connected = true;
            }
        }
Exemplo n.º 29
0
        private Tray GetStackedLoad()
        {
            Tray tray = null;

            if (stackConveyor.TransportSection.Route.Loads.Count > 0)
            {
                tray = (Tray)stackConveyor.TransportSection.Route.Loads.First();
            }
            return(tray);
        }
Exemplo n.º 30
0
 public static TrayDto ToTrayDto(this Tray tray)
 {
     return(new TrayDto
     {
         Name = tray.Name,
         BoxId = tray.Box.Id,
         Id = tray.Id,
         Interval = tray.Interval
     });
 }
Exemplo n.º 31
0
 public bool AddTray(string checkCode, int AccountID, Tray entity, int[] StockLotIDs, bool isQiangDa, ref int Qty, ref string[] Boxs, ref string ErrMsg)
 {
     try
     {
         return _client.AddTray(checkCode, AccountID, entity, StockLotIDs, isQiangDa, ref Qty, ref  Boxs, ref ErrMsg);
     }
     catch (Exception ex)
     {
         ErrMsg = ex.Message;
         return false;
     }
 }
Exemplo n.º 32
0
 public void trayFill(Tray<Tablet> trayList)
 {
     cell0.Text = colToString(trayList.Cells[0]);
     cell1.Text = colToString(trayList.Cells[1]);
     cell2.Text = colToString(trayList.Cells[2]);
     cell3.Text = colToString(trayList.Cells[3]);
     cell4.Text = colToString(trayList.Cells[4]);
     cell5.Text = colToString(trayList.Cells[5]);
     cell6.Text = colToString(trayList.Cells[6]);
     cell7.Text = colToString(trayList.Cells[7]);
     cell8.Text = colToString(trayList.Cells[8]);
     //textBox1.Text = b;
 }
Exemplo n.º 33
0
        public Assembler(ClusterConfig config)
            : base(config)
        {
            _assemblerRobot = config.Robots[typeof(AssemblerRobot)] as AssemblerRobot;
            this._cancelTokenSource = new CancellationTokenSource();
            this.LastOrderTray = null;

            if (_assemblerRobot == null)
            {
                throw new ArgumentException("Could not retrieve a AssemblerRobot from ClusterConfig");
            }

            _actionMap = new Dictionary<AssemblerAction, Action<AssemblerParams>>()
            {
                { AssemblerAction.Assemble, (x) => AssembleAsync(x.Magazine, x.OrderConfiguration) },
                { AssemblerAction.GetTabletMagazine, (x) => GetTabletMagazineAsync() },
                { AssemblerAction.ReturnTabletMagazine, (x) => ReturnTabletMagazineAsync() }
            };
        }
Exemplo n.º 34
0
        private VerificationResult DetermineValidity(Tray<Tablet> t1, Tray<Tablet> t2)
        {
            var validity = (t1.Equals(t2)) ? VerificationResult.Valid : VerificationResult.Invalid;

            return validity;
        }
Exemplo n.º 35
0
 public IAsyncResult BeginModifyTray(string checkCode, int AccountID, Tray entity, int StockLotID, ref int Qty, ref string ErrMsg, AsyncCallback callback, object asyncState)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 36
0
 public IAsyncResult BeginAddTray(string checkCode, int AccountID, Tray entity, int[] StockLotIDs, bool isQiangDa, ref int Qty, ref string[] Boxs, ref string ErrMsg, AsyncCallback callback, object asyncState)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 37
0
 public bool ModifyTray(string checkCode, int AccountID, Tray entity, int StockLotID, ref int Qty, ref string ErrMsg)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 38
0
 private void VerifyTrayAsync(Tray<Tablet> tray, VerificationMode mode)
 {
     Task.Run(() =>
         {
             Logger.Instance.Write(String.Format("[TrayVerifier] Detecting tray. Verification mode: {0}", mode));
             Tray<Tablet> detectedTray;
             bool isTrayVisible = _trayDetector.GetTabletsInTray(out detectedTray);
             VerificationResult verResult = VerificationResult.Invalid;
             if (isTrayVisible)
             {
                 if (mode == VerificationMode.Tray)
                 {
                     tray = new Tray<Tablet>();
                 }
                 verResult = DetermineValidity(tray, detectedTray);
             }
             Logger.Instance.Write(String.Format("[TrayVerifier] Is tray visible? {0}, tray validity: {1}",
                                     isTrayVisible, verResult));
             IsRunning = false;
             OnCompleted(new OnVerificationCompleteEventArgs
                 {
                     DetectedTray = detectedTray,
                     VerificationResult = verResult,
                     VerificationMode = mode,
                     OperationStatus = ControllerOperationStatus.Succeeded
                 });
         });
 }
Exemplo n.º 39
0
        private Tray<Tablet> MapOrderToTray(OrderConfiguration orderConfig)
        {
            int trayIndex = 0;
            var tray = new Tray<Tablet>();
            var tabletCollection = orderConfig.Tablets.Where(x => x.Value > 0);
            int totalTablets = 0;
            tabletCollection.ToList().ForEach(x => totalTablets += x.Value);

            if (totalTablets > Tray<Tablet>.MaxUsableCells)
            {
                throw new Exception(String.Format("The number of tablets in the order exceeds number of usable tray cells ({0} > {1})",
                                        totalTablets, Tray<Tablet>.MaxUsableCells));
            }

            foreach (var pair in tabletCollection)
            {
                var numTablets = pair.Value;
                for (int i = 0; i < numTablets; i++)
                {
                    if (trayIndex == Tray<Tablet>.MiddleCellIndex)
                    {
                        trayIndex++;
                    }
                    tray.Cells[trayIndex] = new Tablet() { Color = pair.Key };
                    trayIndex++;
                }
            }

            return tray;
        }
Exemplo n.º 40
0
        private ControllerOperationStatus Assemble(TabletMagazine mag, OrderConfiguration orderConfiguration, CancellationToken ct)
        {
            var status = ControllerOperationStatus.Succeeded;
            try
            {
                var tray = MapOrderToTray(orderConfiguration);
                for (int i = 0; i < tray.Cells.Count; i++)
                {
                    var tablet = tray.Cells[i];

                    if(tablet == null)
                    {
                        continue;
                    }

                    if (ct.IsCancellationRequested)
                    {
                        status = ControllerOperationStatus.Cancelled;
                        return status;
                    }
                    else
                    {
                        var slotDepth = mag.GetSlotDepth(tablet.Color);
                        mag.RemoveTablet(tablet.Color);
                        var slotIndex = mag.GetSlotIndexReversed(tablet.Color);
                        Logger.Instance.Write(String.Format("[Assembler] Placing ({0}) tablet from slot {1} into slot {2}",
                            tablet.Color, slotIndex, i));
                        _assemblerRobot.PlaceTablet(slotIndex, slotDepth, i);
                    }
                }
                status = ControllerOperationStatus.Succeeded;
                LastOrderTray = tray;
            }
            catch (Exception ex)
            {
                var outer = new Exception("[Assembler] Assembler failed to assemble.", ex);
                Logger.Instance.Write(new LogEntry(outer));
                status = ControllerOperationStatus.Failed;
            }
            return status;
        }
Exemplo n.º 41
0
        /// <summary>
        /// This function is resoncible for working out the state of trays
        /// </summary>
        /// <returns>
        /// it returns the state of the tray
        /// </returns>
        /// <note>use the new function in vision base to detect tablet colour</note>
        public bool GetTabletsInTray(out Tray<Tablet> tray)
        {
            trayList = new Tray<Tablet>();
            img = camera.GetImage(1);//C:/Users/leonid/Dropbox/ICT DESIGN/Assignment 3/vision/cal
            //img = new Image<Bgr, byte>("C:/Users/leonid/Dropbox/ICT DESIGN/Assignment 3/vision/cal/trayGRE.jpg");
            //img = camera.GetImageHttp(new Uri(@"http://www.wwrd.com.au/images/P/2260248_Fable%20s-4%2016cm%20Accent%20Plates-652383734586-co.jpg"));

            Image<Bgr, Byte> src = CropImage(img, 0, 877, img.Cols, 902);//reduce the image so we only see the coveour and tray

            saveImage(src, "croped Image.jpg");

            if (DetectTray(src) == false)//make a ref angle
            {
                tray = trayList;
                return false;
            }

            trayList.Angle = Angle;

            foreach (Point traypoint in trayPoints)
            {//draw dots just for debuging atm
                Rectangle rect = new Rectangle();
                rect.X = traypoint.X;
                rect.Y = traypoint.Y;
                rect.Width = 2;
                rect.Height = 2;
                src.Draw(rect, new Bgr(Color.Red), 6);
            }
            saveImage(img, "orig image.jpg");
            saveImage(src, "Image with points.jpg");

            DetectTabletsInTray();
            DetectTabletType();

            //saveImage(apply_Hough(img), "lines in tray.jpg");
            tray = trayList;
            return true;
        }
Exemplo n.º 42
0
 public bool Add_(Tray entity, int[] StockLotIDs, bool isQiangDa, ref int Qty, ref string[] Boxs, ref string ErrMsg)
 {
     return Proxy.AddTray(CurrentAccount.CheckCode, CurrentAccount.ID, entity, StockLotIDs, isQiangDa, ref Qty, ref Boxs, ref ErrMsg);
 }