Exemple #1
0
        private void ProductosEnProcesoToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            productosProceso frm = new productosProceso();

            frm.MdiParent = this;
            frm.Show();
        }
Exemple #2
0
        private void Btn_producir_Click(object sender, EventArgs e)
        {
            if (Dgb_ordenesPendientes.SelectedRows.Count == 1)
            {
                int i = 0;
                string where = Dgb_ordenesPendientes.CurrentRow.Cells[1].Value.ToString();
                string emp  = "SELECT rhe.id_empleado  FROM registro_horas_emp rhe INNER JOIN produccion_encabezados pe on rhe.cod_orden=pe.cod_orden WHERE pe.cod_orden = " + where + " and rhe.estado=1 ;";
                string empl = mo.consulta(emp);



                if (empl != " ")
                {
                    string where2 = Dgb_ordenesPendientes.CurrentRow.Cells[2].Value.ToString();
                    mo.updateestados("produccion_encabezados", "estado", "0", "cod_orden", where);
                    mo.updateestados("ordenes_pendientes", "estado", "0", "cod_opp", where2);

                    string    inventario = "select dr.id_producto, dr.cantidad, dr.unidad_medida as 'umr' ,pd.cantidad_producto , ip.cantidad_total, ip.unidad_medida as 'umi'  from detalles_recetas dr INNER JOIN produccion_procesos pp ON dr.id_proceso=pp.id_proceso INNER JOIN produccion_detalles pd ON pp.id_producto=pd.id_producto INNER JOIN produccion_encabezados pe ON pd.cod_orden=pe.cod_orden INNER JOIN inventarios_produccion ip ON dr.id_producto =ip.id_producto  WHERE pd.cod_orden= " + where + " and dr.estado=1 and ip.estado=1;";
                    DataTable dt         = mo.consultaLogica2(inventario);


                    foreach (DataRow row in dt.Rows)
                    {
                        var dato       = dt.Rows[i]["id_producto"].ToString();
                        var cantidad   = dt.Rows[i]["cantidad"].ToString();
                        var existencia = dt.Rows[i]["cantidad_total"].ToString();
                        var mult       = dt.Rows[i]["cantidad_producto"].ToString();
                        var umr        = dt.Rows[i]["umr"].ToString();
                        var umi        = dt.Rows[i]["umi"].ToString();

                        string conv = mo.consulta("select cantidad2 from unidades_medida where unidad1 = '" + umr + "' and unidad2 = '" + umi + "' and estado = 1;");
                        if (conv != "" || conv != null)
                        {
                            double conv2 = Convert.ToDouble(conv);

                            int    mm   = Convert.ToInt32(mult);
                            double max  = Convert.ToDouble(existencia);
                            double cant = Convert.ToDouble(cantidad);

                            double resul     = (cant * conv2) * mm;
                            double resultado = max - resul;

                            string result = resultado.ToString();

                            mo.updateestados("inventarios_produccion", "cantidad_total", result, "id_producto", dato);
                        }
                        else
                        {
                            MessageBox.Show("el registro no existe o esta mal ingresado, revisar las dimensionales de unidades de medida ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }


                        i++;
                    }

                    suministros();
                    actualizardatagriew();
                    productos();
                    cu();
                    cutmo();
                    cutmp();
                    cif();
                    ctp();

                    productosProceso frm = new productosProceso();
                    frm.MdiParent = this.MdiParent;
                    frm.Show();
                }
                else
                {
                    MessageBox.Show("No hay empleados asignados e esta orden, Por favor asgine en Mantenimiento 4001", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                    mantenimientoRegistroEmpleados frm = new mantenimientoRegistroEmpleados(usuario);
                    frm.MdiParent = this.MdiParent;
                    frm.Show();
                }
            }
            else
            {
                MessageBox.Show("No hay datos seleccionados en la tabla ", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }