// Get list of rack column
        private static List <RackColumn> GetRackColums()
        {
            List <RackColumn> listCol = new List <RackColumn>();

            foreach (Node n in Node.ListNode)
            {
                if (n.LocationCode.Length == 0 || n.ID == 55 || n.ID == 56)
                {
                    continue;
                }

                RackColumn col = new RackColumn(n.ID);
                listCol.Add(col);
            }
            return(listCol);
        }
Exemple #2
0
        public static void OutputAutoAdd(string palletCode, List <Task> listTaskToAdd, List <AGV> listAGV, List <RackColumn> listColumn)
        {
            // auto select agv
            if (AGV.SimListAGV.Count == 0)
            {
                return;
            }
            int agvID = 1;//AutoSelectAGV(AGV.SimListAGV);

            // find pick node & level
            RackColumn col       = listColumn.Find(c => c.PalletCodes.Contains(palletCode));
            int        pickNode  = col.AtNode;
            int        pickLevel = Array.IndexOf(col.PalletCodes, palletCode) + 1;

            // select drop node (output1 or output2)
            int dropNode = agvID % 2 == 1 ? 51 : 52;

            Task newTask = new Task("Auto " + palletCode, "Output", palletCode, agvID, pickNode, dropNode, pickLevel, 1, "Waiting");

            listTaskToAdd.Add(newTask);
        }
Exemple #3
0
 public static void UpdateListViewTasks(ListView listView, List <Task> listData)
 {
     listView.Items.Clear();
     foreach (Task task in listData)
     {
         RackColumn PickRack = RackColumn.ListColumn.Find(c => c.AtNode == task.PickNode);
         RackColumn DropRack = RackColumn.ListColumn.Find(c => c.AtNode == task.DropNode);
         listView.Items.Add(task.Name, 1);
         listView.Items[listView.Items.Count - 1].SubItems.Add(task.Status);
         listView.Items[listView.Items.Count - 1].SubItems.Add(task.Type);
         listView.Items[listView.Items.Count - 1].SubItems.Add("AGV#" + task.AGVID.ToString());
         listView.Items[listView.Items.Count - 1].SubItems.Add(PickRack.Block.ToString() + PickRack.Number.ToString() + " - " + task.PickLevel.ToString());
         listView.Items[listView.Items.Count - 1].SubItems.Add(DropRack.Block.ToString() + DropRack.Number.ToString() + " - " + task.DropLevel.ToString());
         listView.Items[listView.Items.Count - 1].SubItems.Add(task.PalletCode);
         if (task.Status == "Doing")
         {
             listView.Items[listData.IndexOf(task)].BackColor = Color.PaleGreen;
         }
         else
         {
             listView.Items[listData.IndexOf(task)].BackColor = Color.White;
         }
     }
 }
Exemple #4
0
        private void btnOrder_Click(object sender, EventArgs e)
        {
            // collect all selected pallet code
            List <string> selectedPalletCode = new List <string>();

            foreach (ListViewItem item in lstvwPalletInStock.CheckedItems)
            {
                selectedPalletCode.Add(item.Text);
            }
            List <Pallet> palletSelected = new List <Pallet>();

            foreach (string palletCode in selectedPalletCode)
            {
                switch (Display.Mode)
                {
                case "Real Time":
                    palletSelected.Add(Pallet.ListPallet.Find(c => c.Code == palletCode));
                    break;

                case "Simulation":
                    palletSelected.Add(Pallet.SimListPallet.Find(c => c.Code == palletCode));

                    break;
                }
            }

            foreach (Pallet pallet in palletSelected)
            {
                RackColumn rack      = RackColumn.ListColumn.Find(c => c.Block == pallet.AtBlock && c.Number == pallet.AtColumn);
                int        agvID     = Task.AutoSelectAGV(AGV.SimListAGV, rack.AtNode);
                int        pickNode  = rack.AtNode;
                int        pickLevel = pallet.AtLevel;

                int dropNode  = Output;
                int dropLevel = 1;

                Task task = new Task("Order1", "Order", pallet.Code, agvID,
                                     pickNode, dropNode, pickLevel, dropLevel
                                     , "Waiting");
                switch (Display.Mode)
                {
                case "Real Time":
                    int AGVindex = AGV.ListAGV.FindIndex(a => { return(a.ID == agvID); });
                    AGV.ListAGV[AGVindex].Tasks.Add(task);
                    Task.ListTask.Add(task);
                    break;

                case "Simulation":
                    int SimAGVindex = AGV.SimListAGV.FindIndex(a => { return(a.ID == agvID); });
                    AGV.SimListAGV[SimAGVindex].Tasks.Add(task);
                    Task.SimListTask.Add(task);

                    break;
                }

                listViewPalletSelected.Items.Clear();

                foreach (ListViewItem item in lstvwPalletInStock.Items)
                {
                    if (item.Checked)
                    {
                        lstvwPalletInStock.Items.Remove(item);
                    }
                }
            }
        }
Exemple #5
0
        private void btnStore_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtPalletCode.Text) || String.IsNullOrEmpty(txtPalletName.Text) ||
                String.IsNullOrEmpty(cbbBlock.Text) || String.IsNullOrEmpty(cbbColumn.Text) || String.IsNullOrEmpty(cbbLevel.Text))
            {
                MessageBox.Show(" Please enter correct Pallet informarion !", "Pallet Information ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //int agvID = Task.AutoSelectAGV(AGV.SimListAGV, Input);
            int        agvID      = 1;
            RackColumn rack       = RackColumn.ListColumn.Find(c => c.Block == cbbBlock.Text && c.Number == Convert.ToInt32(cbbColumn.Text));
            string     palletcode = txtPalletCode.Text;
            string     palletName = txtPalletName.Text;
            int        pickNode   = Input;
            int        pickLevel  = 1;

            int dropNode  = rack.AtNode;
            int dropLevel = Convert.ToInt32(cbbLevel.Text);

            switch (Display.Mode)
            {
            case "Real Time":
                foreach (Pallet palet in Pallet.ListPallet)
                {
                    if (palet.Code.Trim() == txtPalletCode.Text)
                    {
                        MessageBox.Show("Pallet has stored in stock !", "Store Pallet Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else if (palet.AtBlock == cbbBlock.Text && palet.AtColumn == Convert.ToInt32(cbbColumn.Text) && palet.AtLevel == Convert.ToInt32(cbbLevel.Text))
                    {
                        MessageBox.Show("Slot is not available !", "Store Pallet Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                break;

            case "Simulation":
                foreach (Pallet palet in Pallet.SimListPallet)
                {
                    if (palet.Code.Trim() == txtPalletCode.Text)
                    {
                        MessageBox.Show("Pallet has stored in stock !", "Store Pallet Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else if (palet.AtBlock == cbbBlock.Text && palet.AtColumn == Convert.ToInt32(cbbColumn.Text) && palet.AtLevel == Convert.ToInt32(cbbLevel.Text))
                    {
                        MessageBox.Show("Slot is not available !", "Store Pallet Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                break;
            }


            Task task = new Task("Store1", "Store", palletcode, agvID,
                                 pickNode, dropNode, pickLevel, dropLevel
                                 , "Waiting");
            Pallet pallet = new Pallet(palletcode, palletName, true, "??", cbbBlock.Text, Convert.ToInt32(cbbColumn.Text), Convert.ToInt32(cbbLevel.Text));

            switch (Display.Mode)
            {
            case "Real Time":
                int AGVindex = AGV.ListAGV.FindIndex(a => { return(a.ID == agvID); });
                AGV.ListAGV[AGVindex].Tasks.Add(task);
                Task.ListTask.Add(task);
                Pallet.StorePallet.Add(pallet);
                break;

            case "Simulation":
                int SimAGVindex = AGV.SimListAGV.FindIndex(a => { return(a.ID == agvID); });
                AGV.SimListAGV[SimAGVindex].Tasks.Add(task);
                Task.SimListTask.Add(task);
                Pallet.SimStorePallet.Add(pallet);
                break;
            }
            ckbAutoSelectSlot.Checked = false;
            cbbBlock.Enabled          = true;
            cbbColumn.Enabled         = true;
            cbbLevel.Enabled          = true;
        }