Пример #1
0
        private IList <Movement> Movements(IList <Detail> details, IList <StockMap> stocksGeneral, Guid cellarId, Guid userId, Guid adjustmentId, string company)
        {
            //Movimiento
            IList <Movement> movements        = new List <Movement>();
            var          lastmov              = _adjustmentManager.GetNextMovementNumber(company);
            double       montoTotalInventario = stocksGeneral.Sum(a => a.GetAmountInStock());
            double       montoTotalBodega     = stocksGeneral.Where(a => a.CellarId == cellarId).Sum(a => a.GetAmountInStock());
            double       stockMovement        = 0;
            TypeMovement temp = TypeMovement.Input;

            foreach (var item in details)
            {
                var stockListCellar = _adjustmentManager.GetStocksList(company, cellarId, item.AssetId);
                var articuloExistenciaInventarioArticulo = stockListCellar.Where(a => a.AssetId == item.AssetId);
                var articuloExistenciaBodega             = articuloExistenciaInventarioArticulo.FirstOrDefault(a => a.CellarId == cellarId);

                double cntAnteriorExistenciaBodegaMigrado = articuloExistenciaBodega.GetStockItemsQty();
                double cntAntExisteciasInvMigrado         = articuloExistenciaInventarioArticulo.Sum(a => a.GetStockItemsQty());

                // Montos antes del movimiento en todo el inventario
                double montoAnteriorExistenciaBodega = articuloExistenciaBodega.GetAmountInStock();
                double montoAntExistenciasInv        = articuloExistenciaInventarioArticulo.Sum(a => a.GetAmountInStock());

                // Monto en todo el inventario y bodega
                double previousGeneralInvAmount   = montoTotalInventario;
                double previousGeneralStockAmount = montoTotalBodega;

                if (cntAnteriorExistenciaBodegaMigrado > item.StockAsset)
                {
                    stockMovement = cntAntExisteciasInvMigrado - item.StockAsset;
                    temp          = TypeMovement.Output;
                }
                else if (cntAnteriorExistenciaBodegaMigrado < item.StockAsset)
                {
                    stockMovement = item.StockAsset - cntAntExisteciasInvMigrado;
                    temp          = TypeMovement.Input;
                }


                var @entity = Movement.Create(lastmov, stockMovement, item.Price, _dateTime.Now,
                                              StatusMovement.AplicadoInventario, temp, MovementCategory.Adjustment, cntAnteriorExistenciaBodegaMigrado, montoAnteriorExistenciaBodega, cntAntExisteciasInvMigrado, montoAntExistenciasInv,
                                              previousGeneralInvAmount, previousGeneralStockAmount, cellarId, item.AssetId, userId, null, null, adjustmentId, null, userId, _dateTime.Now, company);

                if (cntAnteriorExistenciaBodegaMigrado > item.StockAsset)
                {
                    montoTotalInventario -= @entity.GetAmountMovement(); //Actualiza monto inventario
                    montoTotalBodega     -= @entity.GetAmountMovement(); //Actualiza monto bodega
                }
                else
                {
                    montoTotalInventario += @entity.GetAmountMovement(); //Actualiza monto inventario
                    montoTotalBodega     += @entity.GetAmountMovement(); //Actualiza monto bodega
                }


                movements.Add(@entity);
            }

            return(movements);
        }
Пример #2
0
    /// <summary>
    /// Добавление движения в очередь
    /// </summary>
    /// <param name="move">Движение</param>
    public void AddMovement(TypeMovement move)
    {
        //Если : очередь полна - ничего не предпринимать
        if (_Queue.Count == 2)
        {
            return;
        }

        if (move == TypeMovement.Up)
        {
            MainManager.Audio.PlayFrontMoveSound();
        }
        else
        {
            MainManager.Audio.PlaySideMoveSound();
        }

        _Queue.Enqueue(move);

        //Добавлено первое движение на выполнение
        if (_Queue.Count == 1)
        {
            SwitchMovement(_Queue.Peek());
        }
    }
 public void AddPositions(List <Vector2> positions)
 {
     if (_positions == null)
     {
         _positions = new List <Vector2>();
     }
     _positions.AddRange(positions);
     _typeMovement    = TypeMovement.POSITION;
     _positionReached = true;
 }
Пример #4
0
    /// <summary>
    /// Добавление движения в очередь
    /// </summary>
    /// <param name="move">Движение</param>
    public void AddMovement(TypeMovement move)
    {
        //Если : очередь полна - ничего не предпринимать
        if (_Queue.Count == 2)
        {
            return;
        }

        _Queue.Enqueue(move);

        //Добавлено первое движение на выполнение
        if (_Queue.Count == 1)
        {
            SwitchMovement(_Queue.Peek());
        }
    }
Пример #5
0
    /// <summary>
    /// Изменение координаты прибытия
    /// </summary>
    /// <param name="move">Движение</param>
    private void SwitchMovement(TypeMovement move)
    {
        switch (move)
        {
        case TypeMovement.Left:
            //Если : персонаж у левого края - не выполнять это движение
            if (_Position - 1 == -4)
            {
                _Queue.Dequeue();
            }
            else
            {
                _Position -= 1;
            }
            break;

        case TypeMovement.Right:
            //Если : персонаж у правого края - не выполнять это движение
            if (_Position + 1 == 4)
            {
                _Queue.Dequeue();
            }
            else
            {
                _Position += 1;
            }
            break;

        case TypeMovement.Up:
            //Если : движение вверх, то задать импульс
            _Rigidbody.velocity = Vector3.zero;
            if (move == TypeMovement.Up)
            {
                _Rigidbody.AddForce(new Vector3(0, Force, 0), ForceMode.Impulse);
            }
            MainManager.Interface.NextStep();
            break;
        }
    }
Пример #6
0
        private void NuevoJuego()
        {
            timer.Stop();

            movimiento = TypeMovement.Right;

            snake = new List<Point>();
            snake.Add(new Point(CTE_SIDE * 10, CTE_SIDE));
            snake.Add(new Point(CTE_SIDE * 10, CTE_SIDE * 2));
            snake.Add(new Point(CTE_SIDE * 10, CTE_SIDE * 3));
            snake.Add(new Point(CTE_SIDE * 10, CTE_SIDE * 4));

            food = new List<Point>();
            for (int i = 0; i < NUM_FOOD; i++)
                food.Add(new Point(CTE_SIDE * r.Next(0, 30), CTE_SIDE * r.Next(0, 30)));

            timer.Start();
        }
Пример #7
0
 private void MainWindow_KeyDown(object sender, KeyEventArgs e)
 {
     if (Keyboard.IsKeyDown(Key.Up))
         movimiento = TypeMovement.Up;
     if (Keyboard.IsKeyDown(Key.Down))
         movimiento = TypeMovement.Down;
     if (Keyboard.IsKeyDown(Key.Left))
         movimiento = TypeMovement.Left;
     if (Keyboard.IsKeyDown(Key.Right))
         movimiento = TypeMovement.Right;
 }
        public static Movement Create(int numberMovement, double stock, double price, DateTime aplicationDate, StatusMovement status, TypeMovement type,
                                      MovementCategory movementCategory, double previosCellarQty, double previousCellarAmount, double previousCellarStockQtyInv, double previousCellarStockAmountInv,
                                      double previousGeneralInvAmount, double previousGeneralStockAmount, Guid cellarId, Guid assetId, Guid?userId, Guid?inRequestId,
                                      Guid?outRequestId, Guid?adjustmentId, Guid?projectId, Guid creatorid, DateTime createDateTime, string companyName)
        {
            var @movement = new Movement
            {
                Id                           = Guid.NewGuid(),
                MovementNumber               = numberMovement,
                StockMovement                = stock,
                Price                        = price,
                ApplicationDateTime          = aplicationDate,
                Status                       = status,
                TypeMovement                 = type,
                MovementCategory             = movementCategory,
                PreviosCellarQty             = previosCellarQty,
                PreviousCellarAmount         = previousCellarAmount,
                PreviousCellarStockQtyInv    = previousCellarStockQtyInv,
                PreviousCellarStockAmountInv = previousCellarStockAmountInv,
                PreviousGeneralInvAmount     = previousGeneralInvAmount,
                PreviousGeneralStockAmount   = previousGeneralStockAmount,
                CellarId                     = cellarId,
                AssetId                      = assetId,
                UserId                       = userId,
                InRequestId                  = inRequestId,
                OutRequestId                 = outRequestId,
                AdjustmentId                 = adjustmentId,
                ProjectId                    = projectId,
                CreationTime                 = createDateTime,
                CreatorUserId                = creatorid,
                CompanyName                  = companyName,
                IsDeleted                    = false
            };

            return(@movement);
        }