Ejemplo n.º 1
0
        public OPInfoMapper OPInfoApi(string op)
        {
            opinfo      = new OPInfoMapper();
            hasResponse = false;
            exception   = null;

            try
            {
                string path = string.Format("{0}/controldeplacas/opinfo/{1}", apiUrl, op);

                string jsonData = Consume(path);
                hasResponse = true;
                opinfo      = JsonConvert.DeserializeObject <OPInfoMapper>(jsonData);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            return(opinfo);
        }
Ejemplo n.º 2
0
        private void inOp_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnFinish.Enabled  = false;
                inCantidad.Enabled = false;

                currentOp = new OPInfoMapper();

                detailOp.Text = "";
                try
                {
                    ControlDePlacasService api = new ControlDePlacasService();
                    api.OPInfoApi(inOp.Text.ToString());

                    if (api.hasResponse)
                    {
                        if (api.opinfo.error == null)
                        {
                            #region OP INFO
                            if (api.opinfo.smt != null)
                            {
                                // Carga modelo lote panel y op en palet
                                detailOp.Text = string.Concat(
                                    "OP: ",
                                    api.opinfo.smt.op,
                                    System.Environment.NewLine,
                                    "Modelo: ",
                                    api.opinfo.smt.modelo,
                                    System.Environment.NewLine,
                                    "Lote: ",
                                    api.opinfo.smt.lote,
                                    System.Environment.NewLine,
                                    "Panel: ",
                                    api.opinfo.smt.panel,
                                    System.Environment.NewLine,
                                    "Semielaborado: ",
                                    api.opinfo.wip.wip_ot.codigo_producto);

                                btnFinish.Enabled  = true;
                                inCantidad.Enabled = true;

                                currentOp = api.opinfo;
                            }
                            else
                            {
                                btnFinish.Enabled  = false;
                                inCantidad.Enabled = false;

                                currentOp = new OPInfoMapper();

                                detailOp.Text = "No fue posible obtener datos de OP";
                            }
                            #endregion
                        }
                        else
                        {
                            detailOp.Text = "Error: " + api.opinfo.error;
                        }
                    }
                    else
                    {
                        detailOp.Text = "Error: " + api.exception;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }