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); } }
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(); } }
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(); }
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); }
public void Edit([FromBody] Tray tray) { if (ModelState.IsValid) { objtray.UpdateTray(tray); } }
/* 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); }
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(); }
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); } }
public void Create([FromBody] Tray tray) { if (ModelState.IsValid) { objtray.AddTray(tray); } }
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; } } }
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(); }
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(); } }
private void Main_FormClosing(object sender, FormClosingEventArgs e) { Tray.ShowBalloonTip(5); this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; e.Cancel = true; }
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; } }
private void trayShowStatistic_Click(object sender, EventArgs e) { Tray.BalloonTipIcon = ToolTipIcon.Info; Tray.BalloonTipTitle = "Statistics"; Tray.BalloonTipText = Helper.RawStatisitc(); Tray.ShowBalloonTip(5000); }
// Use this for initialization void Start() { _door = GameObject.Find("Door").GetComponent <Door>(); _tray = GameObject.Find("Tray").GetComponent <Tray>(); oneThirdDaySeconds = dayLengthSeconds / 3; }
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; }
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 свернута в трей"); }
public TestBindable() { Tray = new Tray() { Id = 2 }; xxx = 500; }
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); }
public void Quit() { _quitting = true; MainWindow?.Close(); Tray?.Dispose(); Tray = null; Discord?.Quit(); Current?.Shutdown(); }
//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>(); }
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); } }
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); }
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(); }
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; } }
private Tray GetStackedLoad() { Tray tray = null; if (stackConveyor.TransportSection.Route.Loads.Count > 0) { tray = (Tray)stackConveyor.TransportSection.Route.Loads.First(); } return(tray); }
public static TrayDto ToTrayDto(this Tray tray) { return(new TrayDto { Name = tray.Name, BoxId = tray.Box.Id, Id = tray.Id, Interval = tray.Interval }); }
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; } }
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; }
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() } }; }
private VerificationResult DetermineValidity(Tray<Tablet> t1, Tray<Tablet> t2) { var validity = (t1.Equals(t2)) ? VerificationResult.Valid : VerificationResult.Invalid; return validity; }
public IAsyncResult BeginModifyTray(string checkCode, int AccountID, Tray entity, int StockLotID, ref int Qty, ref string ErrMsg, AsyncCallback callback, object asyncState) { throw new NotImplementedException(); }
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(); }
public bool ModifyTray(string checkCode, int AccountID, Tray entity, int StockLotID, ref int Qty, ref string ErrMsg) { throw new NotImplementedException(); }
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 }); }); }
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; }
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; }
/// <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; }
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); }