示例#1
0
        /// <summary>
        /// Funcionalidad para persistir una lectura Z
        /// </summary>
        /// <param name="codeStore">Código de la tienda</param>
        /// <param name="codeBox">Código de la caja</param>
        /// <param name="codeEmployee">Código del empleado</param>
        /// <param name="folioCorteParcial">Folio del Corte Parcial</param>
        /// <param name="importeFisico">Importe físico</param>
        /// <param name="importeTeorico">Importe teórico</param>
        /// <param name="importeRetiro">Importe retiro</param>
        /// <param name="esLecturaOffline">Indica si se trata de una Lectura Offline</param>
        /// <returns>Respuesta de la operación</returns>
        public LecturaZGuardarResponse LecturaZ(int codeStore, int codeBox, int codeEmployee, string folioCorteParcial, decimal importeFisico,
                                                decimal importeTeorico, decimal importeRetiro, int esLecturaOffline)
        {
            LecturaZGuardarResponse operationResponse = new LecturaZGuardarResponse();
            var parameters = new Dictionary <string, object>();

            parameters.Add("@CodigoTienda", codeStore);
            parameters.Add("@CodigoCaja", codeBox);
            parameters.Add("@CodigoEmpleado", codeEmployee);
            parameters.Add("@ImporteFisico", importeFisico);
            parameters.Add("@ImporteTeorico", importeTeorico);
            parameters.Add("@ImporteRetiro", importeRetiro);
            parameters.Add("@FolioCorteParcial", folioCorteParcial);
            parameters.Add("@EsLecturaOffline", esLecturaOffline);
            List <System.Data.SqlClient.SqlParameter> parametersOut = new List <System.Data.SqlClient.SqlParameter>();

            parametersOut.Add(new System.Data.SqlClient.SqlParameter()
            {
                ParameterName = "@CodigoResultado", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.Int
            });
            parametersOut.Add(new System.Data.SqlClient.SqlParameter()
            {
                ParameterName = "@MensajeResultado", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.NVarChar, Size = 4000
            });
            parametersOut.Add(new System.Data.SqlClient.SqlParameter()
            {
                ParameterName = "@FolioLecturaResult", Direction = ParameterDirection.Output, SqlDbType = SqlDbType.NVarChar, Size = 17
            });
            var result = data.ExecuteProcedure("[dbo].[sp_vanti_LecturaZ]", parameters, parametersOut);

            operationResponse.CodeNumber      = result["@CodigoResultado"].ToString();
            operationResponse.CodeDescription = result["@MensajeResultado"].ToString();
            operationResponse.FolioCorte      = result["@FolioLecturaResult"].ToString();
            return(operationResponse);
        }
示例#2
0
        /// <summary>
        /// Lectura Z
        /// </summary>
        /// <returns>Respuesta de la operación</returns>
        public ResponseBussiness <OperationResponse> LecturaZ(LecturaCaja lecturaCaja)
        {
            return(tryCatch.SafeExecutor(() =>
            {
                OperationResponse resultado = new OperationResponse();
                LecturaZGuardarResponse lecturaZGuardarResponse = new LecturaZGuardarResponse();
                LecturaTotalDetalleFormaPago lecturaTotalDetalleFormaPagoCA = null;
                using (TransactionScope scope = new TransactionScope())
                {
                    int secuencia = 1;
                    // Se ejecuta la lectura X
                    LecturaX lecturaX = repository.ObtenerFoliosLecturaX(token.CodeStore, token.CodeBox, token.CodeEmployee, 0);
                    foreach (var lecturaTotalDetalleFormaPago in lecturaCaja.LecturasTotales)
                    {
                        resultado = repository.LecturaX(token.CodeStore, token.CodeBox, token.CodeEmployee, lecturaTotalDetalleFormaPago.InformacionAsociadaFormasPago.CodigoFormaPago, secuencia, lecturaTotalDetalleFormaPago.ImporteFisico, lecturaTotalDetalleFormaPago.ImporteTeorico, lecturaTotalDetalleFormaPago.ImporteFisico, lecturaX);
                        if (lecturaTotalDetalleFormaPago.InformacionAsociadaFormasPago.CodigoFormaPago == "CA")
                        {
                            lecturaTotalDetalleFormaPagoCA = lecturaTotalDetalleFormaPago;
                        }
                        secuencia = secuencia + 1;
                    }
                    // Se ejecutar la lectura Z
                    if (lecturaTotalDetalleFormaPagoCA != null)
                    {
                        lecturaZGuardarResponse = repository.LecturaZ(token.CodeStore, token.CodeBox, token.CodeEmployee,
                                                                      lecturaX.FolioCorteParcial, lecturaTotalDetalleFormaPagoCA.ImporteFisico,
                                                                      lecturaTotalDetalleFormaPagoCA.ImporteTeorico, lecturaTotalDetalleFormaPagoCA.ImporteFisico, 0);
                        resultado.CodeNumber = lecturaZGuardarResponse.CodeNumber;
                        resultado.CodeDescription = lecturaZGuardarResponse.CodeDescription;
                        // Se persisten las denominaciones
                        foreach (var item in lecturaTotalDetalleFormaPagoCA.InformacionAsociadaDenominaciones)
                        {
                            repository.PersistirDenominacionesRetiro(lecturaX.FolioCorteParcial, item.CodigoFormaPago, item.TextoDenominacion, item.Cantidad);
                        }
                    }
                    scope.Complete();
                }

                // Imprimir Ticket
                PrintTickectLecturaBusiness printTickectLectura = new PrintTickectLecturaBusiness(token);
                PrintLecturaRequest printLecturaRequest = new PrintLecturaRequest();
                printLecturaRequest.FolioCorte = lecturaZGuardarResponse.FolioCorte;
                printLecturaRequest.TipoLectura = "z";
                printTickectLectura.PrintNow(printLecturaRequest);

                PrintTicketEgresosBusiness printTicketEgresos = new PrintTicketEgresosBusiness(token);
                PrintTicketEgresosRequest printTicketEgresosRequest = new PrintTicketEgresosRequest();
                printTicketEgresosRequest.FolioCorteZ = lecturaZGuardarResponse.FolioCorte;
                printTicketEgresos.PrintNow(printTicketEgresosRequest);

                return resultado;
            }));
        }
示例#3
0
        /// <summary>
        /// Lectura Z Offline
        /// </summary>
        /// <returns>Respuesta de la operación</returns>
        public ResponseBussiness <LecturaZGuardarResponse> LecturaZOffline(LecturaCaja lecturaCaja)
        {
            return(tryCatch.SafeExecutor(() =>
            {
                OperationResponse resultado = new OperationResponse();
                LecturaZGuardarResponse lecturaZGuardarResponse = new LecturaZGuardarResponse();
                LecturaTotalDetalleFormaPago lecturaTotalDetalleFormaPagoCA = null;
                using (TransactionScope scope = new TransactionScope())
                {
                    int secuencia = 1;
                    // Se ejecuta la lectura X
                    LecturaX lecturaX = repository.ObtenerFoliosLecturaX(token.CodeStore, token.CodeBox, token.CodeEmployee, 1);
                    foreach (var lecturaTotalDetalleFormaPago in lecturaCaja.LecturasTotales)
                    {
                        // Se pone el parámetro de Caja = 0 porque es BackOffice
                        resultado = repository.LecturaX(token.CodeStore, 0, token.CodeEmployee,
                                                        lecturaTotalDetalleFormaPago.InformacionAsociadaFormasPago.CodigoFormaPago, secuencia,
                                                        lecturaTotalDetalleFormaPago.ImporteFisico, lecturaTotalDetalleFormaPago.ImporteTeorico,
                                                        lecturaTotalDetalleFormaPago.ImporteFisico, lecturaX);
                        if (lecturaTotalDetalleFormaPago.InformacionAsociadaFormasPago.CodigoFormaPago == "CA")
                        {
                            lecturaTotalDetalleFormaPagoCA = lecturaTotalDetalleFormaPago;
                        }
                        secuencia = secuencia + 1;
                    }
                    // Se ejecutar la lectura Z
                    if (lecturaTotalDetalleFormaPagoCA != null)
                    {
                        lecturaZGuardarResponse = repository.LecturaZ(token.CodeStore, token.CodeBox, token.CodeEmployee,
                                                                      lecturaX.FolioCorteParcial, lecturaTotalDetalleFormaPagoCA.ImporteFisico,
                                                                      lecturaTotalDetalleFormaPagoCA.ImporteTeorico, lecturaTotalDetalleFormaPagoCA.ImporteFisico, 1);
                        resultado.CodeNumber = lecturaZGuardarResponse.CodeNumber;
                        resultado.CodeDescription = lecturaZGuardarResponse.CodeDescription;

                        // Se persisten las denominaciones
                        foreach (var item in lecturaTotalDetalleFormaPagoCA.InformacionAsociadaDenominaciones)
                        {
                            repository.PersistirDenominacionesRetiro(lecturaX.FolioCorteParcial, item.CodigoFormaPago, item.TextoDenominacion, item.Cantidad);
                        }
                    }
                    scope.Complete();
                }
                return lecturaZGuardarResponse;
            }));
        }