Example #1
0
        public static string verifyItem(string ITEM)
        {
            Ent_twhcol130131 MyObj  = new Ent_twhcol130131();
            Ent_ttwhcol016   obj016 = new Ent_ttwhcol016();

            obj016.item = ITEM.ToUpper().Trim();
            DataTable DTItemt = dal016.TakeMaterialInv_verificaItem_Param(ref obj016, ref strError);

            if (DTItemt.Rows.Count > 0)
            {
                Ent_twhcol130131 MyOriginalPallet = (Ent_twhcol130131)HttpContext.Current.Session["MyOriginalPallet"];
                var MyObjDT = DTItemt.Rows[0];

                if (MyObjDT["UNIDAD"].ToString().Trim() == MyOriginalPallet.UNIT.Trim())
                {
                    MyObj.KTLC      = MyObjDT["LOTE"].ToString();
                    MyObj.ITEM      = MyObjDT["T$ITEM"].ToString();
                    MyObj.DSCA      = MyObjDT["DESCRIPCION"].ToString();
                    MyObj.UNIT      = MyObjDT["UNIDAD"].ToString();
                    MyObj.Error     = false;
                    MyObj.errorMsg  = string.Empty;
                    MyObj.TipeMsgJs = string.Empty;
                }
                else
                {
                    MyObj.Error     = true;
                    MyObj.errorMsg  = "Item not allowed to adjust, due the unit is different";
                    MyObj.TipeMsgJs = "alert";
                }
            }
            else
            {
                MyObj.Error     = true;
                MyObj.errorMsg  = Itemcodedoesntexist;
                MyObj.TipeMsgJs = "Label";
            }

            return(JsonConvert.SerializeObject(MyObj));;
        }
        public static string validaInfo(string valor, string tipo)
        {
            InterfazDAL_ttwhcol016 idal = new InterfazDAL_ttwhcol016();
            Ent_ttwhcol016         obj  = new Ent_ttwhcol016();
            string    strError          = string.Empty;
            string    retorno           = string.Empty;
            DataTable resultado         = new DataTable();
            string    strSecondVal      = string.Empty;

            if (tipo == "1") // Bodega
            {
                obj.cwar  = valor.Trim().ToUpperInvariant();
                resultado = idal.TakeMaterialInv_verificaBodega_Param(ref obj, ref strError);
            }
            if (tipo == "2") // Zona
            {
                obj.zone  = valor.Trim().ToUpperInvariant();
                resultado = idal.TakeMaterialInv_verificaZona_Param(ref obj, ref strError);
                if (resultado.Rows.Count > 0)
                {
                    int consecutivo = 0;
                    consecutivo  = idal.TakeMaterialInv_verificaConsLabel_Param(ref obj, ref strError);
                    strSecondVal = "|" + consecutivo.ToString().Trim();

                    if (consecutivo < 1)
                    {
                        strError = _idioma == "INGLES" ? "Sequence Zone " + valor + " doesn't exist. Cannot Continue"
                            : "Secunecia de zona " + valor + " no existe, no se puede continuar.";
                    }
                }
            }
            if (tipo == "3") // Item
            {
                obj.item  = valor.Trim().ToUpperInvariant();
                resultado = idal.TakeMaterialInv_verificaItem_Param(ref obj, ref strError);
                if (resultado.Rows.Count <= 0)
                {
                    strError = _idioma == "INGLES" ? "Item code doesn´t exist. Cannot continue" : "Codigo de articulo no existe. No se puede continuar";
                }
            }
            if (tipo == "4") // Lote
            {
                obj.clot  = valor.Trim().ToUpperInvariant();
                resultado = idal.TakeMaterialInv_verificaLote_Param(ref obj, ref strError);
                if (resultado.Rows.Count <= 0)
                {
                    strError = _idioma == "INGLES" ? "Lot Code doesn´t exist. Cannot Continue" : "Codigo de lote no existe. No se puede continuar";
                }
            }



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

            if (resultado.Rows.Count > 0)
            {
                retorno = resultado.Rows[0]["DESCRIPCION"].ToString();

                if (tipo == "3")
                {
                    retorno = resultado.Rows[0]["DESCRIPCION"].ToString().Trim() + "|" +
                              resultado.Rows[0]["UNIDAD"].ToString().Trim() + "|" +
                              resultado.Rows[0]["LOTE"].ToString().Trim();
                }
            }

            return(retorno + strSecondVal);
        }