Example #1
0
        protected void btnConsultar_Click(object sender, EventArgs e)
        {
            //JC 300721 Evitar Error de Collection was Modified
            DataTable           _consultaMateriales = new DataTable();
            List <MyLioEntidad> LstTable            = new List <MyLioEntidad>();

            Session["orno"] = txtOrder.Text.Trim().ToUpper();
            lblError.Text   = String.Empty;
            lblConfirm.Text = String.Empty;

            var order = txtOrder.Text.Trim().ToUpper();

            if (order != String.Empty)
            {
                Ent_tticol090 data090 = new Ent_tticol090()
                {
                    fpdn = order
                };
                var consultaOrden = _idaltticol090.lineClearance_verificaOrdenes_Param(ref data090, ref strError);

                if (consultaOrden.Rows.Count > 0)
                {
                    if (valstatwo)
                    {
                        if (consultaOrden.Rows[0]["STAT"].ToString() != "2")
                        {
                            lblError.Text = _textoLabels.readStatement(formName, _idioma, "WorkorderhasnotbeeninitiatedPOP");
                            return;
                        }
                    }
                    _consultarTurno = _idaltticol111.findRecordByPdno(ref order, ref strError);

                    if (_consultarTurno.Rows.Count > 0)
                    {
                        string shift = _consultarTurno.Rows[0]["shif"].ToString().Trim();
                        _consultaMateriales = _idaltticst001.findByPdnoCosts(ref order, ref shift, ref strError);

                        if (_consultaMateriales.Rows.Count > 0)
                        {
                            LstTable.Clear();
                            foreach (DataRow item in _consultaMateriales.Rows)
                            {
                                MyLioEntidad MyLioEntidadObj = new MyLioEntidad();

                                MyLioEntidadObj.PDNO      = item["PDNO"].ToString();
                                MyLioEntidadObj.PONO      = item["PONO"].ToString();
                                MyLioEntidadObj.CWAR      = item["CWAR"].ToString();
                                MyLioEntidadObj.CLOT      = item["CLOT"].ToString();
                                MyLioEntidadObj.SITM      = item["SITM"].ToString();
                                MyLioEntidadObj.DSCA      = item["DSCA"].ToString();
                                MyLioEntidadObj.CUNI      = item["CUNI"].ToString();
                                MyLioEntidadObj.CANT_EST  = item["CANT_EST"].ToString();
                                MyLioEntidadObj.ACT_CANT  = item["ACT_CANT"].ToString();
                                MyLioEntidadObj.ISWH      = item["ISWH"].ToString().Trim() == "" ? "0" : item["ISWH"].ToString().Trim();
                                MyLioEntidadObj.OQMF      = item["OQMF"].ToString();
                                MyLioEntidadObj.CANTD     = item["CANTD"].ToString();
                                MyLioEntidadObj.MCNO      = item["MCNO"].ToString();
                                MyLioEntidadObj.CANT_PICK = item["CANT_PICK"].ToString();
                                DataTable dt215 = _idaltticol090.ConsultarCantidad215(MyLioEntidadObj, ref strError);
                                //JC 190821 No sumar doble vez los pallets asignados
                                //DataTable dt022044131 = _idaltticol090.ConsultarCantidadPoritem022042131(MyLioEntidadObj, ref strError);
                                var Stock    = Convert.ToDecimal(dt215.Rows[0]["T$STOC"].ToString());
                                var Cant_Pic = Convert.ToDecimal(string.IsNullOrEmpty(MyLioEntidadObj.CANT_PICK.Trim()) ? Convert.ToDecimal(0) : Convert.ToDecimal(MyLioEntidadObj.CANT_PICK.Trim()));
                                //MyLioEntidadObj.cant_reg = quantity_reg_order_machine140(shift, MyLioEntidadObj.MCNO, MyLioEntidadObj.SITM, MyLioEntidadObj.PDNO, "cant_reg") == string.Empty ? Convert.ToString(0) : quantity_reg_order_machine140(shift, MyLioEntidadObj.MCNO, MyLioEntidadObj.SITM, MyLioEntidadObj.PDNO, "cant_reg");
                                //MyLioEntidadObj.cant_max = maxquantity_per_shift140(shift, MyLioEntidadObj.MCNO, MyLioEntidadObj.SITM, MyLioEntidadObj.PDNO, "cant_max") == string.Empty ? Convert.ToString(Int32.MaxValue) : maxquantity_per_shift140(shift, MyLioEntidadObj.MCNO, MyLioEntidadObj.SITM, MyLioEntidadObj.PDNO, "cant_max");
                                //MyLioEntidadObj.cant_proc = maxquantity_per_shift140(shift, MyLioEntidadObj.MCNO, MyLioEntidadObj.SITM, MyLioEntidadObj.PDNO, "cant_proc") == string.Empty ? Convert.ToString(0) : maxquantity_per_shift140(shift, MyLioEntidadObj.MCNO, MyLioEntidadObj.SITM, MyLioEntidadObj.PDNO, "cant_proc");
                                //JC 190821 No sumar doble vez los pallets asignados
                                //if (dt022044131.Rows.Count > 0)
                                //{
                                //MyLioEntidadObj.STOCK = (Convert.ToDecimal(string.IsNullOrEmpty(MyLioEntidadObj.ISWH.Trim()) ? Convert.ToDecimal(0) : Convert.ToDecimal(MyLioEntidadObj.ISWH.Trim())) + Convert.ToDecimal(dt022044131.Rows[0]["QTYC"].ToString())).ToString();
                                //MyLioEntidadObj.ISWH = (Convert.ToDecimal(string.IsNullOrEmpty(MyLioEntidadObj.ISWH.Trim()) ? Convert.ToDecimal(0) : Convert.ToDecimal(MyLioEntidadObj.ISWH.Trim())) + Convert.ToDecimal(dt022044131.Rows[0]["QTYC"].ToString())).ToString();
                                MyLioEntidadObj.ISWH = (Convert.ToDecimal(string.IsNullOrEmpty(MyLioEntidadObj.ISWH.Trim()) ? Convert.ToDecimal(0) : Convert.ToDecimal(MyLioEntidadObj.ISWH.Trim())).ToString());
                                //}

                                if (dt215.Rows.Count > 0)
                                {
                                    //MyLioEntidadObj.STOCK = (Convert.ToDecimal(dt215.Rows[0]["T$STOC"].ToString()) - Cant_Pic - Convert.ToDecimal(string.IsNullOrEmpty(MyLioEntidadObj.ACT_CANT.Trim()) ? Convert.ToDecimal(0) : Convert.ToDecimal(MyLioEntidadObj.ISWH.Trim()))).ToString();
                                    MyLioEntidadObj.STOCK = (Convert.ToDecimal(dt215.Rows[0]["T$STOC"].ToString()) - Cant_Pic - Convert.ToDecimal(string.IsNullOrEmpty(MyLioEntidadObj.ACT_CANT.Trim())) - Convert.ToDecimal(MyLioEntidadObj.ISWH.Trim())).ToString();
                                }
                                MyLioEntidadObj.cant_reg  = item["CANT_REG"].ToString().Trim() == "" ? "0" : item["CANT_REG"].ToString().Trim();
                                MyLioEntidadObj.cant_max  = item["CANT_MAX"].ToString().Trim() == "" ? MyLioEntidadObj.STOCK : item["CANT_MAX"].ToString().Trim();
                                MyLioEntidadObj.cant_proc = item["CANT_PROC"].ToString().Trim() == "" ? "0" : item["CANT_PROC"].ToString().Trim();

                                LstTable.Add(MyLioEntidadObj);
                            }

                            //foreach (MyLioEntidad item in LstTable)
                            //{
                            //    item.cant_reg = quantity_reg_order_machine140(shift, item.MCNO, item.SITM, item.PDNO, "cant_reg") == string.Empty ? Convert.ToString(0) : quantity_reg_order_machine140(shift, item.MCNO, item.SITM, item.PDNO, "cant_reg");
                            //    item.cant_max = maxquantity_per_shift140(shift, item.MCNO, item.SITM, item.PDNO, "cant_max") == string.Empty ? Convert.ToString(Int32.MaxValue) : maxquantity_per_shift140(shift, item.MCNO, item.SITM, item.PDNO, "cant_max");
                            //    item.cant_proc = maxquantity_per_shift140(shift, item.MCNO, item.SITM, item.PDNO, "cant_proc") == string.Empty ? Convert.ToString(0) : maxquantity_per_shift140(shift, item.MCNO, item.SITM, item.PDNO, "cant_proc");
                            //}
                            Session["LstTable"] = LstTable;
                            Session["numReg"]   = LstTable.Count();
                            makeTable();
                            divBtnGuardar.Visible = true;
                            lblError.Text         = String.Empty;
                        }
                        else
                        {
                            lblError.Text = mensajes("nomaterials");
                            return;
                        }
                    }
                    else
                    {
                        lblError.Text = mensajes("machinenotexists");
                        return;
                    }
                }
                else
                {
                    lblError.Text = mensajes("ordernotexists");
                    return;
                }
            }
            else
            {
                lblError.Text = mensajes("formempty");
                return;
            }
        }
Example #2
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim()))
            {
                RequiredField.Enabled = true;
                RequiredField.IsValid = false;
                RequiredField.Validate();
                txtWorkOrderFrom.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim()))
            {
                RequiredFieldValidator1.Enabled = true;
                RequiredFieldValidator1.IsValid = false;
                RequiredFieldValidator1.Validate();
                txtWorkOrderTo.Focus();
                return;
            }

            lblResult.Text = string.Empty;

            txtWorkOrderFrom.Text = txtWorkOrderFrom.Text.ToUpperInvariant();
            txtWorkOrderTo.Text   = txtWorkOrderTo.Text.ToUpperInvariant();


            if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim()))
            {
                return;
            }

            if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim()))
            {
                return;
            }

            if (txtWorkOrderFrom.Text.Trim().ToUpperInvariant() == txtWorkOrderTo.Text.Trim().ToUpperInvariant())
            {
                lblResult.Text      = mensajes("ordersequals");
                lblResult.ForeColor = System.Drawing.Color.Red;
                return;
            }

            string ErrorOrden = "FROM ";


            obj.fpdn  = txtWorkOrderFrom.Text.ToUpperInvariant();
            resultado = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError);

            if (resultado.Rows.Count < 1)
            {
                lblResult.Text      = string.Format(mensajes("ordernotexists"), ErrorOrden, obj.fpdn.Trim());
                lblResult.ForeColor = System.Drawing.Color.Red;
                return;
            }

            ErrorOrden = "TO ";
            obj.fpdn   = txtWorkOrderTo.Text.ToUpperInvariant();
            resultado  = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError);

            if (resultado.Rows.Count < 1)
            {
                lblResult.Text      = string.Format(mensajes("ordernotexists"), ErrorOrden, obj.fpdn.Trim());
                lblResult.ForeColor = System.Drawing.Color.Red;
                return;
            }

            obj.fpdn  = txtWorkOrderFrom.Text.ToUpperInvariant();
            resultado = idal.lineClearance_listaRegistrosOrden_Param(ref obj, ref strError);

            if (resultado.Rows.Count < 1)
            {
                lblResult.Text      = string.Format(mensajes("ordernotexists"), ErrorOrden, obj.fpdn.Trim());
                lblResult.ForeColor = System.Drawing.Color.Red;
                return;
            }

            hidden.Value          = txtWorkOrderTo.Text.Trim();
            grdRecords.DataSource = resultado;
            grdRecords.DataBind();

            HeaderGrid.Visible = true;
            btnSave.Visible    = true;
        }
        protected void btnSend_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim()))
            {
                RequiredField.Enabled = true;
                RequiredField.IsValid = false;
                RequiredField.Validate();
                txtWorkOrderFrom.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim()))
            {
                RequiredFieldValidator1.Enabled = true;
                RequiredFieldValidator1.IsValid = false;
                RequiredFieldValidator1.Validate();
                txtWorkOrderTo.Focus();
                return;
            }

            lblResult.Text = string.Empty;

            txtWorkOrderFrom.Text = txtWorkOrderFrom.Text.ToUpperInvariant();
            txtWorkOrderTo.Text   = txtWorkOrderTo.Text.ToUpperInvariant();


            if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim()))
            {
                return;
            }

            if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim()))
            {
                return;
            }

            if (txtWorkOrderFrom.Text.Trim().ToUpperInvariant() == txtWorkOrderTo.Text.Trim().ToUpperInvariant())
            {
                lblResult.Text = "Work Order's are equals. Cannot continue"; return;
            }

            string ErrorOrden = "FROM ";


            obj.fpdn  = txtWorkOrderFrom.Text.ToUpperInvariant();
            resultado = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError);

            ErrorOrden = "TO ";
            obj.fpdn   = txtWorkOrderTo.Text.ToUpperInvariant();
            resultado  = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError);


            obj.fpdn  = txtWorkOrderFrom.Text.ToUpperInvariant();
            resultado = idal.lineClearance_listaRegistrosOrden_Param(ref obj, ref strError);

            if (resultado.Rows.Count < 1)
            {
                lblResult.Text = string.Format("Order Work {0}: {1} doesn't exist or the status is not active, release or completed.", ErrorOrden, obj.fpdn.Trim());
                return;
            }

            hidden.Value          = txtWorkOrderTo.Text.Trim();
            grdRecords.DataSource = resultado;
            grdRecords.DataBind();

            HeaderGrid.Visible = true;
            btnSave.Visible    = true;
        }