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

import android.os.Bundle;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.wd.workoffice.R;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.mesBean.OrderBadBean;
import com.wd.workoffice.util.MathUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 订单追踪 详情
 * author : flexible
 * email : lgd19940421@163.com
 * github: https://github.com/FlexibleXd
 **/
public class MesReportDetailActivity extends WorkToolBarActivity {


    @BindView(R.id.tv_top_no)
    TextView tvTopNo;
    @BindView(R.id.tv_status)
    TextView tvStatus;
    @BindView(R.id.tv_pro_code)
    TextView tvProCode;
    @BindView(R.id.tv_pro_name)
    TextView tvProName;
    @BindView(R.id.tv_img_code)
    TextView tvImgCode;
    @BindView(R.id.tv_spec)
    TextView tvSpec;
    @BindView(R.id.tv_process)
    TextView tvProcess;
    @BindView(R.id.tv_order_num)
    TextView tvOrderNum;
    @BindView(R.id.tv_num)
    TextView tvNum;
    @BindView(R.id.tv_bad)
    TextView tvBad;
    @BindView(R.id.tv_chcek_price)
    TextView tvChcekPrice;
    @BindView(R.id.tv_bad_price)
    TextView tvBadPrice;

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

    @Override
    protected void initData() {
        OrderBadBean.ScrapStatisticsListsBean info = JSON.parseObject(getIntent().getStringExtra("info"), OrderBadBean.ScrapStatisticsListsBean.class);
        OrderBadBean.ScrapStatisticsListsBean.ScrapStatisticsBean data = JSON.parseObject(getIntent().getStringExtra("data"), OrderBadBean.ScrapStatisticsListsBean.ScrapStatisticsBean.class);
        tvTopNo.setText(String.format("订单编号：%s", info.getOrderNumber()));
        tvProCode.setText(data.getProductCode());
        tvProName.setText(data.getProductName());
        tvImgCode.setText(data.getDrawingNumber());
        tvSpec.setText(data.getSpecification());
        tvProcess.setText(data.getProcedureName());
        tvOrderNum.setText(data.getOrderCount()+"");
        tvNum.setText(data.getScrapCount()+"");
        tvBad.setText(MathUtils.converData(data.getBadRate(),3));
        tvBadPrice.setText(MathUtils.converData(data.getScrapLoss(),3));
        tvChcekPrice.setText(MathUtils.converData(data.getUnitPrice(),3));
    }

    @Override
    protected void initEvent() {
    }

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

}
