示例#1
0
        protected void txtLocation_OnTextChanged(object sender, EventArgs e)
        {
            lblError.Text = String.Empty;
            var location = txtLocation.Text.Trim().ToUpper();

            if (location != String.Empty)
            {
                Ent_twhwmd300 data = new Ent_twhwmd300()
                {
                    loca = location
                };
                var validaLocation = _idaltwhwmd300.listaRegistro_ObtieneAlmacen(ref data, ref strError);

                if (validaLocation.Rows.Count > 0)
                {
                    if (Convert.ToInt32(validaLocation.Rows[0]["LOCT"]) != 5)
                    {
                        lblError.Text = mensajes("bulklocation");
                        return;
                    }
                }
                else
                {
                    lblError.Text = mensajes("locationnotexists");
                    return;
                }
            }
        }
示例#2
0
        public DataTable listaRegistro_AlmacenUbicaion(ref Ent_twhwmd300 Parametros, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add(":T$CWAR", Parametros.cwar.Trim());
            paramList.Add(":T$LOCA", Parametros.loca.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 = "Incorrect location, please verify.";
                }
            }
            catch (Exception ex)
            {
                strError = "Error to the search sequence [twhwmd300]. 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);
        }
示例#3
0
        public DataTable listaRegistro_AlmacenUbicaion(ref Ent_twhwmd300 Parametros, ref string strError)
        {
            DataTable retorno;

            try
            {
                retorno = dal.listaRegistro_AlmacenUbicaion(ref Parametros, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.ToString());
            }
        }
示例#4
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            lblError.Text = String.Empty;
            var item      = txtItem.Text.Trim().ToUpper();
            var warehouse = txtWarehouse.Text.Trim().ToUpper();
            var location  = txtLocation.Text.Trim().ToUpper();
            var lot       = Session["Lot"].ToString().ToUpper();

            var cantidad        = Convert.ToDouble(Request.Form["txtQuantity"].ToString().Trim(), CultureInfo.InvariantCulture.NumberFormat);
            var cdis            = Request.Form["slReasons"].ToString().Trim();
            var obse            = Request.Form["txtComments"].ToString().Trim();
            var VariableAuxSuno = Request.Form["txtSupplier"].ToString().Trim();
            var suno            = string.IsNullOrEmpty(VariableAuxSuno) ? string.Empty : Request.Form["txtSupplier"].ToString().Trim();
            var reasondesc      = Request.Form["lblReasonDesc"];

            if (lot == string.Empty)
            {
                lblError.Text = Thelotcantbeempty;
                return;
            }

            if (reasondesc == null)
            {
                reasondesc = "Adhesion";
            }

            if (cantidad > Convert.ToDouble(_stock, CultureInfo.InvariantCulture.NumberFormat))
            {
                lblError.Text = mensajes("quantexceed");
                return;
            }

            Ent_twhwmd300 data = new Ent_twhwmd300()
            {
                loca = location
            };
            var validaLocation = _idaltwhwmd300.listaRegistro_ObtieneAlmacen(ref data, ref strError);

            if (txSloc.Value.ToString().Trim() == "1")
            {
                if (validaLocation.Rows.Count > 0)
                {
                    if (Convert.ToInt32(validaLocation.Rows[0]["LOCT"]) != 5)
                    {
                        lblError.Text = mensajes("bulklocation");
                        return;
                    }
                }
                else
                {
                    lblError.Text = mensajes("locationnotexists");
                    return;
                }
            }

            var validarRegistro = _idaltticol116.findRecordByWarehouseItemLocation(ref item, ref warehouse, ref location, ref strError);

            if (validarRegistro.Rows.Count > 0)
            {
                //var validarUpdate = _idaltticol116.updateRecordRejectedWarehouse(ref item, ref warehouse, ref location, ref cantidad, ref strError);
                Ent_tticol116 data116 = new Ent_tticol116()
                {
                    item = item,
                    cwar = warehouse,
                    loca = location == String.Empty ? " " : location,
                    clot = lot == String.Empty ? " " : lot,
                    qtyr = Convert.ToDouble(cantidad),
                    cdis = cdis,
                    obse = obse == String.Empty ? " " : obse,
                    logr = HttpContext.Current.Session["user"].ToString(),
                    suno = suno == String.Empty ? " " : suno
                };
                var validInsertaux = _idaltticol116.insertarRegistro(ref data116, ref strError);

                if (validInsertaux > 0)
                {
                    lblError.Text         = String.Empty;
                    lblConfirm.Text       = mensajes("msjupdate");
                    divTable.InnerHtml    = String.Empty;
                    divBtnGuardar.Visible = false;
                    txtItem.Text          = String.Empty;
                    txtWarehouse.Text     = String.Empty;
                    txtLocation.Text      = String.Empty;
                    txtLot.Text           = String.Empty;

                    var rutaServ = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + item.Trim().ToUpper() + "&code=Code128&dpi=96";
                    imgCodeItem.Src = !string.IsNullOrEmpty(item) ? rutaServ : "";

                    var rutaServQty = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + cantidad.ToString().Trim().ToUpper() + "&code=Code128&dpi=96";
                    imgQty.Src = !string.IsNullOrEmpty(cantidad.ToString()) ? rutaServQty : "";

                    lblValueDescription.Text = hdfDescItem.Value;
                    lblDescRejectQty.Text    = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblRejectedQty"), " ", cantidad);
                    lblDescPrintedBy.Text    = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblPrintedBy"), " ", HttpContext.Current.Session["user"].ToString());
                    lblValueLot.Text         = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblDescLot"), " ", lot);
                    lblComments.Text         = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblDescComments"), " ", obse);
                    lblValueReason.Text      = reasondesc;

                    divLabel.Visible   = true;
                    divBotones.Visible = true;
                }
                else
                {
                    lblError.Text = mensajes("errorupdt");
                    return;
                }
            }
            else
            {
                Ent_tticol116 data116 = new Ent_tticol116()
                {
                    item = item,
                    cwar = warehouse,
                    loca = location == String.Empty ? " " : location,
                    clot = lot == String.Empty ? " " : lot,
                    qtyr = cantidad,
                    cdis = cdis,
                    obse = obse == String.Empty ? " " : obse,
                    logr = HttpContext.Current.Session["user"].ToString(),
                    suno = suno == String.Empty ? " " : suno
                };

                var validInsert = _idaltticol116.insertarRegistro(ref data116, ref strError);

                if (validInsert > 0)
                {
                    lblError.Text         = String.Empty;
                    lblConfirm.Text       = mensajes("msjsave");
                    divTable.InnerHtml    = String.Empty;
                    divBtnGuardar.Visible = false;
                    txtItem.Text          = String.Empty;
                    txtWarehouse.Text     = String.Empty;
                    txtLocation.Text      = String.Empty;
                    txtLot.Text           = String.Empty;

                    var rutaServ = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + item.Trim().ToUpper() + "&code=Code128&dpi=96";
                    imgCodeItem.Src = !string.IsNullOrEmpty(item) ? rutaServ : "";

                    var rutaServQty = UrlBaseBarcode + "/Barcode/BarcodeHandler.ashx?data=" + cantidad.ToString().Trim().ToUpper() + "&code=Code128&dpi=96";
                    imgQty.Src = !string.IsNullOrEmpty(cantidad.ToString()) ? rutaServQty : "";

                    lblValueDescription.Text = hdfDescItem.Value;
                    lblDescRejectQty.Text    = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblRejectedQty"), " ", cantidad);
                    lblDescPrintedBy.Text    = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblPrintedBy"), " ", HttpContext.Current.Session["user"].ToString());
                    lblValueLot.Text         = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblDescLot"), " ", lot);
                    lblComments.Text         = String.Concat(_textoLabels.readStatement(formName, _idioma, "lblDescComments"), " ", obse);
                    lblValueReason.Text      = reasondesc;

                    divLabel.Visible   = true;
                    divBotones.Visible = true;
                }
                else
                {
                    lblError.Text = mensajes("errorsave");
                    return;
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            lblError.Text   = String.Empty;
            lblConfirm.Text = String.Empty;

            if (txtLocation.Text.Trim() == String.Empty || lblValueLocation2.Text.Trim() == String.Empty)
            {
                lblError.Text = mensajes("locationblank");
                return;
            }

            if (float.Parse(lblValueQuantity.Text) < 1)
            {
                lblError.Text = mensajes("quantityzero");
                return;
            }

            //Valida la ubicacion del producto (INS o REC)
            var item            = lblValueArticulo.Text.Split('-')[0].Trim().ToUpper() + "-" + lblValueArticulo.Text.Split('-')[1].Trim().ToUpper();
            var origen          = slOrigen.SelectedValue;
            var dsca            = lblValueArticulo.Text.Split('-')[2].Trim().ToUpper();
            var validaUbicacion = _idaltqmptc011.findRecordByItemConOrigen(ref item, ref origen, ref strError);

            var location = validaUbicacion.Rows.Count > 0 ? "INS" : "REC";

            //Valida si el articulo maneja lote
            Ent_ttcibd001 data001 = new Ent_ttcibd001()
            {
                item = item
            };

            var validaArticulo = _idalttcibd001.listaRegistro_ObtieneDescripcionUnidad(ref data001, ref strError);

            var consultaOrden     = new DataTable();
            var numeroOrden       = lblValueOrden.Text.Trim();
            var numeroOrdenPallet = txtNumeroOrden.Text.Trim().ToUpper();
            var clot = validaArticulo.Rows[0]["KLTC"].ToString();
            var cwar = _validaAlmacen.Rows[0]["ALM"].ToString();


            if (clot != "1")
            {
                consultaOrden = _idaltwhcol124.findBySqnbPdnoNoClot(ref location, ref cwar, ref numeroOrdenPallet, ref strError);
            }
            else
            {
                consultaOrden = _idaltwhcol124.findBySqnbPdnoYesClot(ref location, ref cwar, ref numeroOrdenPallet, ref strError);
            }

            if (consultaOrden.Rows.Count > 0)
            {
                var QTYPEND = float.Parse(consultaOrden.Rows[0]["QTYPEND"].ToString()).ToString("0.00");
                var QTDL    = float.Parse(lblValueQuantity.Text == "" ? "0" : lblValueQuantity.Text).ToString("0.00");

                var STRQDPU = float.Parse((float.Parse(QTYPEND) - float.Parse(lblValuePorAprobar.Text.Trim())).ToString()).ToString("0.00");

                var CWAR = consultaOrden.Rows[0]["CWAR"].ToString();
                var LOTE = consultaOrden.Rows[0]["CLOT"].ToString();
                //Validar que el almacen sea el mismo de la orden
                if (CWAR != cwar)
                {
                    lblError.Text = String.Format(mensajes("diferentcwar"), txtLocation.Text.ToUpper(), CWAR);
                    return;
                }

                //Validar que exista ubicacion, que sea tipo 5-carga y que no este bloqueado
                Ent_twhwmd300 data300 = new Ent_twhwmd300()
                {
                    loca = txtLocation.Text.Trim(),
                    cwar = cwar
                };

                var validarUbicacionTipo = _idaltwhwmd300.listaRegistro_AlmacenUbicaion(ref data300, ref strError);

                if (validarUbicacionTipo.Rows.Count > 0)
                {
                    if (float.Parse(QTDL) > float.Parse(QTYPEND))
                    {
                        lblError.Text = String.Format(mensajes("suggestedquantityannounced"), QTDL, QTYPEND);
                        return;
                    }

                    //
                    //Validar que la cantidad ingresada no sea mayor a la cantidad disponible por ubicar
                    if (float.Parse(QTDL) > float.Parse(STRQDPU))
                    {
                        lblError.Text = String.Format(mensajes("suggestedquantityavailable"), numeroOrden, QTDL, STRQDPU);
                        return;
                    }

                    //Verificar si ya existe un registro para esta orden
                    //var consecutivo = _idaltticol032.consultarConsecutivoRegistro(ref numeroOrden, ref strError);

                    //consecutivo = consecutivo + 1;

                    Ent_twhinh210 datawhinh210 = new Ent_twhinh210()
                    {
                        orno = lblValueOrden.Text,
                        oorg = origen,
                        item = item,
                        clot = LOTE
                    };

                    var consultaDatosOrden = _idaltwhinh210.findByOrderNumberAndOrigin(ref datawhinh210, ref strError);

                    if (consultaDatosOrden.Rows.Count < 1)
                    {
                        lblError.Text = mensajes("210empty");
                        return;
                    }

                    //T$OORG AS OORG, T$ORNO AS ORNO, T$OSET AS OSET, T$PONO AS PONO, T$SEQN AS SEQN
                    var oorg = consultaDatosOrden.Rows[0]["OORG"].ToString();
                    var orno = consultaDatosOrden.Rows[0]["ORNO"].ToString();
                    var oset = consultaDatosOrden.Rows[0]["OSET"].ToString();
                    var pono = consultaDatosOrden.Rows[0]["PONO"].ToString();
                    var seqn = consultaDatosOrden.Rows[0]["SEQN"].ToString();

                    Ent_tticol032 dataticol032 = new Ent_tticol032()
                    {
                        oorg    = Convert.ToInt32(oorg),
                        orno    = orno,
                        sqnb    = numeroOrdenPallet,
                        oset    = Convert.ToInt32(oset),
                        pono    = Convert.ToInt32(pono),
                        seqn    = Convert.ToInt32(seqn),
                        mitm    = item.Trim(),
                        dsca    = dsca,
                        cwar    = cwar,
                        loca    = lblValueLocation2.Text,
                        qtdl    = Convert.ToDecimal(QTDL),
                        cuni    = lblValueUnit.Text,
                        mess    = " ",
                        user    = HttpContext.Current.Session["user"].ToString(),
                        refcntd = 0,
                        refcntu = 0
                    };

                    var validSave = _idaltticol032.insertarRegistro(ref dataticol032, ref strError);

                    if (validSave > 0)
                    {
                        lblConfirm.Text = mensajes("msjsave");


                        divTable.Visible       = false;
                        txtNumeroOrden.Enabled = true;
                        txtNumeroOrden.Text    = String.Empty;
                        return;
                    }
                    else
                    {
                        lblError.Text = mensajes("errorsave");
                        return;
                    }
                }
                else
                {
                    lblError.Text = String.Format(mensajes("locationnotexist"), data300.loca);
                    return;
                }
            }
            else
            {
                lblError.Text = mensajes("orderemptytwo");
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtLocation.Text.Trim() == String.Empty || lblValueLocation2.Text.Trim() == String.Empty)
            {
                lblError.Text = mensajes("locationblank");
                return;
            }

            if (float.Parse(lblValueQuantity.Text) < 1)
            {
                lblError.Text = mensajes("quantityzero");
                return;
            }

            //Valida la ubicacion del producto (INS o REC)
            var item            = lblValueArticulo.Text.Split('-')[0].Trim().ToUpper() + "-" + lblValueArticulo.Text.Split('-')[1].Trim().ToUpper();
            var dsca            = lblValueArticulo.Text.Split('-')[2].Trim().ToUpper();
            var validaUbicacion = _idaltqmptc011.findRecordByItem(ref item, ref strError);

            var location = validaUbicacion.Rows.Count > 0 ? "INS" : "REC";

            //Valida si el articulo maneja lote
            Ent_ttcibd001 data001 = new Ent_ttcibd001()
            {
                item = item
            };

            var validaArticulo = _idalttcibd001.listaRegistro_ObtieneDescripcionUnidad(ref data001, ref strError);

            var consultaOrden     = new DataTable();
            var numeroOrden       = lblValueOrden.Text.Trim();
            var numeroOrdenPallet = txtNumeroOrden.Text.Trim().ToUpper();
            var clot = validaArticulo.Rows[0]["KLTC"].ToString();
            var cwar = _validaAlmacen.Rows[0]["ALM"].ToString();


            if (clot != "1")
            {
                consultaOrden = _idalttisfc001.findBySqnbPdnoNoClot(ref location, ref cwar, ref numeroOrden, ref numeroOrdenPallet, ref strError);
            }
            else
            {
                consultaOrden = _idalttisfc001.findBySqnbPdnoYesClot(ref location, ref cwar, ref numeroOrden, ref numeroOrdenPallet, ref strError);
            }

            if (consultaOrden.Rows.Count > 0)
            {
                var QTYPEND = float.Parse(consultaOrden.Rows[0]["QTYPEND"].ToString()).ToString("0.00");
                var QTDL    = float.Parse(lblValueQuantity.Text == "" ? "0" : lblValueQuantity.Text).ToString("0.00");

                //var STRQDPU = float.Parse((float.Parse(QTYPEND) - float.Parse(QTDL)).ToString()).ToString("0.00");
                var STRQDPU = float.Parse(QTYPEND).ToString("0.00");
                var CWAR    = consultaOrden.Rows[0]["CWAR"].ToString();

                //Validar que el almacen sea el mismo de la orden
                if (CWAR != cwar)
                {
                    lblError.Text = String.Format(mensajes("diferentcwar"), txtLocation.Text.ToUpper(), CWAR);
                    return;
                }

                //Validar que exista ubicacion, que sea tipo 5-carga y que no este bloqueado
                Ent_twhwmd300 data300 = new Ent_twhwmd300()
                {
                    loca = txtLocation.Text.Trim(),
                    cwar = cwar
                };

                var validarUbicacionTipo = _idaltwhwmd300.listaRegistro_AlmacenUbicaion(ref data300, ref strError);

                if (validarUbicacionTipo.Rows.Count > 0)
                {
                    //Validar que la cantidad no sea mayor a la cantidad pendiente
                    if (float.Parse(QTDL) > float.Parse(QTYPEND))
                    {
                        lblError.Text = String.Format(mensajes("suggestedquantityannounced"), QTDL, QTYPEND);
                        return;
                    }


                    //Validar que la cantidad ingresada no sea mayor a la cantidad disponible por ubicar
                    if (float.Parse(QTDL) > float.Parse(STRQDPU))
                    {
                        lblError.Text = String.Format(mensajes("suggestedquantityavailable"), numeroOrden, QTDL, STRQDPU);
                        return;
                    }

                    //Verificar si ya existe un registro para esta orden
                    var consecutivo = _idaltticol030.consultarConsecutivoRegistro(ref numeroOrden, ref strError);

                    consecutivo = consecutivo + 1;

                    Ent_tticol030 data030 = new Ent_tticol030()
                    {
                        pdno    = numeroOrden,
                        sqnb    = consecutivo,
                        mitm    = item,
                        dsca    = dsca,
                        cwar    = cwar,
                        loca    = lblValueLocation2.Text,
                        qtdl    = Convert.ToDecimal(QTDL),
                        cuni    = lblValueUnit.Text,
                        mess    = " ",
                        user    = HttpContext.Current.Session["user"].ToString(),
                        refcntd = 0,
                        refcntu = 0
                    };

                    List <Ent_tticol030> lista = new List <Ent_tticol030>();
                    lista.Add(data030);

                    var validSave = _idaltticol030.insertarRegistro(ref lista, ref strError);

                    if (validSave > 0)
                    {
                        Ent_tticol022 data022 = new Ent_tticol022()
                        {
                            log2 = HttpContext.Current.Session["user"].ToString(),
                            qtd2 = Convert.ToInt32(data030.qtdl),
                            loca = data030.loca,
                            pdno = data030.pdno,
                            sqnb = numeroOrdenPallet,
                            dele = 7
                        };

                        var validUpdate = _idaltticol022.actualizaRegistroSugUbicaciones(ref data022, ref strError);

                        if (validUpdate)
                        {
                            //_idaltticol022.ActualizarRegistroTicol222
                            var actubicticol222 = _idaltticol022.ActualizarUbicacionTicol222(data022.pdno, data022.sqnb, data022.loca, data030.cwar);
                            lblConfirm.Text     = mensajes("msjsave");
                            divTable.Visible    = false;
                            txtNumeroOrden.Text = String.Empty;
                            return;
                        }
                        else
                        {
                            lblError.Text = mensajes("errorupdt");
                            return;
                        }
                    }
                    else
                    {
                        lblError.Text = mensajes("errorsave");
                        return;
                    }
                }
                else
                {
                    lblError.Text = String.Format(mensajes("locationnotexist"), data300.loca);
                    return;
                }
            }
            else
            {
                lblError.Text = mensajes("orderemptytwo");
            }
        }