Esempio n. 1
0
 protected void btn_mover_Click(object sender, EventArgs e)
 {
     if (this.ddl_bloqLugar.SelectedIndex > 0)
     {
         TrailerBC    t = new TrailerBC().obtenerXID(int.Parse(this.hf_idTrailer.Value));
         MovimientoBC m = new MovimientoBC();
         m.ID_DESTINO = int.Parse(this.ddl_bloqLugar.SelectedValue);
         m.ID_TRAILER = t.ID;
         string resultado;
         if (m.MOVIMIENTO(t.SITE_ID, this.usuario.ID, out resultado) && resultado == "")
         {
             this.ObtenerTrailer(true);
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar4", "showAlert('Movimiento Exitoso');", true);
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar3", "cerrarModal('modalBloqueo');", true);
         }
         else
         {
             ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", string.Format("alert('{0}');", resultado), true);
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", "alert('Seleccione un lugar de destino');", true);
     }
 }
Esempio n. 2
0
 protected void gv_listar_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         MovimientoBC m          = new MovimientoBC();
         LinkButton   btnconf    = (LinkButton)e.Row.FindControl("btn_confirmar");
         LinkButton   btnanular  = (LinkButton)e.Row.FindControl("btn_anular");
         LinkButton   btndestino = (LinkButton)e.Row.FindControl("btn_editar");
         LinkButton   btn_subir  = (LinkButton)e.Row.FindControl("btn_subir");
         LinkButton   btn_bajar  = (LinkButton)e.Row.FindControl("btn_bajar");
         int          site_id    = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "SITE_ID"));
         int          orden      = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "ORDEN"));
         if (orden == m.MinOrden(site_id))
         {
             btn_subir.Visible = false;
         }
         if (orden == m.MaxOrden(site_id))
         {
             btn_bajar.Visible = false;
         }
         if (Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "MOES_ID")) >= 40)
         {
             btnconf.Visible    = false;
             btnanular.Visible  = false;
             btndestino.Visible = false;
         }
     }
     if (e.Row.RowType == DataControlRowType.Header)
     {
         e.Row.CssClass = "header-color2";
     }
 }
Esempio n. 3
0
    protected void btn_mover_Click(object sender, EventArgs e)
    {
        MovimientoBC m = new MovimientoBC();
        SolicitudBC  s = new SolicitudBC();

        s = s.ObtenerXId(int.Parse(this.hf_idSolicitud.Value));
        string resultado;

        m.ID_DESTINO   = int.Parse(this.ddl_editPos.SelectedValue);
        m.ID_TRAILER   = s.ID_TRAILER;
        m.ID_SOLICITUD = s.SOLI_ID;
        m.OBSERVACION  = "";
        bool ejecucion = s.DescargaMovimiento(m, s.ID_SITE, this.u.ID, out resultado);

        if (resultado == "" && ejecucion)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Se generó movimiento correctamente.');", true);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrarModal", "$('#modalPosicion').modal('hide');", true);
            this.ObtenerSolicitudes(true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", resultado), true);
        }
    }
Esempio n. 4
0
    private void ObtenerMovimientos(bool forzarBD)
    {
        if (this.ViewState["lista"] == null || forzarBD)
        {
            this.ViewState.Remove("filtrados");
            MovimientoBC m  = new MovimientoBC();
            DataTable    dt = m.obtenerMovimientoControl(int.Parse(this.ddl_buscarSite.SelectedValue));
            this.ViewState["lista"] = dt;
            this.ViewState.Remove("filtrados");
        }
        DataView dw;

        if (this.ViewState["filtrados"] == null)
        {
            dw = new DataView((DataTable)this.ViewState["lista"]);
        }
        else
        {
            dw = new DataView((DataTable)this.ViewState["filtrados"]);
        }
        if (this.ViewState["sortExpresion"] != null && this.ViewState["sortExpresion"].ToString() != "")
        {
            dw.Sort = (String)this.ViewState["sortExpresion"];
        }
        this.gv_listar.DataSource = dw.ToTable();
        this.gv_listar.DataBind();
    }
Esempio n. 5
0
    protected void btn_anular_Click(object sender, EventArgs e)
    {
        MovimientoBC m = new MovimientoBC();

        string    resultado = "";
        UsuarioBC usuario   = new UsuarioBC();

        usuario = (UsuarioBC)this.Session["Usuario"];

        if (this.ddl_confMotivo.SelectedValue == "0")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Seleccione Motivo!');", true);
        }
        else
        {
            // m.Confirmar(int.Parse(hf_id.Value), u.ID, txt_compObs.Text, int.Parse(ddl_compMotivo.SelectedValue), int.Parse(ddl_compPos.SelectedValue), out resultado);
            m.Anular(int.Parse(this.hf_id.Value), int.Parse(this.ddl_confMotivo.SelectedValue), this.txt_compObs.Text, usuario.ID, out resultado);
            if (resultado == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Anulado!');", true);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "$('#modalConfirmar').modal('hide');", true);
                this.ObtenerMovimientos(true);
                //   ObtenerMovimientos(true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", resultado), true);
            }
        }
    }
Esempio n. 6
0
    protected void btn_confirmar_Click(object sender, EventArgs e)
    {
        try
        {
            if (string.IsNullOrEmpty(hf_idCond.Value))
            {
                ConductorBC c = new ConductorBC();
                c.RUT             = txt_conductorRut.Text;
                c.NOMBRE          = txt_conductorNombre.Text;
                c.TRAN_ID         = Convert.ToInt32(ddl_transportista.SelectedValue);
                c.COND_EXTRANJERO = chk_conductorExtranjero.Checked;
                hf_idCond.Value   = c.AgregarIdentity().ToString();
            }
            MovimientoBC       mov       = new MovimientoBC();
            TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC();
            TrailerBC          trailer   = new TrailerBC();

            mov.FECHA_CREACION = DateTime.Now;
            mov.ID_ESTADO      = 10;
            mov.OBSERVACION    = txt_obs.Text;
            DateTime fh = DateTime.Parse(string.Format("{0} {1}", txt_ingresoFecha.Text, txt_ingresoHora.Text));
            mov.FECHA_ORIGEN  = fh;
            mov.ID_DESTINO    = Convert.ToInt32(this.ddl_posicion.SelectedValue);
            mov.FECHA_DESTINO = fh.AddMinutes(30);

            mov.PATENTE_TRACTO = txt_buscarPatente.Text;

            mov.MANT_EXTERNO = false;
            mov.ID_TRAILER   = 0;
            trailer.ID       = 0;
            trailer.PLACA    = "";

            trailer.TRAN_ID = Convert.ToInt32(ddl_transportista.SelectedValue);

            trailerUE.SITE_ID       = Convert.ToInt32(dropsite.SelectedValue); // 1; // Cambiar después de introducir variables de sesión
            trailerUE.CHOFER_RUT    = utils.formatearRut(txt_conductorRut.Text);
            trailerUE.CHOFER_NOMBRE = txt_conductorNombre.Text;
            trailerUE.ACOMP_RUT     = txt_acomRut.Text;

            trailerUE.COND_ID = Convert.ToInt32(hf_idCond.Value);

            UsuarioBC usuario = (UsuarioBC)Session["USUARIO"];
            string    resultado;
            bool      ejecucion = mov.ProcesoEntrada(mov, trailerUE, trailer, usuario.ID, out resultado);
            if (ejecucion && resultado == "")
            {
                utils.ShowMessage2(this, "confirmar", "success");
                limpiarTodo();
            }
            else
            {
                utils.ShowMessage(this, resultado, "error", false);
            }
        }
        catch (Exception ex)
        {
            utils.ShowMessage(this, ex.Message, "error", false);
        }
    }
Esempio n. 7
0
    protected void btn_cambiarDestino_Click(object sender, EventArgs e)
    {
        MovimientoBC m = new MovimientoBC();
        string       resultado;

        if (m.ModificarDestino(int.Parse(this.hf_id.Value), int.Parse(this.ddl_posDestino.SelectedValue), this.u.ID, out resultado) && resultado == "")
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Modificado correctamente!');", true);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "$('#modalDestino').modal('hide');", true);
            this.ObtenerMovimientos(true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}');", resultado), true);
        }
    }
Esempio n. 8
0
    protected void chk_cambiarDestino_Checked(object sender, EventArgs e)
    {
        MovimientoBC m = new MovimientoBC();

        if (this.chk_cambiarDestino.Checked)
        {
            this.utils.CargaDrop(this.ddl_compMotivo, "MOET_ID", "DESCRIPCION", m.obtenerXEstadoMovEstSubTipo(50, true));
            this.dv_cambiarD.Attributes.Add("style", "display:block");
            this.rfv_posicionConf.Enabled = true;
        }
        else
        {
            this.utils.CargaDrop(this.ddl_compMotivo, "MOET_ID", "DESCRIPCION", m.obtenerXEstadoMovEstSubTipo(40, true));
            this.dv_cambiarD.Attributes.Add("style", "display:none");
            this.rfv_posicionConf.Enabled = false;
        }
    }
Esempio n. 9
0
    protected void btn_completar_Click(object sender, EventArgs e)
    {
        MovimientoBC m = new MovimientoBC();

        if (this.chk_cambiarDestino.Checked)
        {
            if (this.ddl_compPos.SelectedIndex > 0)
            {
                string    resultado = "";
                UsuarioBC usuario   = new UsuarioBC();
                usuario = (UsuarioBC)this.Session["Usuario"];
                m.Confirmar(int.Parse(this.hf_id.Value), this.u.ID, this.txt_compObs.Text, int.Parse(this.ddl_compMotivo.SelectedValue), int.Parse(this.ddl_compPos.SelectedValue), out resultado);
                if (resultado == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Movimiento Finalizado Correctamente!');", true);
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "$('#modalFinalizar').modal('hide');", true);
                    this.ObtenerMovimientos(true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}!');", resultado), true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Seleccione un destino nuevo!');", true);
            }
        }
        else
        {
            string resultado = "";
            m.Confirmar(int.Parse(this.hf_id.Value), this.u.ID, this.txt_compObs.Text, 0, int.Parse(this.ddl_compMotivo.SelectedValue), out resultado);
            if (resultado == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Movimiento Finalizado Correctamente!');", true);
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "$('#modalFinalizar').modal('hide');", true);
                this.ObtenerMovimientos(true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", string.Format("alert('{0}!');", resultado), true);
            }
        }
    }
Esempio n. 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Session["usuario"] == null)
     {
         this.Response.Redirect("~/InicioQYMS2.aspx");
     }
     this.u = (UsuarioBC)this.Session["usuario"];
     if (!this.IsPostBack)
     {
         YMS_ZONA_BC  yms = new YMS_ZONA_BC();
         MovimientoBC m   = new MovimientoBC();
         UsuarioBC    usu = new UsuarioBC();
         this.utils.CargaDropNormal(this.ddl_buscarSite, "ID", "NOMBRE", yms.ObteneSites(this.u.ID));
         this.ddl_buscarSite_SelectedIndexChanged(null, null);
         this.utils.CargaDropTodos(this.ddl_moti, "ID", "DESCRIPCION", m.ObtenerTipos());
         this.utils.CargaDropTodos(this.ddl_usuario, "ID", "USERNAME", usu.ObtenerUsuariosRemolcador(int.Parse(ddl_buscarSite.SelectedValue)));
         this.txt_desde.Text = DateTime.Now.AddDays(-7).ToShortDateString();
         this.txt_hasta.Text = DateTime.Now.ToShortDateString();
         this.ObtenerReporte();
     }
 }
Esempio n. 11
0
 protected void gv_listar_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DESTINO")
     {
         this.hf_id.Value = e.CommandArgument.ToString();
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalDestino();", true);
     }
     if (e.CommandName == "ANULAR")
     {
         this.hf_id.Value = e.CommandArgument.ToString();
         MovimientoBC m = new MovimientoBC();
         this.utils.CargaDrop(this.ddl_confMotivo, "MOET_ID", "DESCRIPCION", m.obtenerXEstadoMovEstSubTipo(60, true));
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalConfirmar();", true);
     }
     if (e.CommandName == "CONFIRMAR")
     {
         this.hf_id.Value = e.CommandArgument.ToString();
         MovimientoBC m = new MovimientoBC();
         this.utils.CargaDrop(this.ddl_compMotivo, "MOET_ID", "DESCRIPCION", m.obtenerXEstadoMovEstSubTipo(40, true));
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "modal", "modalFinalizar();", true);
     }
     if (e.CommandName == "SUBIR")
     {
         this.hf_id.Value = e.CommandArgument.ToString();
         MovimientoBC m = new MovimientoBC();
         m.ID = Convert.ToInt32(this.hf_id.Value);
         m.CambiarOrden(true);
         this.ObtenerMovimientos(true);
     }
     if (e.CommandName == "BAJAR")
     {
         this.hf_id.Value = e.CommandArgument.ToString();
         MovimientoBC m = new MovimientoBC();
         m.ID = Convert.ToInt32(this.hf_id.Value);
         m.CambiarOrden(false);
         this.ObtenerMovimientos(true);
     }
 }
Esempio n. 12
0
 public bool MOVIMIENTO_automatico_estacinamiento(MovimientoBC mov, int site_id, int usua_id, out string resultado)
 {
     return(tran.Movimiento_automatico_estacionamiento(mov, site_id, usua_id, out resultado));
 }
Esempio n. 13
0
 public bool MOVIMIENTO(MovimientoBC mov, int site_id, int usua_id, out string resultado)
 {
     return(tran.Movimiento_Interno(mov, site_id, usua_id, out resultado));
 }
Esempio n. 14
0
 public bool MOVIMIENTO(MovimientoBC mov, TrailerUltEstadoBC traiUE, TrailerBC trai, int usua_id, out string resultado)
 {
     return(tran.Movimiento_Interno(mov, traiUE, trai, usua_id, out resultado));
 }
Esempio n. 15
0
 public bool ProcesoEntrada(MovimientoBC mov, TrailerUltEstadoBC traiUE, TrailerBC trai, int usua_id, out string resultado)
 {
     return(tran.Movimiento_Entrada(mov, traiUE, trai, usua_id, out resultado));
 }
Esempio n. 16
0
    private bool CrearSolicitud(int luga_id, string error_in, out string error_out)
    {
        bool error = true;

        error_out = error_in;
        int           soli_id = Convert.ToInt32(hf_idSolicitud.Value);
        SolicitudBC   s       = new SolicitudBC();
        TrailerLogiBC t       = new TrailerLogiBC();

        s.ID_SITE     = Convert.ToInt32(dropsite.SelectedValue);
        s.SOLI_ID     = soli_id;
        s.ID_USUARIO  = usuario.ID;
        s.DOCUMENTO   = txt_doc.Text;
        s.OBSERVACION = txt_obs.Text;
        s.ID_TRAILER  = Convert.ToInt32(hf_idTrailer.Value);
        if (rb_Desechos.Checked)
        {
            error = t.Desechos_Crear(s, luga_id, out error_in);
            if (string.IsNullOrEmpty(error_in))
            {
                error_out += "Se ha creado la solicitud";
            }
            else
            {
                error_out += error_in;
            }
        }
        if (rb_Pallets.Checked)
        {
            error = t.Pallets_Crear(s, luga_id, out error_in);
            if (string.IsNullOrEmpty(error_in))
            {
                error_out += "Se ha creado la solicitud";
            }
            else
            {
                error_out += error_in;
            }
        }

        if (rb_estacionamiento.Checked)
        {
            MovimientoBC mov = new MovimientoBC();
            mov.ID_TRAILER  = Convert.ToInt32(hf_idTrailer.Value);
            mov.OBSERVACION = "";

            mov.ID_DESTINO  = 0;
            mov.OBSERVACION = txt_obs.Text;
            mov.petroleo    = null;
            error           = mov.MOVIMIENTO_automatico_estacinamiento(mov, Convert.ToInt32(dropsite.SelectedValue), usuario.ID, out error_in);

            if (string.IsNullOrEmpty(error_in))
            {
                error_out += "Trailer al estacionamiento";
            }
            else
            {
                error_out += error_in;
            }
        }

        if (rb_estacionamientoMan.Checked)
        {
            MovimientoBC mov = new MovimientoBC();
            mov.ID_TRAILER  = Convert.ToInt32(hf_idTrailer.Value);
            mov.OBSERVACION = "";

            mov.ID_DESTINO  = luga_id;
            mov.OBSERVACION = txt_obs.Text;
            mov.petroleo    = null;
            error           = mov.MOVIMIENTO(mov, Convert.ToInt32(dropsite.SelectedValue), usuario.ID, out error_in);

            if (string.IsNullOrEmpty(error_in))
            {
                error_out += "Trailer al estacionamiento";
            }
            else
            {
                error_out += error_in;
            }
        }

        if (rb_descargar.Checked)
        {
            s             = new SolicitudBC();
            s.ID_SITE     = Convert.ToInt32(dropsite.SelectedValue);
            s.ID_USUARIO  = usuario.ID;
            s.DOCUMENTO   = txt_doc.Text;
            s.OBSERVACION = txt_obs.Text;
            s.ID_TRAILER  = Convert.ToInt32(hf_idTrailer.Value);

            error = t.DescargaLI_Crear(s, luga_id, out error_in);

            if (string.IsNullOrEmpty(error_in))
            {
                error_out = "Se ha creado la solicitud.";
            }
            else
            {
                error_out += error_in;
            }
        }

        return(error);
    }
Esempio n. 17
0
 public bool DescargaMovimiento(MovimientoBC movimiento, int site_id, int usua_id, out string resultado)
 {
     return(tran.Solicitud_DescargaMovimiento(movimiento, site_id, usua_id, out resultado));
 }
Esempio n. 18
0
    public void btn_confirmar_Click(object sender, EventArgs e)
    {
        try
        {
            MovimientoBC mov = new MovimientoBC();
            //SolicitudBC solicitud = new SolicitudBC();
            //TrailerUltEstadoBC traiue = new TrailerUltEstadoBC();
            //int id = int.Parse(hf_trailerId.Value);
            //traiue = traiue.CargaTrue(id);
            //string fh = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
            //solicitud.ID_TIPO = 2;
            //solicitud.ID_USUARIO = 1;   // Variable de sesión
            //solicitud.FECHA_CREACION = DateTime.Now;
            //solicitud.FECHA_PLAN_ANDEN = DateTime.Parse(fh);
            //solicitud.DOCUMENTO = traiue.DOC_INGRESO;
            //solicitud.OBSERVACION = "";
            //solicitud.ID_TRAILER = id;
            //solicitud.ID_DESTINO = int.Parse(ddl_destinoPos.SelectedValue);
            //if (solicitud.Descarga(solicitud))
            //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Solicitud ingresada correctamente');", true);
            //else
            //    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ocurrió un error!');", true);

            if (this.hf_trailerId.Value == "" || this.hf_trailerId.Value == null)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe seleccionar un trailer.');", true);
            }
            else
            {
                mov.ID_TRAILER     = int.Parse(this.hf_trailerId.Value);
                mov.FECHA_CREACION = DateTime.Now;
                mov.OBSERVACION    = "";
                mov.FECHA_ORIGEN   = DateTime.Parse(DateTime.Now.ToString());
                mov.FECHA_DESTINO  = mov.FECHA_ORIGEN.AddMinutes(15);
                mov.ID_DESTINO     = int.Parse(this.ddl_destinoPos.SelectedValue);
                mov.ID_ESTADO      = 10;
                mov.OBSERVACION    = "";
                TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC();
                trailerUE.ID       = int.Parse(this.hf_trailerId.Value);
                trailerUE.SITE_ID  = 1; // Cambiar después de introducir variables de sesión
                trailerUE.SITE_IN  = true;
                trailerUE.LUGAR_ID = int.Parse(this.ddl_destinoPos.SelectedValue);

                TrailerBC trailer = new TrailerBC();

                mov.MANT_EXTERNO = false;
                mov.ID_TRAILER   = int.Parse(this.hf_trailerId.Value);

                //  trailer.PLACA = this.txt_buscarPatente.Text;
                //     trailer.CODIGO = "S/ CODIGO";

                //  trailer.NUMERO = this.txt_buscarNro.Text;
                trailer.ID = mov.ID_TRAILER;
                UsuarioBC usuario = (UsuarioBC)Session["USUARIO"];
                string    resultado;
                bool      ejecucion = mov.MOVIMIENTO(mov, trailerUE, trailer, usuario.ID, out resultado);

                if (ejecucion && resultado == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Se ingresaron correctamente los datos.');", true);
                    ddl_destinoZona.SelectedValue = "0";
                    ddl_destinoZona_SelectedIndexChanged(null, null);
                    this.pnl_detalleLugar.Attributes.Remove("style");
                    this.pnl_detalleTrailer.CssClass = "";
                    this.pnl_detalleTrailer.Attributes.Remove("style");
                    this.img_reloj.ImageUrl   = "";
                    this.img_trailer.ImageUrl = "";
                    this.lbl_lugar.Text       = "";
                    this.lbl_origenZona.Text  = "";
                    this.lbl_origenPlaya.Text = "";
                }
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Ocurrió un error!');", true);
        }
    }
Esempio n. 19
0
    protected void btn_confirmar_Click(object sender, EventArgs e)
    {
        try
        {
            ConductorBC        c         = new ConductorBC();
            MovimientoBC       mov       = new MovimientoBC();
            TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC();
            TrailerBC          trailer   = new TrailerBC();
            if (string.IsNullOrEmpty(hf_idCond.Value))
            {
                c.RUT             = utils.formatearRut(txt_conductorRut.Text);
                c.NOMBRE          = txt_conductorNombre.Text;
                c.TRAN_ID         = Convert.ToInt32(ddl_transportista.SelectedValue);
                c.COND_EXTRANJERO = chk_conductorExtranjero.Checked;
                hf_idCond.Value   = c.AgregarIdentity().ToString();
            }

            mov.FECHA_CREACION = DateTime.Now;
            mov.ID_ESTADO      = 10;
            mov.OBSERVACION    = txt_obs.Text;
            mov.FECHA_ORIGEN   = Convert.ToDateTime(string.Format("{0} {1}", txt_ingresoFecha.Text, txt_ingresoHora.Text));
            mov.ID_DESTINO     = Convert.ToInt32(ddl_posicion.SelectedValue);
            mov.FECHA_DESTINO  = mov.FECHA_ORIGEN.AddMinutes(30);
            if (utils.patentevalida(txt_traExtPat.Text) == true)
            {
                mov.PATENTE_TRACTO = txt_traExtPat.Text;

                if (rb_mantExterno.Checked)
                {
                    mov.MANT_EXTERNO = true;
                }
                else
                {
                    trailerUE.COND_ID = Convert.ToInt32(hf_idCond.Value);
                    mov.MANT_EXTERNO  = false;
                    mov.ID_TRAILER    = Convert.ToInt32(hf_idTrailer.Value);
                    trailer.ID        = Convert.ToInt32(hf_idTrailer.Value);
                    trailer.PLACA     = txt_buscarPatente.Text;
                    trailer.CODIGO    = string.Format("{0}_{1}", ddl_transportista.SelectedItem.Text, txt_buscarPatente.Text);
                    trailer.EXTERNO   = (rb_externo.Checked || rb_proveedor.Checked || rb_mantExterno.Checked);
                    trailer.TRAN_ID   = Convert.ToInt32(ddl_transportista.SelectedValue);

                    trailerUE.SITE_ID                   = Convert.ToInt32(dropsite.SelectedValue); // 1; // Cambiar después de introducir variables de sesión
                    trailerUE.CHOFER_RUT                = utils.formatearRut(txt_conductorRut.Text);
                    trailerUE.CHOFER_NOMBRE             = txt_conductorNombre.Text;
                    trailerUE.ACOMP_RUT                 = txt_acomRut.Text;
                    trailerUE.PROV_ID                   = Convert.ToInt32(ddl_proveedor.SelectedValue);
                    trailerUE.DOC_INGRESO               = txt_buscarDoc.Text;
                    trailerUE.SELLO_INGRESO             = txt_idSello.Text;
                    trailerUE.TIPO_INGRESO_CARGA        = ddl_tipo_carga.SelectedValue;
                    trailerUE.motivo_TIPO_INGRESO_CARGA = ddl_motivo.SelectedValue;
                    trailerUE.pring_id                  = hf_pring_id.Value.ToString(); // p.CargarPreEntrada(  //p.CargarPreEntrada(mov.ID_TRAILER, Convert.ToInt32(dropsite.SelectedValue)).ID.ToString();
                    trailerUE.CARGADO                   = rb_ingresoCargado.Checked;
                }
                UsuarioBC usuario = (UsuarioBC)this.Session["USUARIO"];

                if (trailer.ID == 0)
                {
                    utils.ShowMessage(this, "Debe ingresar Trailer", "warn", true);
                    limpiarTodo();
                }
                else
                {
                    string resultado;
                    bool   ejecucion = mov.ProcesoEntrada(mov, trailerUE, trailer, usuario.ID, out resultado);
                    if (ejecucion && resultado == "")
                    {
                        utils.ShowMessage(this, "Ingreso correcto", "success", true);
                        limpiarTodo();
                    }
                    else
                    {
                        utils.ShowMessage(this, resultado, "error", false);
                    }
                }
            }
            else
            {
                utils.ShowMessage(this, "Patente de Tracto Invalida", "warn", false);
            }
        }
        catch (Exception ex)
        {
            utils.ShowMessage(this, ex.Message, "error", false);
        }
    }
Esempio n. 20
0
    protected void btn_guardar_Click(object sender, EventArgs e)
    {
        TrailerLogiBC t            = new TrailerLogiBC();
        SolicitudBC   s            = new SolicitudBC();
        int           soli_id      = Convert.ToInt32(hf_idSolicitud.Value);
        int           luga_trailer = 0;
        int           soan_orden   = 0;

        try
        {
            luga_trailer = Convert.ToInt32(hf_lugaid.Value);
            soan_orden   = Convert.ToInt32(hf_soanorden.Value);
        }
        catch (Exception)
        {
        }

        int luga_id = 0;
        int site_id = 0;

        try
        {
            luga_id = Convert.ToInt32(ddl_posicion.SelectedValue);
            site_id = Convert.ToInt32(dropsite.SelectedValue);
        }
        catch (Exception)
        {
        }

        string mensaje = "";
        bool   error   = true;

        switch (hf_accion.Value)
        {
        case "DEF_PALLETS":
        case "DEF_DESECHOS":
            if (luga_id != 0)
            {
                error = CrearSolicitud(luga_id, "", out mensaje);
            }
            else
            {
                utils.ShowMessage(this, "Complete todos los datos", "warn", true);
                return;
            }
            break;

        case "DEF_DESCARGA_LI":
            if (luga_id != 0)
            {
                s             = new SolicitudBC();
                s.ID_SITE     = site_id;
                s.ID_USUARIO  = usuario.ID;
                s.DOCUMENTO   = txt_doc.Text;
                s.OBSERVACION = txt_obs.Text;
                s.ID_TRAILER  = Convert.ToInt32(hf_idTrailer.Value);

                error = t.DescargaLI_Crear(s, luga_id, out mensaje);

                if (string.IsNullOrEmpty(mensaje))
                {
                    mensaje = "Se ha creado la solicitud.";
                }
            }
            else
            {
                utils.ShowMessage(this, "Complete todos los datos", "warn", true);
                return;
            }
            break;

        case "DEF_MOVER":
            MovimientoBC mov = new MovimientoBC();
            mov.ID_TRAILER  = Convert.ToInt32(hf_idTrailer.Value);
            mov.OBSERVACION = "";
            mov.ID_DESTINO  = Convert.ToInt32(ddl_posicion.SelectedValue);
            mov.OBSERVACION = txt_obs.Text;
            mov.petroleo    = null;
            error           = mov.MOVIMIENTO(mov, site_id, usuario.ID, out mensaje);
            if (string.IsNullOrEmpty(mensaje))
            {
                mensaje = "Se ha generado el movimiento";
            }
            break;

        case "DESCARGA_EDITA":
            break;

        case "DESCARGA_POSICION_LI":
            break;

        case "DESCARGA_COMPLETA_LI":
            error = t.DescargaLI_Completar(soli_id, luga_trailer, soan_orden, usuario.ID, out mensaje);
            if (string.IsNullOrEmpty(mensaje))
            {
                string error_out;
                mensaje = "Se ha completado la solicitud.";
                error   = CrearSolicitud(luga_id, mensaje, out error_out);
                mensaje = error_out;
            }
            break;

        case "DESECHOS_COMPLETAR":
            error = t.Desechos_Completar(soli_id, luga_trailer, soan_orden, usuario.ID, out mensaje);
            if (string.IsNullOrEmpty(mensaje) && !rb_Nada.Checked)
            {
                mensaje = "Se ha completado la solicitud. ";
                string error_out;
                error   = CrearSolicitud(luga_id, mensaje, out error_out);
                mensaje = error_out;
            }
            break;

        case "PALLETS_COMPLETAR":
            error = t.PALLETS_Completar(soli_id, luga_trailer, soan_orden, usuario.ID, out mensaje);
            if (string.IsNullOrEmpty(mensaje) && !rb_Nada.Checked)
            {
                mensaje = "Se ha completado la solicitud. ";
                string error_out;
                error   = CrearSolicitud(luga_id, mensaje, out error_out);
                mensaje = error_out;
            }
            break;

        case "PALLETS_TRASLADO_ANDEN":
            error = t.Pallets_Reiniciar(soli_id, luga_trailer, luga_id, usuario.ID, soan_orden, soan_orden + 1, out mensaje);

            if (string.IsNullOrEmpty(mensaje))
            {
                mensaje = "Se ha generado el movimiento";
            }
            break;

        case "PALLETS_TRASLADO_EST":

            error = t.Pallets_TrasladoEst(soli_id, luga_trailer, luga_id, soan_orden, usuario.ID, out mensaje);
            if (string.IsNullOrEmpty(mensaje))
            {
                mensaje = "Se ha generado el movimiento";
            }
            break;

        case "PALLETS_REINICIAR":
            error = t.Pallets_Reiniciar(soli_id, luga_trailer, luga_id, usuario.ID, 0, soan_orden + 1, out mensaje);
            if (string.IsNullOrEmpty(mensaje))
            {
                mensaje = "Se ha reanudado la descarga";
            }
            break;

        case "DEF_DESCARGA":
        case "DESCARGA_COMPLETA":
            error = s.DescargaCompleta(soli_id, out mensaje, usuario.ID, luga_id);
            if (string.IsNullOrEmpty(mensaje))
            {
                mensaje = "Se ha completado la descarga";
            }
            break;

        case "DESCARGA_POSICION":
            s             = new SolicitudBC();
            s.SOLI_ID     = Convert.ToInt32(hf_idSolicitud.Value);
            s.OBSERVACION = "";
            s.ID_DESTINO  = luga_id;
            s.TIMESTAMP   = Convert.ToDateTime(hf_timestamp.Value);
            if (s.validarTimeStamp())
            {
                error = s.ModificarDescarga(s);
                if (string.IsNullOrEmpty(mensaje))
                {
                    mensaje = "Se ha modificado la solicitud";
                }
                else
                {
                    mensaje = "Error";
                }
            }
            else
            {
                mensaje = "No se pudo validar timestamp.";
            }
            break;

        case "DESCARGA_MOVER":
            MovimientoBC m = new MovimientoBC();
            s              = new SolicitudBC();
            m.ID_DESTINO   = luga_id;
            m.ID_TRAILER   = Convert.ToInt32(hf_idTrailer.Value);
            m.ID_SOLICITUD = soli_id;
            m.OBSERVACION  = "";

            error = s.DescargaMovimiento(m, site_id, usuario.ID, out mensaje);
            if (string.IsNullOrEmpty(mensaje))
            {
                mensaje = "Se ha generado el movimiento";
            }
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrarmodal", "cerrarModal('modalLogistica');", true);
            break;
        }

        if (error)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", string.Format("showAlert('{0}');", mensaje), true);
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cerrar", "cerrarModal('modalLogistica');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "msj", string.Format("showAlert4('{0}');", mensaje), true);
        }
        ObtenerTrailer(true);
    }
Esempio n. 21
0
 public bool Modificar(MovimientoBC movimiento)
 {
     return(tran.Movimiento_Modificar(movimiento));
 }
Esempio n. 22
0
    protected void btn_confirmar_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.ddl_posicion.SelectedValue == "0")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe seleccionar posicion Destino');", true);
            }
            else if (this.hf_idTrailer.Value == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe ingresar Trailer');", true);
                limpiarTodo();
            }
            else if (this.txt_conductorRut.Text == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje2", "alert('Debe ingresar Conductor');", true);
            }

            else
            {
                ConductorBC c = new ConductorBC();
                if (string.IsNullOrEmpty(hf_idCond.Value))
                {
                    if (extranjero.Checked == false)
                    {
                        c.RUT = utils.formatearRut(txt_conductorRut.Text);
                    }
                    else
                    {
                        c.RUT = txt_conductorRut.Text;
                    }

                    c.NOMBRE        = txt_conductorNombre.Text;
                    c.TRAN_ID       = int.Parse(ddl_transportista.SelectedValue);
                    hf_idCond.Value = c.AgregarIdentity().ToString();
                }
                MovimientoBC       mov       = new MovimientoBC();
                TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC();
                TrailerBC          trailer   = new TrailerBC();

                mov.FECHA_CREACION = DateTime.Now;

                mov.ID_ESTADO = 10;

                mov.OBSERVACION = this.txt_obs.Text;

                DateTime fh = DateTime.Parse(string.Format("{0} {1}", this.txt_ingresoFecha.Text, this.txt_ingresoHora.Text));

                mov.FECHA_ORIGEN = fh;

                mov.ID_DESTINO    = int.Parse(this.ddl_posicion.SelectedValue);
                mov.FECHA_DESTINO = fh.AddMinutes(30);

                mov.PATENTE_TRACTO = this.txt_traExtPat.Text;

                trailerUE.COND_ID = int.Parse(hf_idCond.Value);
                mov.MANT_EXTERNO  = false;
                mov.ID_TRAILER    = int.Parse(this.hf_idTrailer.Value);
                trailer.ID        = int.Parse(this.hf_idTrailer.Value);
                trailer.PLACA     = this.txt_buscarPatente.Text;
                trailer.CODIGO    = string.Format("{0}_{1}", this.ddl_transportista.SelectedItem.Text, this.txt_buscarPatente.Text);
                if (rb_externo.Checked)
                {
                    trailer.EXTERNO = true;
                }
                else
                {
                    trailer.EXTERNO = false;
                }
                trailer.TRAN_ID = int.Parse(this.ddl_transportista.SelectedValue);

                trailerUE.SITE_ID = Convert.ToInt32(this.dropsite.SelectedValue); // 1; // Cambiar después de introducir variables de sesión

                if (extranjero.Checked == false)
                {
                    trailerUE.CHOFER_RUT = utils.formatearRut(this.txt_conductorRut.Text);
                }
                else
                {
                    trailerUE.CHOFER_RUT = this.txt_conductorRut.Text;
                }
                trailerUE.CHOFER_NOMBRE             = this.txt_conductorNombre.Text;
                trailerUE.ACOMP_RUT                 = this.txt_acomRut.Text;
                trailerUE.PROV_ID                   = int.Parse(this.ddl_proveedor.SelectedValue);
                trailerUE.DOC_INGRESO               = this.txt_buscarDoc.Text;
                trailerUE.SELLO_INGRESO             = this.txt_idSello.Text;
                trailerUE.TIPO_INGRESO_CARGA        = this.ddl_tipo_carga.SelectedValue;
                trailerUE.motivo_TIPO_INGRESO_CARGA = this.ddl_motivo.SelectedValue;
                PreEntradaBC p = new PreEntradaBC();
                trailerUE.pring_id = hf_pring_id.Value.ToString(); // p.CargarPreEntrada(  //p.CargarPreEntrada(mov.ID_TRAILER, int.Parse(dropsite.SelectedValue)).ID.ToString();
                if (this.rb_ingresoCargado.Checked)                //Trailer cargado: Entrada a destino
                {
                    trailerUE.CARGADO = true;
                }
                else //Trailer sin carga: Entrada a origen
                {
                    trailerUE.CARGADO = false;
                }
                UsuarioBC usuario = (UsuarioBC)Session["USUARIO"];

                if (trailer.ID == 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe ingresar Trailer);", true);
                    limpiarTodo();
                }
                else
                {
                    string resultado;
                    bool   ejecucion = mov.ProcesoEntrada(mov, trailerUE, trailer, usuario.ID, out resultado);
                    if (ejecucion && resultado == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje8", "showAlert('Ingreso correcto.');", true);
                        limpiarTodo();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + resultado + "');", true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Error! No se pudo ingresar los datos.');", true);
        }
    }
Esempio n. 23
0
    protected void btn_confirmar_Click(object sender, EventArgs e)
    {
        MovimientoBC mov = new MovimientoBC();

        if (this.hf_idTrailer.Value == "" || this.hf_idTrailer.Value == null)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('Debe seleccionar un trailer.');", true);
        }
        else
        {
            mov.ID_TRAILER     = int.Parse(this.hf_idTrailer.Value);
            mov.FECHA_CREACION = DateTime.Now;
            mov.OBSERVACION    = "";
            mov.FECHA_ORIGEN   = DateTime.Parse(this.txt_fechaMovimiento.Text);
            mov.FECHA_DESTINO  = mov.FECHA_ORIGEN.AddMinutes(15);
            mov.ID_DESTINO     = int.Parse(this.ddl_destinoPos.SelectedValue);
            mov.ID_ESTADO      = 10;
            mov.OBSERVACION    = this.txt_refOp.Text;
            mov.petroleo       = petroleo.Checked.ToString();
            TrailerUltEstadoBC trailerUE = new TrailerUltEstadoBC();
            trailerUE.ID       = int.Parse(this.hf_idTrailer.Value);
            trailerUE.SITE_ID  = int.Parse(this.dropsite.SelectedValue);   //   1; // Cambiar después de introducir variables de sesión
            trailerUE.SITE_IN  = true;
            trailerUE.LUGAR_ID = int.Parse(this.ddl_destinoPos.SelectedValue);

            TrailerBC trailer = new TrailerBC();

            mov.MANT_EXTERNO = false;
            mov.ID_TRAILER   = int.Parse(this.hf_idTrailer.Value);

            //  trailer = trailer.obtenerXID(int.Parse(this.hf_idTrailer.Value));
            trailer.PLACA  = this.txt_buscarPatente.Text;
            trailer.CODIGO = "S/ CODIGO";
            if (this.rb_trailerExterno.Checked)
            {
                trailer.EXTERNO = true;
            }
            else
            {
                trailer.EXTERNO = false;
            }
            trailer.NUMERO = this.txt_buscarNro.Text;
            trailer.ID     = int.Parse(this.ddl_transportista.SelectedValue);


            UsuarioBC usuario = (UsuarioBC)Session["USUARIO"];
            string    resultado;

            bool ejecucion = mov.MOVIMIENTO(mov, trailerUE, trailer, usuario.ID, out resultado);

            if (resultado == "" && ejecucion)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "showAlert('Se ingresaron correctamente los datos.');", true);
                limpiar();
                ddl_destinoZona.SelectedValue = "0";
                ddl_destinoZona_SelectedIndexChanged(null, null);
                this.pnl_detalleLugar.Attributes.Remove("style");
                this.pnl_detalleTrailer.CssClass = "";
                this.pnl_detalleTrailer.Attributes.Remove("style");
                //this.img_reloj.ImageUrl = "";
                this.img_trailer.ImageUrl = "";
                this.lbl_lugar.Text       = "";
                this.lbl_origenZona.Text  = "";
                this.lbl_origenPlaya.Text = "";
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "mensaje", "alert('" + resultado + "');", true);
            }
        }
    }