LeanEngine.Engine.ProcessOrderQty C# (CSharp) Method

ProcessOrderQty() private method

private ProcessOrderQty ( ItemFlow itemFlow ) : void
itemFlow LeanEngine.Entity.ItemFlow
return void
        private void ProcessOrderQty(ItemFlow itemFlow)
        {
            if (itemFlow == null || itemFlow.ReqQty <= 0)
                return;

            decimal orderQty = itemFlow.ReqQty;
            decimal minLotSize = itemFlow.MinLotSize;//Min qty to order
            decimal UC = itemFlow.UC;//Unit container
            Enumerators.RoundUp roundUp = itemFlow.RoundUp;//Round up option
            //decimal orderLotSize = itemFlow.OrderLotSize;//Order lot size, one to many

            //Min lot size to order
            if (minLotSize > 0 && orderQty < minLotSize)
            {
                orderQty = minLotSize;
            }

            //round up
            if (UC > 0)
            {
                if (roundUp == Enumerators.RoundUp.Ceiling)
                {
                    orderQty = Math.Ceiling(orderQty / UC) * UC;
                }
                else if (roundUp == Enumerators.RoundUp.Floor)
                {
                    orderQty = Math.Floor(orderQty / UC) * UC;
                }
            }
            itemFlow.OrderQty = orderQty;

            //Order lot size, only production support
            //if (itemFlow.Flow.FlowType == Enumerators.FlowType.Production && orderLotSize > 0)
            //{
            //    itemFlow.OrderQtyList = this.SplitOrderByLotSize(orderQty, orderLotSize);
            //}
        }