Exemplo n.º 1
0
        public void FillBatches()
        {
            if (IsDraft())
            {
                FillBatchesForDraft();
                return;
            }

            BatchNumbes = new List <BatchNumber>();

            var batches = B1Helper.GetBatchNumbers(
                DBName, ItemCode, WhsCode, DocEntry, LineNum, ObjType);

            if (batches.IsEmpty() && BaseType != eDocumentObjectType.oNone)
            {
                batches = B1Helper.GetBatchNumbers(
                    DBName, ItemCode, WhsCode, BaseEntry, BaseLine, BaseType);
            }

            foreach (var batch in batches)
            {
                var newBath = new BatchNumber(DBName);

                if (!newBath.GetByKey(batch.ItemCode, batch.WhsCode, batch.BatchNum))
                {
                    continue;
                }

                newBath.Quantity = batch.Quantity;
                BatchNumbes.Add(newBath);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Pega um lote
        /// </summary>
        /// <param name="pItemCode">Código do Item</param>
        /// <param name="pWhsCode">Código do Depósito</param>
        /// <param name="pBatchNumber">Código do Lote</param>
        /// <param name="pCompanyDB">Empresa</param>
        /// <returns></returns>
        public static BatchNumber GetBatchNumber(string pItemCode, string pWhsCode, string pBatchNumber, string pCompanyDB)
        {
            pCompanyDB.CheckForArgumentNull("pCompanyDb");
            pWhsCode.CheckForArgumentNull("pWhsCode");
            pItemCode.CheckForArgumentNull("pItemCode");
            pBatchNumber.CheckForArgumentNull("pItemCode");

            BatchNumber batch = new BatchNumber(pCompanyDB);

            if (!batch.GetByKey(pItemCode, pWhsCode, pBatchNumber))
            {
                throw new Exception(
                          string.Format(
                              DontFindText3Key, BatchNumberObjectName, pBatchNumber,
                              ItemObjectName, pItemCode,
                              WarehouseObjectName, pWhsCode));
            }

            return(batch);
        }