private void rdbtnSimulation_CheckedChanged(object sender, EventArgs e) { if (rdbtnSimulation.Checked) { lbModeStatus.Text = "Simulation Mode."; timerListview.Interval = 100; timerSimAGV.Interval = 100; Display.Mode = "Simulation"; foreach (AGV agv in AGV.ListAGV) { Label label = Display.LabelAGV[agv.ID]; pnFloor.Controls.Remove(label); //label.Dispose(); } foreach (AGV agv in AGV.SimListAGV) { pnFloor.Controls.Add(Display.SimLabelAGV[agv.ID]); } Pallet.SimListPallet = DBUtility.GetPalletInfoFromDB <List <Pallet> >("SimPalletInfoTable"); // Display Pallet in Navigation Map foreach (Pallet pallet in Pallet.ListPallet) { Display.DeleteLabelPallet(pallet); } foreach (Pallet pallet in Pallet.SimListPallet) { Display.UpdateLabelPallet(pallet); } } }
private void rdbtnRealTime_CheckedChanged(object sender, EventArgs e) { if (rdbtnRealTime.Checked) { lbModeStatus.Text = "Realtime Mode."; timerListview.Interval = 100; timerSimAGV.Interval = 250; Display.Mode = "Real Time"; foreach (AGV agv in AGV.SimListAGV) { //Label label = pnFloor.Controls.OfType<Label>().FirstOrDefault(lb => lb.Name == "AGV" + agv.ID.ToString()); Label label = Display.SimLabelAGV[agv.ID]; pnFloor.Controls.Remove(label); //label.Dispose(); } foreach (AGV agv in AGV.ListAGV) { pnFloor.Controls.Add(Display.LabelAGV[agv.ID]); } Pallet.ListPallet = DBUtility.GetPalletInfoFromDB <List <Pallet> >("PalletInfoTable"); foreach (Pallet pallet in Pallet.SimListPallet) { Display.DeleteLabelPallet(pallet); } foreach (Pallet pallet in Pallet.ListPallet) { Display.UpdateLabelPallet(pallet); } } }
private void RefreshListviewPallet() { lstvwPalletInStock.Items.Clear(); switch (Display.Mode) { case "Real Time": lbMode.Text = "Mode: Real Time"; Pallet.ListPallet = DBUtility.GetPalletInfoFromDB <List <Pallet> >("PalletInfoTable"); foreach (Pallet pallet in Pallet.ListPallet) { lstvwPalletInStock.Items.Add(pallet.Code, 0); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(pallet.Name.Trim()); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(pallet.StoreTime.Trim()); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(pallet.AtBlock + "-" + pallet.AtColumn.ToString() + "-" + pallet.AtLevel.ToString()); } break; case "Simulation": lbMode.Text = "Mode: Simulation"; Pallet.SimListPallet = DBUtility.GetPalletInfoFromDB <List <Pallet> >("SimPalletInfoTable"); foreach (Pallet pallet in Pallet.SimListPallet) { lstvwPalletInStock.Items.Add(pallet.Code, 0); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(pallet.Name.Trim()); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(pallet.StoreTime.Trim()); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(pallet.AtBlock + "-" + pallet.AtColumn.ToString() + "-" + pallet.AtLevel.ToString()); } break; } }
private void OrderForm_Load(object sender, EventArgs e) { List <Pallet> palletsInStock = new List <Pallet>(); Pallet.SimListPallet = DBUtility.GetPalletInfoFromDB <List <Pallet> >("SimPalletInfoTable"); Pallet.ListPallet = DBUtility.GetPalletInfoFromDB <List <Pallet> >("PalletInfoTable"); RefreshListviewPallet(); }
private void btnSearch_Click(object sender, EventArgs e) { DataTable table = new DataTable(); switch (Display.Mode) { case "Real Time": table = DBUtility.GetPalletInfoFromDB <DataTable>("PalletInfoTable"); break; case "Simulation": table = DBUtility.GetPalletInfoFromDB <DataTable>("SimPalletInfoTable"); break; } string filter = null; switch (cbbFilter.Text) { case "Code": filter = "PalletCode"; break; case "Name": filter = "PalletName"; break; case "Block": filter = "AtBlock"; break; } string searchQuery = filter + "='" + txtName.Text + "'"; try { DataRow[] result = table.Select(searchQuery); lstvwPalletInStock.Items.Clear(); for (int i = 0; i < result.Length; i++) { lstvwPalletInStock.Items.Add(result[i][0].ToString(), 0); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(result[i][1].ToString().Trim()); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(result[i][3].ToString().Trim()); lstvwPalletInStock.Items[lstvwPalletInStock.Items.Count - 1].SubItems.Add(result[i][4].ToString() + "-" + result[i][5].ToString() + "-" + result[i][6].ToString()); } } catch { lstvwPalletInStock.Items.Clear(); } }