Ejemplo n.º 1
0
        protected void txtItem_OnTextChanged(object sender, EventArgs e)
        {
            lblError.Text = String.Empty;

            var item = txtItem.Text.Trim().ToUpper();

            if (item != String.Empty)
            {
                Ent_ttcibd001 data001 = new Ent_ttcibd001()
                {
                    item = item
                };
                _validaItem = _idalttcibd001.listaRegistro_ObtieneDescripcionUnidad(ref data001, ref strError);

                if (_validaItem.Rows.Count < 1)
                {
                    lblError.Text = mensajes("itemnotexists");
                    return;
                }
            }

            var kltc = Convert.ToInt32(_validaItem.Rows[0]["KLTC"].ToString());

            if (kltc != 1)
            {
                txtLot.Text    = String.Empty;
                txtLot.Enabled = false;
            }
        }
Ejemplo n.º 2
0
        protected void btnConsultar_Click(object sender, EventArgs e)
        {
            divTable.InnerHtml = String.Empty;
            if (txtArticulo.Text.Trim().ToUpper() != String.Empty)
            {
                Ent_tticol127 dataticol127 = new Ent_tticol127()
                {
                    user = HttpContext.Current.Session["user"].ToString()
                };
                //_consultaLoteUsuario = _idaltticol127.listaRegistro_ObtieneAlmacen(ref dataticol127, ref strError);

                //if (_consultaLoteUsuario.Rows.Count > 0)
                //{
                Ent_ttcibd001 data001 = new Ent_ttcibd001()
                {
                    item = txtArticulo.Text.Trim().ToUpper()
                };
                _consultaItem = _idalttcibd001.listaRegistro_ObtieneDescripcionUnidad(ref data001, ref strError);

                if (_consultaItem.Rows.Count > 0)
                {
                    var cwar = string.Empty;
                    //var cwar = _consultaLoteUsuario.Rows[0]["BODEGA"].ToString();
                    //var cwardesc = _consultaLoteUsuario.Rows[0]["DSCA"].ToString();
                    var item     = txtArticulo.Text.Trim().ToUpper();
                    var itemdesc = _consultaItem.Rows[0]["DESCRIPCION"].ToString();
                    var unidad   = _consultaItem.Rows[0]["UNID"].ToString();

                    _consultaInformacion = _idaltwhinr140.consultaPorAlmacenItem(ref item, ref strError);

                    if (_consultaInformacion.Rows.Count > 0)
                    {
                        divTable.InnerHtml = makeTableReceipt();
                    }
                    else
                    {
                        lblError.Text = String.Format(mensajes("nodata"), cwar, item);
                        return;
                    }
                }
                else
                {
                    lblError.Text = mensajes("itemnotexists");
                    return;
                }
                //}
                //else
                //{
                //    lblError.Text = mensajes("usernotwarehouse");
                //    return;
                //}
            }
            else
            {
                lblError.Text = mensajes("formempty");
                return;
            }
        }
Ejemplo n.º 3
0
        public DataTable listaRegistro_ObtieneDescUnidNOLote(ref Ent_ttcibd001 Parametros, ref string strError)
        {
            DataTable retorno;

            try
            {
                retorno = dal.listaRegistro_ObtieneDescUnidNOLote(ref Parametros, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.ToString());
            }
        }
        public static string VerificarItem(string ITEM)
        {
            HttpContext.Current.Session["myItemType"] = string.Empty;
            Ent_ttcibd001 ObjTtcibd001 = new Ent_ttcibd001();

            DataTable dtTtcibd001 = ITtcibd001.findItem(ITEM);

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

                if (ObjTtcibd001.kitm.Trim() == "2")
                {
                    ObjTtcibd001.Error      = false;
                    ObjTtcibd001.TypeMsgJs  = "console";
                    ObjTtcibd001.SuccessMsg = "Item Encontrado";
                    HttpContext.Current.Session["myItemType"] = ObjTtcibd001.cpcl;
                    HttpContext.Current.Session["ITEM"]       = ObjTtcibd001.item;
                    HttpContext.Current.Session["CUNI"]       = ObjTtcibd001.cuni;
                }
                else
                {
                    ObjTtcibd001.Error     = true;
                    ObjTtcibd001.TypeMsgJs = "label";

                    ObjTtcibd001.ErrorMsg = ItemcodeisnotManufacturingType;
                }
            }
            else
            {
                ObjTtcibd001.Error     = true;
                ObjTtcibd001.TypeMsgJs = "label";

                ObjTtcibd001.ErrorMsg = Itemcodedoesntexist;
            }



            return(JsonConvert.SerializeObject(ObjTtcibd001));
        }
        public static string VerificarItem(string ITEM, string CLOT)
        {
            Ent_ttcibd001 ObjTtcibd001 = new Ent_ttcibd001();

            DataTable dtTtcibd001 = ITtcibd001.findItem(ITEM);

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

                if (ObjTtcibd001.kltc.Trim() == "1")
                {
                    PCLOT = CLOT;
                }

                if (ObjTtcibd001.kitm.Trim() == "1")
                {
                    ObjTtcibd001.Error     = true;
                    ObjTtcibd001.TypeMsgJs = "label";

                    ObjTtcibd001.ErrorMsg = ItemcodeisnotPurchaseType;
                }
                else
                {
                    ObjTtcibd001.Error      = false;
                    ObjTtcibd001.TypeMsgJs  = "console";
                    ObjTtcibd001.SuccessMsg = "Item Encontrado";
                }
            }
            else
            {
                ObjTtcibd001.Error     = true;
                ObjTtcibd001.TypeMsgJs = "label";

                ObjTtcibd001.ErrorMsg = ItemcodeisnotPurchaseType;
            }



            return(JsonConvert.SerializeObject(ObjTtcibd001));
        }
        public static string VerificarItem(string PDNO, string ITEM)
        {
            string        strError     = string.Empty;
            Ent_ttcibd001 ObjTtcibd001 = new Ent_ttcibd001();
            string        myPdno       = PDNO.ToUpper().Trim();
            string        myItem       = ITEM.ToUpper().Trim();

            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();

                DataTable dtTtcibd001 = ITtcibd001.findItem(ITEM);
                if (dtTtcibd001.Rows.Count > 0)
                {
                    kltc = Convert.ToInt32(dtTtcibd001.Rows[0]["KLTC"].ToString());
                    ObjTtcibd001.item = dtTtcibd001.Rows[0]["ITEM"].ToString();
                    ObjTtcibd001.dsca = dtTtcibd001.Rows[0]["DSCA"].ToString();
                    ObjTtcibd001.cuni = dtTtcibd001.Rows[0]["CUNI"].ToString();
                    ObjTtcibd001.kltc = kltc.ToString();
                    ObjTtcibd001.kitm = dtTtcibd001.Rows[0]["KITM"].ToString();
                }
                else
                {
                    ObjTtcibd001.Error     = true;
                    ObjTtcibd001.TypeMsgJs = "label";

                    ObjTtcibd001.ErrorMsg = Itemcodedoesntexist;
                }
            }
            else
            {
                ObjTtcibd001.Error     = true;
                ObjTtcibd001.TypeMsgJs = "label";

                ObjTtcibd001.ErrorMsg = Itemcodedoesntexist;
            }

            return(JsonConvert.SerializeObject(ObjTtcibd001));
        }
Ejemplo n.º 7
0
        public static string VerificarSalesOrder(string ORDER)
        {
            HttpContext.Current.Session["ORNO"] = "";
            Ent_ttcibd001 ObjTtcibd001 = new Ent_ttcibd001();

            DataTable dtTtcibd001 = ITtcibd001.findSalesOrder(ORDER);

            if (dtTtcibd001.Rows.Count > 0)
            {
                ObjTtcibd001.Error                  = false;
                ObjTtcibd001.TypeMsgJs              = "console";
                ObjTtcibd001.SuccessMsg             = "Orden Encontrada";
                HttpContext.Current.Session["ORNO"] = ORDER;
            }
            else
            {
                ObjTtcibd001.Error     = true;
                ObjTtcibd001.TypeMsgJs = "label";
                ObjTtcibd001.ErrorMsg  = SalesOrdercodedoesntexist;
            }
            return(JsonConvert.SerializeObject(ObjTtcibd001));
        }
Ejemplo n.º 8
0
        public DataTable listaRegistro_ObtieneDescUnidNOLote(ref Ent_ttcibd001 Parametros, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add(":T$ITEM", Parametros.item.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 = "Wrong item, please check. " + Parametros.item.Trim();
                }
            }
            catch (Exception ex)
            {
                strError = "Error to the search sequence [ttcibd001]. 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);
        }
Ejemplo n.º 9
0
        public static string Click_Save(string PAID, string ITEM, string CWAR, string LOCA, string UNIT, string QTYS, string CLOT, string ZONE, string USER)
        {
            string strError = string.Empty;

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

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

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

                    DataTable DtTticol125 = ITticol125.listaRegistrosLoteItem_Param(ref Obj_tticol125);

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

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

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

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

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

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

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

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

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


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

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

            Ent_twhcol019 ObjTwhcol019 = new Ent_twhcol019();

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

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

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

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

                ObjTwhcol019.SuccessMsg = Therecordwasnotinserted + " " + strError;
            }
            return(JsonConvert.SerializeObject(ObjTwhcol019));
        }
Ejemplo n.º 10
0
        protected void btnConsultar_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       = txtLot.Text.Trim().ToUpper();

            if (string.IsNullOrEmpty(txtLot.Text.Trim().ToUpper()) == true)
            {
                Session["Lot"] = string.Empty;
            }
            else
            {
                Session["Lot"] = txtLot.Text.Trim().ToUpper();
            }


            Ent_ttcibd001 data001 = new Ent_ttcibd001()
            {
                item = item
            };

            _validaItem = _idalttcibd001.listaRegistro_ObtieneDescripcionUnidad(ref data001, ref strError);

            if (_validaItem.Rows.Count < 1)
            {
                lblError.Text = mensajes("itemnotexists");
                return;
            }

            var kltc = Convert.ToInt32(_validaItem.Rows[0]["KLTC"].ToString());

            manejalote = kltc;

            _validaWarehouse = _idalttcmcs003.findRecordByCwar(ref warehouse, ref strError);

            if (_validaWarehouse.Rows.Count < 1)
            {
                lblError.Text = mensajes("warehousenotexists");
                return;
            }

            Ent_twhwmd200 data200 = new Ent_twhwmd200()
            {
                cwar = warehouse
            };
            var manejoUbicacionAlmacen = Convert.ToInt32(_idaltwhwmd200.listaRegistro_ObtieneAlmacenLocation(ref data200, ref strError).Rows[0]["LOC"]);

            manejaubicacion = manejoUbicacionAlmacen;

            if (manejoUbicacionAlmacen == 1)
            {
                _validaUbicacion = _idaltwhwmd300.validateExistsLocation(ref location, ref warehouse, ref strError);

                if (_validaUbicacion.Rows.Count < 1)
                {
                    lblError.Text = mensajes("Location doesn't exist.");
                    return;
                }
            }

            if (kltc == 1)
            {
                Ent_twhltc100 data100 = new Ent_twhltc100()
                {
                    item = item, clot = lot
                };
                _validaItemLote = _idaltwhltc100.listaRegistro_Clot(ref data100, ref strError);

                if (_validaItemLote.Rows.Count < 1)
                {
                    lblError.Text = mensajes("lotnotexists");
                    return;
                }
            }

            var consultaCantidad = new DataTable();

            if (manejoUbicacionAlmacen == 1)
            {
                if (kltc == 1)
                {
                    consultaCantidad = _idaltwhinr140.consultaPorAlmacenItemUbicacionLote(ref warehouse, ref item, ref location, ref lot, ref strError);
                }
                else
                {
                    consultaCantidad = _idaltwhinr140.consultaPorAlmacenItemUbicacion(ref warehouse, ref item, ref location, ref strError);
                }
            }
            else
            {
                if (kltc == 1)
                {
                    consultaCantidad = _idaltwhinr140.consultaPorAlmacenItemLote(ref warehouse, ref item, ref lot, ref strError);
                }
                else
                {
                    consultaCantidad = _idaltwhinr140.consultaCantidadItemLote(ref warehouse, ref item, ref strError);
                }
            }

            //_stock = (Decimal)0;

            if (consultaCantidad.Rows.Count > 0)
            {
                //_stock = Convert.ToDecimal(consultaCantidad.Rows[0]["STKS"].ToString());
                _stock = consultaCantidad.Rows[0]["STKS"].ToString();
            }

            //if (_stock == 0)
            if (_stock == "0")
            {
                lblError.Text = mensajes("notstock");
                return;
            }

            divBotones.Visible    = false;
            divLabel.Visible      = false;
            divBtnGuardar.Visible = true;
            makeTable();
        }
        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");
            }
        }
Ejemplo n.º 12
0
        protected void btnTransfer_Click(object sender, EventArgs e)
        {
            if (txtItem.Text.Trim() == String.Empty || txtTargetLocation.Text.Trim() == String.Empty || txtTargetQty.Text.Trim() == String.Empty)
            {
                lblError.Text = mensajes("formempty");
                return;
            }

            if (_tipoFormulario == "TO" && slPlant.SelectedValue.Trim() == String.Empty)
            {
                lblError.Text = mensajes("formempty");
                return;
            }

            var item = txtItem.Text.Trim().ToUpper();
            var loca = txtTargetLocation.Text.Trim().ToUpper();
            var qtdl = double.Parse(txtTargetQty.Text.Trim(), CultureInfo.InvariantCulture.NumberFormat);

            //Buscar datos del articulo
            Ent_ttcibd001 data001 = new Ent_ttcibd001()
            {
                item = item
            };
            var datosArticulo = _idalttcibd001.listaRegistro_ObtieneDescripcionUnidad(ref data001, ref strError);

            if (datosArticulo.Rows.Count <= 0)
            {
                lblError.Text = mensajes("itemnotexists");
                return;
            }

            var dscaitem = datosArticulo.Rows[0]["DESCRIPCION"].ToString();
            var cuni     = datosArticulo.Rows[0]["UNID"].ToString();

            //Buscar almacen de la ubicación+
            var loct           = "5";
            var btrr           = "2";
            var datosUbicacion = _idaltwhwmd300.findLocationByLoctAndBtrr(ref loct, ref btrr, ref loca, ref strError);

            if (datosUbicacion.Rows.Count <= 0)
            {
                lblError.Text = String.Format(mensajes("targetlocation"), loca);
                return;
            }

            var cwar = datosUbicacion.Rows[0]["CWAR"].ToString();

            //Valida si ya existe registro
            var consecutivo = _tipoFormulario == "TO" ? _idaltwhcol010.consultarConsecutivoMaximo(ref strError)
                : _idaltwhcol010.consultarConsecutivoMaximo(ref strError); //_idaltwhcol010.consultarConsecutivoRegistroPorItem(ref item, ref loca, ref strError);

            consecutivo = consecutivo + 1;

            Ent_twhcol010 data010 = new Ent_twhcol010()
            {
                clot    = " ",
                sqnb    = consecutivo,
                mitm    = item,
                dsca    = dscaitem,
                cwor    = _tipoFormulario == "TO" ? slPlant.SelectedValue.Trim().ToUpper() : cwar,
                loor    = " ",
                cwde    = cwar,
                lode    = loca,
                qtdl    = qtdl,
                cuni    = cuni,
                user    = HttpContext.Current.Session["user"].ToString(),
                refcntd = 0,
                refcntu = 0
            };

            var validInsert = _idaltwhcol010.insertarRegistro(ref data010, ref strError);

            if (validInsert > 0)
            {
                lblError.Text          = String.Empty;
                lblConfirm.Text        = mensajes("msjsave");
                txtItem.Text           = String.Empty;
                txtTargetLocation.Text = String.Empty;
                txtTargetQty.Text      = String.Empty;
                return;
            }
            else
            {
                lblError.Text = mensajes("errorsave");
                return;
            }
        }
Ejemplo n.º 13
0
        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");
            }
        }