Пример #1
0
        public Boolean ActualizarEstadoAprob(com_ListadoMaterialesDisponibles_Det_Info Info, ref string msg)
        {
            try
            {
                using (EntitiesCompras_Edehsa context = new EntitiesCompras_Edehsa())
                {
                    var contact = context.com_ListadoMaterialesDisponibles_Det.FirstOrDefault(obj => obj.IdEmpresa == Info.IdEmpresa &&
                                                                                              obj.IdListadoMaterialesDisponibles == Info.IdListadoMaterialesDisponibles && obj.IdDetalle == Info.IdDetalle);

                    if (contact != null)
                    {
                        contact.IdEstadoAprob = Info.lm_IdEstadoAprobado;

                        context.SaveChanges();
                        msg = "Se ha procedido actualizar elListado de Materiales #: " + Info.IdListadoMaterialesDisponibles.ToString() + " exitosamente.";
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.InnerException + " " + ex.Message;
                msg     = "Se ha producido el siguiente error: " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
        private void gridvwDetListMaterialesDisponibles_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            try
            {
                InfoDet = new com_ListadoMaterialesDisponibles_Det_Info();
                InfoDet = (com_ListadoMaterialesDisponibles_Det_Info)this.gridvwDetListMaterialesDisponibles.GetFocusedRow();
                Double LongitudProductoOT;

                if (e.Column.Name == "col_IdProducto" || e.Column.Name == "ColCantidad_pieza_entera" || e.Column.Name == "ColCantidad_total_pieza_complementaria")
                {
                    foreach (var item in ListaBind)
                    {
                        var    itemProd = listProducto.FirstOrDefault(p => p.IdProducto == InfoDet.IdProducto);
                        double?suma_largo_restante_pedido = LstInfoLMatxObra.AsEnumerable().Where(row => row.IdProducto == InfoDet.IdProducto).Sum(row => row.largo_restante);

                        if (item.IdProducto == InfoDet.IdProducto)
                        {
                        }
                        item.Unidades = Convert.ToDouble(item.cantidad_pieza_entera) + Convert.ToDouble(item.cantidad_total_pieza_complementaria);
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus = new tb_sis_Log_Error_Vzen_Bus();
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void gridvwDetListMaterialesDisponibles_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                com_ListadoMaterialesDisponibles_Det_Info Temp = new com_ListadoMaterialesDisponibles_Det_Info();
                Temp = (com_ListadoMaterialesDisponibles_Det_Info)gridvwDetListMaterialesDisponibles.GetFocusedRow();
                if ((e.KeyChar == (char)8))
                {
                    if (MessageBox.Show("¿Desea eliminar el producto: " + Temp.pr_descripcion + " de la Lista ?", "Eliminar producto", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        List <com_ListadoMaterialesDisponibles_Det_Info> lsttemp = new List <com_ListadoMaterialesDisponibles_Det_Info>();


                        for (int i = 0; i < gridvwDetListMaterialesDisponibles.RowCount; i++)
                        {
                            if (i != gridvwDetListMaterialesDisponibles.FocusedRowHandle)
                            {
                                var ass = (com_ListadoMaterialesDisponibles_Det_Info)gridvwDetListMaterialesDisponibles.GetRow(i);
                                if (ass != null)
                                {
                                    com_ListadoMaterialesDisponibles_Det_Info row = new com_ListadoMaterialesDisponibles_Det_Info();

                                    row.IdEmpresa = param.IdEmpresa;

                                    row.CodObra = Obra.get_item();
                                    //row.IdOrdenTaller = Convert.ToInt32(UltraCmbOrdenTaller.EditValue);
                                    row.Det_Kg    = ass.Det_Kg;
                                    row.IdDetalle = 0;
                                    row.IdListadoMaterialesDisponibles = 0;
                                    row.IdProducto = ass.IdProducto;
                                    if (ass.IdProducto == 0)
                                    {
                                        MessageBox.Show("Debe corregir su seleccion de productos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                    }
                                    row.Unidades       = ass.Unidades;
                                    row.pr_codigo      = ass.pr_codigo;
                                    row.pr_descripcion = ass.pr_descripcion;
                                    if (row.Unidades != 0 && row.Det_Kg != 0)
                                    {
                                        lsttemp.Add(row);
                                    }
                                }
                            }
                        }


                        gridCtrlDetListMaterialesDisponibles.DataSource = lsttemp;

                        LstInfoLMat = (List <com_ListadoMaterialesDisponibles_Det_Info>)gridvwDetListMaterialesDisponibles.DataSource;
                    }
                }
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString());
            }
        }
Пример #4
0
        public List <com_ListadoMaterialesDisponibles_Det_Info> Get_List_ListadoMaterialesDisponibles_Det(int IdEmpresa, decimal idLstMater)
        {
            List <com_ListadoMaterialesDisponibles_Det_Info> Lst = new List <com_ListadoMaterialesDisponibles_Det_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_ListadoMaterialesDisponibles_Detalle
                            where q.IdEmpresa == IdEmpresa && q.IdListadoMaterialesDisponibles == idLstMater
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoMaterialesDisponibles_Det_Info Obj = new com_ListadoMaterialesDisponibles_Det_Info();
                    Obj.IdEmpresa = item.IdEmpresa;


                    Obj.IdListadoMaterialesDisponibles = item.IdListadoMaterialesDisponibles;
                    Obj.IdDetalle           = item.IdDetalle;
                    Obj.IdProducto          = item.IdProducto;
                    Obj.Unidades            = item.Unidades;
                    Obj.Det_Kg              = item.Det_Kg;
                    Obj.CodObra             = item.CodObra;
                    Obj.pr_codigo           = item.pr_codigo;
                    Obj.pr_descripcion      = item.pr_descripcion;
                    Obj.lm_IdEstadoAprobado = item.IdEstadoAprob;

                    Obj.largo_pieza_entera                  = item.largo_pieza_entera;
                    Obj.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                    Obj.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                    Obj.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                    Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                    Obj.largo_despunte1     = item.largo_despunte1;
                    Obj.cantidad_despunte1  = item.cantidad_despunte1;
                    Obj.es_despunte_usable1 = item.es_despunte_usable1;
                    Obj.largo_despunte2     = item.largo_despunte2;
                    Obj.cantidad_despunte2  = item.cantidad_despunte2;
                    Obj.es_despunte_usable2 = item.es_despunte_usable2;


                    Lst.Add(Obj);
                }
                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
Пример #5
0
 public Boolean ActualizarEstadoAprob(com_ListadoMaterialesDisponibles_Det_Info Info, ref string msg)
 {
     try
     {
         return(Data.ActualizarEstadoAprob(Info, ref msg));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "ActualizarEstadoAprob", ex.Message), ex)
               {
                   EntityType = typeof(com_ListadoMaterialesDisponibles_Det_Bus)
               };
     }
 }
 private void gridvwDetListMaterialesDisponibles_FocusedColumnChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedColumnChangedEventArgs e)
 {
     try
     {
         com_ListadoMaterialesDisponibles_Det_Info Info = new com_ListadoMaterialesDisponibles_Det_Info();
         int i = 0;
         //idprod
         //i = gridvwDetListMaterialesDisponibles.FocusedRowHandle;
         Info = (com_ListadoMaterialesDisponibles_Det_Info)gridvwDetListMaterialesDisponibles.GetFocusedRow();
         in_Producto_Info prod = new in_Producto_Info();
         if (Info != null)
         {
             prod = BusProd.Get_Info_BuscarProducto(Info.IdProducto, param.IdEmpresa);
             gridvwDetListMaterialesDisponibles.SetFocusedRowCellValue(colDet_Kg, prod.pr_peso);
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString());
     }
 }
Пример #7
0
        public List <com_ListadoMaterialesDisponibles_Det_Info> Get_List_ListadoDespunteMaterialesDisponibles_Det(int IdEmpresa, string CodObra)
        {
            List <com_ListadoMaterialesDisponibles_Det_Info> Lst = new List <com_ListadoMaterialesDisponibles_Det_Info>();
            EntitiesCompras_Edehsa oEnti = new EntitiesCompras_Edehsa();

            try
            {
                var Query = from q in oEnti.vwcom_AllListDetMaterialesDisponibles
                            where q.IdEmpresa == IdEmpresa &&
                            q.CodObra == CodObra
                            //&& q.largo_despunte1 != null
                            select q;
                foreach (var item in Query)
                {
                    com_ListadoMaterialesDisponibles_Det_Info Obj = new com_ListadoMaterialesDisponibles_Det_Info();
                    Obj.IdEmpresa = item.IdEmpresa;


                    Obj.ot_IdSucursal = item.IdSucursal;
                    Obj.IdListadoMaterialesDisponibles = item.IdListadoMaterialesDisponibles;
                    Obj.IdDetalle           = item.IdDetalle;
                    Obj.IdProducto          = item.IdProducto;
                    Obj.Unidades            = item.Unidades;
                    Obj.Det_Kg              = item.Det_Kg;
                    Obj.CodObra             = item.CodObra;
                    Obj.pr_codigo           = item.pr_codigo;
                    Obj.pr_descripcion      = item.pr_descripcion;
                    Obj.lm_IdEstadoAprobado = item.IdEstadoAprob;
                    Obj.ea_codigo           = item.IdEstadoAprob;
                    Obj.ea_descripcion      = item.ea_descripcion;
                    Obj.FechaRequer         = item.FechaReg;
                    Obj.mr_descripcion      = item.mr_descripcion;
                    Obj.Motivo              = item.Motivo;
                    Obj.ob_descripcion      = item.ob_descripcion;

                    Obj.obra           = item.ob_descripcion;
                    Obj.largo_restante = item.largo_restante;
                    Obj.producto       = item.pr_descripcion + "[" + item.pr_codigo + "/" + item.IdProducto + "] ";
                    Obj.solicitante    = item.Usuario;

                    Obj.largo_pieza_entera                  = item.largo_pieza_entera;
                    Obj.cantidad_pieza_entera               = item.cantidad_pieza_entera;
                    Obj.largo_pieza_complementaria          = item.largo_pieza_complementaria;
                    Obj.cantidad_pieza_complementaria       = item.cantidad_pieza_complementaria;
                    Obj.cantidad_total_pieza_complementaria = item.cantidad_total_pieza_complementaria;
                    Obj.largo_despunte1     = item.largo_despunte1;
                    Obj.cantidad_despunte1  = item.cantidad_despunte1;
                    Obj.es_despunte_usable1 = item.es_despunte_usable1;
                    Obj.largo_despunte2     = item.largo_despunte2;
                    Obj.cantidad_despunte2  = item.cantidad_despunte2;
                    Obj.es_despunte_usable2 = item.es_despunte_usable2;

                    Obj.largo_total = item.largo_total;
                    Lst.Add(Obj);
                }
                return(Lst);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString();
                throw new Exception(ex.ToString());
            }
        }
        public Boolean getDet()
        {
            try
            {
                List <com_ListadoMaterialesDisponibles_Det_Info> lsttemp = new List <com_ListadoMaterialesDisponibles_Det_Info>();


                for (int i = 0; i < gridvwDetListMaterialesDisponibles.RowCount; i++)
                {
                    var ass = (com_ListadoMaterialesDisponibles_Det_Info)gridvwDetListMaterialesDisponibles.GetRow(i);
                    if (ass != null)
                    {
                        com_ListadoMaterialesDisponibles_Det_Info row = new com_ListadoMaterialesDisponibles_Det_Info();

                        row.IdEmpresa = param.IdEmpresa;

                        row.CodObra = Obra.get_item();
                        //row.IdOrdenTaller = Convert.ToInt32(UltraCmbOrdenTaller.EditValue);
                        row.Det_Kg    = ass.Det_Kg;
                        row.IdDetalle = 0;
                        row.IdListadoMaterialesDisponibles = 0;
                        row.IdProducto          = ass.IdProducto;
                        row.lm_IdEstadoAprobado = "PEN";

                        row.pr_largo       = ass.pr_largo;
                        row.largo_total    = ass.largo_total;
                        row.largo_restante = ass.largo_restante;

                        row.largo_pieza_entera                  = ass.largo_pieza_entera;
                        row.cantidad_pieza_entera               = ass.cantidad_pieza_entera;
                        row.largo_pieza_complementaria          = ass.largo_pieza_complementaria;
                        row.cantidad_pieza_complementaria       = ass.cantidad_pieza_complementaria;
                        row.cantidad_total_pieza_complementaria = ass.cantidad_total_pieza_complementaria;
                        row.largo_despunte1     = ass.largo_despunte1;
                        row.cantidad_despunte1  = ass.cantidad_despunte1;
                        row.es_despunte_usable1 = ass.es_despunte_usable1;
                        row.largo_despunte2     = ass.largo_despunte2;
                        row.cantidad_despunte2  = ass.cantidad_despunte2;
                        row.es_despunte_usable2 = ass.es_despunte_usable2;

                        if (ass.IdProducto == 0)
                        {
                            MessageBox.Show("Debe corregir su seleccion de productos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return(false);
                        }
                        row.Unidades       = ass.Unidades;
                        row.pr_codigo      = ass.pr_codigo;
                        row.pr_descripcion = ass.pr_descripcion;
                        if (row.Unidades > 0)
                        {
                            lsttemp.Add(row);
                        }
                        else
                        {
                            MessageBox.Show("Debe corregir la cantidad de los productos", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return(false);
                        }
                    }
                }


                //gridCtrlDetListMaterialesDisponibles.DataSource  = lsttemp;
                LstInfoLMat = lsttemp;
                //LstInfoLMat  = (List<com_ListadoMaterialesDisponibles_Det_Info>)gridvwDetListMaterialesDisponibles.DataSource;
                if (LstInfoLMat.Count < 1)
                {
                    MessageBox.Show("Debe ingresar los MaterialesDisponibles para la Orden de Taller", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }