Beispiel #1
0
        public static string verifyLot(string ITEM, string LOT)
        {
            Ent_twhcol130131 MyObj   = new Ent_twhcol130131();
            Ent_twhltc100    data100 = new Ent_twhltc100()
            {
                item = ITEM, clot = LOT
            };
            var DTLot = dal100.listaRegistro_Clot(ref data100, ref strError);

            if (DTLot.Rows.Count > 0)
            {
                var MyObjDT = DTLot.Rows[0];
                MyObj.Error     = false;
                MyObj.errorMsg  = string.Empty;
                MyObj.TipeMsgJs = string.Empty;
            }
            else
            {
                MyObj.Error     = true;
                MyObj.errorMsg  = Lotcodedoesntexist;
                MyObj.TipeMsgJs = "Label";
            }

            return(JsonConvert.SerializeObject(MyObj));
        }
Beispiel #2
0
        public DataTable listaRegistro_Clot(ref Ent_twhltc100 Parametros, ref string strError)
        {
            method = MethodBase.GetCurrentMethod();

            paramList = new Dictionary <string, object>();
            paramList.Add(":T$CLOT", Parametros.clot.Trim());
            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 = "That Lot doesn't be Asociated to the Item.";
                }
            }
            catch (Exception ex)
            {
                strError = "Error to the search sequence [twhltc100]. 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);
        }
        public DataTable listaRegistros_ObtieneItem(ref Ent_twhltc100 Parametros, ref string strError)
        {
            DataTable retorno;

            try
            {
                retorno = dal.listaRegistros_ObtieneItem(ref Parametros, ref strError);
                return(retorno);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.InnerException.ToString());
            }
        }
Beispiel #4
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)
        {
            var pdno       = txtWorkOrder.Text.Trim().ToUpper();
            var machine    = " ";
            var seqn       = 1;
            var item       = slItems.SelectedValue.Trim().ToUpper();
            var clot       = slLot.SelectedValue.Trim().ToUpper();
            var reason     = slReason.SelectedValue.Trim().ToUpper();
            var rejectType = slRejectType.SelectedValue.Trim().ToUpper();
            var qtyr       = double.Parse(txtQty.Text.Trim(), CultureInfo.InvariantCulture.NumberFormat);

            if (item == string.Empty)
            {
                lblError.Text = TheItemcantbeempty;
                return;
            }

            if (reason == string.Empty)
            {
                lblError.Text = TheReasoncantbeempty;
                return;
            }

            if (rejectType == string.Empty)
            {
                lblError.Text = TheRejectTypecantbeempty;
                return;
            }

            if (qtyr.ToString() == string.Empty)
            {
                lblError.Text = TheCantcantbeempty;
                return;
            }

            var consultaMaquina = _idaltticol011.findRecordByPdno(ref pdno, ref strError);

            if (consultaMaquina.Rows.Count > 0)
            {
                machine = consultaMaquina.Rows[0]["MCNO"].ToString().Trim();
            }

            var registroItem = _consultaInformacionPedido.AsEnumerable().Where(x => x["SITM"].ToString().Trim() == item).FirstOrDefault();
            var kltc         = registroItem["KLTC"].ToString();
            var pono         = registroItem["PONO"].ToString();

            if (kltc == "1")
            {
                if (clot == string.Empty)
                {
                    lblError.Text = Thelotcantbeempty;
                    return;
                }

                Ent_twhltc100 data100 = new Ent_twhltc100()
                {
                    item = item, clot = clot
                };
                var validaLote = _idaltwhltc100.listaRegistro_Clot(ref data100, ref strError);

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

            var consultaSecuencia = _idaltticol100.findMaxSeqnByPdnoPono(ref pdno, ref pono, ref strError);

            if (consultaSecuencia.Rows.Count > 0)
            {
                seqn = Convert.ToInt32(consultaSecuencia.Rows[0]["SEQN"]) + 1;
            }

            Ent_tticol100 dataticol100 = new Ent_tticol100()
            {
                //dsca = .Text,
                pdno = pdno,
                pono = Convert.ToInt32(pono),
                seqn = seqn,
                mcno = machine,
                item = item,
                qtyr = qtyr,
                shif = txtShift.Text.Trim().ToUpper(),
                cdis = slReason.SelectedValue.Trim().ToUpper(),
                rejt = Convert.ToInt32(slRejectType.SelectedValue),
                clot = slLot.SelectedValue == "" ? " " : slLot.SelectedValue.Trim().ToUpper(),
                obse = txtExactReasons.InnerText,
                logr = HttpContext.Current.Session["user"].ToString(),
                disp = 4,
                proc = 1,
                Unit = txtUnit.Text,
                logn = HttpContext.Current.Session["user"].ToString(),
                mess = "0"
            };

            var validaInsert = _idaltticol100.insertRecord(ref dataticol100, ref strError);

            if (validaInsert > 0)
            {
                lblError.Text         = String.Empty;
                lblConfirm.Text       = mensajes("msjsave");
                divTable.Visible      = false;
                divBtnGuardar.Visible = false;
                txtWorkOrder.Text     = String.Empty;
                MakeLabel(dataticol100);
                divLabel.Visible   = true;
                divBotones.Visible = true;
            }
            else
            {
                lblError.Text = mensajes("errorsave");
                return;
            }
        }
        protected void btnConsultar_Click(object sender, EventArgs e)
        {
            lblConfirm.Text = String.Empty;
            lblError.Text   = String.Empty;
            if (txtItem.Text.Trim() != String.Empty)
            {
                var withLot             = true;
                var consultaInformacion = new DataTable();

                var ITEM = txtItem.Text.Trim().ToUpper();
                var CLOT = txtNumeroLote.Text.Trim().ToUpper();

                Ent_twhltc100 data = new Ent_twhltc100()
                {
                    item = ITEM,
                    clot = CLOT
                };

                Ent_tticol127 dataticol127 = new Ent_tticol127()
                {
                    user = HttpContext.Current.Session["user"].ToString()
                };

                var validaAlmacenUsuario = _idaltticol127.listaRegistro_ObtieneAlmacen(ref dataticol127, ref strError);

                if (validaAlmacenUsuario.Rows.Count < 1)
                {
                    lblError.Text = mensajes("Usuario no tiene definido el almacen, por favor comuniquese con el administrador.");
                    return;
                }

                if (txtNumeroLote.Text.Trim() != String.Empty)
                {
                    var validaItem = _idaltwhltc100.listaRegistro_Clot(ref data, ref strError);

                    if (validaItem.Rows.Count > 0)
                    {
                        consultaInformacion = _idalttcibd001.findRecordTransfers(ref ITEM, ref withLot, ref strError);
                    }
                }
                else
                {
                    withLot             = false;
                    consultaInformacion = _idalttcibd001.findRecordTransfers(ref ITEM, ref withLot, ref strError);
                }

                if (consultaInformacion.Rows.Count > 0)
                {
                    hdfUnidad.Value            = consultaInformacion.Rows[0]["CUNI"].ToString();
                    hdfFactor.Value            = consultaInformacion.Rows[0]["CONV"].ToString();
                    txtSourceLocation.Text     = validaAlmacenUsuario.Rows[0]["BODEGA"].ToString();
                    txtDescription.Text        = consultaInformacion.Rows[0]["DSCA"].ToString();
                    txtNumeroLote.Text         = txtNumeroLote.Text.Trim().ToUpper();
                    txtNumeroLote.Enabled      = false;
                    txtItem.Text               = txtItem.Text.Trim().ToUpper();
                    txtItem.Enabled            = false;
                    trDescription.Visible      = true;
                    trSource.Visible           = true;
                    trUbicacion.Visible        = true;
                    btnConsultar.Visible       = false;
                    btnConsultarSource.Visible = true;
                }
                else
                {
                    txtNumeroLote.Text         = txtNumeroLote.Text.Trim().ToUpper();
                    txtNumeroLote.Enabled      = true;
                    txtItem.Text               = txtItem.Text.Trim().ToUpper();
                    txtItem.Enabled            = true;
                    trDescription.Visible      = false;
                    trSource.Visible           = false;
                    trUbicacion.Visible        = false;
                    btnConsultar.Visible       = true;
                    btnConsultarSource.Visible = false;
                    lblError.Text              = withLot ? mensajes("lotitemincorrect") : mensajes("itemincorrect");
                    return;
                }
            }
            else
            {
                lblError.Text = mensajes("itemblank");
                return;
            }
        }