Example #1
0
        private List <Ent_ParametrosDAL> AdicionaParametrosComunes(Ent_tticol080 parametros, bool blnUsarPRetorno = false)
        {
            string param = string.Empty;
            List <Ent_ParametrosDAL> parameterCollection = new List <Ent_ParametrosDAL>();

            try
            {
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$ORNO", DbType.String, parametros.orno);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PONO", DbType.String, parametros.pono);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$ITEM", DbType.String, "         " + parametros.item.Trim().ToUpperInvariant());
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$CWAR", DbType.String, parametros.cwar);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$QUNE", DbType.Decimal, Convert.ToDecimal(parametros.qune).ToString("#.##0,0000"));
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$LOGN", DbType.String, parametros.logn);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PROC", DbType.String, parametros.proc);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTD", DbType.String, parametros.refcntd);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTU", DbType.String, parametros.refcntu);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$CLOT", DbType.String, parametros.clot);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PICK", DbType.String, parametros.pick);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$OORG", DbType.String, parametros.oorg);

                if (blnUsarPRetorno)
                {
                    Ent_ParametrosDAL pDal = new Ent_ParametrosDAL();
                    pDal.Name         = "@p_Int_Resultado";
                    pDal.Type         = DbType.Int32;
                    pDal.ParDirection = ParameterDirection.Output;
                    parameterCollection.Add(pDal);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            return(parameterCollection);
        }
Example #2
0
        public bool updateRecordCosts(ref Ent_tticol080 data, ref string strError)
        {
            parametrosIn.Clear();
            method = MethodBase.GetCurrentMethod();
            bool retorno = false;

            try
            {
                paramList = new Dictionary <string, object>();
                paramList.Add(":T$QUNE", data.qune.ToString().Replace(',', '.'));
                paramList.Add(":T$LOGN", data.logn.Trim().ToUpper());
                paramList.Add(":T$ORNO", data.orno.Trim().ToUpper());
                paramList.Add(":T$PONO", data.pono);

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

                retorno = DAL.BaseDAL.BaseDal.EjecutarCrud("text", strSentencia, ref parametersOut, parametrosIn, false);

                return(retorno);
            }

            catch (Exception ex)
            {
                strError = ex.InnerException != null ?
                           ex.Message + " (" + ex.InnerException + ")" :
                           ex.Message;
            }

            return(retorno);
        }
Example #3
0
        public DataTable listaRegistroImprimir_Param(ref Ent_tticol080 ParametrosIn, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add("p1", ParametrosIn.pono);
            paramList.Add("p2", ParametrosIn.orno.Trim().ToUpperInvariant());
            paramList.Add("p3", ParametrosIn.item.Trim().ToUpperInvariant());
            paramList.Add("p4", ParametrosIn.cwar.Trim().ToUpperInvariant());

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

            try
            {
                consulta = DAL.BaseDAL.BaseDal.EjecutarCons("Text", strSentencia, ref parametersOut, null, true);
                if (consulta.Rows.Count < 1)
                {
                    strError = "-1";
                }
                return(consulta);
            }
            catch (Exception ex)
            {
                strError = "Error when querying data [tticol080]. Try again or contact your administrator";
                throw ex;
            }
        }
Example #4
0
        public int actualizarRegistro_Param(ref List <Ent_tticol125> parametros, ref string strError, string Aplicacion, bool updHist = false)
        {
            method = MethodBase.GetCurrentMethod();
            bool   retorno = false;
            string table   = owner + ".tticol125" + env;
            List <Ent_tticol080> Parametros080 = new List <Ent_tticol080>();
            Ent_tticol080        t080          = new Ent_tticol080();
            tticol080            dal080        = new tticol080();
            string strTagId = string.Empty;

            if (updHist)
            {
                table = owner + ".tticol126" + env;
            }

            try
            {
                strSentencia = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, table);
                string strCondicion = string.Empty;

                foreach (Ent_tticol125 reg in parametros)
                {
                    strCondicion = " WHERE ROWID = '" + reg.idrecord + "'";
                    parametrosIn = AdicionaParametrosComunesUpdate(reg);
                    retorno      = DAL.BaseDAL.BaseDal.EjecutarCrud("text", strSentencia + strCondicion, ref parametersOut, parametrosIn, false);

                    //Requerimiento No. 46122.
                    //Insertar en la tabla ticol080 - Comentado por nuevos requerimientos
                    //CChaverra 28/07/2017 - 09/03/2017
                    //if (Convert.ToInt32(retorno) > 0)
                    //{
                    //    t080 = new Ent_tticol080();
                    //    t080.orno = reg.pdno;
                    //    t080.pono = reg.pono;
                    //    t080.item = reg.item;
                    //    t080.cwar = reg.cwar;
                    //    t080.qune = reg.reqt * -1;
                    //    t080.logn = reg.user;
                    //    t080.proc = 2;
                    //    t080.refcntd = 0;
                    //    t080.refcntu = 0;
                    //    t080.clot = reg.clot;
                    //    Parametros080.Add(t080);
                    //    dal080.insertarRegistro(ref Parametros080, ref strError, ref strTagId);
                    //    Parametros080.Clear();

                    //    if (!string.IsNullOrEmpty(strError))
                    //        break;
                    //}
                }
                return(Convert.ToInt32(retorno));
            }

            catch (Exception ex)
            {
                strError += "Error updating data [125]. Try again or contact your administrator";
                log.escribirError(strError + Console.Out.NewLine + ex.Message, method.Module.Name, method.Name, method.ReflectedType.Name);
            }
            return(Convert.ToInt32(retorno));
        }
Example #5
0
        public int insertarRegistro(ref List <Ent_tticol125> parametros, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();
            bool retorno = false;

            foreach (var item in parametros)
            {
                if (item.paid == "")
                {
                    item.paid = " ";
                }
            }

            List <Ent_tticol080> Parametros080 = new List <Ent_tticol080>();
            Ent_tticol080        t080          = new Ent_tticol080();
            tticol080            dal080        = new tticol080();
            string strTagId = string.Empty;

            try
            {
                strSentencia = recursos.readStatement(method.ReflectedType.Name, method.Name, ref owner, ref env, tabla);

                foreach (Ent_tticol125 reg in parametros)
                {
                    parametrosIn = AdicionaParametrosComunes(reg);
                    retorno      = DAL.BaseDAL.BaseDal.EjecutarCrud("text", strSentencia, ref parametersOut, parametrosIn, false);

                    //Requerimiento No. 46122.
                    //Se quitó la inserción en la tabla ticol080
                    //CChaverra 28/07/2017
                    //if (Convert.ToInt32(retorno) > 0)
                    //{
                    //    t080 = new Ent_tticol080();
                    //    t080.orno = reg.pdno;
                    //    t080.pono = reg.pono;
                    //    t080.item = reg.item;
                    //    t080.cwar = reg.cwar;
                    //    t080.qune = reg.reqt * -1;
                    //    t080.logn = reg.user;
                    //    t080.proc = 2;
                    //    t080.refcntd = 0;
                    //    t080.refcntu = 0;
                    //    t080.clot = reg.clot;
                    //    Parametros080.Add(t080);
                    //    dal080.insertarRegistro(ref Parametros080, ref strError, ref strTagId);
                    //    Parametros080.Clear();

                    //    if (!string.IsNullOrEmpty(strError))
                    //        break;
                    //}
                }
            }

            catch (Exception ex)
            {
                strError += "Error when inserting data [025]. Try again or contact your administrator";
                log.escribirError(strError + Console.Out.NewLine + ex.Message, method.Module.Name, method.Name, method.ReflectedType.Name);
            }
            return(Convert.ToInt32(retorno));
        }
Example #6
0
        public bool updateRecordCosts(ref Ent_tticol080 data, ref string strError)
        {
            //int retorno = -1;
            bool retorno;

            try
            {
                retorno = dal.updateRecordCosts(ref data, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.ToString());
            }
        }
Example #7
0
        public DataTable listaRegistroImprimir_Param(ref Ent_tticol080 ParametrosIn, ref string strError)
        {
            //int retorno = -1;
            DataTable retorno;

            try
            {
                retorno = dal.listaRegistroImprimir_Param(ref ParametrosIn, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.ToString());
            }
        }
        public static void actualizarTablas(Ent_tticol080 MyObj)
        {
            bool ActalizacionExitosa = false;

            switch (HttpContext.Current.Session["TBL"].ToString().Trim())
            {
            case "ticol022":
                Itwhcol122.ActCausalTICOL022(HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper(), 11);
                break;

            case "whcol130":
                Itwhcol122.ActCausalcol130140(HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper(), 9);

                break;

            case "whcol131":
                Itwhcol122.ActCausalcol131140(HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper(), 9);
                break;

            case "ticol042":
                Itwhcol122.ActCausalTICOL042(HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper(), 11);
                break;
            }
        }
Example #9
0
        public static string ClickSave(string LstJson)
        {
            List <Ent_twhinh220> lstGuardar       = JsonConvert.DeserializeObject <List <Ent_twhinh220> >(LstJson);
            List <bool>          ListInsertResult = new List <bool>();

            if (lstGuardar.Count > 0)
            {
                foreach (Ent_twhinh220 myObj in lstGuardar)
                {
                    Factor MyConvertionFactor = new Factor {
                    };
                    decimal QUANTITYPLT       = 0;
                    decimal QUANTITYCUNI      = 0;
                    int     ciclosADVS        = 0;

                    if (myObj.CUNI != myObj.STUN)
                    {
                        MyConvertionFactor = FactorConversion(myObj.ITEM, myObj.STUN, myObj.CUNI);
                        QUANTITYCUNI       = (MyConvertionFactor.Tipo == "Div") ? Convert.ToDecimal((Convert.ToDecimal(myObj.QSTR) * MyConvertionFactor.FactorB) / MyConvertionFactor.FactorD) : Convert.ToDecimal((Convert.ToDecimal(myObj.QSTR) * MyConvertionFactor.FactorD) / MyConvertionFactor.FactorB);
                        QUANTITYCUNI       = Math.Ceiling(Math.Round(QUANTITYCUNI, 1));
                        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));
                        }
                    }
                    else
                    {
                        QUANTITYCUNI       = Convert.ToDecimal(myObj.QSTR);
                        MyConvertionFactor = FactorConversion(myObj.ITEM, myObj.CUNI, "PLT");
                        QUANTITYPLT        = (MyConvertionFactor.Tipo == "Div") ? Convert.ToDecimal((Convert.ToDecimal(myObj.QSTR) * MyConvertionFactor.FactorB) / MyConvertionFactor.FactorD) : Convert.ToDecimal((Convert.ToDecimal(myObj.QSTR) * MyConvertionFactor.FactorD) / MyConvertionFactor.FactorB);
                        //ciclosADVS = Convert.ToInt32(Math.Ceiling(QUANTITYPLT));
                    }

                    //if (ciclosADVS > 0)
                    //{
                    //    //int PRIO = Itticol082.PrioridadMaxima();
                    //    //int PRIO = Itticol080.PrioridadMaxima();

                    //for (int i = 1; i <= ciclosADVS; i++)
                    //{
                    //    //Ent_tticol082 Objtticol082 = new Ent_tticol082
                    //    //{
                    //    //    PAID = " ",
                    //    //    LOGN = _operator,
                    //    //    OORG = myObj.OORG,
                    //    //    ORNO = myObj.ORNO,
                    //    //    OSET = myObj.OSET,
                    //    //    PONO = myObj.PONO,
                    //    //    SQNB = myObj.SEQN,
                    //    //    ADVS = i.ToString(),
                    //    //    ITEM = myObj.ITEM,
                    //    //    STAT = "1",
                    //    //    QTYT = CantidadPorCiclo(QUANTITYCUNI, Convert.ToInt32(MyConvertionFactor.FactorD), ciclosADVS, i).ToString(),
                    //    //    CWAR = myObj.SFCO.Trim(),
                    //    //    UNIT = myObj.CUNI,
                    //    //    PRIO = Convert.ToString(PRIO+1)
                    //    //};

                    Ent_tticol080 Objtticol080 = new Ent_tticol080
                    {
                        oorg = myObj.OORG,
                        orno = myObj.ORNO,
                        pono = Convert.ToInt32(myObj.PONO),
                        item = myObj.ITEM,
                        cwar = myObj.SFCO.Trim(),
                        //qune = Convert.ToDecimal(CantidadPorCiclo(QUANTITYCUNI, Convert.ToInt32(MyConvertionFactor.FactorD), ciclosADVS, i).ToString()),
                        qune    = Convert.ToDecimal(QUANTITYCUNI),
                        logn    = HttpContext.Current.Session["user"].ToString(),
                        proc    = 2,
                        pick    = 1,
                        clot    = " ",
                        refcntd = 0,
                        refcntu = 0
                    };
                    //bool InsertSuccess = Itticol082.InsertarregistroItticol082(Objtticol082);
                    List <Ent_tticol080> lst80 = new List <Ent_tticol080>();
                    lst80.Add(Objtticol080);
                    string aux           = string.Empty;
                    int    InsertSuccess = Itticol080.insertarRegistro(ref lst80, ref strError, ref aux);
                    ListInsertResult.Add((InsertSuccess != -1 ? true : false));
                    //PRIO++;
                    //}
                    //}
                }
            }
            return(JsonConvert.SerializeObject(ListInsertResult));
        }
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            lblError.Text   = String.Empty;
            lblConfirm.Text = String.Empty;
            var qtdl = double.Parse(txtQuantity.Text.Trim(), CultureInfo.InvariantCulture.NumberFormat);
            var orno = txtWorkOrder.Text.Trim().ToUpper();
            var pono = hdfPONO.Value.Trim().ToUpper();
            var clot = loteitem;
            var item = txtItem.Text.Trim().ToUpper();
            var cwar = hdfCWAR.Value.Trim().ToUpper();

            if (qtdl <= 0)
            {
                lblError.Text = mensajes("quantityhigher");
                return;
            }

            var consultaRegistro = _idaltticol080.findRecordByOrnoPonoItem(ref orno, ref pono, ref item, ref strError).Rows;

            Ent_tticol080 data080 = new Ent_tticol080()
            {
                orno    = orno,
                pono    = Convert.ToInt32(pono),
                item    = item,
                cwar    = cwar,
                qune    = Convert.ToDecimal(qtdl),
                logn    = HttpContext.Current.Session["user"].ToString(),
                proc    = 2,
                refcntd = 0,
                refcntu = 0,
                clot    = clot,
                oorg    = "4",
                pick    = 2
            };

            if (consultaRegistro.Count > 0)
            {
                var validateUpdate = _idaltticol080.updateRecordRollAnnounce(ref data080, ref strError);

                if (validateUpdate)
                {
                    _idaltticol022.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                    _idaltticol022.ActualizarCantidadRegistroTicol222(0, txtRollNumber.Text.Trim());
                    _idaltticol042.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                    _idaltticol042.ActualizarCantidadRegistroTicol242(0, txtRollNumber.Text.Trim());
                    _idaltwhcol131.Actualizartwhcol131CantEstado(txtRollNumber.Text.Trim(), 9, 0);
                    lblError.Text          = String.Empty;
                    lblConfirm.Text        = mensajes("msjupdate");
                    trItem.Visible         = false;
                    trQuantity.Visible     = false;
                    txtWorkOrder.ReadOnly  = false;
                    txtRollNumber.ReadOnly = false;
                    txtRollNumber.Text     = String.Empty;
                    txtWorkOrder.Text      = String.Empty;
                    btnConsultar.Visible   = true;
                    btnRegister.Visible    = false;
                }
                else
                {
                    lblError.Text = mensajes("errorupdt");
                    return;
                }
            }
            else
            {
                List <Ent_tticol080> lista = new List <Ent_tticol080>();
                lista.Add(data080);
                var isTag = String.Empty;

                var validaInsert = _idaltticol080.insertarRegistro(ref lista, ref strError, ref isTag);
                _idaltticol022.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                _idaltticol022.ActualizarCantidadRegistroTicol222(0, txtRollNumber.Text.Trim());
                _idaltticol042.ActualizacionPalletId(txtRollNumber.Text.Trim(), "11", strError);
                _idaltticol042.ActualizarCantidadRegistroTicol242(0, txtRollNumber.Text.Trim());
                _idaltwhcol131.Actualizartwhcol131CantEstado(txtRollNumber.Text.Trim(), 9, 0);
                if (validaInsert > 0)
                {
                    lblError.Text          = String.Empty;
                    lblConfirm.Text        = mensajes("msjsave");
                    trItem.Visible         = false;
                    trQuantity.Visible     = false;
                    txtWorkOrder.ReadOnly  = false;
                    txtRollNumber.ReadOnly = false;
                    txtRollNumber.Text     = String.Empty;
                    txtWorkOrder.Text      = String.Empty;
                    btnConsultar.Visible   = true;
                    btnRegister.Visible    = false;
                }
                else
                {
                    lblError.Text = mensajes("errorsave");
                    return;
                }
            }
        }
Example #11
0
        public static string Click_Pick(string PAID)
        {
            try
            {
                var ITEM = string.Empty;
                var DSCA = string.Empty;
                var ACQT = string.Empty;
                var CUNI = string.Empty;
                var STAT = string.Empty;
                var SQNB = string.Empty;
                var PONO = string.Empty;
                var CWAT = string.Empty;
                var PROC = string.Empty;
                var DATE = string.Empty;

                string    retorno            = string.Empty;
                string    USRR               = HttpContext.Current.Session["user"].ToString().Trim();
                DataTable DTtccol307PalletID = twhcol130DAL.Consultarttccol307(PAID, string.Empty);


                if (DTtccol307PalletID.Rows.Count > 0)
                {
                    Error ReturnError = new Error
                    {
                        MyError = TheIDpalled + " " + DTtccol307PalletID.Rows[0]["PAID"].ToString().Trim() + " " + pendingtolocatebyuser + " " + DTtccol307PalletID.Rows[0]["USRR"].ToString().Trim()
                    };
                    retorno = JsonConvert.SerializeObject(ReturnError);
                }
                else if (DTtccol307PalletID.Rows.Count == 0)
                {
                    //DataTable DTtccol307User = twhcol130DAL.Consultarttccol307(PAID, USRR);
                    //if (DTtccol307User.Rows.Count > 0)
                    //{
                    //    Error ReturnError = new Error
                    //    {
                    //        MyError = "You have the ID pallet: " + DTtccol307User.Rows[0]["PAID"].ToString().Trim() + " Pending to locate"
                    //    };
                    //    retorno = JsonConvert.SerializeObject(ReturnError);

                    //}
                    //else
                    if (true)
                    {
                        if (active022 == true)
                        {
                            DataTable consultaOrden = tticol022DAL.ConsultaPorPalletID(ref PAID, ref strError);
                            PROC = consultaOrden.Rows[0]["PROC"].ToString();
                            ITEM = consultaOrden.Rows[0]["ITEM"].ToString();
                            DSCA = consultaOrden.Rows[0]["DSCA"].ToString();
                            ACQT = consultaOrden.Rows[0]["ACQT"].ToString();
                            CUNI = consultaOrden.Rows[0]["CUNI"].ToString();
                            STAT = consultaOrden.Rows[0]["STAT"].ToString();
                        }
                        else
                        {
                            DataTable consultaOrden = tticol042DAL.ConsultaPorPalletID(ref PAID, ref strError);
                            SQNB = consultaOrden.Rows[0]["SQNB"].ToString();
                            PONO = consultaOrden.Rows[0]["PONO"].ToString();
                            PDNO = consultaOrden.Rows[0]["PDNO"].ToString();
                            CWAT = consultaOrden.Rows[0]["CWAT"].ToString();
                            PROC = consultaOrden.Rows[0]["PROC"].ToString();
                            ITEM = consultaOrden.Rows[0]["ITEM"].ToString();
                            DSCA = consultaOrden.Rows[0]["DSCA"].ToString();
                            ACQT = consultaOrden.Rows[0]["ACQT"].ToString();
                            CUNI = consultaOrden.Rows[0]["CUNI"].ToString();
                            STAT = consultaOrden.Rows[0]["STAT"].ToString();
                            DATE = consultaOrden.Rows[0]["DATEA"].ToString();
                        }
                        if (active022 == true && STAT != "2")
                        {
                            Error ReturnError = new Error
                            {
                                MyError = TheIDPalletisConfirmedcantdelete
                            };
                            retorno = JsonConvert.SerializeObject(ReturnError);
                        }
                        else
                        {
                            if (STAT == "13")
                            {
                                Error ReturnError = new Error
                                {
                                    MyError = TheIDPalletisalreadymarktoDeleteSuccessfully
                                };
                                retorno = JsonConvert.SerializeObject(ReturnError);
                            }
                            else
                            {
                                if (active022 == true)
                                {
                                    tticol022DAL.ActualizacionPalletId(PAID, "13", strError);
                                    Error ReturnError = new Error
                                    {
                                        MyError = TheIDPalletismarktoDeleteSuccessfully
                                    };
                                    retorno = JsonConvert.SerializeObject(ReturnError);
                                }
                                else
                                {
                                    bool stateDelete = tticol042DAL.ActualizacionPalletId(PAID, "13", strError);
                                    if (stateDelete)
                                    {
                                        Ent_tticol080 obj080 = new Ent_tticol080();



                                        obj080.orno     = PDNO.Trim();
                                        obj080.pono     = Convert.ToInt16(PONO);
                                        obj080.item     = ITEM;
                                        obj080.cwar     = CWAT;
                                        obj080.qune     = Convert.ToDecimal(ACQT);
                                        obj080.logn     = HttpContext.Current.Session["user"].ToString().Trim();
                                        obj080.date     = DATE;
                                        obj080.proc     = Convert.ToInt16(PROC);
                                        obj080.refcntd  = 0;
                                        obj080.refcntu  = 0;
                                        obj080.clot     = " ";
                                        obj080.idrecord = "2";
                                        obj080.oorg     = "4";
                                        obj080.pick     = 0;

                                        string strTagID = string.Empty;
                                        List <Ent_tticol080> list080 = new List <Ent_tticol080>();
                                        list080.Add(obj080);
                                        tticol080DAL.insertarRegistro(ref list080, ref strError, ref strTagID);
                                    }
                                    Error ReturnError = new Error
                                    {
                                        MyError = Transactionsavedsuccesfully
                                    };
                                    retorno = JsonConvert.SerializeObject(ReturnError);
                                }
                            }
                        }
                    }
                }
                return(retorno);
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
        public static string Click_Save(string PDNO, string ITEM, string CLOT, string QTYS, string UNIT)
        {
            Ent_tticol080 MyObj    = new Ent_tticol080();
            string        strError = string.Empty;
            string        myPdno   = PDNO.ToUpper().Trim();
            string        myItem   = ITEM.ToUpper().Trim();

            //if (Convert.ToDecimal(HttpContext.Current.Session["QTYC"].ToString().Trim()) < Convert.ToDecimal(QTYS.Trim()))
            //{
            //    MyObj.Error = true;
            //    MyObj.TypeMsgJs = "label";

            //    MyObj.ErrorMsg = QuantitymustbelowerthanPalletIDquantity;
            //    return JsonConvert.SerializeObject(MyObj);
            //}

            DataTable dtTticst001 = ITticst001.findByItemAndPdno(ref myPdno, ref myItem, ref strError);

            if (dtTticst001.Rows.Count > 0)
            {
                HttpContext.Current.Session["PONO"] = dtTticst001.Rows[0]["PONO"].ToString();
                HttpContext.Current.Session["CWAR"] = dtTticst001.Rows[0]["CWAR"].ToString();
            }
            else
            {
                MyObj.Error     = true;
                MyObj.TypeMsgJs = "alert";

                MyObj.ErrorMsg = doesnotexistaregisterwithItemassociatedtopalletIDandWorkOrder;
                return(JsonConvert.SerializeObject(MyObj));
            }

            string strTagId = string.Empty;
            List <Ent_tticol080> lstTticol080 = new List <Ent_tticol080>();

            MyObj.orno = PDNO.ToUpper().Trim();
            MyObj.pono = Convert.ToInt32(HttpContext.Current.Session["PONO"].ToString().Trim()); // VARIABLE GLOBAL
            MyObj.item = ITEM.ToUpper().Trim();
            MyObj.cwar = HttpContext.Current.Session["CWAR"].ToString().ToUpper();               //VARIABLE GLOBAL
            //MyObj.qune = Convert.ToDecimal(QTYS);
            MyObj.qune = Convert.ToDecimal(QTYS);

            MyObj.logn    = HttpContext.Current.Session["user"].ToString();
            MyObj.date    = "";
            MyObj.proc    = 2;
            MyObj.refcntu = 0;
            MyObj.refcntd = 0;
            MyObj.clot    = CLOT.ToUpper().Trim() == string.Empty ? " " : CLOT.ToUpper().Trim();
            MyObj.oorg    = "4";
            MyObj.pick    = 0;

            lstTticol080.Add(MyObj);

            string ORNO  = MyObj.orno.ToString();
            string PONO  = MyObj.pono.ToString();
            string ITEMN = MyObj.item.ToString();

            DataTable dtTticol080 = Tticol080.findRecordByOrnoPonoItem(ref ORNO, ref PONO, ref ITEMN, ref strError);

            if (dtTticol080.Rows.Count > 0)
            {
                int res = Tticol080.actualizarRegistro_Param(ref lstTticol080, ref strError, ref strTagId);
                if (res == 1)
                {
                    MyObj.Error     = false;
                    MyObj.TypeMsgJs = "alert";

                    MyObj.SuccessMsg = Updatesuccess;


                    //if ((Convert.ToDecimal(HttpContext.Current.Session["QTYC"].ToString()) - Convert.ToDecimal(QTYS.Trim())) == 0)
                    //{
                    actualizarTablas(MyObj);
                    Ent_tticol082 ObjTticol082 = new Ent_tticol082();
                    ObjTticol082.PAID = HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper();
                    ObjTticol082.QTYC = (Convert.ToDecimal(HttpContext.Current.Session["QTYC"].ToString()) - Convert.ToDecimal(QTYS.Trim())).ToString();
                    actualizarTablasCant(ObjTticol082);
                    //}
                    //else
                    //{
                    //    Ent_tticol082 ObjTticol082 = new Ent_tticol082();
                    //    ObjTticol082.PAID = HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper();
                    //    ObjTticol082.QTYC = (Convert.ToDecimal(HttpContext.Current.Session["QTYC"].ToString()) - Convert.ToDecimal(QTYS.Trim())).ToString();
                    //    actualizarTablasCant(ObjTticol082);
                    //}
                }
                else
                {
                    MyObj.Error     = true;
                    MyObj.TypeMsgJs = "alert";

                    MyObj.ErrorMsg = Updatefail;
                }
            }
            else
            {
                int res = Tticol080.insertarRegistro(ref lstTticol080, ref strError, ref strTagId);
                if (res == 1)
                {
                    MyObj.Error     = false;
                    MyObj.TypeMsgJs = "label";

                    MyObj.SuccessMsg = Insertsuccess;

                    //if ((Convert.ToDecimal(HttpContext.Current.Session["QTYC"].ToString()) - Convert.ToDecimal(QTYS.Trim())) == 0)
                    //{
                    actualizarTablas(MyObj);
                    Ent_tticol082 ObjTticol082 = new Ent_tticol082();
                    ObjTticol082.PAID = HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper();
                    ObjTticol082.QTYC = (Convert.ToDecimal(HttpContext.Current.Session["QTYC"].ToString()) - Convert.ToDecimal(QTYS.Trim())).ToString();
                    actualizarTablasCant(ObjTticol082);
                    //}
                    //else
                    //{
                    //    Ent_tticol082 ObjTticol082 = new Ent_tticol082();
                    //    ObjTticol082.PAID = HttpContext.Current.Session["PAID"].ToString().Trim().ToUpper();
                    //    ObjTticol082.QTYC = (Convert.ToDecimal(HttpContext.Current.Session["QTYC"].ToString()) - Convert.ToDecimal(QTYS.Trim())).ToString();
                    //    actualizarTablasCant(ObjTticol082);
                    //}
                }
                else
                {
                    MyObj.Error     = true;
                    MyObj.TypeMsgJs = "alert";

                    MyObj.ErrorMsg = Insertfail;
                }
            }


            return(JsonConvert.SerializeObject(MyObj));
        }
Example #13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            InsertarIngresoPagina();

            string strTagId = string.Empty;
            List <Ent_tticol080> parameterCollection        = new List <Ent_tticol080>();
            List <Ent_tticol042> parameterCollectionRegrind = new List <Ent_tticol042>();

            obj080 = new Ent_tticol080();
            obj042 = new Ent_tticol042();

            lblError.Visible = true;
            lblError.Text    = string.Empty;
            NumberStyles style = NumberStyles.AllowDecimalPoint;


            decimal cantidad;
            string  cantidads;

            cantidads = txtQuantity.Text;
            //bool convert = decimal.TryParse(txtQuantity.Text.Trim(), out cantidad);
            //bool convert = decimal.TryParse(cantidads, out cantidad);
            //var numberFormatInfo = new NumberFormatInfo { NumberDecimalSeparator = "," };
            var value = Decimal.Parse(cantidads);

            cantidad = Decimal.Parse(cantidads);
            decimal valueP = value;

            if (MAXR < cantidad)
            {
                lblError.Text = "Regrind announced weight cannot be higher than " + MAXR + "Kg"; return;
            }

            if (String.IsNullOrEmpty(listRegrind.SelectedValue.Trim()))
            {
                lblError.Text = mensajes("fillform"); return;
            }
            if (cantidad <= 1)
            {
                lblError.Text = mensajes("quantityzero"); return;
            }

            strError = string.Empty;
            //obj.pdno = hidden.Value;
            cantidad        = cantidad * (-1);
            obj080.pono     = Convert.ToInt32(ConsecPos);
            obj080.orno     = txtWorkOrder.Text;
            obj080.item     = listRegrind.SelectedValue;
            obj080.qune     = cantidad;
            obj080.cwar     = BodegaItem;
            obj080.logn     = Session["user"].ToString();
            obj080.clot     = LoteItem;
            obj080.proc     = 2;
            obj080.refcntd  = 0;
            obj080.refcntu  = 0;
            obj080.idrecord = unityItem;
            obj080.oorg     = "4";
            obj080.pick     = 2;
            parameterCollection.Add(obj080);

            //GRRC Inicio
            obj042.pdno     = txtWorkOrder.Text;
            cantidadRegrind = idal042.listaCantidadRegrind(ref obj042, ref strError);
            strTagId        = txtWorkOrder.Text + "-R" + cantidadRegrind.Rows[0]["CANT"].ToString();
            //GRRC Fin

            int retorno = idal080.actualizarRegistro_Param(ref parameterCollection, ref strError, ref strTagId);

            if (retorno < 1 && string.IsNullOrEmpty(strError))
            {
                retorno = idal080.insertarRegistro(ref parameterCollection, ref strError, ref strTagId);
            }

            if (!string.IsNullOrEmpty(strError))
            {
                lblError.Text = mensajes("errorsave"); return;
            }


            //GRRC Inicio
            strError    = string.Empty;
            obj042.sqnb = strTagId;
            obj042.proc = 1;
            obj042.logn = Session["user"].ToString();
            obj042.mitm = listRegrind.SelectedValue;
            obj042.pono = Convert.ToInt32(ConsecPos);
            obj042.qtdl = Convert.ToDouble(value);
            obj042.cuni = unityItem;
            obj042.log1 = " ";
            obj042.qtd1 = 0;
            obj042.pro1 = 2;
            obj042.log2 = " ";
            obj042.qtd2 = 0;
            obj042.pro2 = 2;
            obj042.loca = " ";
            obj042.norp = 0;
            //JC 060921 Leer el parametro de confirmación automatica de regrind para poner el estado correcto
            if (_ConfirmacionAutomaticaRgr == true)
            {
                obj042.dele = 7;
            }
            else
            {
                obj042.dele = 2;
            }
            obj042.logd    = " ";
            obj042.refcntd = 0;
            obj042.refcntu = 0;
            obj042.drpt    = DateTime.Now;
            obj042.urpt    = " ";
            obj042.acqt    = Convert.ToDouble(value);
            obj042.cwaf    = BodegaItem;
            //JC 060921 Leer el parametro de confirmación automatica de regrind para poner el estado correcto
            if (_ConfirmacionAutomaticaRgr == true)
            {
                obj042.cwat = BodegaItem;
            }
            else
            {
                obj042.cwat = " ";
            }
            obj042.aclo = " ";
            obj042.allo = 0;
            parameterCollectionRegrind.Add(obj042);

            int  retornoRegrind          = idal042.insertarRegistro(ref parameterCollectionRegrind, ref strError);
            bool retornoRegrindTticon242 = idal042.insertarRegistroTticon242(ref parameterCollectionRegrind, ref strError);

            if (!string.IsNullOrEmpty(strError))
            {
                lblError.Text = mensajes("errorsave"); return;
            }
            //GRRC Fin



            txtQuantity.Text          = string.Empty;
            listRegrind.SelectedIndex = 0;

            DataRow filaImprimir = ((DataTable)idal080.listaRegistroImprimir_Param(ref obj080, ref strError)).Rows[0];

            filaImprimir["T$QUNE"] = Math.Abs(cantidad).ToString();

            //Session["FilaImprimir"] = filaImprimir;
            //Session["descItem"] = descItem;
            //Session["unidad"] = unityItem;
            //Session["machineItem"] = machineItem;
            //Session["strTagid"] = strTagId;

            StringBuilder script = new StringBuilder();

            //script.Append("ventanaImp = window.open('../Labels/whInvLabelRegrind.aspx', ");
            //script.Append("'ventanaImp', 'menubar=0,resizable=0,width=580,height=450');");
            //script.Append("ventanaImp.moveTo(30, 0);");
            ////script.Append("setTimeout (ventanaImp.close(), 20000);");
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "printTag", script.ToString(), true);

            Session["Reprint"]      = "no";
            Session["MaterialDesc"] = descItem;
            Session["Material"]     = filaImprimir.ItemArray[2].ToString().Trim();
            Session["codePaid"]     = strTagId;
            Session["Lot"]          = filaImprimir.ItemArray[0].ToString();
            Session["Quantity"]     = filaImprimir.ItemArray[3].ToString().Trim() + " " + unityItem;
            Session["Date"]         = Convert.ToDateTime(filaImprimir.ItemArray[6].ToString().Trim()).ToString("MM/dd/yyyy");
            Session["Machine"]      = machineItem;
            Session["Operator"]     = Session["user"].ToString();
            Session["Pallet"]       = strTagId;

            if (HttpContext.Current.Session["navigator"].ToString() == "EDG")
            {
                script.Append("ventanaImp = window.open('../Labels/RedesingLabels/3RegrindsME.aspx', ");
            }
            else
            {
                script.Append("ventanaImp = window.open('../Labels/RedesingLabels/3Regrinds.aspx', ");
            }

            script.Append("'ventanaImp', 'menubar=0,resizable=0,width=800,height=450');");
            script.Append("ventanaImp.moveTo(30, 0);");
            ScriptManager.RegisterStartupScript(this, this.GetType(), "printTag", script.ToString(), true);

            listRegrind.Focus();
        }
Example #14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            InsertarIngresoPagina();

            string strTagId = string.Empty;
            List <Ent_tticol080> parameterCollection        = new List <Ent_tticol080>();
            List <Ent_tticol042> parameterCollectionRegrind = new List <Ent_tticol042>();

            obj080 = new Ent_tticol080();
            obj042 = new Ent_tticol042();

            lblError.Visible = true;
            lblError.Text    = string.Empty;
            NumberStyles style = NumberStyles.AllowDecimalPoint;

            decimal cantidad;

            bool convert = decimal.TryParse(txtQuantity.Text.Trim(), style, System.Globalization.CultureInfo.InvariantCulture, out cantidad);

            if (String.IsNullOrEmpty(listRegrind.SelectedValue.Trim()))
            {
                lblError.Text = "Please fill the quantity and item."; return;
            }
            if (!convert || cantidad < 1)
            {
                lblError.Text = "Quantity must be greater than zero"; return;
            }

            strError = string.Empty;
            //obj.pdno = hidden.Value;
            cantidad        = cantidad * (-1);
            obj080.pono     = Convert.ToInt32(ConsecPos);
            obj080.orno     = txtWorkOrder.Text;
            obj080.item     = "         " + listRegrind.SelectedValue;
            obj080.qune     = cantidad;
            obj080.cwar     = BodegaItem;
            obj080.logn     = Session["user"].ToString();
            obj080.clot     = LoteItem;
            obj080.proc     = 2;
            obj080.refcntd  = 0;
            obj080.refcntu  = 0;
            obj080.idrecord = unityItem;
            parameterCollection.Add(obj080);

            //GRRC Inicio
            obj042.pdno     = txtWorkOrder.Text;
            cantidadRegrind = idal042.listaCantidadRegrind(ref obj042, ref strError);
            strTagId        = txtWorkOrder.Text + "-R" + cantidadRegrind.Rows[0]["CANT"].ToString();
            //GRRC Fin

            int retorno = idal080.actualizarRegistro_Param(ref parameterCollection, ref strError, ref strTagId);

            if (retorno < 1 && string.IsNullOrEmpty(strError))
            {
                retorno = idal080.insertarRegistro(ref parameterCollection, ref strError, ref strTagId);
            }

            if (!string.IsNullOrEmpty(strError))
            {
                lblError.Text = strError; return;
            }


            //GRRC Inicio
            strError       = string.Empty;
            obj042.sqnb    = strTagId;
            obj042.proc    = 1;
            obj042.logn    = Session["user"].ToString();
            obj042.mitm    = "         " + listRegrind.SelectedValue;
            obj042.pono    = Convert.ToInt32(ConsecPos);
            obj042.qtdl    = cantidad * -1;
            obj042.cuni    = unityItem;
            obj042.log1    = " ";
            obj042.qtd1    = 0;
            obj042.pro1    = 2;
            obj042.log2    = " ";
            obj042.qtd2    = 0;
            obj042.pro2    = 2;
            obj042.loca    = " ";
            obj042.norp    = 0;
            obj042.dele    = 2;
            obj042.logd    = " ";
            obj042.refcntd = 0;
            obj042.refcntu = 0;
            parameterCollectionRegrind.Add(obj042);

            int retornoRegrind = idal042.insertarRegistro(ref parameterCollectionRegrind, ref strError);

            if (!string.IsNullOrEmpty(strError))
            {
                lblError.Text = strError; return;
            }
            //GRRC Fin



            txtQuantity.Text          = string.Empty;
            listRegrind.SelectedIndex = 0;

            DataRow filaImprimir = ((DataTable)idal080.listaRegistroImprimir_Param(ref obj080, ref strError)).Rows[0];

            filaImprimir["T$QUNE"] = Math.Abs(cantidad).ToString();

            Session["FilaImprimir"] = filaImprimir;
            Session["descItem"]     = descItem;
            Session["unidad"]       = unityItem;
            Session["machineItem"]  = machineItem;
            Session["strTagid"]     = strTagId;

            StringBuilder script = new StringBuilder();

            script.Append("ventanaImp = window.open('../Labels/whInvLabelRegrind.aspx', ");
            script.Append("'ventanaImp', 'menubar=0,resizable=0,width=580,height=450');");
            script.Append("ventanaImp.moveTo(30, 0);");
            //script.Append("setTimeout (ventanaImp.close(), 20000);");
            ScriptManager.RegisterStartupScript(this, this.GetType(), "printTag", script.ToString(), true);

            listRegrind.Focus();
        }
Example #15
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            lblError.Text   = String.Empty;
            lblConfirm.Text = String.Empty;
            List <MyLioEntidad> LstTable = new List <MyLioEntidad>();

            LstTable          = (List <MyLioEntidad>)Session["LstTable"];
            Session["numReg"] = LstTable.Count();
            for (int i = 0; i < LstTable.Count; i++)
            {
                bool tticol088         = false;
                var  txtQuantity       = Request.Form["txtQuantity-" + i].ToString().Trim();
                var  txtQuantityHidden = Request.Form["txtQuantityHidden-" + i].ToString().Trim();

                if ((txtQuantity.Trim() != string.Empty && txtQuantity.Trim() != "0") || (txtQuantityHidden.Trim() != string.Empty && txtQuantityHidden.Trim() != "0"))
                {
                    var orno             = Convert.ToString(Session["orno"]);
                    var qune             = double.Parse((txtQuantity.Trim() == "" ? "0" : txtQuantity.Trim()), CultureInfo.InvariantCulture.NumberFormat) == 0 ? double.Parse(txtQuantityHidden, CultureInfo.InvariantCulture.NumberFormat) : double.Parse(txtQuantity, CultureInfo.InvariantCulture.NumberFormat);
                    var pono             = LstTable[i].PONO.ToString().Trim();
                    var item             = LstTable[i].SITM.ToString().Trim();
                    var cwar             = LstTable[i].CWAR.ToString().Trim();
                    var iswh             = LstTable[i].ISWH.ToString().Trim();
                    var actcant          = LstTable[i].ACT_CANT.ToString().Trim();
                    var stock            = LstTable[i].STOCK.ToString().Trim();
                    var consultaRegistro = _idaltticol080.findRecordByOrnoPono(ref orno, ref pono, ref strError);

                    Ent_tticol080 data080 = new Ent_tticol080()
                    {
                        orno    = orno,
                        pono    = Convert.ToInt32(pono),
                        item    = "         " + item,
                        cwar    = cwar,
                        qune    = Convert.ToDecimal(qune),
                        logn    = _operator,
                        proc    = 2,
                        refcntd = 0,
                        refcntu = 0,
                        clot    = " ",
                        oorg    = "4",
                        pick    = 1
                    };

                    Ent_tticol088 data088 = new Ent_tticol088()
                    {
                        orno    = orno,
                        pono    = Convert.ToInt32(pono),
                        item    = "         " + item,
                        cwar    = cwar,
                        qune    = Convert.ToDecimal(qune),
                        logn    = _operator,
                        proc    = 1,
                        refcntd = 0,
                        refcntu = 0,
                        oorg    = "4"
                    };

                    if ((Convert.ToDecimal(stock.Trim()) - Convert.ToDecimal(iswh.Trim())) < Convert.ToDecimal(txtQuantityHidden.Trim()))
                    {
                        _idaltticol090.InsertTticol088(data088, ref strError);
                        lblError.Text += "[" + item + "] Available quantity not enough for your request <br/>";
                        tticol088      = true;
                    }
                    if (tticol088 == false)
                    {
                        List <Ent_tticol080> lista = new List <Ent_tticol080>();
                        lista.Add(data080);
                        var tag = String.Empty;
                        if (consultaRegistro.Rows.Count > 0)
                        {
                            var validUpdate = _idaltticol080.ActualizarRegistros(ref lista, ref strError, ref tag);
                            if (validUpdate > 0)
                            {
                                lblConfirm.Text      += "[" + item + "]" + mensajes("msjupdate") + "<br/>";
                                divBtnGuardar.Visible = false;
                            }
                            else
                            {
                                lblError.Text += "[" + item + "]" + mensajes("errorsave") + "<br/>";
                            }
                        }
                        else
                        {
                            var validInsert = _idaltticol080.insertarRegistro(ref lista, ref strError, ref tag);
                            if (validInsert > 0)
                            {
                                lblConfirm.Text      += "[" + item + "]" + mensajes("msjsave") + "<br/>";
                                divBtnGuardar.Visible = false;
                            }
                            else
                            {
                                lblError.Text += "[" + item + "]" + mensajes("errorsave") + "<br/>";
                            }
                        }
                        //}
                    }
                }
            }
            txtOrder.Text      = String.Empty;
            divTable.InnerHtml = String.Empty;
        }