package com.wd.workoffice.ui.activity.mes.user;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseMesBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.event.AddMachineModifyChildEvent;
import com.wd.workoffice.bean.event.RefreshMachineEvent;
import com.wd.workoffice.bean.mesBean.MachineDetailBean;
import com.wd.workoffice.bean.mesBean.MesClientBean;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;

import org.greenrobot.eventbus.EventBus;

import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import io.reactivex.disposables.Disposable;
import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * author : flexible
 * email : lgd19940421@163.com
 * github: https://github.com/FlexibleXd
 **/
public class MesSpeedDetailActivity extends WorkToolBarActivity {
    @BindView(R.id.tv_steel_type)
    TextView tvSteelType;
    @BindView(R.id.tv_speed)
    TextView tvSpeed;
    @BindView(R.id.rl_cover)
    RelativeLayout rlCover;
    @BindView(R.id.tv_cover1)
    TextView tvCover1;
    @BindView(R.id.tv_cover2)
    TextView tvCover2;
    @BindView(R.id.tv_cover3)
    TextView tvCover3;
    @BindView(R.id.tv_cover4)
    TextView tvCover4;
    @BindView(R.id.ll_cover)
    LinearLayout llCover;
    @BindView(R.id.rl_protection)
    RelativeLayout rlProtection;
    @BindView(R.id.tv_protection1)
    TextView tvProtection1;
    @BindView(R.id.tv_protection2)
    TextView tvProtection2;
    @BindView(R.id.tv_protection3)
    TextView tvProtection3;
    @BindView(R.id.tv_protection4)
    TextView tvProtection4;
    @BindView(R.id.ll_protection)
    LinearLayout llProtection;
    private String from;
    private MachineDetailBean.SpeedsBean machineDetailBean;

    @Override
    protected void initView() {
        ButterKnife.bind(this);
    }

    @Override
    protected void initData() {
        from = getIntent().getStringExtra("from");
        machineDetailBean = JSON.parseObject(getIntent().getStringExtra("data"), MachineDetailBean.SpeedsBean.class);
        MachineDetailBean.SpeedsBean.CovAgentBean covAgent = machineDetailBean.getCovAgent();
        if (covAgent != null) {
            tvCover1.setText(covAgent.getLadleCoveringAgentName());
            tvCover2.setText(covAgent.getAcidAlkaliDegreeCov());
            tvCover3.setText(covAgent.getChemicalCompositionCov());
            tvCover4.setText(covAgent.getSupplierNameCov());
        }
        MachineDetailBean.SpeedsBean.MouldFluBean mouldFlu = machineDetailBean.getMouldFlu();
        if (mouldFlu != null) {
            tvProtection1.setText(mouldFlu.getMouldFluxesName());
            tvProtection2.setText(mouldFlu.getAcidAlkaliDegreeFlu());
            tvProtection3.setText(mouldFlu.getChemicalCompositionFlu());
            tvProtection4.setText(mouldFlu.getSupplierNameFlu());
        }
        tvSpeed.setText(machineDetailBean.getCastingSpeed());
        tvSteelType.setText(machineDetailBean.getSteelGrade());
    }



    @Override
    protected void initEvent() {
    }

    @Override
    protected int layoutId() {
        return R.layout.activity_mes_user_data_speed_detail;
    }



}
