Esempio n. 1
0
        private List <Ent_ParametrosDAL> AdicionaParametrosComunes(Ent_tticol025 parametros, bool blnUsarPRetorno = false)
        {
            method = MethodBase.GetCurrentMethod();
            string strError = string.Empty;
            List <Ent_ParametrosDAL> parameterCollection = new List <Ent_ParametrosDAL>();

            try
            {
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$PDNO", DbType.String, parametros.pdno);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$SQNB", DbType.Int32, parametros.sqnb);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$MITM", DbType.String, parametros.mitm);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$DSCA", DbType.String, parametros.dsca);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$QTDL", DbType.Decimal, Convert.ToDecimal(parametros.qtdl));
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$CUNI", DbType.String, parametros.cuni);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$MESS", DbType.String, parametros.mess);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$USER", DbType.String, parametros.user);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTD", DbType.Int32, parametros.refcntd);
                Ent_ParametrosDAL.AgregaParametro(ref parameterCollection, ":T$REFCNTU", DbType.Int32, parametros.refcntu);

                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)
            {
                strError = "Error when creating parameters [301]. 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(parameterCollection);
        }
 public int insertarRegistro(ref Ent_tticol025 parametrosIn, ref string strError)
 {
     int retorno = -1;
     try
     {
         retorno = dal.insertarRegistro(ref parametrosIn, ref strError);
         return retorno;
     }
     catch (Exception ex)
     {
         throw new Exception(strError += "\nPila: " + ex.Message);
     }
 }
Esempio n. 3
0
        public int insertarRegistro(ref Ent_tticol025 parametro, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();
            bool retorno = false;

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

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

                return(Convert.ToInt32(retorno));
            }

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

            return(Convert.ToInt32(retorno));
        }
        protected void btnSaveInformation_Click(object sender, EventArgs e)
        {
            var tipoFormulario = Request.QueryString["tipoFormulario"];

            tipoFormulario = tipoFormulario != null?tipoFormulario.ToUpper() : "CREATE";

            //Valida tipo de formulario y campos en blanco
            if (tipoFormulario == "CONFIRM" ? txtConfirmado.Text.Trim() != String.Empty : txtAnunciado.Text != String.Empty)
            {
                var validateSave = 0;

                if (tipoFormulario == "CONFIRM")
                {
                    var orderNumber  = txtNumeroOrden.Text.ToUpper();
                    var consec       = 0;
                    var qtdltisfc001 = _qtdltisfc001;
                    var qtdlTotal    = 0.0M;
                    //Suma valores QTDL
                    var sumQtdlticol025 = _idalticol025.sumQtdlByOrderNumber(ref orderNumber, ref strError);

                    if (sumQtdlticol025.Rows.Count > 0)
                    {
                        consec = Convert.ToInt32(sumQtdlticol025.Rows[0]["CONSEC"]) + 1;
                        var sum = sumQtdlticol025.Rows[0]["SUMQTDL"].ToString();
                        qtdlTotal = decimal.Parse(qtdltisfc001) + decimal.Parse(sum == "" ? "0" : sum);
                    }

                    //Valida que cantidad de confirmado no sea mayor que QTDL Total
                    if (decimal.Parse(txtConfirmado.Text.Trim().Replace(".", ",")) > qtdlTotal)
                    {
                        lblError.Text = mensajes("largerQuant");
                        return;
                    }

                    //Inserta en tabla ticol025
                    Ent_tticol025 dataticol025 = new Ent_tticol025()
                    {
                        pdno = lblOrdenFabricacion.Text.ToUpper(),
                        sqnb = consec,
                        mitm = lblItem.Text.ToUpper(),
                        dsca = lblDescripcionItem.Text.ToUpper(),
                        qtdl = float.Parse(txtConfirmado.Text.Trim(), CultureInfo.InvariantCulture.NumberFormat),
                        cuni = lblUnidad.Text.ToUpper(),
                        user = HttpContext.Current.Session["user"].ToString()
                    };

                    validateSave = _idalticol025.insertarRegistro(ref dataticol025, ref strError);
                }
                else
                {
                    //Inserta en tabl ticol020
                    Ent_tticol020 dataticol020 = new Ent_tticol020()
                    {
                        pdno = lblOrdenFabricacion.Text.ToUpper(),
                        mitm = lblItem.Text.ToUpper().TrimStart(),
                        dsca = lblDescripcionItem.Text.ToUpper(),
                        qtdl = Convert.ToDecimal(txtAnunciado.Text.Trim()),
                        cuni = lblUnidad.Text.ToUpper(),
                        mess = " ",
                        user = HttpContext.Current.Session["user"].ToString()
                    };

                    List <Ent_tticol020> listData = new List <Ent_tticol020>();
                    listData.Add(dataticol020);

                    validateSave = _idalticol020.insertarRegistro(ref listData, ref strError);
                }



                //Valida que los procesos en BD sean correctos
                if (validateSave > 0)
                {
                    lblError.Text   = "";
                    lblConfirm.Text = mensajes("save");

                    trDataAditional.Visible = false;
                    txtConfirmado.Text      = "";
                    txtAnunciado.Text       = "";
                    txtNumeroOrden.Text     = "";
                    txtNumeroOrden.Focus();
                    return;
                }
                else
                {
                    lblError.Text = mensajes("error");
                    return;
                }
            }
            else
            {
                lblError.Text = mensajes("anunBlank");
                return;
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            //JC 091221 Grabar las variables de sesion en variables tipo string

            string CWARG = "";
            string LOCAG = "";

            CWARG = HttpContext.Current.Session["CWAR"].ToString();
            LOCAG = HttpContext.Current.Session["LOCA"].ToString();

            var sqnb = txtNumeroOrden.Text.Trim().ToUpper();
            var pdno = sqnb.Substring(0, 9);
            var pro1 = "2";

            var consultadata = _idalttisfc001.findByPdnoSqnbAndPro1(ref pdno, ref sqnb, ref pro1, ref strError);

            if (consultadata.Rows.Count > 0)
            {
                var STRQTY  = lblValueConfirmed.Text;
                var QTYPEND = lblValueToReceive.Text;

                if (float.Parse(STRQTY) > float.Parse(QTYPEND))
                {
                    lblError.Text   = String.Format(mensajes("confirmedquantity"), STRQTY, QTYPEND);
                    lblConfirm.Text = "";
                    return;
                }

                if (float.Parse(STRQTY) < 0)
                {
                    lblError.Text   = mensajes("quantitynegative");
                    lblConfirm.Text = "";
                    return;
                }

                if (float.Parse(STRQTY) == 0)
                {
                    lblError.Text   = mensajes("quantityzero");
                    lblConfirm.Text = "";
                    return;
                }

                var consecutivo = _idaltticol025.consultarConsecutivoRegistro(ref pdno, ref strError);

                consecutivo = consecutivo + 1;

                var item = lblValueArticulo.Text.Split('|')[0].Trim().ToUpper();     // + "|" + lblValueArticulo.Text.Split('|')[1].Trim().ToUpper();
                var dsca = lblValueArticulo.Text.Split('|')[1].Trim().ToUpper();
                var qtdl = float.Parse(STRQTY.Replace(',', '.'), CultureInfo.InvariantCulture.NumberFormat);
                var cuni = lblValueUnit.Text;

                Ent_tticol025 data025 = new Ent_tticol025()
                {
                    pdno    = pdno,
                    sqnb    = consecutivo,
                    mitm    = item.Trim().ToUpper(),
                    dsca    = dsca,
                    qtdl    = qtdl,
                    cuni    = cuni,
                    mess    = " ",
                    user    = HttpContext.Current.Session["user"].ToString(),
                    refcntd = 0,
                    refcntu = 0
                };

                var validSave = _idaltticol025.insertarRegistro(ref data025, ref strError);

                if (validSave > 0)
                {
                    Ent_tticol022 data022 = new Ent_tticol022()
                    {
                        log1 = HttpContext.Current.Session["user"].ToString(),
                        qtd1 = Convert.ToInt32(data025.qtdl),
                        pdno = pdno,
                        sqnb = sqnb
                    };

                    var validateUpdate = _idaltticol022.actualizaRegistroConfirmReceipt(ref data022, ref strError);

                    if (validateUpdate)
                    {
                        lblConfirm.Text     = mensajes("msjsave");
                        lblError.Text       = "";
                        lblError.Text       = String.Empty;
                        divTable.Visible    = false;
                        txtNumeroOrden.Text = String.Empty;
                        _idaltticol022.ActualizarCantidadAlmacenRegistroTicol222(HttpContext.Current.Session["user"].ToString(), data022.qtd1, LOCAG, CWARG, data022.sqnb);
                        return;
                    }
                    else
                    {
                        lblError.Text   = mensajes("errorupdt");
                        lblConfirm.Text = "";
                        return;
                    }
                }
                else
                {
                    lblConfirm.Text = String.Empty;
                    lblError.Text   = mensajes("errorsave");
                    lblConfirm.Text = "";
                    return;
                }
            }
            else
            {
                lblError.Text   = mensajes("orderconfirmed");
                lblConfirm.Text = "";
                return;
            }
        }
Esempio n. 6
0
        private void Prosess()
        {
            lblError.Visible = true;
            decimal cantidad;
            string  cantidads;

            cantidads = txtQuantity.Text;
            //bool convert = decimal.TryParse(txtQuantity.Text.Trim(), out cantidad);
            bool convert = decimal.TryParse(cantidads, out cantidad);

            cantidads = cantidad.ToString();
            //var numberFormatInfo = new NumberFormatInfo { NumberDecimalSeparator = "," };
            var value = Decimal.Parse(cantidads);

            lblError.Text = string.Empty;

            //string RollWinder = txtRollWinder.Text.ToString().ToUpper();
            string RollWinder = ddRollWinder.Text;

            if (_tipoFormulario.ToUpper() == "ROLLTAGS")
            {
                if (RollWinder.Trim() == "1" || RollWinder.Trim() == "2" || RollWinder.Trim() == "3" || RollWinder.Trim() == "4")
                {
                }
                else
                {
                    lblError.Text      = mensajes("Pleaseselectrollwinder");
                    lblError.ForeColor = System.Drawing.Color.Red;
                    return;
                }
                //            Session["rollwinder"] = txtRollWinder.Text.ToString();
                Session["rollwinder"] = RollWinder;
            }
            else
            {
                Session["rollwinder"] = "";
            }

            if (!convert || cantidad < 1)
            {
                lblError.Visible   = true;
                lblError.Text      = mensajes("quantitymust");
                lblError.ForeColor = System.Drawing.Color.Red;
                return;
            }
            strError = string.Empty;
            obj.pdno = hOrdenMachine.Value;  //hidden.Value;
            var pdno = obj.pdno;

            resultado = idal.invLabel_listaRegistrosOrdenParam(ref obj, ref strError);

            if (resultado.Rows.Count < 1)
            {
                lblError.Visible   = true;
                lblError.Text      = String.Concat(mensajes("noitemsfound"), obj.pdno.Trim());
                lblError.ForeColor = System.Drawing.Color.Red;
                return;
            }

            if (Convert.ToDecimal(resultado.Rows[0]["maxr"].ToString()) < Convert.ToDecimal(cantidads))
            {
                lblError.Visible   = true;
                lblError.Text      = "Roll weight cannot be higher than " + Convert.ToDecimal(resultado.Rows[0]["maxr"].ToString()) + " Kg";
                lblError.ForeColor = System.Drawing.Color.Red;
                return;
            }

            var mbrl = idal022.consultambrl(ref strError).Rows[0]["MBRL"];//ConfigurationManager.AppSettings["MBRL"].ToString();

            var tiempo = Convert.ToInt32(mbrl);

            var validaTiempoGuardado = idal022.validateTimeSaveRecord(ref pdno, ref tiempo, ref strError);

            if (validaTiempoGuardado.Rows.Count > 0)
            {
                lblError.Visible   = true;
                lblError.Text      = String.Format(mensajes("rollannounced"), tiempo);
                lblError.ForeColor = System.Drawing.Color.Red;
                return;
            }

            List <Ent_tticol020> parameterCollection020 = new List <Ent_tticol020>();
            List <Ent_tticol022> parameterCollection022 = new List <Ent_tticol022>();
            List <Ent_tticol042> parameterCollection042 = new List <Ent_tticol042>();

            obj020.pdno = resultado.Rows[0]["ORDEN"].ToString();
            obj020.mitm = resultado.Rows[0]["ITEM"].ToString();
            obj020.dsca = resultado.Rows[0]["DESCI"].ToString();
            obj020.cuni = resultado.Rows[0]["UNIDAD"].ToString();
            //obj020.qtdl = Decimal.Parse(txtQuantity.Text, System.Globalization.CultureInfo.InvariantCulture);  //Convert.ToDecimal(txtQuantity.Text);
            obj020.qtdl    = value;
            obj020.mess    = " ";
            obj020.refcntd = 0;
            obj020.refcntu = 0;
            obj020.user    = Session["user"].ToString();
            parameterCollection020.Add(obj020);


            obj022.cuni = resultado.Rows[0]["UNIDAD"].ToString();
            obj022.pdno = resultado.Rows[0]["ORDEN"].ToString();
            int sec = 0;

            if (_tipoFormulario.ToUpper() == "ROLLTAGS")
            {
                obj022.sqnb = idal022.invLabel_generaSecuenciaOrden(ref obj022, ref strError);
                //DataTable dt022 = Itticol022.SecuenciaMayorRollos(obj022.pdno.Trim().ToUpperInvariant());
                //if (dt022.Rows.Count > 0)
                //{
                //    string paid = dt022.Rows[0]["T$SQNB"].ToString().Trim().ToUpper();
                //    sec = Convert.ToInt16(paid.Substring(paid.IndexOf("-") + 2)) + 1;
                //    obj022.sqnb = obj022.pdno + "-" + sec;
                //}
                //else
                //{
                //    sec = 1;
                //}
            }
            else
            {
                DataTable dt022 = Itticol022.SecuenciaMayorR(obj022.pdno.Trim().ToUpperInvariant());
                if (dt022.Rows.Count > 0)
                {
                    //JC 260422 Corregir la busqueda de la secuencia para evitar problemas con la organización por fecha
                    //string paid = dt022.Rows[0]["T$SQNB"].ToString().Trim().ToUpper();
                    //sec = Convert.ToInt16(paid.Substring(paid.IndexOf("-R") + 2)) + 1;
                    sec         = Convert.ToInt32(dt022.Rows[0]["T$SQNB"].ToString().Trim()) + 1;
                    obj022.sqnb = obj022.pdno + "-R" + sec;
                    //JC 290422 Validar si ese registro existe, si es así incrementar la secuencia en 1
                    int cons_pal = 0;
                    while (cons_pal < 10)
                    {
                        obj022.sqnb = obj022.pdno + "-R" + sec;
                        var cons_pallet = Itticol022.ValidarConsecutivoR(obj022.sqnb.Trim().ToUpperInvariant());
                        if (cons_pallet.Rows.Count > 0)
                        {
                            sec = sec + 1;
                        }
                        cons_pal++;
                    }
                }
                else
                {
                    sec = 1;
                }
            }

            obj022.mitm = resultado.Rows[0]["ITEM"].ToString();
            //obj022.qtdl = Decimal.Parse(txtQuantity.Text, System.Globalization.CultureInfo.InvariantCulture);  //Convert.ToDecimal(txtQuantity.Text);
            obj022.qtdl    = _procesConfirmacionAutomatica ? cantidad : 0;
            obj022.logn    = Session["user"].ToString();
            obj022.proc    = 2;
            obj022.pro1    = 2;
            obj022.pro2    = 2;
            obj022.log1    = "NONE";
            obj022.log2    = "NONE";
            obj022.logd    = "NONE";
            obj022.dele    = _procesoAutomatico ? 7 : 2;
            obj022.qtd1    = 0;
            obj022.norp    = 1;
            obj022.loca    = " ";
            obj022.qtd2    = 0;
            obj022.refcntd = 0;
            obj022.refcntu = 0;
            obj022.drpt    = DateTime.Now;
            obj022.urpt    = " ";
            //obj022.acqt = Convert.ToDouble(obj022.qtdl);
            obj022.acqt = _procesConfirmacionAutomatica ? value : 0;
            obj022.cwaf = idal022.WharehouseTisfc001(obj022.pdno, ref strError);
            obj022.cwat = idal022.WharehouseTisfc001(obj022.pdno, ref strError);
            //obj022.cwaf = idal022.WharehouseTisfc001(resultado.Rows[0]["ORDEN"].ToString(), ref strError);
            //obj022.cwat = idal022.WharehouseTisfc001(resultado.Rows[0]["ORDEN"].ToString(), ref strError);
            if (_procesConfirmacionAutomatica)
            {
                obj022.aclo = idal022.getloca(obj022.cwaf.Trim(), ref strError).Rows.Count > 0 ? idal022.getloca(obj022.cwaf.Trim(), ref strError).Rows[0]["LOCA"].ToString() : " ";
            }
            else
            {
                obj022.aclo = " ";
            }

            obj042.cuni = resultado.Rows[0]["UNIDAD"].ToString();
            obj042.pdno = resultado.Rows[0]["ORDEN"].ToString();
            obj042.sqnb = obj022.pdno + "-R" + sec;
            obj042.mitm = resultado.Rows[0]["ITEM"].ToString();
            //ob4022.qtdl = Decimal.DoParse(txtQuantity.Text, System.Globalization.CultureInfo.InvariantCulture);  //Convert.ToDecimal(txtQuantity.Text);
            obj042.qtdl    = _procesConfirmacionAutomatica ? Convert.ToDouble(cantidad) : 0;
            obj042.logn    = Session["user"].ToString();
            obj042.proc    = 2;
            obj042.pro1    = 2;
            obj042.pro2    = 2;
            obj042.log1    = "NONE";
            obj042.log2    = "NONE";
            obj042.logd    = "NONE";
            obj042.dele    = _procesoAutomatico ? 7 : 2;
            obj042.qtd1    = 0;
            obj042.norp    = 1;
            obj042.loca    = " ";
            obj042.qtd2    = 0;
            obj042.refcntd = 0;
            obj042.refcntu = 0;
            obj042.drpt    = DateTime.Now;
            obj042.urpt    = " ";
            //ob4022.acqt = Convert.ToDouble(obj022.qtdl);
            obj042.acqt = _procesConfirmacionAutomatica ? Convert.ToDouble(value) : 0;
            obj042.cwaf = idal022.WharehouseTisfc001(resultado.Rows[0]["ORDEN"].ToString(), ref strError);
            obj042.cwat = idal022.WharehouseTisfc001(resultado.Rows[0]["ORDEN"].ToString(), ref strError);
            if (_procesConfirmacionAutomatica)
            {
                obj042.aclo = idal022.getloca(obj022.cwaf.Trim(), ref strError).Rows.Count > 0 ? idal022.getloca(obj022.cwaf.Trim(), ref strError).Rows[0]["LOCA"].ToString() : " ";
            }
            else
            {
                obj042.aclo = " ";
            }
            parameterCollection022.Add(obj022);
            parameterCollection042.Add(obj042);
            //ActiveOrderMachine = obj022.sqnb;

            if (_procesoAutomatico)
            {
                anuncioautomatico = "true";
            }
            else
            {
                anuncioautomatico = "false";
            }

            int retorno = 0;

            if (_tipoFormulario.ToUpper() == "GRINDER")
            {
                idal042.insertarRegistro(ref parameterCollection042, ref strError);
                idal042.insertarRegistroTticon242(ref parameterCollection042, ref strError);

                if (anuncioautomatico == "true")
                {
                    int intRetorno = idal020.insertarRegistro(ref parameterCollection020, ref strError);
                }
            }
            else
            {
                idal022.insertarRegistro(ref parameterCollection022, ref strError);
                idal022.insertarRegistroTticon222(ref parameterCollection022, ref strError);

                if (anuncioautomatico == "true")
                {
                    int intRetorno = idal020.insertarRegistro(ref parameterCollection020, ref strError);
                }

                //idal022.insertarRegistro(ref parameterCollection022, ref parameterCollection020, ref strError, ref anuncioautomatico);
            }

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

            if (_procesConfirmacionAutomatica)
            {
                confirmacionautomatica = "true";
            }
            else
            {
                confirmacionautomatica = "false";
            }

            if (_procesConfirmacionAutomaticagrinder)
            {
                confirmacionautomaticagrinder = "true";
            }
            else
            {
                confirmacionautomaticagrinder = "false";
            }

            //JC 290921 Buscar la secuencia solo en la tabla ticol025
            var consecutivo = idal025.consultarConsecutivoRegistro(ref pdno, ref strError);

            consecutivo = consecutivo + 1;

            if (confirmacionautomatica == "true" && _tipoFormulario.ToUpper() == "ROLLTAGS")
            {
                //if (retorno > 0)
                //{
                Ent_tticol025 objTticol025 = new Ent_tticol025();
                objTticol025.pdno = obj022.pdno;
                //objTticol025.sqnb = Convert.ToInt32(obj022.sqnb.Substring((obj022.sqnb.IndexOf("-") + 1)));
                objTticol025.sqnb    = consecutivo;
                objTticol025.mitm    = obj022.mitm;
                objTticol025.dsca    = Transfers.DescripcionItem(obj022.mitm);
                objTticol025.qtdl    = (float)obj022.qtdl;
                objTticol025.cuni    = obj022.cuni;
                objTticol025.date    = DateTime.Now.ToString();
                objTticol025.mess    = "0";
                objTticol025.user    = obj022.logn;
                objTticol025.refcntd = obj022.refcntd;
                objTticol025.refcntu = obj022.refcntu;

                lblError.Visible   = true;
                lblError.Text      = mensajes("rollsaved");
                lblError.ForeColor = System.Drawing.Color.Green;
                int res = idal025.insertarRegistro(ref objTticol025, ref strError);

                //}
            }

            if (confirmacionautomaticagrinder == "true" && _tipoFormulario.ToUpper() == "GRINDER")
            {
                //if (retorno > 0)
                //{
                Ent_tticol025 objTticol025 = new Ent_tticol025();
                objTticol025.pdno = obj022.pdno;
                //objTticol025.sqnb = sec;
                objTticol025.sqnb    = consecutivo;
                objTticol025.mitm    = obj022.mitm;
                objTticol025.dsca    = Transfers.DescripcionItem(obj022.mitm);
                objTticol025.qtdl    = (float)obj022.qtdl;
                objTticol025.cuni    = obj022.cuni;
                objTticol025.date    = DateTime.Now.ToString();
                objTticol025.mess    = "0";
                objTticol025.user    = obj022.logn;
                objTticol025.refcntd = obj022.refcntd;
                objTticol025.refcntu = obj022.refcntu;

                lblError.Visible   = true;
                lblError.Text      = mensajes("rollsaved");
                lblError.ForeColor = System.Drawing.Color.Green;
                int res = idal025.insertarRegistro(ref objTticol025, ref strError);

                //}
            }

            txtQuantity.Text = string.Empty;

            if (_tipoFormulario.ToUpper() == "GRINDER")
            {
                resultado = idal042.invLabel_registroImprimir_Param(ref obj042, ref strError);
            }
            else
            {
                resultado = idal022.invLabel_registroImprimir_Param(ref obj022, ref strError);
            }

            DataRow reg = resultado.Rows[0];

            Session["FilaImprimir"] = reg;
            Session["descItem"]     = obj020.dsca;
            Session["unidad"]       = hidden.Value;

            HttpContext.Current.Session["Reprint"]   = "no";
            HttpContext.Current.Session["AutoPrint"] = "yes";
            Session["MaterialDesc"] = obj020.dsca;
            Session["codeMaterial"] = obj022.mitm;
            Session["codePaid"]     = reg["SECUENCIA"].ToString();
            Session["Lot"]          = reg["ORDEN"].ToString();
            Session["Quantity"]     = reg["PESO"].ToString() + " " + obj020.cuni;
            Session["Date"]         = reg["FECHA"].ToString();
            Session["Machine"]      = idal022.getMachine(reg["ORDEN"].ToString(), obj022.mitm, ref strError);
            Session["Operator"]     = reg["USUARIO"].ToString();
            if (_tipoFormulario.ToUpper() == "GRINDER")
            {
                Session["Winder"] = "";
            }
            else
            {
                Session["Winder"] = RollWinder;
            }
            Session["Pallet"] = reg["SECUENCIA"].ToString();
        }
Esempio n. 7
0
        public static string Save()
        {
            ReturnEntity ReturnObj = (ReturnEntity)HttpContext.Current.Session["MyObj"];

            InterfazDAL_ttisfc001 _idalttisfc001 = new InterfazDAL_ttisfc001();
            //JC 091221 Grabar las variables de sesion en variables tipo string

            string CWARG = "";
            string LOCAG = "";

            CWARG = HttpContext.Current.Session["CWAR"].ToString();
            LOCAG = HttpContext.Current.Session["LOCA"].ToString();

            string sqnb = ReturnObj.PAID;
            string pdno = ReturnObj.ORNO;
            var    pro1 = "2";

            var consultadata = _idalttisfc001.findByPdnoSqnbAndPro1(ref pdno, ref sqnb, ref pro1, ref strError);

            if (consultadata.Rows.Count > 0)
            {
                var STRQTY  = ReturnObj.QTDL;
                var QTYPEND = ReturnObj.QRDR;

                if (STRQTY > float.Parse(QTYPEND))
                {
                    ReturnObj.Msg   = String.Format(mensajes("confirmedquantity"), STRQTY, QTYPEND);
                    ReturnObj.Error = true;
                    return(JsonConvert.SerializeObject(ReturnObj));
                }

                if (STRQTY < 0)
                {
                    ReturnObj.Msg   = mensajes("quantitynegative");
                    ReturnObj.Error = true;
                    return(JsonConvert.SerializeObject(ReturnObj));
                }

                if (STRQTY == 0)
                {
                    ReturnObj.Msg   = mensajes("quantityzero");
                    ReturnObj.Error = true;
                    return(JsonConvert.SerializeObject(ReturnObj));
                }

                var consecutivo = _idaltticol025.consultarConsecutivoRegistro(ref pdno, ref strError);

                consecutivo = consecutivo + 1;

                string item = ReturnObj.MITM; // + "|" + lblValueArticulo.Text.Split('|')[1].Trim().ToUpper();
                string dsca = ReturnObj.DSCA;
                float  qtdl = STRQTY;
                string cuni = ReturnObj.CUNI;

                Ent_tticol025 data025 = new Ent_tticol025()
                {
                    pdno    = pdno,
                    sqnb    = consecutivo,
                    mitm    = item.Trim().ToUpper(),
                    dsca    = dsca,
                    qtdl    = qtdl,
                    cuni    = cuni,
                    mess    = " ",
                    user    = HttpContext.Current.Session["user"].ToString(),
                    refcntd = 0,
                    refcntu = 0
                };

                var validSave = _idaltticol025.insertarRegistro(ref data025, ref strError);

                if (validSave > 0)
                {
                    Ent_tticol022 data022 = new Ent_tticol022()
                    {
                        log1 = HttpContext.Current.Session["user"].ToString(),
                        qtd1 = Convert.ToInt32(data025.qtdl),
                        pdno = pdno,
                        sqnb = sqnb
                    };

                    var validateUpdate = _idaltticol022.actualizaRegistroConfirmReceipt(ref data022, ref strError);

                    if (validateUpdate)
                    {
                        ReturnObj.Msg   = mensajes("msjsave");
                        ReturnObj.Error = false;
                        _idaltticol022.ActualizarCantidadAlmacenRegistroTicol222(HttpContext.Current.Session["user"].ToString(), data022.qtd1, LOCAG, CWARG, data022.sqnb);
                        return(JsonConvert.SerializeObject(ReturnObj));
                    }
                    else
                    {
                        ReturnObj.Msg   = mensajes("errorupdt");
                        ReturnObj.Error = true;
                        return(JsonConvert.SerializeObject(ReturnObj));
                    }
                }
                else
                {
                    ReturnObj.Msg   = mensajes("errorsave");
                    ReturnObj.Error = true;
                    return(JsonConvert.SerializeObject(ReturnObj));
                }
            }
            else
            {
                ReturnObj.Msg   = mensajes("orderconfirmed");
                ReturnObj.Error = true;
                return(JsonConvert.SerializeObject(ReturnObj));
            }
        }