Exemplo n.º 1
0
        public DataTable listaRegistrosOrden_Param(ref Ent_tticol125 parametros)
        {
            //System.Collections.Generic.List<EntidadRecuperaClientes> lista = new System.Collections.Generic.List<EntidadRecuperaClientes>();
            DataTable             lista; //= new System.Collections.Generic.List<EntidadRecuperaClientes>();
            InterfazDAL_tticol125 interfazDAL = new InterfazDAL_tticol125();
            string strError = string.Empty;

            try
            {
                lista = interfazDAL.listaRegistrosOrden_Param(ref parametros, ref strError);
                //        int i = list.get_Count();
            }
            catch (System.TimeoutException e1)
            {
                throw new System.Exception(e1.StackTrace);
            }
            catch (System.ServiceModel.FaultException e2)
            {
                throw new System.Exception(e2.Reason.ToString());
            }
            catch (System.Exception e3)
            {
                throw new System.Exception(strError);
            }
            return(lista);
        }
Exemplo n.º 2
0
        protected void generateDropDownReasonCodes()
        {
            InterfazDAL_tticol125 idal      = new InterfazDAL_tticol125();
            Ent_tticol125         obj       = new Ent_tticol125();
            DataTable             resultado = idal.getReasonCodes(ref strError);

            if (resultado.Rows.Count > 0)
            {
                int      rowIndex = 0;
                ListItem itemS    = null;
                itemS       = new ListItem();
                itemS.Text  = _idioma == "INGLES" ? "-- Select an option -- " : " -- Seleccione --";
                itemS.Value = "";
                dropDownReasonCodes.Items.Insert(rowIndex,itemS);

                //ListItem itemS = null;
                foreach (DataRow dr in resultado.Rows)
                {
                    itemS       = new ListItem();
                    rowIndex    = (int)resultado.Rows.IndexOf(dr);
                    itemS.Value = dr.ItemArray[0].ToString();
                    itemS.Text  = dr.ItemArray[0].ToString() + " - " + dr.ItemArray[1].ToString();
                    dropDownReasonCodes.Items.Insert(rowIndex + 1,itemS);
                }
            }
        }
        public static string validarCantidades(object fila, string valor, string lote, string qty)
        {
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;
            string retorno             = string.Empty;
            Factor MyConvertionFactor  = new Factor {
            };
            Array row = fila.ToString().Replace(" ", "").Replace("\"", "").Split(',');

            try
            {
                valor = valor.Trim();
                lote  = lote.Trim().ToUpperInvariant();
                if (!string.IsNullOrEmpty(valor))
                {
                    if (row.GetValue(10).ToString().Trim() == "1")
                    {
                        MyConvertionFactor = FactorConversion(row.GetValue(4).ToString().Trim(), row.GetValue(6).ToString().Trim(), "plt");
                        decimal QUANTITYCUNI = (MyConvertionFactor.Tipo == "Div") ? Convert.ToDecimal((Convert.ToDecimal(qty) * MyConvertionFactor.FactorB) / MyConvertionFactor.FactorD) : Convert.ToDecimal((Convert.ToDecimal(qty) * MyConvertionFactor.FactorD) / MyConvertionFactor.FactorB);
                        if (QUANTITYCUNI > 1)
                        {
                            strError = Returnedquantityhigherthanpalletsize;
                            return(strError);
                        }
                    }
                }
                if (!string.IsNullOrEmpty(valor) && !string.IsNullOrEmpty(lote))
                {
                    double iCantMax = 0;

                    obj.pdno = row.GetValue(1).ToString().Trim();
                    obj.pono = Convert.ToInt32(row.GetValue(2).ToString().Trim());
                    obj.item = row.GetValue(4).ToString().Trim();
                    obj.clot = lote.ToString().Trim();

                    iCantMax = idal.cantidadMaximaPorLote(ref obj, ref strError);

                    if (double.Parse(valor) <= iCantMax)
                    {
                        return(retorno);
                    }
                    else if (string.IsNullOrEmpty(strError))
                    {
                        strError = Theamounttoreturnisinvalid;
                    }
                }
            }
            catch (Exception ex)
            {
                strError = ex.InnerException != null ?
                           ex.Message + " (" + ex.InnerException + ")" :
                           ex.Message;
            }
            return(strError);
        }
        public static string vallidatePalletID(string palletID, string quantity)
        {
            //TextBox palletIdTextBox = (TextBox)e.Row.Cells[10].FindControl("palletId");
            //
            //quantityToReturn = "2";

            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;
            string retorno             = string.Empty;

            //TextBox quantity = (TextBox)e.Row.Cells[10].FindControl("palletId");

            obj.paid = palletID.Trim().ToUpperInvariant();
            //obj.reqt = Convert.ToInt32(fila.GetValue(8).ToString().Trim());
            obj.reqt = Convert.ToDecimal(quantity);

            DataTable resultado = idal.vallidatePalletID(ref obj, ref strError);

            decimal palletQuantity = 0;
            decimal status;
            string  tableName     = string.Empty;
            decimal givenQuantity = Convert.ToDecimal(quantity);

            if (resultado.Rows.Count < 1)
            {
                return(PalletIDdoesntexists);
            }
            else
            {
                foreach (DataRow dr in resultado.Rows)
                {
                    status         = Convert.ToDecimal(dr.ItemArray[8].ToString());
                    palletQuantity = Convert.ToDecimal(dr.ItemArray[3].ToString());
                    tableName      = dr.ItemArray[0].ToString();
                    if (palletQuantity < givenQuantity)
                    {
                        retorno = QuantitytoreturnmustbeequalorlessthanPalletIDquantityforpalletId + " " + palletID.Trim().ToUpperInvariant();
                        break;
                    }
                    if (((tableName == "whcol131") || (tableName == "whcol130")) && (status != 9))
                    {
                        retorno = PalletIDstatusdoesntallowreturn
                        ;
                        break;
                    }
                    else if (((tableName == "ticol022") || (tableName == "ticol042")) && (status != 11))
                    {
                        retorno = PalletIDstatusdoesntallowreturn;
                        break;
                    }
                }
            }

            return(retorno);
        }
Exemplo n.º 5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <Ent_tticol125> parameterCollection = new List <Ent_tticol125>();
            Ent_tticol125        obj = new Ent_tticol125();

            foreach (GridViewRow fila in grdRecords.Rows)
            {
                DropDownList lista = ((DropDownList)fila.Cells[7].Controls[1]);
                if (lista != null)
                {
                    if (Convert.ToInt32(lista.SelectedValue) == 1)
                    {
                        obj          = new Ent_tticol125();
                        obj.pdno     = txtWorkOrder.Text.Trim();
                        obj.pono     = Convert.ToInt32(fila.Cells[0].Text);
                        obj.item     = fila.Cells[1].Text;
                        obj.cwar     = fila.Cells[3].Text.Trim();
                        obj.clot     = string.IsNullOrEmpty(fila.Cells[4].Text) ? " " : fila.Cells[4].Text;
                        obj.reqt     = Convert.ToDecimal(fila.Cells[5].Text);
                        obj.refcntd  = "0";
                        obj.refcntu  = "0";
                        obj.mess     = " ";
                        obj.prin     = Convert.ToInt32(((Label)fila.Cells[8].FindControl("prin")).Text);
                        obj.conf     = Convert.ToInt32(lista.SelectedValue);;
                        obj.idrecord = grdRecords.DataKeys[fila.RowIndex].Value.ToString();
                        //Requerimiento No. 46122.
                        //Insertar en la tabla ticol080
                        //CChaverra 28/07/2017
                        obj.user = Session["user"].ToString();
                        parameterCollection.Add(obj);
                    }
                }
            }
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();

            idal.actualizarRegistro_Param(ref parameterCollection, ref strError, Aplicacion);
            printResult.Visible     = true;
            lblResult.Text          = "Records was saved succesfully.";
            this.HeaderGrid.Visible = false;

            grdRecords.DataSource = "";
            grdRecords.DataBind();

            if (strError != string.Empty)
            {
                lblResult.Text = strError;
                Label control = ((Label)Page.Controls[0].FindControl("lblPageTitle"));
                control.Text = strError;
                return;
                //throw new System.InvalidOperationException(strError);
            }
        }
        protected void grdRecords_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //string prin = ((DataRowView)e.Row.DataItem).DataView.Table.Rows[e.Row.RowIndex]["T$PRIN"].ToString();
                string paid = ((DataRowView)e.Row.DataItem).DataView.Table.Rows[e.Row.RowIndex]["T$PAID"].ToString();
                //JC 190821 Actualiza el contador de impresiones cada vez que ingresen
                if (IsPostBack)
                {
                    idal.updateFieldPrint(ref paid, ref strError);
                    if (strError != string.Empty)
                    {
                        OrderError.IsValid = false;
                    }
                }

                var    printed = idal.queryFieldPrint(ref paid, ref strError);
                string prin    = printed.Rows[0]["T$PRIN"].ToString().Trim();
                valueprint = prin;
                //obj.prin = idal.Rows[0].["T$PRIN"]

                // ((Button)e.Row.Cells[7].FindControl("btnPrint")).OnClientClick = "printTag(" + FilaSerializada.Trim() + ")";
                //((Button)e.Row.Cells[7].FindControl("btnPrint")).Text = (prin.Trim().Equals("1")
                //    ? _idioma == "INGLES" ? "Print" : "Imprimir" : _idioma == "INGLES" ? "Reprint" : "Reimprimir");

                //Cambia el estado del campo print en la tabla ticol125
                //JC 190821 Actualiza el contador de impresiones cada vez que ingresen
                //if (prin.Trim().Equals("2"))
                //{
                //idal.updateFieldPrint(ref paid, ref strError);
                //if (strError != string.Empty)
                //{
                //    OrderError.IsValid = false;
                //}
                //}
                //JC 190821 Actualiza el contador de impresiones cada vez que ingresen
                if (Convert.ToInt16(valueprint) > 1)
                {
                    ((Button)e.Row.Cells[7].FindControl("btnPrint")).Text = (_idioma == "INGLES" ? "Reprint" : "Reimprimir");
                }
                else
                {
                    ((Button)e.Row.Cells[7].FindControl("btnPrint")).Text = (_idioma == "INGLES" ? "Print" : "Imprimir");
                }
            }
        }
Exemplo n.º 7
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtWorkOrder.Text.Trim()))
            {
                minlenght.Enabled      = true;
                minlenght.ErrorMessage = "Work Order is required";
                minlenght.IsValid      = false;

                return;
            }

            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;

            txtWorkOrder.Text = txtWorkOrder.Text.ToUpperInvariant();
            obj.pdno          = txtWorkOrder.Text.ToUpperInvariant();
            resultado         = idal.listaRegistrosOrden_Param(ref obj, ref strError, true); //DataTable resultado = TABLA; //

            string findIn = string.Empty;

            // Validar si el numero de orden trae registros
            if (strError != string.Empty || resultado.Rows.Count < 1)
            {
                strError = string.Empty;
                // Si no encuentra registros en la principal busca en historico
                resultado = idal.listaRegistrosOrden_ParamHis(ref obj, ref strError);
                if (strError != string.Empty || resultado.Rows.Count < 1)
                {
                    OrderError.IsValid = false;
                    txtWorkOrder.Focus();
                    grdRecords.DataSource = "";
                    grdRecords.DataBind();
                    return;
                }
                findIn            = " [ Find in  History ]";
                Session["update"] = 1;
            }

            lblOrder.Text         = "Order: " + obj.pdno + findIn;
            grdRecords.DataSource = resultado;
            grdRecords.DataBind();

            if (Session["resultado"] == null)
            {
                Session["resultado"] = resultado;
            }
        }
        protected void btnSend_Click(object sender, EventArgs e)
        {
            //if (string.IsNullOrEmpty(txtPalletId.Text.Trim()))
            //{
            //    minlenght.Enabled = true;
            //    minlenght.ErrorMessage = mensajes("Please Fill all the Required  Fields.");
            //    minlenght.IsValid = false;

            //    return;
            //}

            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;

            //obj.pdno = txtWorkOrder.Text.ToUpper();
            obj.conf       = 2; // CONFIRMED = NO
            obj.paid       = txtPalletId.Text.ToUpper();
            lblResult.Text = string.Empty;
            DataTable resultado = idal.listaRegistrosporConfirmar_Param(ref obj, ref strError);

            // Validar si el numero de orden trae registros
            if (strError != string.Empty)
            {
                OrderError.IsValid      = false;
                OrderError.ForeColor    = System.Drawing.Color.Red;
                OrderError.ErrorMessage = strError;

                txtWorkOrder.Focus();
                btnSave.Visible = false;
                return;
            }
            lblOrder.Text         = _idioma == "INGLES" ? "Order: " : "Orden: " + obj.pdno;
            obj.pdno              = resultado.Rows[0]["T$PDNO"].ToString().Trim();
            Order                 = obj.pdno;
            grdRecords.DataSource = resultado;
            grdRecords.DataBind();

            this.HeaderGrid.Visible = true;
            btnSave.Visible         = true;
            lblResult.Text          = "";
        }
        protected void btnSend_Click(object sender, EventArgs e)
        {
            btnSave.Visible = false;
            if (string.IsNullOrEmpty(txtWorkOrder.Text.Trim()))
            {
                RequiredField.Enabled = true;
                RequiredField.IsValid = false;
                txtWorkOrder.Focus();
                grdRecords.DataSource = "";
                grdRecords.DataBind();
                return;
            }

            lblOrder.Visible = true;
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;

            txtWorkOrder.Text = txtWorkOrder.Text.ToUpperInvariant();
            obj.pdno          = txtWorkOrder.Text.ToUpperInvariant();
            lblResult.Text    = string.Empty;
            DataTable resultado = idal.listaRegistrosOrden_Param(ref obj, ref strError);


            // Validar si el numero de orden trae registros
            if (strError != string.Empty)
            {
                OrderError.IsValid = false;
                txtWorkOrder.Focus();
                btnSave.Visible       = false;
                grdRecords.DataSource = "";
                grdRecords.DataBind();
                return;
            }
            lblOrder.Text         = "Order: " + obj.pdno;
            grdRecords.DataSource = resultado;
            grdRecords.DataBind();

            this.HeaderGrid.Visible = true;
            btnSave.Visible         = true;
            lblResult.Text          = "";
        }
        public static string validarCantidades(object fila, string valor, string lote)
        {
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;
            string retorno             = string.Empty;

            try
            {
                valor = valor.Trim();
                lote  = lote.Trim().ToUpperInvariant();
                if (!string.IsNullOrEmpty(valor) && !string.IsNullOrEmpty(lote))
                {
                    Array  row      = fila.ToString().Replace(" ", "").Replace("\"", "").Split(',');
                    double iCantMax = 0;

                    obj.pdno = row.GetValue(1).ToString().Trim();
                    obj.pono = Convert.ToInt32(row.GetValue(2).ToString().Trim());
                    obj.item = row.GetValue(4).ToString().Trim();
                    obj.clot = lote.ToString().Trim();

                    iCantMax = idal.cantidadMaximaPorLote(ref obj, ref strError);

                    if (double.Parse(valor) <= iCantMax)
                    {
                        return(retorno);
                    }
                    else if (string.IsNullOrEmpty(strError))
                    {
                        strError = "The amount to return is invalid";
                    }
                }
            }
            catch (Exception ex)
            {
                strError = ex.InnerException != null ?
                           ex.Message + " (" + ex.InnerException + ")" :
                           ex.Message;
            }
            return(strError);
        }
Exemplo n.º 11
0
        //public int actualizarInfoCliente(Ent_tticol125 parametros)
        //{
        //    int i2;

        //    int i1 = 0;
        //    InterfazDAL_tticol125 interfazDAL = new InterfazDAL_tticol125();
        //    try
        //    {
        //        i1 = interfazDAL.actualizarInfoCliente(parametros, ref strError, Aplicacion);
        //        strError = "Actualizar Informacion del cliente";
        //        interfazDAL.guardaErrores(ref strError, Aplicacion);
        //        strError = System.String.Empty;
        //        i2 = i1;
        //    }
        //    catch (System.TimeoutException e1)
        //    {
        //        throw new System.Exception(e1.StackTrace);
        //    }
        //    catch (System.Exception e2)
        //    {
        //        strError = strError + "| - |" + e2.Message.ToString();
        //        interfazDAL.guardaErrores(ref strError, Aplicacion);
        //        throw new System.Exception(strError);
        //    }
        //    return i2;
        //}

        public System.Collections.Generic.List <Ent_tticol125> enviaDatos(List <Ent_tticol125> parametros)
        {
            List <Ent_tticol125> list;

            int i = 1;
            List <Ent_tticol125>  list1       = new System.Collections.Generic.List <Ent_tticol125>();
            InterfazDAL_tticol125 interfazDAL = new InterfazDAL_tticol125();

            try
            {
                strError = "CREAR tticol125";
                i        = interfazDAL.insertarRegistro(ref parametros, ref strError, Aplicacion);
                strError = "Recuperar CalenDario";
                interfazDAL.guardaErrores(ref strError, Aplicacion);
                strError = System.String.Empty;
                if ((i > 0) && System.String.IsNullOrEmpty(strError))
                {
                    strError = "Recuperar tticol125 Sentencia";
                    interfazDAL.guardaErrores(ref strError, Aplicacion);
                    strError = System.String.Empty;
                    // list1 = recuperarClientes(ref parametros);
                }
                else if (strError != System.String.Empty)
                {
                    interfazDAL.guardaErrores(ref strError, Aplicacion);
                    throw new System.Exception(strError);
                }
                list = list1;
            }
            catch (System.TimeoutException e1)
            {
                throw new System.Exception(e1.StackTrace);
            }
            catch (System.Exception e2)
            {
                strError += e2.Message.ToString();
                interfazDAL.guardaErrores(ref strError, Aplicacion);
                throw new System.Exception(strError);
            }
            return(list);
        }
Exemplo n.º 12
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtWorkOrder.Text.Trim()))
            {
                minlenght.Enabled      = true;
                minlenght.ErrorMessage = "Work Order is required";
                minlenght.IsValid      = false;

                return;
            }

            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;

            txtWorkOrder.Text = txtWorkOrder.Text.ToUpperInvariant();
            obj.pdno          = txtWorkOrder.Text.ToUpperInvariant();
            obj.conf          = 2; // CONFIRMED = NO
            lblResult.Text    = string.Empty;
            DataTable resultado = idal.listaRegistrosporConfirmar_Param(ref obj, ref strError);


            // Validar si el numero de orden trae registros
            if (strError != string.Empty)
            {
                OrderError.IsValid = false;
                txtWorkOrder.Focus();
                btnSave.Visible = false;
                return;
            }
            lblOrder.Text         = "Order: " + obj.pdno;
            grdRecords.DataSource = resultado;
            grdRecords.DataBind();

            this.HeaderGrid.Visible = true;
            btnSave.Visible         = true;
            lblResult.Text          = "";
        }
        public static string validaExistLot(object Fila, string valor)
        {
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;
            Array  fila    = Fila.ToString().Replace(" ", "").Replace("\"", "").Split(',');
            string retorno = string.Empty;

            obj.pdno = valor.Trim().ToUpperInvariant();
            obj.pono = Convert.ToInt32(fila.GetValue(2).ToString().Trim());
            // obj.clot = valor.Trim().ToUpperInvariant();

            //lblResult.Text = string.Empty;
            int resultado = idal.listaRegistrosPendConfItem_Param(ref obj, ref strError);

            // Validar si el numero de orden trae registros
            if (strError != string.Empty)
            {
                return(strError);
            }

            return(retorno);
        }
        public static string vallidatePalletID(string palletID, string position, string returnOrder)
        {
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;
            string retorno             = string.Empty;

            //TextBox quantity = (TextBox)e.Row.Cells[10].FindControl("palletId");



            obj.paid = palletID.Trim().ToUpperInvariant();

            DataTable resultado = idal.vallidatePalletData(ref obj, ref strError);
            //decimal palletQuantity = 0;
            //decimal status;
            //string tableName = string.Empty;
            //decimal givenQuantity = Convert.ToDecimal(quantity);

            /* select  col131.t$paid "palletid", col131.t$loaa "current_location",
             * col131.t$qtya "current_qty", col131.t$item "item", ibd001.t$dsca "description"*/
            string  item, description, palletid, current_location, unit, war, stat;
            decimal current_qty;

            if (resultado.Rows.Count < 1)
            {
                return(null);
            }
            else
            {
                foreach (DataRow dr in resultado.Rows)
                {
                    palletid         = dr.ItemArray[0].ToString();
                    current_location = dr.ItemArray[1].ToString();
                    current_qty      = Convert.ToDecimal(dr.ItemArray[2].ToString());
                    item             = dr.ItemArray[3].ToString();
                    description      = dr.ItemArray[4].ToString();
                    unit             = dr.ItemArray[5].ToString();
                    war  = dr.ItemArray[6].ToString();
                    stat = dr.ItemArray[7].ToString();

                    // lblItemValue.Text = item;
                    //lblItemDescValue.Text = description;
                    //lblUnitValue.Text = unit;
                    //lbllotValue.Text = lot;


                    string  warehouse, itemcode;
                    decimal qty;
                    InterfazDAL_twhcol130 idal2      = new InterfazDAL_twhcol130();
                    DataTable             resultado1 = idal2.vallidatePurchaseOrderWithPosition(ref returnOrder, ref position, ref strError);
                    if (resultado1.Rows.Count < 1)
                    {
                        return(null);
                    }
                    else
                    {
                        foreach (DataRow dr1 in resultado1.Rows)
                        {
                            itemcode  = dr1.ItemArray[0].ToString();
                            warehouse = dr1.ItemArray[1].ToString();
                            qty       = Convert.ToDecimal(dr1.ItemArray[2].ToString());
                            if (warehouse.Trim() != war.Trim())
                            {
                                return(PalletWarehousedoesnotmatch);
                            }
                            if (itemcode.Trim() != item.Trim())
                            {
                                return(PalletItemcodedoesnotmatch);
                            }
                            if (current_qty < qty)
                            {
                                return(ActualquantitypalletIDequalorlessthanorderedquantity
                                       );
                            }
                        }
                    }
                }

                return(JsonConvert.SerializeObject(resultado));
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <Ent_tticol125> parameterCollection = new List <Ent_tticol125>();
            Ent_tticol125        obj = new Ent_tticol125();

            foreach (GridViewRow fila in grdRecords.Rows)
            {
                DropDownList lista = ((DropDownList)fila.Cells[8].Controls[1]);
                if (lista != null)
                {
                    if (Convert.ToInt32(lista.SelectedValue) == 1)
                    {
                        obj = new Ent_tticol125();
                        //obj.pdno = txtWorkOrder.Text.Trim().ToUpper();
                        obj.pdno    = Order;
                        obj.pono    = Convert.ToInt32(fila.Cells[0].Text);
                        obj.item    = fila.Cells[1].Text;
                        obj.cwar    = fila.Cells[3].Text.Trim();
                        obj.clot    = string.IsNullOrEmpty(fila.Cells[4].Text) ? " " : fila.Cells[4].Text;
                        obj.reqt    = Convert.ToDecimal(fila.Cells[6].Text);
                        obj.refcntd = "0";
                        obj.refcntu = "0";
                        obj.mess    = " ";

                        obj.paid     = txtPalletId.Text.Trim().ToUpper();
                        obj.prin     = Convert.ToInt32(((Label)fila.Cells[8].FindControl("prin")).Text);
                        obj.conf     = Convert.ToInt32(lista.SelectedValue);;
                        obj.idrecord = grdRecords.DataKeys[fila.RowIndex].Value.ToString();
                        //Requerimiento No. 46122.
                        //Insertar en la tabla ticol080
                        //CChaverra 28/07/2017
                        obj.user = Session["user"].ToString();
                        parameterCollection.Add(obj);
                    }
                }
            }
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();

            idal.actualizarRegistro_Param(ref parameterCollection, ref strError, Aplicacion);

            //Update status updataPalletStatus on table (whcol131, ticol022, ticol042) to delivered.   paramList.Add("p2", 9);// , whcol131 -Delieverd status=9
            // paramList.Add("p3", 11); // , ticol022, ticol042 -Delieverd status=11

            bool resultado = idal.updataPalletStatus(ref obj, ref strError);


            printResult.Visible     = true;
            lblResult.Text          = mensajes("msjsave");
            lblResult.ForeColor     = System.Drawing.Color.Green;
            this.HeaderGrid.Visible = false;

            grdRecords.DataSource = "";
            grdRecords.DataBind();

            if (strError != string.Empty)
            {
                lblResult.Text      = strError;
                lblResult.ForeColor = System.Drawing.Color.Red;
                Label control = ((Label)Page.Controls[0].FindControl("lblPageTitle"));
                control.Text = strError;
                return;
                //throw new System.InvalidOperationException(strError);
            }
        }
Exemplo n.º 16
0
        protected void btnSend_Click(object sender, EventArgs e)
        {

            lblError.Text = "";
            lblConfirm.Text = "";
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125 obj = new Ent_tticol125();
            string strError = string.Empty;
            obj.paid = txtPalletId.Text.ToUpperInvariant();

            HttpContext.Current.Session["flag022"] = 0;
            HttpContext.Current.Session["flag042"] = 0;
            HttpContext.Current.Session["flag131"] = 0;
            divPrint.Visible = false;

            string retorno = string.Empty;


            decimal palletQuantity = 0;
            decimal status;
            string tableName = string.Empty;

            DataTable resultadoPaid = idal.vallidatePalletID(ref obj, ref strError);

            if (resultadoPaid.Rows.Count < 1) { retorno = PalletIDdoesntexists; }
            else
            {
                foreach (DataRow dr in resultadoPaid.Rows)
                {
                    status = Convert.ToDecimal(dr.ItemArray[8].ToString());
                    palletQuantity = Convert.ToDecimal(dr.ItemArray[3].ToString());
                    tableName = dr.ItemArray[0].ToString();

                    if (((tableName == "whcol131") || (tableName == "whcol130")) && (status != 3))
                    {
                        lblError.Text = PalletIDstatusdoesntallowadjustment;
                        return;
                    }
                    else if (((tableName == "ticol022") || (tableName == "ticol042")) && (status != 7))
                    {
                        lblError.Text = PalletIDstatusdoesntallowadjustment;
                        return;
                    }
                }
            }

            if (string.IsNullOrEmpty(txtPalletId.Text.Trim()))
            {
                //minlenght.Enabled = true;
                //minlenght.ErrorMessage = mensajes("Please Fill all the Required  Fields.");
                //minlenght.IsValid = false;

                //return;
            }
            DataTable resultado = idal.invGetPalletInfo(ref obj, ref strError);
            DataTable resultadoSerie = idal.invGetPalletInfoSerie(ref strError);

            if (resultado == null || resultado.Rows.Count == 0)
            {
                lblError.Text = PalletIDdoesntexists;
                return;
            }

            string palletId, item, warehouse, lot, location, quantity, dsca, unit, waredesc, machine, tbl, pono;

            if (resultado.Rows.Count == 1)
            {
                if (resultadoSerie.Rows.Count > 0)
                {
                    Session["emno"] = resultadoSerie.Rows[0]["EMNO"].ToString();
                    Session["cdis"] = resultadoSerie.Rows[0]["CDIS"].ToString();
                    lblReason.Text = resultadoSerie.Rows[0]["CDIS"].ToString() + " - " + resultadoSerie.Rows[0]["DSCA"].ToString();
                    lblCost.Text = resultadoSerie.Rows[0]["EMNO"].ToString() + " - " + resultadoSerie.Rows[0]["NAMA"].ToString();
                }
                else
                {
                    lblReason.Text = string.Empty;
                    lblCost.Text = string.Empty;
                }

                DataRow dr = resultado.Rows[0];
                tbl = dr.ItemArray[0].ToString();
                if (tbl.Trim() == "ticol022")
                {
                    HttpContext.Current.Session["flag022"] = 1;
                    HttpContext.Current.Session["flag131"] = 0;
                    HttpContext.Current.Session["flag042"] = 0;
                }
                else if (tbl.Trim() == "whcol131")
                {
                    HttpContext.Current.Session["flag022"] = 0;
                    HttpContext.Current.Session["flag131"] = 1;
                    HttpContext.Current.Session["flag042"] = 0;
                }
                else if (tbl.Trim() == "ticol042")
                {
                    HttpContext.Current.Session["flag022"] = 0;
                    HttpContext.Current.Session["flag131"] = 0;
                    HttpContext.Current.Session["flag042"] = 1;
                }

                palletId = dr.ItemArray[2].ToString();
                quantity = dr.ItemArray[3].ToString();
                item = dr.ItemArray[4].ToString();
                dsca = dr.ItemArray[5].ToString();
                unit = dr.ItemArray[6].ToString();
                warehouse = dr.ItemArray[7].ToString();
                waredesc = dr.ItemArray[8].ToString();
                lot = dr.ItemArray[10].ToString();
                location = dr.ItemArray[9].ToString();
                Pquantity = Convert.ToDouble(quantity);
                machine = dr.ItemArray[11].ToString();
                pono = dr.ItemArray[12].ToString();
                HttpContext.Current.Session["pono"] = pono;

                lblPalletId1Value.Text = palletId;
                lblItemValue.Text = item;
                lblItemDescValue.Text = dsca;
                lblWarehouseValue.Text = warehouse;
                lblWarehouseDescValue.Text = waredesc;
                lblLotValue.Text = lot;
                lblLocationValue.Text = location;
                lblQuantityValue.Text = quantity;
                lblUnitValue.Text = unit;
                lblUnitValue1.Text = unit;
                tblPalletInfo.Visible = true;
                btnSend.Visible = false;
                btnSave.Visible = true;
                lblMachine.Text = machine;
                generateDropDownReasonCodes();
                generateDropDownCostCenters();
                dropDownCostCenters.SelectedValue = Session["emno"].ToString();
                dropDownReasonCodes.SelectedValue = Session["cdis"].ToString();
                if (Session["emno"].ToString() == "DO3062" && Session["cdis"].ToString() == "CS1004")
                {
                    dropDownCostCenters.Visible = true;
                    dropDownReasonCodes.Visible = true;
                    lblReason.Visible = false;
                    lblCost.Visible = false;
                }
                else
                {
                    dropDownCostCenters.Visible = false;
                    dropDownReasonCodes.Visible = false;
                    lblReason.Visible = true;
                    lblCost.Visible = true;
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <Ent_tticol125> parameterCollection = new List <Ent_tticol125>();
            Ent_tticol125        obj = new Ent_tticol125();

            //Recorrer filas con valores en los textos
            Session["WorkOrder"] = txtWorkOrder.Text.Trim();

            foreach (GridViewRow row in grdRecords.Rows)
            {
                string toreturn = ((TextBox)row.Cells[6].FindControl("toReturn")).Text;
                string toLot    = ((DropDownList)row.Cells[8].FindControl("toLot")).SelectedValue;

                string condLote = ((HiddenField)row.Cells[6].FindControl("LOTE")).Value.Trim();
                bool   reqLote  = condLote == "1" ? true : false;
                if ((reqLote && String.IsNullOrEmpty(toLot.Trim())) && !string.IsNullOrEmpty(toreturn))
                {
                    lblResult.Text = "Lot code is required. Cannot continue";
                    return;
                }

                //string toreturn = ((TextBox)row.Cells[6].FindControl("toReturn")).Text;
                //string toLot = ((TextBox)row.Cells[8].FindControl("toLot")).Text;

                if (!toreturn.Equals(string.Empty))
                {
                    obj          = new Ent_tticol125();
                    obj.pdno     = txtWorkOrder.Text.Trim().ToUpperInvariant();
                    obj.pono     = Convert.ToInt32(row.Cells[0].Text);
                    obj.item     = row.Cells[1].Text.ToUpperInvariant();                                       //.Trim();
                    obj.cwar     = row.Cells[3].Text.ToUpperInvariant();                                       //.Trim();
                    obj.clot     = string.IsNullOrEmpty(toLot) ? " " : toLot.ToUpperInvariant();
                    obj.reqt     = Decimal.Parse(toreturn, System.Globalization.CultureInfo.InvariantCulture); //Convert.ToInt32(toreturn);
                    obj.refcntd  = "0";
                    obj.refcntu  = "0";
                    obj.mess     = " ";
                    obj.prin     = 2;
                    obj.conf     = 2;
                    obj.user     = Session["user"].ToString();
                    obj.idrecord = grdRecords.DataKeys[row.RowIndex].Value.ToString();
                    parameterCollection.Add(obj);
                }
            }
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();

            idal.insertarRegistro(ref parameterCollection, ref strError, Aplicacion);
            printResult.Visible     = true;
            printLabel.Visible      = true;
            lblResult.Text          = "Material Return was saved succesfully.";
            this.HeaderGrid.Visible = false;

            grdRecords.DataSource = "";
            grdRecords.DataBind();

            btnSave.Visible = false;
            if (strError != string.Empty)
            {
                btnSave.Visible = false;
                lblResult.Text  = strError;
                throw new System.InvalidOperationException(strError);
            }
        }
        protected void printLabel_Click(object sender, EventArgs e)
        {
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;

            obj.pdno       = txtWorkOrder.Text;
            lblResult.Text = string.Empty;
            DataTable resultado = idal.listaRegistrosOrden_Param(ref obj, ref strError, true);

            // Validar si el numero de orden trae registros
            if (strError != string.Empty)
            {
                string MsgError = OrderError.ErrorMessage;
                OrderError.ErrorMessage = mensajes("worktag");
                OrderError.ForeColor    = System.Drawing.Color.Red;
                OrderError.IsValid      = false;
                OrderError.ErrorMessage = MsgError;
                return;
            }
            //lblOrder.Text = _idioma == "INGLES" ? "Order: " : "Orden: " + obj.pdno;

            Session["resultado"]   = resultado;
            Session["RemotePrint"] = "yes";
            StringBuilder paramurl = new StringBuilder();

            paramurl.Append("?");
            paramurl.Append("valor1=" + Request.QueryString[0].ToString() + "&");
            paramurl.Append("valor2=" + Request.QueryString[1].ToString() + "&");
            paramurl.Append("valor3=" + Request.QueryString[2].ToString());
            Session["IsPreviousPage"] = "";
            //Server.Transfer("whInvMaterialDevolReprintLabel.aspx", true);
            Response.Redirect("whInvMaterialDevolReprintLabel.aspx" + paramurl.ToString());


            //            //grdRecords.DataSource = resultado;
            //            //grdRecords.DataBind();
            //            printResult.Visible = false;


            //            string printerHtml = printerDiv.InnerHtml;
            //            printerDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "White");
            //            printerDiv.Style.Add(HtmlTextWriterStyle.Height, "400px");
            //            printerDiv.Style.Add(HtmlTextWriterStyle.Width, "500px");
            ////            printerDiv.Style.Add(HtmlTextWriterStyle., BorderStyle.Solid.ToString());

            //            foreach (DataRow reg in resultado.Rows)
            //            {

            //                if (scriptBlock.IsClientScriptBlockRegistered("printTag"))
            //                {
            //                    scriptBlock.RegisterClientScriptBlock(csType, "printTag", string.Empty, false);
            //                }

            //                DataRow drv = reg;
            //                Session["FilaImprimir"] = reg;
            //                printerDiv.InnerHtml = printerHtml; //

            //                // Validar que la division exista en el documento
            //                Control div = FindControl("printer");
            //                if (div == null)
            //                {
            //                   // this.Controls.Add(createDiv);
            //                }

            //                printerDiv.InnerHtml = "<iframe src='../Labels/whInvPrintLabel.aspx' width='100%'; height='100%'; onload='this.contentWindow.print()></iframe>"; //
            //                printerDiv.Focus();

            //                //csType = this.GetType();
            //                //scriptBlock = Page.ClientScript;

            //                //scriptBlock.RegisterClientScriptBlock(csType, "printTag", this.crearScriptImp(pagina), false);

            //                //String cstext1 = "printTag();";
            //                //scriptBlock.RegisterStartupScript(csType, "ButtonClickScript", cstext1, true);
            //          }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Session["save"] == null)
            {
                Session["save"] = true;
                List <Ent_tticol125> parameterCollection = new List <Ent_tticol125>();
                Ent_tticol125        obj = new Ent_tticol125();
                //Recorrer filas con valores en los textos
                Session["WorkOrder"] = txtWorkOrder.Text.Trim();

                //string vpaid = validaPalletID("OPI009584-001", 1);
                String a = string.Empty;
                foreach (GridViewRow row in grdRecords.Rows)
                {
                    string paid     = string.Empty;
                    string sec      = string.Empty;
                    int    sec022   = 0;
                    string toreturn = ((TextBox)row.Cells[4].FindControl("toReturn")).Text;
                    string toLot    = ((DropDownList)row.Cells[6].FindControl("toLot")).SelectedValue;
                    //string palletId = ((TextBox)row.Cells[9].FindControl("palletId")).Text;
                    string condLote = ((HiddenField)row.Cells[4].FindControl("LOTE")).Value.Trim();
                    ktlc = Convert.ToString(row.Cells[9].Text);
                    Item = row.Cells[0].Text.ToUpperInvariant();
                    //JC 180821 Tomar la bodega del maestro de artículos
                    HttpContext.Current.Session["ITEM"] = Item;
                    var Warehouse = Itwhcol130.GetWarehouseMaterialReturn(HttpContext.Current.Session["ITEM"].ToString());

                    Uni = row.Cells[3].Text.ToLower().Trim();
                    //JC 061221 Como ya no se tiene posición se define fija la posicíón 10
                    //Pos = row.Cells[0].Text;
                    Pos   = "10";
                    Tipo  = row.Cells[10].Text;
                    Clase = row.Cells[11].Text.ToUpperInvariant().Trim();

                    bool reqLote = condLote == "1" ? true : false;

                    //if (myObj.CUNI.Trim().ToUpper() != "PLT")
                    //{
                    //    MyConvertionFactor = FactorConversion(myObj.ITEM, myObj.CUNI, "PLT");
                    //    QUANTITYPLT = (MyConvertionFactor.Tipo == "Div") ? Convert.ToDecimal((QUANTITYCUNI * MyConvertionFactor.FactorB) / MyConvertionFactor.FactorD) : Convert.ToDecimal((QUANTITYCUNI * MyConvertionFactor.FactorD) / MyConvertionFactor.FactorB);
                    //    ciclosADVS = Convert.ToInt32(Math.Ceiling(QUANTITYPLT));
                    //}

                    //if (palletId.Trim() == string.Empty)
                    //{
                    //    lblResult.Text = RecordswithoutIDpallet;
                    //    lblResult.ForeColor = System.Drawing.Color.Red;
                    //    return;
                    //}
                    if ((reqLote && String.IsNullOrEmpty(toLot.Trim())) && !string.IsNullOrEmpty(toreturn))
                    {
                        lblResult.Text      = mensajes("lotcode");
                        lblResult.ForeColor = System.Drawing.Color.Red;
                        Session["save"]     = null;
                        return;
                    }

                    //string toreturn = ((TextBox)row.Cells[6].FindControl("toReturn")).Text;
                    //string toLot = ((TextBox)row.Cells[8].FindControl("toLot")).Text;

                    int tabla022 = 0;
                    int tabla042 = 0;
                    int tabla131 = 0;

                    if (!toreturn.Equals(string.Empty))
                    {
                        if (Tipo == "2")
                        {
                            if (Clase != "RET")
                            {
                                tabla022 = 1;
                                tabla042 = 0;
                                tabla131 = 0;
                            }
                            else
                            {
                                tabla042 = 1;
                                tabla022 = 0;
                                tabla131 = 0;
                            }
                        }
                        else
                        {
                            tabla131 = 1;
                            tabla022 = 0;
                            tabla042 = 0;
                        }

                        DataTable dt022 = Itticol022.SecuenciaMayorRT(txtWorkOrder.Text.Trim().ToUpperInvariant());
                        if (dt022.Rows.Count > 0)
                        {
                            paid   = dt022.Rows[0]["T$SQNB"].ToString().Trim().ToUpper();;
                            sec    = paid.Substring(12, 2);
                            sec022 = Convert.ToInt32(sec);
                            sec    = addZero(sec022 + 1);
                        }
                        else
                        {
                            sec = "01";
                        }

                        if (tabla131 == 1)
                        {
                            Ent_twhcol130131 obj131 = new Ent_twhcol130131();
                            Ent_twhcol130131 MyObj  = new Ent_twhcol130131();

                            MyObj.OORG = "4";
                            MyObj.ORNO = txtWorkOrder.Text.Trim().ToUpper();
                            MyObj.ITEM = row.Cells[0].Text.ToUpper();
                            MyObj.PAID = txtWorkOrder.Text.Trim().ToUpper() + "-RT" + sec;
                            //JC 061221 Como ya no se tiene posición se define fija la posicíón 10
                            //MyObj.PONO = Convert.ToInt32(row.Cells[0].Text).ToString();
                            MyObj.PONO = "10";
                            MyObj.SEQN = "0";
                            MyObj.CLOT = string.IsNullOrEmpty(toLot) ? " " : toLot.ToUpper();
                            //JC 180821 Grabar la bodega por defecto del item
                            //MyObj.CWAR = row.Cells[3].Text.ToUpperInvariant();
                            MyObj.CWAR  = Warehouse.Rows[0]["WARITEM"].ToString().Trim().ToUpper();
                            MyObj.QTYS  = toreturn;// cantidad escaneada view
                            MyObj.QTYA  = toreturn;
                            MyObj.UNIT  = row.Cells[3].Text.Trim();
                            MyObj.QTYC  = toreturn;                                       //cantidad escaneada view aplicando factor
                            MyObj.UNIC  = row.Cells[3].Text.Trim();
                            MyObj.DATE  = DateTime.Now.ToString("dd/MM/yyyy").ToString(); //fecha de confirmacion
                            MyObj.CONF  = "1";
                            MyObj.RCNO  = " ";                                            //llena baan
                            MyObj.DATR  = "01/01/70";                                     //llena baan
                            MyObj.LOCA  = " ";                                            // enviamos vacio
                            MyObj.DATL  = DateTime.Now.ToString("dd/MM/yyyy").ToString(); //llenar con fecha de hoy
                            MyObj.PRNT  = "1";                                            // llenar en 1
                            MyObj.DATP  = DateTime.Now.ToString("dd/MM/yyyy").ToString(); //llena baan
                            MyObj.NPRT  = "1";                                            //conteo de reimpresiones
                            MyObj.LOGN  = HttpContext.Current.Session["user"].ToString(); // nombre de ususario de la session
                            MyObj.LOGT  = " ";                                            //llena baan
                            MyObj.STAT  = "1";                                            // LLENAR EN 1
                            MyObj.DSCA  = row.Cells[1].Text.ToUpperInvariant();
                            MyObj.COTP  = "0";
                            MyObj.FIRE  = "1";
                            MyObj.PSLIP = " ";
                            MyObj.ALLO  = "0";
                            string StrError = string.Empty;

                            Itwhcol130.Insertartwhcol131(MyObj, ref StrError);
                        }

                        if (tabla022 == 1)
                        {
                            Ent_tticol022        obj022  = new Ent_tticol022();
                            List <Ent_tticol022> list022 = new List <Ent_tticol022>();

                            //obj022.pdno = txtWorkOrder.Text.Trim().ToUpper();
                            obj022.pdno    = string.IsNullOrEmpty(toLot) ? txtWorkOrder.Text.Trim().ToUpper() : toLot.ToUpper().Trim();
                            obj022.sqnb    = txtWorkOrder.Text.Trim().ToUpper() + "-RT" + sec;
                            obj022.proc    = 1;
                            obj022.logn    = HttpContext.Current.Session["user"].ToString();
                            obj022.mitm    = row.Cells[0].Text.ToUpper().Trim();
                            obj022.qtdl    = Convert.ToDecimal(toreturn);
                            obj022.cuni    = row.Cells[3].Text.Trim();
                            obj022.log1    = "NONE";
                            obj022.qtd1    = Convert.ToInt32(toreturn);
                            obj022.pro1    = 1;
                            obj022.log2    = "NONE";
                            obj022.qtd2    = Convert.ToInt32(toreturn);
                            obj022.pro2    = 2;
                            obj022.loca    = " ";
                            obj022.norp    = 1;
                            obj022.dele    = 2;
                            obj022.logd    = "NONE";
                            obj022.refcntd = 0;
                            obj022.refcntu = 0;
                            obj022.drpt    = DateTime.Now;
                            obj022.urpt    = HttpContext.Current.Session["user"].ToString();
                            obj022.acqt    = Convert.ToDecimal(toreturn);
                            //JC 180821 Grabar la bodega por defecto del item
                            //obj022.cwaf = row.Cells[3].Text.ToUpper();
                            //obj022.cwat = row.Cells[3].Text.ToUpper();
                            obj022.cwaf = Warehouse.Rows[0]["WARITEM"].ToString().Trim().ToUpper();
                            obj022.cwat = Warehouse.Rows[0]["WARITEM"].ToString().Trim().ToUpper();
                            obj022.aclo = "";
                            obj022.allo = 0;

                            list022.Add(obj022);
                            Itticol022.insertarRegistroSimple(ref obj022, ref strError);
                            Itticol022.InsertarRegistroTicol222(ref obj022, ref strError);
                        }
                        if (tabla042 == 1)
                        {
                            Ent_tticol042        obj042  = new Ent_tticol042();
                            List <Ent_tticol042> list042 = new List <Ent_tticol042>();
                            //JC 061221 Ajustar para que salve el campo orden en la tabla ticol042 siempre con un valor
                            //obj042.pdno = string.IsNullOrEmpty(toLot) ? " " : toLot.ToUpper().Trim();
                            obj042.pdno    = string.IsNullOrEmpty(toLot) ? txtWorkOrder.Text.Trim().ToUpper() : toLot.ToUpper().Trim();
                            obj042.sqnb    = txtWorkOrder.Text.Trim().ToUpper() + "-RT" + sec;
                            obj042.proc    = 1;
                            obj042.logn    = HttpContext.Current.Session["user"].ToString();
                            obj042.mitm    = row.Cells[0].Text.ToUpper().Trim();
                            obj042.pono    = Convert.ToInt32(Pos);
                            obj042.qtdl    = Convert.ToDouble(toreturn);
                            obj042.cuni    = row.Cells[3].Text.Trim();
                            obj042.log1    = "NONE";
                            obj042.qtd1    = Convert.ToDecimal(toreturn);
                            obj042.pro1    = 1;
                            obj042.log2    = "NONE";
                            obj042.qtd2    = Convert.ToDecimal(toreturn);
                            obj042.pro2    = 2;
                            obj042.loca    = " ";
                            obj042.norp    = 1;
                            obj042.dele    = 2;
                            obj042.logd    = "NONE";
                            obj042.refcntd = 0;
                            obj042.refcntu = 0;
                            obj042.drpt    = DateTime.Now;
                            obj042.urpt    = HttpContext.Current.Session["user"].ToString();
                            obj042.acqt    = Convert.ToDouble(toreturn);
                            //JC 180821 Grabar la bodega por defecto del item
                            //obj042.cwaf = row.Cells[3].Text.ToUpper();
                            //obj042.cwat = row.Cells[3].Text.ToUpper();
                            obj042.cwaf = Warehouse.Rows[0]["WARITEM"].ToString().Trim().ToUpper();
                            obj042.cwat = Warehouse.Rows[0]["WARITEM"].ToString().Trim().ToUpper();
                            //JC 061221 Se quita esta inserción debido a que se cambio la estructura del gridview
                            //obj042.cwaf = row.Cells[3].Text.ToUpper();
                            //obj042.cwat = row.Cells[3].Text.ToUpper();
                            obj042.aclo = "";
                            obj042.allo = 0;

                            list042.Add(obj042);
                            Itticol042.insertarRegistroSimple(ref obj042, ref strError);
                            Itticol042.InsertarRegistroTicol242(ref obj042, ref strError);
                        }

                        obj      = new Ent_tticol125();
                        obj.pdno = txtWorkOrder.Text.Trim().ToUpper();
                        //JC 061221 Como ya no se tiene posición se define fija la posicíón 10
                        //obj.pono = Convert.ToInt32(row.Cells[0].Text);
                        obj.pono = Convert.ToInt32("10");
                        obj.item = row.Cells[0].Text.ToUpper(); //.Trim();
                        //JC 180821 Grabar la bodega por defecto del item
                        //obj.cwar = row.Cells[3].Text.ToUpper(); //.Trim();
                        obj.cwar     = Warehouse.Rows[0]["WARITEM"].ToString().Trim().ToUpper();
                        obj.paid     = txtWorkOrder.Text.Trim().ToUpper() + "-RT" + sec;
                        obj.clot     = string.IsNullOrEmpty(toLot) ? " " : toLot.ToUpperInvariant();
                        obj.reqt     = Decimal.Parse(toreturn, System.Globalization.CultureInfo.InvariantCulture); //Convert.ToInt32(toreturn);
                        obj.refcntd  = "0";
                        obj.refcntu  = "0";
                        obj.mess     = " ";
                        obj.prin     = 1;
                        obj.conf     = 2;
                        obj.user     = Session["user"].ToString();
                        obj.idrecord = grdRecords.DataKeys[row.RowIndex].Value.ToString();
                        parameterCollection.Add(obj);
                    }
                }
                InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
                idal.insertarRegistro(ref parameterCollection, ref strError, Aplicacion);
                printResult.Visible     = true;
                printLabel.Visible      = true;
                lblResult.Text          = mensajes("msjsave");
                lblResult.ForeColor     = System.Drawing.Color.Green;
                this.HeaderGrid.Visible = false;

                grdRecords.DataSource = "";
                grdRecords.DataBind();
                btnSave.Visible = false;

                if (strError != string.Empty)
                {
                    btnSave.Visible = false;

                    lblResult.Text      = mensajes("errorsave");
                    lblResult.ForeColor = System.Drawing.Color.Red;
                    throw new System.InvalidOperationException(strError);
                }
            }
            printResult.Visible   = true;
            printLabel.Visible    = true;
            grdRecords.DataSource = "";
            grdRecords.DataBind();
            btnSave.Visible = false;
        }
        protected void btnSend_Click(object sender, EventArgs e)
        {
            Session["save"] = null;
            btnSave.Visible = false;
            if (string.IsNullOrEmpty(txtWorkOrder.Text.Trim()))
            {
                RequiredField.Enabled = true;
                RequiredField.IsValid = false;
                txtWorkOrder.Focus();
                grdRecords.DataSource = "";
                grdRecords.DataBind();
                return;
            }

            //lblOrder.Visible = true;
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();
            Ent_tticol125         obj  = new Ent_tticol125();
            string strError            = string.Empty;

            txtWorkOrder.Text = txtWorkOrder.Text.ToUpperInvariant();
            obj.pdno          = txtWorkOrder.Text.ToUpperInvariant();

            lblResult.Text = string.Empty;
            DataTable resultado = idal.listaRegistrosOrden_Param(ref obj, ref strError);

            if (resultado.Rows.Count > 0)
            {
                foreach (DataRow item in resultado.Rows)
                {
                    Ent_tticol125 MyObj = new Ent_tticol125();
                    MyObj.pdno = item["Orden"].ToString();
                    //JC 061221 MyObj.pono = Convert.ToInt32(item["Pos"].ToString());
                    MyObj.item = item["Articulo"].ToString();

                    DataTable ResQtdl = idal.ConsultarQtdl(ref MyObj, ref strError);

                    decimal Qtdl = 0;

                    if (ResQtdl.Rows.Count > 0)
                    {
                        Qtdl = Convert.ToDecimal(ResQtdl.Rows[0]["REQT"].ToString());
                    }

                    item["CANT"] = Convert.ToString(Convert.ToDecimal(item["CANT"].ToString()) - Qtdl);
                }
            }

            // Validar si el numero de orden trae registros
            if (strError != string.Empty)
            {
                OrderError.IsValid = false;
                txtWorkOrder.Focus();
                btnSave.Visible       = false;
                grdRecords.DataSource = "";
                grdRecords.DataBind();
                return;
            }
            //lblOrder.Text = _idioma == "INGLES" ? "Order: " : "Orden: " + obj.pdno;
            grdRecords.DataSource = resultado;
            grdRecords.DataBind();
            printLabel.Visible      = false;
            this.HeaderGrid.Visible = true;
            btnSave.Visible         = true;
            lblResult.Text          = "";
        }
Exemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string  rutaServ = string.Empty;
            DataRow fila     = (DataRow)Session["FilaImprimir"];

            if (fila == null)
            {
                return;
            }


            // string id =
            LblWorkOrder.Text = fila.ItemArray[0].ToString().Trim();
            lblLotCode.Text   = fila.ItemArray[4].ToString().Trim();
            lblItem.Text      = fila.ItemArray[2].ToString().Trim();
            lblArticulo.Text  = fila.ItemArray[15].ToString().Trim();
            lblQuantity.Text  = fila.ItemArray[5].ToString().Trim();
            lblUnit.Text      = fila.ItemArray[14].ToString().Trim();
            lblUser.Text      = fila.ItemArray[6].ToString().Trim();
            lblStatPrint.Text = fila.ItemArray[8].ToString().Trim() == "1"?"Reprinted":"Printed";
            string PalletId = fila.ItemArray[13].ToString().Trim();
            //lblDate.Text = fila.ItemArray[7].ToString().Trim();
            string siteName = ConfigurationManager.AppSettings["enlaceRet"].ToString();

            rutaServ        = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + PalletId + "&code=Code128&dpi=96";
            imgPalletId.Src = !string.IsNullOrEmpty(PalletId) ? rutaServ : "";

            rutaServ         = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + LblWorkOrder.Text + "&code=Code128&dpi=96";
            imgWorkOrder.Src = !string.IsNullOrEmpty(LblWorkOrder.Text) ? rutaServ : "";

            rutaServ       = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + lblLotCode.Text + "&code=Code128&dpi=96";
            imgLotCode.Src = !string.IsNullOrEmpty(lblLotCode.Text) ? rutaServ : "";

            rutaServ    = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + lblItem.Text + "&code=Code128&dpi=96";
            imgItem.Src = !string.IsNullOrEmpty(lblItem.Text) ? rutaServ : "";

            Type csType = this.GetType();
            ClientScriptManager scriptBlock = Page.ClientScript;

            string cstext1 = "printDiv('Label');";

            scriptBlock.RegisterStartupScript(csType, "printerLabel", cstext1, true);

            if (Session["update"] != null)
            {
                return;
            }

            List <Ent_tticol125> parameterCollection = new List <Ent_tticol125>();
            Ent_tticol125        obj = new Ent_tticol125();

            //Actualizar estado de impresion
            obj          = new Ent_tticol125();
            obj.paid     = fila.ItemArray[13].ToString().Trim();
            obj.pdno     = fila.ItemArray[0].ToString().Trim();
            obj.pono     = Convert.ToInt32(fila.ItemArray[1].ToString().Trim());
            obj.item     = fila.ItemArray[2].ToString();
            obj.cwar     = fila.ItemArray[3].ToString().Trim();
            obj.clot     = string.IsNullOrEmpty(fila.ItemArray[4].ToString().Trim()) ? " " : fila.ItemArray[4].ToString().Trim();
            obj.reqt     = Convert.ToDecimal(fila.ItemArray[5].ToString().Trim());
            obj.refcntd  = "0";
            obj.refcntu  = "0";
            obj.mess     = " ";
            obj.conf     = Convert.ToInt32(fila.ItemArray[9].ToString().Trim());
            obj.prin     = 1;
            obj.idrecord = fila.ItemArray[16].ToString().Trim();
            parameterCollection.Add(obj);
            InterfazDAL_tticol125 idal = new InterfazDAL_tticol125();

            if (fila.ItemArray.Count() > 16)
            {
                if (fila.ItemArray[16].ToString().Trim() == "126")
                {
                    idal.actualizarRegistro_Param(ref parameterCollection, ref strError, Aplicacion, true);
                    return;
                }
            }
            idal.actualizarRegistro_Param(ref parameterCollection, ref strError, Aplicacion);
            Session.Remove("IsPreviousPage");

            //ScriptManager.RegisterStartupScript(this, this.GetType(), "printDiv", "javascript:printDiv('Label');", true);
        }