private void btnBarcode_Click(int LoadingStation, RoundedPanel btnBarcode, Label lblAction, RoundedPanel btnMoveRollOut) { log.Debug("btnBarcode_Click"); Program.ScanningForLoadingStation = LoadingStation; if ((int)btnBarcode.Tag == 0) { btnBarcode.Visible = false; btnBarcode.Refresh(); Program.ScannedLabelNumber = ""; lblAction.Text = "Scan label on roll now"; btnBarcode.CenteredText = "After Scanning the barcode\r\npush blue button on station to proceed"; btnBarcode.Tag = 1; StartBlueLight(LoadingStation); btnBarcode.Visible = true; btnMoveRollOut.Visible = false; } //else // btnBarcode2.Tag = 0; log.Debug("btnBarcode_Click sent"); }
/// <summary> /// Initializes a new instance of the <see cref="FieldController"/> class. /// </summary> /// <param name="enabled">True if the <see cref="FieldController"/> is modifiable, false otherwise</param> public FieldController(bool enabled) : base() { this.enabled = enabled; titleLabel = new Label() { Text = Title, BackColor = Color.Transparent, Font = new Font("Tahoma", 8, FontStyle.Bold) }; errorPanel = new RoundedPanel() { BorderColor = Color.White, BorderSize = 1, BackColor = Color.Transparent }; errorPanel.Controls.Add(titleLabel); errorPanel.Controls.Add(Content); Controls.Add(errorPanel); if (enabled) { descriptionLabel = new Label() { Text = Description, Font = new Font("Tahoma", 8, FontStyle.Regular), ForeColor = Color.FromArgb(90, 90, 90) }; Controls.Add(descriptionLabel); } UpdateLayout(); }
private void btnPallet(object sender, EventArgs e) { clear_system_message(sender, e); btnBarcode2.Tag = 0; if (DoubleClicked("btnPallet", 1)) { return; } log.Info("changing pallets"); RoundedPanel btn = ((RoundedPanel)sender); btn.Visible = false; StartBlueLight(int.Parse(((RoundedPanel)sender).Tag.ToString())); log.Info("changing pallets sent"); }
private void login_number_clicked(object sender, EventArgs e) { if (sender == null) { return; } RoundedPanel rp = sender as RoundedPanel; string txt = ""; if (rp != null) { txt = rp.CenteredText; } if (string.IsNullOrEmpty(txt)) { return; } if (txt.Length == 1) { txtLoginCode.Text = txtLoginCode.Text + txt; } }
/// <summary> /// Initializes a new instance of the <see cref="ChoiceBoxController"/> class. /// </summary> /// <param name="element">The element representig the related <see cref="ChoiceBox"/></param> /// <param name="enabled">True if the <see cref="ChoiceBox"/> is modifiable, false otherwise</param> public ChoiceBoxController(ChoiceBox element, bool enabled) : base(enabled) { this.element = element; enabledVal = enabled; if (enabled) { groupPanel = new Panel() { Height = 0, Width = this.Width - (2 * padding) }; Panel checksContainer = new Panel() { Width = groupPanel.Width - 40, Dock = DockStyle.Left }; Panel editContainer = new Panel() { Width = 40, Dock = DockStyle.Right }; groupPanel.Controls.Add(checksContainer); groupPanel.Controls.Add(editContainer); for (int i = 0; i < element.Fields.Length; i++) { RadioButton button = new RadioButton() { Enabled = enabled, Top = groupPanel.Height, Font = new Font("Tahoma", 8, FontStyle.Regular), Text = element.Fields[i].Name, Width = checksContainer.Width }; RoundedButton editButton = new RoundedButton() { Width = 38, Height = button.Height - 2, Top = groupPanel.Height, Left = 1, BackColor = Color.FromArgb(236, 236, 236), BorderColor = Color.FromArgb(146, 146, 146), ClickedBackColor = Color.FromArgb(186, 186, 186), Text = "edit", Font = new Font("Tahoma", 8, FontStyle.Regular), ForeColor = Color.FromArgb(90, 90, 90), BorderSize = 1, CornerRadius = 4 }; groupPanel.Height += button.Height + padding; checksContainer.Controls.Add(button); editContainer.Controls.Add(editButton); button.CheckedChanged += OnCheckedChange; editButton.Click += new EventHandler(OnEditButtonClick); if (element.SelectedIndex == i) { button.Checked = true; editButton.Visible = true; } else { editButton.Visible = false; } } groupPanel.Height -= padding; Content = groupPanel; Title = element.Name; Description = element.Description; } else { resultPanel = new RoundedPanel { BackColor = Color.Transparent, BorderColor = Color.FromArgb(90, 90, 90), BorderSize = 1, CornerRadius = 4, Dock = DockStyle.None, Height = 0 }; int buttonMargin = padding; FieldController controller = FieldFactory.CreateController(element.Fields[element.SelectedIndex], false); RadioButton button = new RadioButton() { Checked = true, Enabled = enabled, Font = new Font("Tahoma", 8, FontStyle.Regular), Left = resultPanel.CornerRadius + 1, Text = element.Fields[element.SelectedIndex].Name, Top = buttonMargin }; buttonMargin += button.Height; resultPanel.Controls.Add(button); (controller as Control).Top = buttonMargin; (controller as Control).Left = resultPanel.CornerRadius + 1; (controller as Control).Width = resultPanel.Width - (2 * (resultPanel.CornerRadius + 1)); (controller as Control).Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; buttonMargin += (controller as Control).Height + padding; resultPanel.Controls.Add(controller as Control); resultPanel.Height += buttonMargin + (2 * padding); Content = resultPanel; Title = element.Name; Description = element.Description; } }
private void choose_pic() { openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = @"C:\"; openFileDialog1.Title = "Browse Files"; openFileDialog1.Multiselect = true; openFileDialog1.CheckPathExists = true; openFileDialog1.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp"; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true; openFileDialog1.ReadOnlyChecked = true; openFileDialog1.ShowReadOnly = true; DialogResult dr = openFileDialog1.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { foreach (String file in openFileDialog1.FileNames) { allpic.Add(file); } string path = "", name = ""; for (var i = countpic; i < allpic.Count; i++) { path = allpic[i].ToString(); name = ""; statpic[i] = new CheckBox(); statpic[i].Text = path; pic = new PictureBox(); l = new Label(); rp = new RoundedPanel(); // pic pic.SizeMode = PictureBoxSizeMode.StretchImage; pic.Size = new Size(60, 90); pic.Image = Image.FromFile(path); // name for (var a = path.Length - 1; a >= 0; a--) { if (path[a] == '\\') { break; } name = path[a] + name; } l.Text = name; l.Font = new Font("Arial", 10, FontStyle.Bold); l.ForeColor = Color.White; roundedPanel3.Controls.Add(l); rp.Controls.Add(pic); rp.Controls.Add(l); rp.Controls.Add(statpic[i]); pic.Dock = DockStyle.Top; l.Location = new Point(1, 100); statpic[i].Location = new Point(60, 130); statpic[i].Size = new Size(10, 10); roundedPanel3.Controls.Add(rp); rp.Location = new Point(6, pois_y); rp.Size = new Size(150, 150); rp.Thickness = 0; rp.Radius = 50; rp.BorderColor = Color.FromArgb(50, 0, 0, 0); pois_y += 160; } countpic = allpic.Count; } }
private void refresh_timer_Tick(object sender, EventArgs e) { try { if (!Program.MainIsRunning) { return; } if (!refresh_timer.Enabled) { return; } refresh_timer.Enabled = false; List <Unit> stations = new List <Unit>(); stations.Add(Unit.LS01); stations.Add(Unit.LS02); stations.Add(Unit.LS03); Label lblInfo = null; Label lblAction = null; Label label = null; RoundedPanel btnMoveIn = null; RoundedPanel btnMovePalletIn = null; RoundedPanel btnMovePalletOut = null; RoundedPanel btnBarcode = null; RoundedPanel btnMoveRollOut = null; RoundedPanel btnPauseAutomatic = null; RoundedPanel btnConfirmOutside = null; DateTime last_confirmed = new DateTime(2000, 1, 1); string system_message = ""; bool already_paused = false; foreach (var ls in stations) { if (ls.BlockForManualOrderUntil >= DateTime.UtcNow) { already_paused = true; } } foreach (var ls in stations) { bool reserved = ls.Reserved != 0; string info = ""; if (ls.Unit_ID == 13) { lblInfo = lblInfo2; lblAction = lblAction2; label = label2; btnMoveIn = btnMoveIn2; btnMovePalletIn = btnMovePalletIn2; btnMovePalletOut = btnMovePalletOut2; btnBarcode = btnBarcode2; btnMoveRollOut = btnMoveRollOut2; btnPauseAutomatic = btnPauseAutomaticLS12; btnConfirmOutside = btnConfirmOutside2; system_message = system_message_12; last_confirmed = last_confirmed_2; } else { continue; } if (!ls.LoadingStation_WithPallet && !ls.LoadingStation_WithRoll && ls.Ready && !reserved) { btnMoveIn.Visible = true; if (btnMoveIn.CenteredText != "Move roll in") { btnMoveIn.CenteredText = "Move roll in"; } } else if (ls.LoadingStation_WithRollOnShuttle && ls.Ready && !reserved && !ls.Active) { btnMoveIn.Visible = true; if (btnMoveIn.CenteredText != "Store roll inside") { btnMoveIn.CenteredText = "Store roll inside"; } } else { btnMoveIn.Visible = false; } if (ls.LoadingStation_WithBlueButtonFlashing && last_confirmed.AddSeconds(15) < DateTime.Now) { btnConfirmOutside.Visible = true; if (btnConfirmOutside.InnerFillColor == Color.Blue) { btnConfirmOutside.InnerFillColor = Color.DodgerBlue; } else { btnConfirmOutside.InnerFillColor = Color.Blue; } } else { if (btnConfirmOutside.Visible) { btnConfirmOutside.Visible = false; } } bool btnMovePalletIn_Visible = !ls.LoadingStation_WithPallet && ls.Ready && !reserved; bool btnMovePalletOut_Visible = ls.LoadingStation_WithPallet && ls.Ready && !reserved && !ls.LoadingStation_WithRollOnShuttle; bool with_order = false; int tas = 0; bool with_agv = false; bool from_as400 = false; bool manual_pallet_wanted = false; if (PalletNeeded(ls.Unit_ID, true, forklifter: true)) { btnMovePalletIn_Visible = true; info += "please put pallet inside "; manual_pallet_wanted = true; } else if (PalletNeeded(ls.Unit_ID, false, forklifter: true)) { btnMovePalletOut_Visible = true; info += "please remove pallet "; manual_pallet_wanted = true; } else if (PalletNeeded(ls.Unit_ID, true, forklifter: false)) { info += "pallet coming with agv "; } else if (PalletNeeded(ls.Unit_ID, false, forklifter: false)) { info += "pallet removing with agv "; } else if (ls.Reserved != 0) { var ta = Main.Database.FirstOrDefault <TransportOrder>("SELECT * FROM StorageOrders WITH(NOLOCK) WHERE ID=@0", ls.Reserved); if (ta != null && ta.State != TransportOrder.OrderStates.Done && ta.State != TransportOrder.OrderStates.Error) { info += ta.SimpleString.Replace("station 1", "").Replace("station 2", ""); with_order = true; from_as400 = ta.ID >= 0; if (ta.State == TransportOrder.OrderStates.agv_coming_to_loadingstation || ta.State == TransportOrder.OrderStates.agv_fetching_from_loadingstation) { // info += "AGV coming "; set by server now with_agv = true; } if (!with_agv && ta.Target == 1 && ls.LoadingStation_WithPallet && !ls.Active && !btnMovePalletOut_Visible) { // keine wartenden Aufträge tas = Main.Database.ExecuteScalar <int>( "SELECT COUNT(*) FROM StorageOrders WITH(NOLOCK) " + "WHERE NOT Status IN ('done', 'error', 'timeout', 'cancel')" + " AND ID <> @0 AND (LoadingStation = 0 OR LoadingStation = @1)", ta.ID, ls.Unit_ID); btnMovePalletOut_Visible = tas == 0; } } } btnMovePalletOut.Visible = btnMovePalletOut_Visible; btnMovePalletIn.Visible = btnMovePalletIn_Visible; btnPauseAutomatic.Visible = BauerLib.Registry.ManuallyBlockMaxMinutes > 0 && !already_paused && ((reserved && from_as400) || manual_pallet_wanted) && ((ls.ErrorWord11 & 2048) == 0) && ((ls.ErrorWord05 & 16) == 0); // btnPauseAutomatic.Visible = true; if (manual_pallet_wanted) { ls.LoadingStation_CyanLight(true); if (lblInfo.BackColor != Color.Cyan) { lblInfo.BackColor = Color.Cyan; } } else { ls.LoadingStation_CyanLight(false); } if (!string.IsNullOrWhiteSpace(system_message)) { info = system_message; if (lblInfo.BackColor != Color.Red) { lblInfo.BackColor = Color.Red; lblAction.BackColor = Color.Red; label.BackColor = Color.Red; lblInfo.ForeColor = Color.White; lblAction.ForeColor = Color.White; label.ForeColor = Color.White; } } else if ((ls.ErrorWord05 & 16) != 0) { // Cylinder without barcode info += $"barcode not detected "; if (lblInfo.BackColor != Color.Blue && !manual_pallet_wanted) { lblInfo.BackColor = Color.Blue; lblAction.BackColor = Color.Blue; label.BackColor = Color.Blue; lblInfo.ForeColor = Color.White; lblAction.ForeColor = Color.White; label.ForeColor = Color.White; } } else { if (lblInfo.BackColor != Color.White && !manual_pallet_wanted) { lblInfo.BackColor = Color.White; lblAction.BackColor = Color.White; label.BackColor = Color.White; lblInfo.ForeColor = Color.Black; lblAction.ForeColor = Color.Black; label.ForeColor = Color.Black; } } if (!with_order) { if ((int)btnBarcode.Tag != 0) { if (!info.Contains(Program.ScannedLabelNumber) && Program.ScanningForLoadingStation == ls.Unit_ID && !info.Contains("barcode not detected")) { info += Program.ScannedLabelNumber; } } else { if (!info.Contains("barcode not detected")) { Hook lsh = Hook.LoadingStation(ls.Number, inside: true); if (lsh.CylinderID != 0) { var c = Cylinder.GetCylinder(lsh.CylinderID); if (!info.Contains(c.Number)) { info += $"{c.Number} "; } } } } } bool roll_on_shuttle = ls.IsPlcStateBitSet((int)BauerCOM.BauerPlcControlBits.RollOnShuttle); // if ...ls.barcode == "" && ... if (ls.Ready && ls.LoadingStation_WithPallet && ls.LoadingStation_WithRoll && !roll_on_shuttle && !with_order) { if ((int)btnBarcode.Tag == 0) { btnMovePalletIn.Visible = false; btnBarcode.Visible = true; } } else { if ((int)btnBarcode.Tag == 0) { btnBarcode.Visible = false; } //if (!ls.Ready) //{ // btnBarcode.Tag = 0; // btnBarcode.CenteredText = "Scan barcode"; //} } if (ls.Ready && ls.LoadingStation_WithPallet && ls.LoadingStation_WithRoll && roll_on_shuttle) { btnMoveRollOut.Visible = true; } else { btnMoveRollOut.Visible = false; } if (ls.Ready && !ls.Active) { lblAction.Text = "ready"; } if (ls.Active) { lblAction.Text = "active"; } else if (!ls.Ready) { lblAction.Text = "not ready"; } if ((ls.ErrorWord11 & 2048) != 0) { lblAction.Text += $"\r\nchange pipe magazin "; } if ((int)btnBarcode.Tag == 1) // scan knopf gedrückt { if (!ls.Ready) { lblAction.Text = "Scan barcode now"; btnBarcode.Tag = 2; // ls hat move bekommen } } if ((int)btnBarcode.Tag == 2) { if (ls.Ready && ls.Unit_ID == Program.ScanningForLoadingStation) // blauer Knopf gedrückt { btnBarcode.CenteredText = "Scan barcode"; // Text zurücksetzen btnBarcode.Tag = 0; if (Program.ScannedLabelNumber != "") { CreateMoveManuallyInside(ls.Unit_ID, Program.ScannedLabelNumber); } else { log.Error("Error: no barcode found, please try again."); var tps = Main.Database.Fetch <TransportOrder>( "SELECT * FROM StorageOrders WITH(NOLOCK) " + "WHERE JobNumber='manually inside'" + " NOT Status IN ('done', 'error', 'timeout') " + " AND LoadingStation=@0", ls.Unit_ID); foreach (var ta in tps) { log.Info($"{ta} canceled"); ta.State = TransportOrder.OrderStates.Error; ta.Save(); } } Program.ScannedLabelNumber = ""; Program.ScanningForLoadingStation = 0; } if (ls.Active) { lblAction.Text = "Scan barcode now"; } } if ((Program.ScanningForLoadingStation != 0) && (Program.ScanningForLoadingStation != ls.Unit_ID)) { btnBarcode.Visible = false; } lblInfo.Text = info; } } catch { } refresh_timer.Enabled = true; }