package com.mvc.model.produce;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 生产计划PDF格式对象
 * 表中存储是行数据,id和Value(在此转换行三列)
 */
public class ProductionPlanPdfModel {
    public ProductionPlanPdfModel(){

    }

    /**
     * 根据生产计划对象构造
     *
     * @param planModel
     */
    public ProductionPlanPdfModel(TProductionPlanModel planModel) {
        this.planName = planModel.getPlanName();
        this.createMan = planModel.getCreateMan();
        this.createTime = planModel.getCreateTime();
        this.productionQty = planModel.getProductionQty();
        this.deliveryTime = planModel.getDeliveryTime();
        this.remarks = StringUtils.isEmpty(planModel.getRemarks()) ? "无" : planModel.getRemarks();
        this.producer = planModel.getProducer();
        this.deviceType = planModel.getDeviceType();
    }

    /**
     * 计划名称
     */
    private String planName;

    /**
     * 创建人
     */
    private String createMan;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh")
    private Date createTime;

    /**
     * 生产数量
     */
    private Integer productionQty;

    /**
     * 类型名称
     */
    private String typeName;

    /**
     * 交付时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh")
    private Date deliveryTime;

    /**
     * 备注
     */
    private String remarks;

    /**
     * 生产人
     */
    private String producer;

    /**
     * 设备类型
     */
    private String deviceType;

    /**
     * 起始设备编号
     */
    private String startDeviceSn;

    /**
     * 结束设备编号
     */
    private String endDeviceSn;

    private List<DetailModel> details;

    public String getPlanName() {
        return planName;
    }

    public void setPlanName(String planName) {
        this.planName = planName;
    }

    public String getCreateMan() {
        return createMan;
    }

    public void setCreateMan(String createMan) {
        this.createMan = createMan;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getProductionQty() {
        return productionQty;
    }

    public void setProductionQty(Integer productionQty) {
        this.productionQty = productionQty;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public Date getDeliveryTime() {
        return deliveryTime;
    }

    public void setDeliveryTime(Date deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getProducer() {
        return producer;
    }

    public void setProducer(String producer) {
        this.producer = producer;
    }

    public String getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }

    public String getStartDeviceSn() {
        return startDeviceSn;
    }

    public void setStartDeviceSn(String startDeviceSn) {
        this.startDeviceSn = startDeviceSn;
    }

    public String getEndDeviceSn() {
        return endDeviceSn;
    }

    public void setEndDeviceSn(String endDeviceSn) {
        this.endDeviceSn = endDeviceSn;
    }

    public List<DetailModel> getDetails() {
        return details;
    }

    public void setDetails(List<DetailModel> details) {
        this.details = details;
    }

    public static class DetailModel {
        private String key1;
        private String key2;
        private String key3;
        private String value1;
        private String value2;
        private String value3;

        public String getKey1() {
            return key1;
        }

        public void setKey1(String key1) {
            this.key1 = key1;
        }

        public String getKey2() {
            return key2;
        }

        public void setKey2(String key2) {
            this.key2 = key2;
        }

        public String getKey3() {
            return key3;
        }

        public void setKey3(String key3) {
            this.key3 = key3;
        }

        public String getValue1() {
            return value1;
        }

        public void setValue1(String value1) {
            this.value1 = value1;
        }

        public String getValue2() {
            return value2;
        }

        public void setValue2(String value2) {
            this.value2 = value2;
        }

        public String getValue3() {
            return value3;
        }

        public void setValue3(String value3) {
            this.value3 = value3;
        }
    }

}
