Exemple #1
0
        private static void ProcessByInfo(int yontem, int tip, int yukseklik, int uzunluk, int orderSize)
        {
            var product = new Product(yukseklik, uzunluk, tip, orderSize, yontem.ToString());
            var cList   = Cells.FindAll(cell =>
                                        (cell.Product.Height == yukseklik) && (cell.Product.Width == uzunluk) &&
                                        (cell.Product.GetProductType() == tip) && (cell.Product.YontemKodu == yontem));

            Cell?c = null;

            switch (cList.Count)
            {
            case 0 when Cells.Count < 3:
            {    /*
                  * var px = product.GetHeight();
                  * var py = product.GetWidth();
                  * var katMax = GetKatMax(px, py, product.GetYontem(), product.GetProductType());
                  * var k = GetPalletMax(px, py, product.GetYontem(), product.GetProductType());
                  * var p = new Pallet()//TODO
                  *
                  * if (IsHeavy(product) && Cells.Find(cell => cell.RobotNo == 2) == null)
                  * {
                  *     AssignCell(-1, 2, p!, katMax, product);
                  *     OnCellAssigned(2, -1, p!, k);
                  * }
                  * else
                  * {
                  *     var r = 1;
                  *     while (Cells.Find(c => c.RobotNo == r) != null)
                  *     {
                  *         r++;
                  *     }
                  *
                  *     if (r > 3) return;
                  *     AssignCell(-1, r, p!, katMax, product);
                  *     OnCellAssigned(r, -1, p!, k);
                  * }
                  *
                  * c = GetCell(-1)!;
                  */
                break;
            }

            case 0 when Cells.Count == Cells.Capacity:
                return;

            default:
            {
                if (_patternLast < cList.Count)
                {
                    c             = cList[_patternLast];
                    _patternLast += 1;
                }
                else
                {
                    _patternLast = 0;
                }

                if (_patternLast == cList.Count)
                {
                    _patternLast = 0;
                }

                break;
            }
            }
            var adjWidth  = 0;
            var adjHeight = 0;
            var offadjX   = 0;
            var offadjY   = 0;

            var boxed = 0;

            if (product.GetYontem() == 156 || product.GetYontem() == 223 || product.GetYontem() == 250)
            {
                boxed      = 1;
                adjHeight += 80;
                adjWidth  += 80;
            }

            var a = product.GetProductType();
            var z = 0;

            if (boxed == 1)
            {
                z = a switch
                {
                    11 => 96,
                    21 => 96,
                    22 => 130,
                    33 => 180,
                    _ => z
                };
            }
            else
            {
                z = a switch
                {
                    11 => 74,
                    21 => 76,
                    22 => 108,
                    33 => 164,
                    _ => z
                };
            }

            var cNo = c !.GetRobotNo();

            if (c.PHolding == 0)
            {
                OnCellFull(c.RobotNo - 1);
            }

            c.AddProduct();

            //offset hesapları

            var offsets = Calculator.Calculate(product.GetHeight() + adjHeight, product.GetWidth() + adjWidth, z,
                                               c.PHolding,
                                               product.GetYontem(), product.GetProductType(), c.GetPalletHeight(), c.GetPalletWidth(),
                                               c.GetPalletZ());

            //gerekli sinyaller gönderilir
            int full = 0;

            if (offsets.NextKat > c.KatMax || c.Full())
            {
                full = 1;
            }


            var s = new Signal(cNo, offsets, product.GetHeight() + adjHeight, product.GetWidth() + adjWidth,
                               product.GetProductType(), c.PHolding, full, boxed, offadjX, offadjY, c.KatMax);

            SendPlcSignals(s);

            if (full == 1)
            {
                c.PHolding = 0;
                c.PDropped = 0;
            }
            //cell, (x,y,z) offsets, dizilim şekli, en, boy, kat, tip, sayı, hücredolu, kutulu?

            ProductAdd(cNo);
            ReportLogger.AddRecord(product.YontemKodu, product.GetProductType(), product.Height, product.Width);
        }
Exemple #2
0
        private static void ProcessOrder(long orderNum)
        {
            var product = Sql.Select("Siparis_No", orderNum.ToString());

            if (product == null)
            {
                return;
            }

            var cList = Cells.FindAll(cell => cell.OrderNo == orderNum);


            Cell?c = null;

            switch (cList.Count)
            {
            case 0 when Cells.Count < 3:
            {
                var px     = product.GetHeight();
                var py     = product.GetWidth();
                var katMax = GetKatMax(px, py, product.GetYontem(), product.GetProductType());
                var k      = GetPalletMax(px, py, product.GetYontem(), product.GetProductType());
                var p      = Sql.GetPallet(orderNum.ToString());
                if (IsHeavy(product) && Cells.Find(cell => cell.RobotNo == 2) == null)
                {
                    AssignCell(orderNum, 2, p !, katMax, product);
                    OnCellAssigned(2, orderNum, p !, k);
                }
                else
                {
                    var r = 1;
                    while (Cells.Find(c => c.RobotNo == r) != null)
                    {
                        r++;
                    }

                    if (r > 3)
                    {
                        return;
                    }
                    AssignCell(orderNum, r, p !, katMax, product);
                    OnCellAssigned(r, orderNum, p !, k);
                }

                c = GetCell(orderNum) !;
                break;
            }

            case 0 when Cells.Count == Cells.Capacity:
                return;

            default:
            {
                if (_patternLast < cList.Count)
                {
                    c             = cList[_patternLast];
                    _patternLast += 1;
                }
                else
                {
                    _patternLast = 0;
                }

                if (_patternLast == cList.Count)
                {
                    _patternLast = 0;
                }

                break;
            }
            }

            var adjWidth  = 0;
            var adjHeight = 0;
            var offadjX   = 0;
            var offadjY   = 0;

            var boxed = 0;

            if (product.GetYontem() == 156 || product.GetYontem() == 223 || product.GetYontem() == 250)
            {
                boxed      = 1;
                adjHeight += 80;
                adjWidth  += 80;
            }

            var a = product.GetProductType();
            var z = 0;

            if (boxed == 1)
            {
                z = a switch
                {
                    11 => 96,
                    21 => 96,
                    22 => 130,
                    33 => 180,
                    _ => z
                };
            }
            else
            {
                z = a switch
                {
                    11 => 74,
                    21 => 76,
                    22 => 108,
                    33 => 164,
                    _ => z
                };
            }

            var cNo = c !.GetRobotNo();

            if (c.PHolding == 0)
            {
                OnCellFull(c.RobotNo - 1);
            }

            c.AddProduct();

            //offset hesapları

            var offsets = Calculator.Calculate(product.GetHeight() + adjHeight, product.GetWidth() + adjWidth, z,
                                               c.PHolding,
                                               product.GetYontem(), product.GetProductType(), c.GetPalletHeight(), c.GetPalletWidth(),
                                               c.GetPalletZ());

            //gerekli sinyaller gönderilir
            int full = 0;

            if (offsets.NextKat > c.KatMax || c.Full())
            {
                full = 1;
            }


            var s = new Signal(cNo, offsets, product.GetHeight() + adjHeight, product.GetWidth() + adjWidth,
                               product.GetProductType(), c.PHolding, full, boxed, offadjX, offadjY, c.KatMax);

            SendPlcSignals(s);

            if (full == 1)
            {
                c.PHolding = 0;
                c.PDropped = 0;
            }
            //cell, (x,y,z) offsets, dizilim şekli, en, boy, kat, tip, sayı, hücredolu, kutulu?

            ProductAdd(cNo);
            ReportLogger.AddRecord(product.YontemKodu, product.GetProductType(), product.Height, product.Width);
        }
Exemple #3
0
        private static void ProcessNonBarcode()
        {
            var cList = GetNonBarcodeCells();
            var c     = cList[_patternLast];

            _patternLast += 1;
            if (_patternLast == cList.Count)
            {
                _patternLast = 0;
            }

            //if (c!.Full()) return;

            var adjWidth  = 0;
            var adjHeight = 0;
            var offadjX   = 0;
            var offadjY   = 0;
            var boxed     = 0;

            if (PatternProduct !.GetYontem() == 156 || PatternProduct.GetYontem() == 223 ||
                PatternProduct.GetYontem() == 250)
            {
                boxed      = 1;
                adjHeight += 80;
                adjWidth  += 80;
            }

            var a = PatternProduct.GetProductType();
            var z = 0;

            if (boxed == 1)
            {
                z = a switch
                {
                    11 => 96,
                    21 => 96,
                    22 => 130,
                    33 => 180,
                    _ => z
                };
            }
            else
            {
                z = a switch
                {
                    11 => 74,
                    21 => 76,
                    22 => 108,
                    33 => 164,
                    _ => z
                };
            }

            var cNo = c.GetRobotNo();

            if (c.PHolding == 0)
            {
                OnCellFull(c.RobotNo - 1);
            }

            c.AddProduct();
            //offset hesapları

            var offsets = Calculator.Calculate(PatternProduct.GetHeight() + adjHeight,
                                               PatternProduct.GetWidth() + adjWidth,
                                               z,
                                               c.PHolding,
                                               PatternProduct.GetYontem(), PatternProduct.GetProductType(), c.GetPalletHeight(),
                                               c.GetPalletWidth(), c.GetPalletZ());
            //gerekli sinyaller gönderilir
            var full = 0;

            if (offsets.NextKat > c.KatMax || c.Full())
            {
                full = 1;
            }

            var s = new Signal(cNo, offsets, PatternProduct.GetHeight() + adjHeight,
                               PatternProduct.GetWidth() + adjWidth,
                               PatternProduct.GetProductType(), c.PHolding, full, boxed, offadjX, offadjY, c.KatMax);

            SendPlcSignals(s);

            if (full == 1)
            {
                c.PHolding = 0;
                c.PDropped = 0;
            }

            ProductAdd(cNo);
            ReportLogger.AddRecord(PatternProduct.YontemKodu, PatternProduct.GetProductType(), PatternProduct.Height, PatternProduct.Width);

            //cell, (x,y,z) offsets, dizilim şekli, en, boy, kat, tip, sayı, hücredolu, kutulu?
        }