public DataTable listaRegistro_ObtieneConteo(ref Ent_twhcol002 Parametros, ref string strError)
        {
            DataTable retorno;

            try
            {
                retorno = dal.listaRegistro_ObtieneConteo(ref Parametros, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.ToString());
            }
        }
Beispiel #2
0
        public DataTable listaRegistro_ObtieneConteo(ref Ent_twhcol002 Parametros, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add(":T$CWAR", Parametros.cwar.Trim());

            strSQL = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, tabla, paramList);

            try
            {
                consulta = DAL.BaseDAL.BaseDal.EjecutarCons("Text", strSQL, ref parametersOut, null, true);
                if (consulta.Rows.Count < 1)
                {
                    strError = "There is no active count for the warehouse." + Parametros.cwar.Trim();
                }
            }
            catch (Exception ex)
            {
                strError = "Error to the search sequence [twhcol002]. Try again or contact your administrator \n ";
                log.escribirError(strError + Console.Out.NewLine + ex.Message, stackTrace.GetFrame(1).GetMethod().Name, method.Name, method.ReflectedType.Name);
            }
            return(consulta);
        }
Beispiel #3
0
        public static string Click_Save(string PAID, string ITEM, string CWAR, string LOCA, string UNIT, string QTYS, string CLOT, string ZONE, string USER)
        {
            string strError = string.Empty;

            //Valido si el articulo maneja lote
            Ent_ttcibd001 ObjTtcibd001 = new Ent_ttcibd001();
            DataTable     dtTtcibd001  = ITtcibd001.findItem(ITEM);

            if (dtTtcibd001.Rows.Count > 0)
            {
                ObjTtcibd001.item = dtTtcibd001.Rows[0]["ITEM"].ToString();
                ObjTtcibd001.dsca = dtTtcibd001.Rows[0]["DSCA"].ToString();
                ObjTtcibd001.cuni = dtTtcibd001.Rows[0]["CUNI"].ToString();
                ObjTtcibd001.kltc = dtTtcibd001.Rows[0]["KLTC"].ToString();
                ObjTtcibd001.kitm = dtTtcibd001.Rows[0]["KITM"].ToString();

                if (ObjTtcibd001.kltc.Trim() == "1")
                {
                    //Valido el Lote que exista en baan y este asociado al item
                    Ent_tticol125 Obj_tticol125 = new Ent_tticol125();
                    Obj_tticol125.item = ITEM;
                    Obj_tticol125.clot = CLOT;

                    DataTable DtTticol125 = ITticol125.listaRegistrosLoteItem_Param(ref Obj_tticol125);

                    if (DtTticol125.Rows.Count > 0)
                    {
                        Obj_tticol125.error      = false;
                        Obj_tticol125.typeMsgJs  = "console";
                        Obj_tticol125.SuccessMsg = "Lote Encontrado";
                    }
                    else
                    {
                        Obj_tticol125.error      = true;
                        Obj_tticol125.typeMsgJs  = "label";
                        Obj_tticol125.SuccessMsg = Lotcodedoesntexist;
                        return(JsonConvert.SerializeObject(Obj_tticol125));
                    }
                }
            }

            //Valido los datos de la bodega
            Ent_twhwmd200  Obj_twhwmd200 = new Ent_twhwmd200();
            Ent_ttwhcol016 Obj_twhcol016 = new Ent_ttwhcol016();

            Obj_twhcol016.cwar = CWAR;
            Obj_twhwmd200.cwar = CWAR;

            DataTable DtTtwhcol016 = ITtwhcol016.TakeMaterialInv_verificaBodega_Param(ref Obj_twhcol016, ref strError);
            DataTable DtTwhwmd200  = ITwhwmd200.listaRegistro_ObtieneAlmacenLocation(ref Obj_twhwmd200, ref strError);

            if (DtTtwhcol016.Rows.Count > 0)
            {
                Obj_twhcol016.error      = false;
                Obj_twhcol016.typeMsgJs  = "console";
                Obj_twhcol016.SuccessMsg = "Warehouse Encontrado";

                //if (CWAR != PCWAR)
                //{
                //    Obj_twhcol016.error = true;
                //    Obj_twhcol016.typeMsgJs = "label";
                //    Obj_twhcol016.SuccessMsg = Warehousenotequalzone;
                //    return JsonConvert.SerializeObject(Obj_twhcol016);
                //}
                if (DtTwhwmd200.Rows.Count > 0)
                {
                    Obj_twhcol016.sloc = DtTwhwmd200.Rows[0]["LOC"].ToString();
                }
                else
                {
                    Obj_twhcol016.sloc = string.Empty;
                }
            }
            else
            {
                Obj_twhcol016.error      = true;
                Obj_twhcol016.typeMsgJs  = "label";
                Obj_twhcol016.SuccessMsg = Warehousecodedoesntexist;
                return(JsonConvert.SerializeObject(Obj_twhcol016));
            }

            if (Obj_twhcol016.sloc == "1")
            {
                //Valido que la ubicación sea válida.
                DataTable DtTransfer = Itransfer.ConsultarLocation(CWAR, LOCA);
                if (DtTransfer.Rows.Count > 0)
                {
                    if (DtTransfer.Rows[0]["LOCT"].ToString() == "5")
                    {
                        if (DtTransfer.Rows[0]["BINB"].ToString() == "2")
                        {
                            Obj_twhwmd200.Error      = false;
                            Obj_twhwmd200.TypeMsgJs  = "console";
                            Obj_twhwmd200.SuccessMsg = "Location Encontrado";
                        }
                        else
                        {
                            Obj_twhwmd200.error      = true;
                            Obj_twhwmd200.typeMsgJs  = "label";
                            Obj_twhwmd200.SuccessMsg = Locationcodedoesntexist;
                            return(JsonConvert.SerializeObject(Obj_twhwmd200));
                        }
                    }
                    else
                    {
                        Obj_twhwmd200.error      = true;
                        Obj_twhwmd200.typeMsgJs  = "label";
                        Obj_twhwmd200.SuccessMsg = Locationcodedoesntexist;
                        return(JsonConvert.SerializeObject(Obj_twhwmd200));
                    }
                }
                else
                {
                    Obj_twhwmd200.error      = true;
                    Obj_twhwmd200.typeMsgJs  = "label";
                    Obj_twhwmd200.SuccessMsg = Locationcodedoesntexist;
                    return(JsonConvert.SerializeObject(Obj_twhwmd200));
                }
            }

            //Valido que exista un conteo activo para la bodega.
            Ent_twhcol002 ObjTwhcol002      = new Ent_twhcol002();
            DataTable     DTSecuenciaConteo = _idaltwhcol019.ConsecutivoConteo(CWAR, ref strError);
            string        SecuenciaConteo   = "0";

            if (DTSecuenciaConteo.Rows.Count > 0)
            {
                SecuenciaConteo = DTSecuenciaConteo.Rows[0]["T$COUN"].ToString();
                if (SecuenciaConteo == "0")
                {
                    ObjTwhcol002.error      = true;
                    ObjTwhcol002.typeMsgJs  = "label";
                    ObjTwhcol002.SuccessMsg = CountWarehouseNotDefined;
                    return(JsonConvert.SerializeObject(ObjTwhcol002));
                }
            }
            else
            {
                ObjTwhcol002.error      = true;
                ObjTwhcol002.typeMsgJs  = "label";
                ObjTwhcol002.SuccessMsg = CountWarehouseNotDefined;
                return(JsonConvert.SerializeObject(ObjTwhcol002));
            }


            DataTable DTPalletContinue = _idaltwhcol019.Consetwhcol019(PAID, ref strError);
            int       SecuenciaPallet  = 0;

            if (DTPalletContinue.Rows.Count > 0)
            {
                SecuenciaPallet = DTPalletContinue.Rows.Count + 1;
            }
            else
            {
                SecuenciaPallet = 1;
            }

            Ent_twhcol019 ObjTwhcol019 = new Ent_twhcol019();

            QTYS = QTYS.Trim() == "" ? "0" : QTYS.Trim();
            //QTYS = QTYS.Contains(".") == true ? QTYS.Replace(".", ",") : QTYS.Replace(",", ".");
            decimal QTYD = Convert.ToDecimal(QTYS);

            if (QTYD <= Convert.ToDecimal(0))
            {
                ObjTwhcol019.error      = false;
                ObjTwhcol019.typeMsgJs  = "label";
                ObjTwhcol019.SuccessMsg = Registeredquantitycannotbelessthanorequaltozero;
                return(JsonConvert.SerializeObject(ObjTwhcol019));
            }
            //string CLOT = " ";
            ObjTwhcol019.PAID    = PAID;
            ObjTwhcol019.SQNB    = SecuenciaPallet;//Convert.ToInt32(PAID.Substring(10,3));
            ObjTwhcol019.ZONE    = ZONE;
            ObjTwhcol019.CWAR    = CWAR;
            ObjTwhcol019.LOCA    = Obj_twhcol016.sloc == "2" ? " ": LOCA.Trim() == "" ? " " : LOCA.Trim();
            ObjTwhcol019.ITEM    = ITEM;
            ObjTwhcol019.CLOT    = CLOT.Trim() == "" ? " " : CLOT.Trim();
            ObjTwhcol019.QTDL    = QTYD;
            ObjTwhcol019.CUNI    = UNIT;
            ObjTwhcol019.LOGN    = USER.Trim() != "" ? USER.Trim() : HttpContext.Current.Session["user"].ToString().Trim();
            ObjTwhcol019.DATE    = new DateTime();
            ObjTwhcol019.COUN    = Convert.ToInt32(SecuenciaConteo);
            ObjTwhcol019.PROC    = 0;
            ObjTwhcol019.REFCNTD = 0;
            ObjTwhcol019.REFCNTU = 0;

            bool res = _idaltwhcol019.insertRegistertwhcol019(ref ObjTwhcol019, ref strError);

            if (res)
            {
                ObjTwhcol019.error      = false;
                ObjTwhcol019.typeMsgJs  = "alert";
                ObjTwhcol019.SuccessMsg = Therecordwassuccessfullyinserted;
            }
            else
            {
                ObjTwhcol019.error     = true;
                ObjTwhcol019.typeMsgJs = "alert";

                ObjTwhcol019.SuccessMsg = Therecordwasnotinserted + " " + strError;
            }
            return(JsonConvert.SerializeObject(ObjTwhcol019));
        }