protected override void CrearDocumentoSAP()
        {
            this.elaboracionVO = (ElaboracionVO)this.documentoVO;

            log.Debug(elaboracionVO);

            bool error = false;
            int PrimerDocNum = 0;

            log.Debug("Partidas en la elaboracion: " + elaboracionVO.partidas.Count);
            foreach (ElaboracionPartidaVO itemVO in elaboracionVO.partidas)
            {
                log.Debug("Creando Orden de Fabricacion");
                int docEntry = CrearOrden(itemVO, elaboracionVO.whsCode);

                if (docEntry == -1)
                {
                    error = true;
                    break;
                }

                if (PrimerDocNum == 0) PrimerDocNum = this.resultadoVO.DocNum;

                log.Debug("Recibir Producto Terminado");
                RecibirProductoTerminado(docEntry);
                if (resultadoVO.Success == false)
                {
                    error = true;
                    break;
                }

                log.Debug("Cerrar Orden de Fabricacion");
                CerrarOrdenFabricacion(docEntry);
            }

            if (error == false)
            {
                this.resultadoVO = new ResultadoVO();
                this.resultadoVO.Success = true;
                this.resultadoVO.Mensaje = "";
                this.resultadoVO.DocEntry = 0;
                this.resultadoVO.DocNum = PrimerDocNum;
            }

            log.Debug(this.resultadoVO);
        }
        public ResultadoVO crearElaboracion(ElaboracionVO elaboracion)
        {
            ElaboracionService elaboracionService = new ElaboracionService();
            ResultadoVO        resultadoVO        = new ResultadoVO();

            try
            {
                resultadoVO = elaboracionService.crearDocumento(elaboracion);
            }
            catch (Exception ex)
            {
                log.Error(ex);
                resultadoVO.Success  = false;
                resultadoVO.DocEntry = 0;
                resultadoVO.Mensaje  = ex.Message;
            }

            return(resultadoVO);
        }