Пример #1
0
        //protected override void KeyDown(KeyEventArgs e)
        //{
        //    if (Core.Environment.InvokeRequired)
        //    {
        //        Core.Environment.Invoke(() => KeyDown(e));
        //        return;
        //    }

        //    base.KeyDown(e);
        //    Random rnd = new Random();

        //    switch (e.KeyCode)
        //    {
        //        case Keys.NumPad1:
        //        case Keys.NumPad2:
        //            InFeedMethod(e, rnd);
        //            break;
        //        case Keys.NumPad3:
        //            foreach (var item in aisle1Locations)
        //            {
        //                if (!item.Value && item.Key.ActiveLoad == null)
        //                {
        //                    Experior.Core.Loads.Load.CreateEuroPallet().Switch(item.Key);
        //                }
        //            }
        //            break;
        //        case Keys.NumPad4:
        //            foreach (var item in aisle2Locations)
        //            {
        //                if (!item.Value && item.Key.ActiveLoad == null)
        //                {
        //                    Experior.Core.Loads.Load.CreateEuroPallet().Switch(item.Key);
        //                }
        //            }
        //            break;
        //        case Keys.NumPad5:
        //            foreach (var item in aisle1Locations)
        //            {
        //                if (item.Key.ActiveLoad != null && item.Key.ActiveLoad is EuroPallet)
        //                {
        //                    transferCarController1.PickupAndDrop(item.Key, ActionPoint.Get("PLA1EPL1"));
        //                    break;
        //                }
        //            }
        //            break;
        //        case Keys.NumPad6:
        //            if (ActionPoint.Get("PLA2EPL1").ActiveLoad != null)
        //            {
        //                break;
        //            }
        //            foreach (var item in aisle2Locations)
        //            {
        //                if (item.Key.ActiveLoad != null && item.Key.ActiveLoad is EuroPallet)
        //                {
        //                    transferCarController2.PickupAndDrop(item.Key, ActionPoint.Get("PLA2EPL1"));
        //                    break;
        //                }
        //            }
        //            break;
        //        case Keys.NumPad7:
        //            if (ActionPoint.Get("PLA1EPL1").ActiveLoad != null)
        //            {
        //                transferCarController1.PickupAndDrop(ActionPoint.Get("PLA1EPL1"), ActionPoint.Get("TCar1-OutFeed"));
        //            }
        //            break;
        //        case Keys.NumPad8:
        //            if (ActionPoint.Get("PLA2EPL1").ActiveLoad != null)
        //            {
        //                transferCarController2.PickupAndDrop(ActionPoint.Get("PLA2EPL1"), ActionPoint.Get("TCar2-OutFeed"));
        //            }
        //            break;

        //        case Keys.Z:
        //            ActionPoint tempAPA1 = null;
        //            foreach (var item in aisle1Locations)
        //            {
        //                if (item.Value)
        //                {
        //                    if (ActionPoint.Get("PLA1SPL11").UserData == null)
        //                    {
        //                        ActionPoint.Get("PLA1SPL11").UserData = item.Key.ActiveLoad;
        //                        transferCarController1.PickupAndDrop(item.Key, ActionPoint.Get("PLA1SPL11"));
        //                        tempAPA1 = item.Key;
        //                        break;
        //                    }
        //                    if (ActionPoint.Get("PLA1SPL21").UserData == null)
        //                    {
        //                        ActionPoint.Get("PLA1SPL21").UserData = item.Key.ActiveLoad;
        //                        transferCarController1.PickupAndDrop(item.Key, ActionPoint.Get("PLA1SPL21"));
        //                        tempAPA1 = item.Key;
        //                        break;
        //                    }
        //                    break;
        //                }
        //            }
        //            if (tempAPA1 != null)
        //            {
        //                aisle1Locations[tempAPA1] = false;
        //            }

        //            break;

        //        case Keys.X:
        //            ActionPoint tempAPA2 = null;
        //            foreach (var item in aisle2Locations)
        //            {
        //                if (item.Value)
        //                {
        //                    if (ActionPoint.Get("PLA2SPL11").UserData == null)
        //                    {
        //                        ActionPoint.Get("PLA2SPL11").UserData = item.Key.ActiveLoad;

        //                        transferCarController2.PickupAndDrop(item.Key, ActionPoint.Get("PLA2SPL11"));
        //                        tempAPA2 = item.Key;
        //                        break;
        //                    }
        //                    if (ActionPoint.Get("PLA2SPL21").UserData == null)
        //                    {
        //                        ActionPoint.Get("PLA2SPL21").UserData = item.Key.ActiveLoad;
        //                        transferCarController2.PickupAndDrop(item.Key, ActionPoint.Get("PLA2SPL21"));
        //                        tempAPA2 = item.Key;
        //                        break;
        //                    }
        //                    break;
        //                }
        //            }
        //            if (tempAPA2 != null)
        //            {
        //                aisle2Locations[tempAPA2] = false;
        //            }
        //            break;


        //        case Keys.C:
        //            ((Load)ActionPoint.Get("PLA1SPL11").UserData)?.Release();
        //            ((Load)ActionPoint.Get("PLA1SPL21").UserData)?.Release();
        //            ((Load)ActionPoint.Get("PLA2SPL11").UserData)?.Release();
        //            ((Load)ActionPoint.Get("PLA2SPL21").UserData)?.Release();
        //            break;
        //        default:
        //            break;
        //    }
        //}

        //private void InFeedMethod(KeyEventArgs e, Random rnd)
        //{
        //    float pHeightVar = (byte)(rnd).Next(1, 5);
        //    float pHeight = 1 + 0.25f * pHeightVar;
        //    Load tempPallet = Experior.Core.Loads.Load.CreateBox(1, pHeight, 1.2f, System.Drawing.Color.FromArgb((byte)(rnd).Next(1, 255), (byte)(rnd).Next(1, 255), (byte)(rnd).Next(1, 255)));
        //    //tempPallet.Yaw += (float)(Math.PI / 2);
        //    PalletUserData tempPalletStorage = null;
        //    var layer = (byte)(rnd).Next(4, 7);
        //    while (true)
        //    {
        //        var aisle = (byte)(rnd).Next(1, 3);
        //        var location = (byte)(rnd).Next(1, 28);
        //        tempPalletStorage = new PalletUserData(aisle, location, layer);
        //        if (aisle == 1)
        //        {
        //            if (aisle1Locations[ActionPoint.Get(GetPalletStorageName(tempPalletStorage))] == true)
        //            {
        //                continue;
        //            }
        //            else
        //            {
        //                aisle1Locations[ActionPoint.Get(GetPalletStorageName(tempPalletStorage))] = true;
        //                break;
        //            }
        //        }
        //        if (aisle == 2)
        //        {
        //            if (aisle2Locations[ActionPoint.Get(GetPalletStorageName(tempPalletStorage))] == true)
        //            {
        //                continue;
        //            }
        //            else
        //            {
        //                aisle2Locations[ActionPoint.Get(GetPalletStorageName(tempPalletStorage))] = true;
        //                break;
        //            }
        //        }
        //    }

        //    tempPallet.UserData = tempPalletStorage;

        //    if (e.KeyData == Keys.NumPad1)
        //    {
        //        ActionPoint.Get("InFeed1").Parent.Add(tempPallet);
        //        return;
        //    }
        //    else if (e.KeyData == Keys.NumPad2)
        //    {
        //        ActionPoint.Get("InFeed2").Parent.Add(tempPallet);
        //        return;
        //    }

        //}

        private void InFeedMethod(PalletRequest request)
        {
            if (request.Status == PalletRequestStatus.Requested)
            {
                return;
            }
            float LoadHeight = .25f;

            foreach (var item in request.RequestPallet())
            {
                Experior.Core.Loads.Load load = Experior.Core.Loads.Load.CreateBox(1f, item.LayerCount * LoadHeight, 1.2f, Color.Azure);
                load.UserData = item;
                int i = rndFeed.Next(1, 3);
                if (i == 1)
                {
                    load.Switch(ActionPoint.Get("InFeed1").Parent);
                }
                else
                {
                    load.Switch(ActionPoint.Get("InFeed2").Parent);
                }
            }
        }
Пример #2
0
        protected override void Arriving(INode node, Load load)
        {
            base.Arriving(node, load);

            if (node.Name == "PLA1SPL12")
            {
                ActionPoint.Get("PLA1SPL11").UserData = null;
                transferCarController1.PickupAndDrop(ActionPoint.Get(node.Name), ActionPoint.Get(GetPalletLocationName(load)));
            }
            if (node.Name == "PLA1SPL22")
            {
                ActionPoint.Get("PLA1SPL21").UserData = null;
                transferCarController1.PickupAndDrop(ActionPoint.Get(node.Name), ActionPoint.Get(GetPalletLocationName(load)));
            }

            if (node.Name == "PLA2SPL12")
            {
                ActionPoint.Get("PLA2SPL11").UserData = null;
                transferCarController2.PickupAndDrop(ActionPoint.Get(node.Name), ActionPoint.Get(GetPalletLocationName(load)));
            }
            if (node.Name == "PLA2SPL22")
            {
                ActionPoint.Get("PLA2SPL21").UserData = null;
                transferCarController2.PickupAndDrop(ActionPoint.Get(node.Name), ActionPoint.Get(GetPalletLocationName(load)));
            }

            if (node.Name == "PLA2EPL1" || node.Name == "PLA1EPL1")
            {
                Random rnd           = null;
                bool   pickCondition = (ActionPoint.Get("PLA1SPL11").UserData != null &&
                                        ActionPoint.Get("PLA1SPL21").UserData != null &&
                                        ActionPoint.Get("PLA2SPL11").UserData != null &&
                                        ActionPoint.Get("PLA2SPL21").UserData != null);
                if (pickCondition)
                {
                    rnd = new Random();
                    OrderData tempOD = new OrderData((byte)rnd.Next(0, 3), (byte)rnd.Next(0, 3), (byte)rnd.Next(0, 3), (byte)rnd.Next(0, 3));
                    load.UserData = tempOD;
                    float sST = 8f;
                    float tST = tempOD.SKU1 * sST + tempOD.SKU2 * sST + tempOD.SKU3 * sST + tempOD.SKU4 * sST;
                    var   l1H = ((Load)ActionPoint.Get("PLA1SPL11").UserData).Height / (((Load)ActionPoint.Get("PLA1SPL11").UserData).UserData as PalletUserData).LayerCount;
                    var   l2H = ((Load)ActionPoint.Get("PLA1SPL21").UserData).Height / (((Load)ActionPoint.Get("PLA1SPL21").UserData).UserData as PalletUserData).LayerCount;
                    var   l3H = ((Load)ActionPoint.Get("PLA2SPL11").UserData).Height / (((Load)ActionPoint.Get("PLA2SPL11").UserData).UserData as PalletUserData).LayerCount;
                    var   l4H = ((Load)ActionPoint.Get("PLA2SPL21").UserData).Height / (((Load)ActionPoint.Get("PLA2SPL21").UserData).UserData as PalletUserData).LayerCount;

                    (((Load)ActionPoint.Get("PLA1SPL11").UserData).UserData as PalletUserData).LayerCount -= tempOD.SKU1;
                    (((Load)ActionPoint.Get("PLA1SPL21").UserData).UserData as PalletUserData).LayerCount -= tempOD.SKU2;
                    (((Load)ActionPoint.Get("PLA2SPL11").UserData).UserData as PalletUserData).LayerCount -= tempOD.SKU3;
                    (((Load)ActionPoint.Get("PLA2SPL21").UserData).UserData as PalletUserData).LayerCount -= tempOD.SKU4;

                    Experior.Core.Loads.Load l1Load = null;
                    Experior.Core.Loads.Load l2Load = null;
                    Experior.Core.Loads.Load l3Load = null;
                    Experior.Core.Loads.Load l4Load = null;

                    Experior.Core.Timer.Action(() =>
                    {
                        l1Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU1 * l1H, 1.2f, ((Load)ActionPoint.Get("PLA1SPL11").UserData).Color);
                        load.Group(l1Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height / 2, 0));
                        Experior.Core.Timer.Action(() =>
                        {
                            l2Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU2 * l2H, 1.2f, ((Load)ActionPoint.Get("PLA1SPL21").UserData).Color);
                            load.Group(l2Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height + l2Load.Height / 2, 0));
                            Experior.Core.Timer.Action(() =>
                            {
                                l3Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU3 * l3H, 1.2f, ((Load)ActionPoint.Get("PLA2SPL11").UserData).Color);
                                load.Group(l3Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height + l2Load.Height + l3Load.Height / 2, 0));
                                Experior.Core.Timer.Action(() =>
                                {
                                    l4Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU4 * l4H, 1.2f, ((Load)ActionPoint.Get("PLA2SPL21").UserData).Color);
                                    load.Group(l4Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height + l2Load.Height + l3Load.Height + l4Load.Height / 2, 0));
                                }, tempOD.SKU4 * sST);
                            }, tempOD.SKU3 * sST);
                        }, tempOD.SKU2 * sST);
                    }, tempOD.SKU1 * sST);

                    //l1Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU1 * l1H, 1.2f, ((Load)ActionPoint.Get("PLA1SPL11").UserData).Color);
                    //l2Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU2 * l2H, 1.2f, ((Load)ActionPoint.Get("PLA1SPL21").UserData).Color);
                    //l3Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU3 * l3H, 1.2f, ((Load)ActionPoint.Get("PLA2SPL11").UserData).Color);
                    //l4Load = Experior.Core.Loads.Load.CreateBox(1, tempOD.SKU4 * l4H, 1.2f, ((Load)ActionPoint.Get("PLA2SPL21").UserData).Color);

                    //load.Group(l1Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height / 2, 0));
                    //load.Group(l2Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height + l2Load.Height / 2, 0));
                    //load.Group(l3Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height + l2Load.Height + l3Load.Height / 2, 0));
                    //load.Group(l4Load, new Microsoft.DirectX.Vector3(0, load.Height / 2 + l1Load.Height + l2Load.Height + l3Load.Height + l4Load.Height / 2, 0));
                }
            }
        }