using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SLC1_N
{
    public partial class Form_hbMESset : Form
    {
        public Form_hbMESset()
        {
            InitializeComponent();
        }

        private void Form_gdMESset_Load(object sender, EventArgs e)
        {
            tb_partno.Text = Form1.f1.mes_partno;
            tb_station.Text = Form1.f1.mes_station;

            tb_workorder.Text = Form1.f1.mes_workorder;
            tb_equipmentno.Text = Form1.f1.mes_equipmentno;
            tb_fixturecode.Text = Form1.f1.mes_fixturecode;
            tb_plan.Text = Form1.f1.mes_plan;
        }

        // 保存
        private void bt_save_Click(object sender, EventArgs e)
        {
            var config = new JsonConfig("config.json");

            config.SetValue($"mes_urlip", tb_url_ip.Text); 
            config.SetValue($"mes_urlport", tb_url_port.Text);
            config.SetValue($"mes_partno", tb_partno.Text);
            config.SetValue($"mes_station", tb_station.Text);

            config.SetValue($"mes_workorder", tb_workorder.Text);
            config.SetValue($"mes_equipmentno", tb_equipmentno.Text);
            config.SetValue($"mes_fixturecode", tb_fixturecode.Text);
            config.SetValue($"mes_plan", tb_plan.Text);

            Form1.f1.mes_partno = tb_partno.Text;
            Form1.f1.mes_station = tb_station.Text;

            Form1.f1.mes_workorder = tb_workorder.Text;
            Form1.f1.mes_equipmentno = tb_equipmentno.Text;
            Form1.f1.mes_fixturecode = tb_fixturecode.Text;
            Form1.f1.mes_plan = tb_plan.Text;
        }
    }
}
