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

import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
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.MesOrderBean;

import butterknife.BindView;
import butterknife.ButterKnife;
import flexible.xd.android_base.utils.TimeUtils;

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


    @BindView(R.id.tv_top_no)
    TextView tvTopNo;
    @BindView(R.id.tv_status)
    TextView tvStatus;
    @BindView(R.id.tv_no)
    TextView tvNo;
    @BindView(R.id.tv_pro_name)
    TextView tvProName;
    @BindView(R.id.tv_pro_code)
    TextView tvProCode;
    @BindView(R.id.tv_factory_name)
    TextView tvFactoryName;
    @BindView(R.id.tv_factory_code)
    TextView tvFactoryCode;
    @BindView(R.id.tv_order_time)
    TextView tvOrderTime;
    @BindView(R.id.tv_num)
    TextView tvNum;
    @BindView(R.id.tv_weight)
    TextView tvWeight;
    @BindView(R.id.tv_time)
    TextView tvTime;

    @Override
    protected void initView() {
        ButterKnife.bind(this);
        MesOrderBean.ListBean info = JSON.parseObject(getIntent().getStringExtra("info"), MesOrderBean.ListBean.class);
        if (TextUtils.equals(info.getScheduleStatus(), "") || TextUtils.equals(info.getScheduleStatus(), "0")) {
            tvStatus.setText("未排程");
        } else {
            tvStatus.setText("已排程");
        }
        tvTopNo.setText(String.format("制造令单号:%s", info.getManufactureOrderNumber()));
        tvNo.setText(info.getManufactureOrderNumber());
        tvFactoryName.setText(info.getSiteName());
        tvFactoryCode.setText(info.getSiteCode());
        tvNum.setText(info.getPlanCount() + "");
        tvProCode.setText(info.getProductCode());
        tvProName.setText(info.getProductName());
        tvWeight.setText(info.getUnit());
        tvTime.setText(TimeUtils.millis2String(info.getDeliveryDate()));
        tvOrderTime.setText(TimeUtils.millis2String(info.getCreateDateTime()));
    }

    @Override
    protected void initData() {
    }

    @Override
    protected void initEvent() {
    }

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

}
