public ResponseBussiness <OperationResponse> EjecutarProcedimientoCorteCaja(LecturaCaja lecturaCaja) { TokenDto token = new TokenService().Get(); ResponseBussiness <OperationResponse> response = new LecturaBusiness(token).LecturaZ(lecturaCaja); return(response); }
/// <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; })); }
/// <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; })); }
/// <summary> /// Metodo que genera Lectura Z y Logout Offline /// </summary> /// <param name="token"></param> /// <param name="lecturaCaja"></param> /// <returns></returns> public ResponseBussiness <ValidacionOperacionResponse> GenerarLecturaZOffline(TokenDto token, LecturaCaja lecturaCaja) { return(tryCatch.SafeExecutor(() => { ValidacionOperacionResponse validacionOperacionResponse = new ValidacionOperacionResponse(); using (TransactionScope scope = new TransactionScope()) { token.CodeBox = lecturaCaja.CodigoCaja; LecturaZGuardarResponse lecturaZGuardarResponse = new LecturaBusiness(token).LecturaZOffline(lecturaCaja); inicioFinDiaRepository.RegistrarLecturaZOffline(token.CodeStore, token.CodeBox, lecturaZGuardarResponse.FolioCorte); validacionOperacionResponse = inicioFinDiaRepository.RegistrarLogoutCaja(token); // Asignamos códigos de Lectura Z validacionOperacionResponse.CodeNumber = lecturaZGuardarResponse.CodeNumber; validacionOperacionResponse.CodeDescription = lecturaZGuardarResponse.CodeDescription; token.CodeBox = 0; scope.Complete(); } return validacionOperacionResponse; })); }
public ResponseBussiness <ValidacionOperacionResponse> GenerarLecturaZLogoutOffline(LecturaCaja lecturaCaja) { //new SecurityBusiness().ValidarPermisos("xxx", "E"); TokenDto token = new TokenService().Get(); return(new InicioFinDiaBusiness().GenerarLecturaZOffline(token, lecturaCaja)); }