package com.yeechart.dotMatrix.signage.bean;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@Data

/**
 * 产品类型020201 终端 的所有的属性详情
 */
public class Ter020201InfoVo {


    /**
     * 产品ID
     */
    private String productId;


    /**
     * 设备ID
     */
    private String deId;


    /**
     * 终端编码, type:1
     */
    private String terWorkCode;


    /**
     * 终端名称, type:2
     */
    private String terName;


    /**
     * 电池电量
     */
    private Integer battery;


    /**
     * 信号
     */
    private Integer signalNum;


    /**
     * 在线状态(0离线,1在线)
     */
    private Integer online;


    /**
     * 屏幕刷新周期(0:1分钟 1:5分钟 2:10分钟,3:30), type:3
     */
    private Integer screenRef;


    /**
     * 左屏幕设置, type:4
     */
    private Integer leftScreen;


    /**
     * 右屏幕设置, type:5
     */
    private Integer rightScreen;


    /**
     * 音量大小, type:6
     */
    private Integer volume;


    /**
     * 电池温度
     */
    private String temp;


    /**
     * 设备最新的工作状态, type:7
     */
    private Integer currentStatus;


    /**
     * 设备最新的工作状态开始时间, type:8
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date statusTime;


    /**
     * 工站_编码, type:9
     */
    private String wsWorkCode;


    /**
     * 工站_名称, type:10
     */
    private String wsName;


    /**
     * 工站_公告, type:11
     */
    private String wsNotice;


    /**
     * 工站责任人设置, type:12
     */
    private TiOnusBean tiOnusBean;


    /**
     * 工站_生产责任人, type:13
     */
    private String produce;


    /**
     * 工站_维修责任人, type:14
     */
    private String maintain;


    /**
     * 工站_巡检责任人, type:15
     */
    private String inspection;


    /**
     * 工站_保养责任人, type:16
     */
    private String upkeep;


    /**
     * 工站_操作员, type:17
     */
    private String operator;


    /**
     * 工站_产能标准线, type:18
     */
    private Integer standardNum;


//
//    @ApiModelProperty(value = "工站_状态信息设置, type:19")// ,当更新此项时需将type-29和type-30均更新一次,用来刷新报表数据
//    private TiSetStateBean tiSetState;

    //@ApiModelProperty(value = "终端_状态信息设置, type:19")// ,当更新此项时需将type-29和type-30均更新一次,用来刷新报表数据
    /**
     * 终端_状态信息设置, type:19
     */
    private Ter020201DriverBean ter020201DriverBean;


    /**
     * 工站_打卡设置, type:20
     */
    private TiClockBean tiClock;


    /**
     * 系统公告, type:21
     */
    private String sysNotice;


    /**
     * 版本公告, type:22
     */
    private String verNotice;


    /**
     * 工站_打卡,实时 生产人员打卡个数, type:23
     */
    private Integer checkProduce;


    /**
     * 工站_打卡,实时 巡检人员打卡个数, type:24
     */
    private Integer checkInspect;


    /**
     * 工站_打卡,实时 维修人员打卡个数, type:25
     */
    private Integer checkMaintain;


    /**
     * 工站_打卡,实时 保养人员打卡个数, type:26
     */
    private Integer checkUpkeep;


    /**
     * 硬件版本, type:27
     */
    private String version;


    /**
     * 硬件升级状态(0 默认 正常状态 , 1 正在升级中), type:28
     */
    private Integer otaState;


    /**
     * 终端_状态历史( 0-运行 1-保养 2-维修/封存 3-故障 4-待料 5-停机  ), type:29
     */
    private Long[] stateHistoryArray = new Long[]{0L, 0L, 0L, 0L, 0L, 0L};


    /**
     * 终端_工时历史(0-生产打卡工时, 1-巡检打卡工时, 2-保养打卡工时, 3-维修打卡工时), type:30
     */
    private Long[] workingHoursHistoryArray = new Long[]{0L, 0L, 0L, 0L};

//    @ApiModelProperty(value = "终端_签到历史(0-生产打卡人数, 1-巡检打卡人数, 2-保养打卡人数, 3-维修打卡人数), type:30") 2024/05/31 将打卡历史更换为 工时历史
//    private Long[] checkHistoryArray = new Long[]{0L,0L,0L,0L};


    /**
     * 工站_报表_人数/工时, type:31
     */
    private List<SheetCheckVo> sheetCheckVos = new ArrayList<>();


    /**
     * 工站_报表_生产产能, type:32
     */
    private List<SheetPVo> sheetVos = new ArrayList<>();


    /**
     * 工站_良品率基线, type:33
     */
    private Integer yieldRate;


    /**
     * 工站_稼动率基线, type:34
     */
    private Integer cropRate;


    private Boolean isDefault = false;//是否是默认数据


    /**
     * 硬件重启, type:35
     */
    private Integer recover;// 0为重启 1为恢复出厂(暂未实装)


    /**
     * NFC开关, （0 开 1关）type:36
     */
    private Integer nfcOpen;


    /**
     * 是否切换到该状态,( 0-停机 1-运行 2-维修 3-故障 )
     */
    private Integer forceState;


    /**
     * 当设备关机时 需要将状态进行更改( 0-停机 1-运行 2-封存 3-故障 4-保养 5-待料 ,  7 -延续上一次的状态, 255 不统计 ,  ), type:38
     */
    private Integer offlineStatus;


    public static Ter020201InfoVo defaultInit(String deid) {
        Ter020201InfoVo ter020201InfoVo = new Ter020201InfoVo();
        ter020201InfoVo.setProductId("020201");
        ter020201InfoVo.setDeId(deid);

        ter020201InfoVo.setTerWorkCode("00000001");
        ter020201InfoVo.setTerName("蚁巢标识牌");
        ter020201InfoVo.setBattery(100);
        ter020201InfoVo.setSignalNum(100);
        ter020201InfoVo.setScreenRef(30);
        ter020201InfoVo.setLeftScreen(0);
        ter020201InfoVo.setRightScreen(0);
        ter020201InfoVo.setVolume(50);
        ter020201InfoVo.setTemp("30.0");
        ter020201InfoVo.setCurrentStatus(0);
        ter020201InfoVo.setStatusTime(new Date());
        ter020201InfoVo.setVersion("3.0.0");
        ter020201InfoVo.setOtaState(0);


        ter020201InfoVo.setStateHistoryArray(new Long[]{0L, 0L, 0L, 0L, 0L, 0L});


        ter020201InfoVo.setWorkingHoursHistoryArray(new Long[]{0L, 0L, 0L, 0L});


        ter020201InfoVo.setWsWorkCode("000000001");
        ter020201InfoVo.setWsName("未绑定工站");
        ter020201InfoVo.setWsNotice("");

        TiOnusBean tiOnusBean1 = new TiOnusBean();

        tiOnusBean1.setPAlias("生产责任人");
        tiOnusBean1.setIsProduce(0);

        tiOnusBean1.setMAlias("维修责任人");
        tiOnusBean1.setIsMaintain(0);

        tiOnusBean1.setOAlias("操作人员");
        tiOnusBean1.setIsOperate(0);

        tiOnusBean1.setIAlias("巡检责任人");
        tiOnusBean1.setIsInspect(0);

        tiOnusBean1.setUAlias("保养责任人");
        tiOnusBean1.setIsUpkeep(0);

        ter020201InfoVo.setTiOnusBean(tiOnusBean1);

        ter020201InfoVo.setProduce("");
        ter020201InfoVo.setMaintain("");
        ter020201InfoVo.setInspection("");
        ter020201InfoVo.setUpkeep("");
        ter020201InfoVo.setOperator("");

        ter020201InfoVo.setStandardNum(100);
        ter020201InfoVo.setYieldRate(90);
        ter020201InfoVo.setCropRate(75);

        Ter020201DriverBean ter020201DriverBean1 = new Ter020201DriverBean();

        ter020201DriverBean1.setRAlias("运行");
        ter020201DriverBean1.setRun(0);
        //tiSetStateBean.setRShow(0);

        ter020201DriverBean1.setWAlias("待料");
        ter020201DriverBean1.setWait(0);
        //tiSetStateBean.setWShow(0);

        ter020201DriverBean1.setMAlias("维修");
        ter020201DriverBean1.setMaintain(0);
        //tiSetStateBean.setMShow(0);

        ter020201DriverBean1.setFAlias("故障");
        ter020201DriverBean1.setFault(0);
        //tiSetStateBean.setFShow(0);

        ter020201DriverBean1.setUAlias("保养");
        ter020201DriverBean1.setUpkeep(0);
        //tiSetStateBean.setUShow(0);

        ter020201DriverBean1.setHAlias("停机");
        ter020201DriverBean1.setHalt(0);
        //tiSetStateBean.setHShow(0);


        ter020201InfoVo.setTer020201DriverBean(ter020201DriverBean1);

        TiClockBean tiClockBean = new TiClockBean();

        tiClockBean.setPAlias("生产");
        tiClockBean.setProduce(0);

        tiClockBean.setMAlias("维修");
        tiClockBean.setMaintain(0);

        tiClockBean.setIAlias("巡检");
        tiClockBean.setInspect(0);

        tiClockBean.setUAlias("保养");
        tiClockBean.setUpkeep(0);


        ter020201InfoVo.setTiClock(tiClockBean);

        ter020201InfoVo.setCheckProduce(0);
        ter020201InfoVo.setCheckInspect(0);
        ter020201InfoVo.setCheckMaintain(0);
        ter020201InfoVo.setCheckUpkeep(0);

        ter020201InfoVo.setSysNotice("");
        ter020201InfoVo.setVerNotice("");


        List<SheetCheckVo> sheetCheckVos = new ArrayList<>();

        for (int i = 0; i < 8; i++) {
            SheetCheckVo sheetCheckVo = new SheetCheckVo();
            sheetCheckVo.setTime("00:00");//展示时间
            sheetCheckVo.setPeopleNum(0);//人数
            sheetCheckVo.setWork(0);//工时
            sheetCheckVo.setPeoplep(0);
            ;
            sheetCheckVo.setPeoplew(0);
            ;
            sheetCheckVo.setPeoplei(0);
            ;
            sheetCheckVo.setPeopleu(0);
            ;
            sheetCheckVos.add(sheetCheckVo);
        }

        ter020201InfoVo.setSheetCheckVos(sheetCheckVos);

        List<SheetPVo> sheetVos = new ArrayList<>();
        for (int i = 0; i < 8; i++) {

            SheetPVo sheetPVo = new SheetPVo();

            sheetPVo.setTime("00:00");//展示时间

            sheetPVo.setGood(0.0);
            sheetPVo.setNoGood(0.0);
            sheetPVo.setProduction((double) 0L);

            //sheetPVo.setGoodRate(Double.valueOf(AllUtil.getdecimal(String.valueOf(0),2)));
            sheetPVo.setGoodRate(new BigDecimal(0.0));
            sheetPVo.setUtilizationRate(new BigDecimal(0));

            sheetVos.add(sheetPVo);

        }

        ter020201InfoVo.setSheetVos(sheetVos);


        return ter020201InfoVo;
    }


    public static Ter020201InfoVo test3(String str) {
        Ter020201InfoVo ter020201InfoVo = new Ter020201InfoVo();
        ter020201InfoVo.setProductId("020201");
        ter020201InfoVo.setDeId("test");

        ter020201InfoVo.setTerWorkCode("11111111");
        ter020201InfoVo.setTerName("终端名称");
        ter020201InfoVo.setBattery(100);
        ter020201InfoVo.setSignalNum(100);
        ter020201InfoVo.setScreenRef(30);
        ter020201InfoVo.setLeftScreen(1);
        ter020201InfoVo.setRightScreen(1);
        ter020201InfoVo.setVolume(50);
        ter020201InfoVo.setTemp("30.0");
        ter020201InfoVo.setCurrentStatus(1);
        ter020201InfoVo.setStatusTime(new Date());
        ter020201InfoVo.setVersion("3.0.0");
        ter020201InfoVo.setOtaState(0);


//        for(int i =0;i < 6;i++){
//            RecordTStateBean recordTStateBean = new RecordTStateBean();
//            recordTStateBean.setState(0);
//            recordTStateBean.setDuration(20*i);
//            ter020201InfoVo.getRecordTStateBeanList().add(recordTStateBean);
//        }

        ter020201InfoVo.setStateHistoryArray(new Long[]{100L, 50L, 80L, 10L, 0L, 60L});


        ter020201InfoVo.setWorkingHoursHistoryArray(new Long[]{200L, 20L, 180L, 3000L});


        ter020201InfoVo.setWsWorkCode("22222222");
        ter020201InfoVo.setWsName("工站名称");
        ter020201InfoVo.setWsNotice("这是一个工站的公告，不过是测试使用的，需要多打几个字看看如何换行处理之类的，还有后续考虑省略号的奥iu不到你千万会被丢弃表不对哦白uiu啊不会的iu哦啊是对iu还u收到iu哎u阿斯u豆瓣iu啊ui地球该海湾地区有困境和关怀和改革和白素会给丢啊");

        TiOnusBean tiOnusBean1 = new TiOnusBean();

        tiOnusBean1.setPAlias("生产责任人别名");
        tiOnusBean1.setIsProduce(0);

        tiOnusBean1.setMAlias("维修责任人别名");
        tiOnusBean1.setIsMaintain(0);

        tiOnusBean1.setOAlias("操作员别名");
        tiOnusBean1.setIsOperate(0);

        tiOnusBean1.setIAlias("巡检责任人别名");
        tiOnusBean1.setIsInspect(0);

        tiOnusBean1.setUAlias("保养责任人别名");
        tiOnusBean1.setIsUpkeep(0);

        ter020201InfoVo.setTiOnusBean(tiOnusBean1);

        ter020201InfoVo.setProduce("生产责任人的内容，这样度过的");
        ter020201InfoVo.setMaintain("那就轰炸不符合以上南沙海域撒娇你不是赛那啥啥金沙萨");
        ter020201InfoVo.setInspection("就篡改活跃于计划的用户接口对接急啊急啊就就接电话将按计划和绝对是");
        ter020201InfoVo.setUpkeep("惊险刺激的剩余环境环境据四四恶化的集合和但遗憾的是 决定快递看见大家核对就");
        ter020201InfoVo.setOperator("进行创业时代是佳能单反觉得还是有看见安河桥进度计划的决定接口暗杀计划是大家就阿萨");


        ter020201InfoVo.setStandardNum(50);
        ter020201InfoVo.setYieldRate(80);
        ter020201InfoVo.setCropRate(80);

        Ter020201DriverBean tiSetStateBean = new Ter020201DriverBean();

        tiSetStateBean.setRAlias("ABCDEF");
        tiSetStateBean.setRun(0);
        //tiSetStateBean.setRShow(0);

        tiSetStateBean.setWAlias(str);
        tiSetStateBean.setWait(0);
        //tiSetStateBean.setWShow(0);

        tiSetStateBean.setMAlias("/+大-和*");
        tiSetStateBean.setMaintain(0);
        //tiSetStateBean.setMShow(0);

        tiSetStateBean.setFAlias("我a你b才g");
        tiSetStateBean.setFault(0);
        //tiSetStateBean.setFShow(0);

        tiSetStateBean.setUAlias("好1早2骄y");
        tiSetStateBean.setUpkeep(0);
        //tiSetStateBean.setUShow(0);

        tiSetStateBean.setHAlias("0g9y1R");
        tiSetStateBean.setHalt(0);
        //tiSetStateBean.setHShow(0);


        ter020201InfoVo.setTer020201DriverBean(tiSetStateBean);

        TiClockBean tiClockBean = new TiClockBean();

        tiClockBean.setPAlias("生产别名");
        tiClockBean.setProduce(0);

        tiClockBean.setMAlias("维修别名");
        tiClockBean.setMaintain(0);

        tiClockBean.setIAlias("巡检别名");
        tiClockBean.setInspect(0);

        tiClockBean.setUAlias("保养别名");
        tiClockBean.setUpkeep(0);


        ter020201InfoVo.setTiClock(tiClockBean);

        ter020201InfoVo.setCheckProduce(0);
        ter020201InfoVo.setCheckInspect(123);
        ter020201InfoVo.setCheckMaintain(456);
        ter020201InfoVo.setCheckUpkeep(789);

        ter020201InfoVo.setSysNotice("这是测试的系统公告金卡稍等哈晒ui偶是对哦奥会丢哈iu哈桑对哈斯u的hi撒谎丢啊大撒大撒谁的iu好低啊u是对哦i啊u是丢哈");
        ter020201InfoVo.setVerNotice("这是测试的版本公告按时间哦好的哈是呵呵大弧度坏坏的i不都啊随队前往的iu去啊不阿三大苏打丢啊大雾i百度哦i啊是不对还很多");


        List<SheetCheckVo> sheetCheckVos = new ArrayList<>();

        SheetCheckVo sheetCheckVo = new SheetCheckVo();
        sheetCheckVo.setTime("10:30");//展示时间
        sheetCheckVos.add(sheetCheckVo);

        SheetCheckVo sheetCheckVo1 = new SheetCheckVo();
        sheetCheckVo1.setTime("11:00");//展示时间
        sheetCheckVos.add(sheetCheckVo1);

        SheetCheckVo sheetCheckVo2 = new SheetCheckVo();
        sheetCheckVo2.setTime("11:30");//展示时间
        sheetCheckVos.add(sheetCheckVo2);

        SheetCheckVo sheetCheckVo3 = new SheetCheckVo();
        sheetCheckVo3.setTime("12:00");//展示时间
        sheetCheckVos.add(sheetCheckVo3);

        SheetCheckVo sheetCheckVo4 = new SheetCheckVo();
        sheetCheckVo4.setTime("12:30");//展示时间
        sheetCheckVos.add(sheetCheckVo4);

        SheetCheckVo sheetCheckVo5 = new SheetCheckVo();
        sheetCheckVo5.setTime("13:00");//展示时间
        sheetCheckVos.add(sheetCheckVo5);

        SheetCheckVo sheetCheckVo6 = new SheetCheckVo();
        sheetCheckVo6.setTime("13:30");//展示时间
        sheetCheckVos.add(sheetCheckVo6);

        SheetCheckVo sheetCheckVo7 = new SheetCheckVo();
        sheetCheckVo7.setTime("14:00");//展示时间
        sheetCheckVos.add(sheetCheckVo7);


//        for(int i = 0; i < 8 ; i++){
//            SheetCheckVo sheetCheckVo = new SheetCheckVo();
//            int time = i*30;
//
//            int hour = time/60;
//            int minute = time%60;
//
//            sheetCheckVo.setTime(
//                    (hour>10?hour:"0"+hour) +
//                    ":" +
//                    (minute>10?minute:"0"+minute)
//            );//展示时间
//
//            sheetCheckVo.setPeopleNum(i*30);//人数
//            sheetCheckVo.setWork(i*22);//工时
//
//            sheetCheckVo.setPeoplep(i*2);;
//            sheetCheckVo.setPeoplew(i*3);;
//            sheetCheckVo.setPeoplei(i*4);;
//            sheetCheckVo.setPeopleu(i*5);;
//
//
//            sheetCheckVos.add(sheetCheckVo);
//        }

        ter020201InfoVo.setSheetCheckVos(sheetCheckVos);


        List<SheetPVo> sheetVos = new ArrayList<>();


        SheetPVo sheetPVo = new SheetPVo();
        sheetPVo.setTime("10:30");//展示时间
        sheetVos.add(sheetPVo);

        SheetPVo sheetPVo1 = new SheetPVo();
        sheetPVo1.setTime("11:00");//展示时间
        sheetPVo1.setUtilizationRate(new BigDecimal(13.33));
        sheetPVo1.setDuration(new BigDecimal(4.0));
        sheetVos.add(sheetPVo1);

        SheetPVo sheetPVo2 = new SheetPVo();
        sheetPVo2.setTime("11:30");//展示时间
        sheetPVo2.setUtilizationRate(new BigDecimal(20.0));
        sheetPVo2.setDuration(new BigDecimal(6.0));
        sheetVos.add(sheetPVo2);

        SheetPVo sheetPVo3 = new SheetPVo();
        sheetPVo3.setTime("12:00");//展示时间
        sheetVos.add(sheetPVo3);

        SheetPVo sheetPVo4 = new SheetPVo();
        sheetPVo4.setTime("12:30");//展示时间
        sheetVos.add(sheetPVo4);

        SheetPVo sheetPVo5 = new SheetPVo();
        sheetPVo5.setTime("13:00");//展示时间
        sheetVos.add(sheetPVo5);

        SheetPVo sheetPVo6 = new SheetPVo();
        sheetPVo6.setTime("13:30");//展示时间
        sheetVos.add(sheetPVo6);


        SheetPVo sheetPVo7 = new SheetPVo();
        sheetPVo7.setTime("14:00");//展示时间
        sheetPVo7.setUtilizationRate(new BigDecimal(71.43));
        sheetPVo7.setDuration(new BigDecimal(25.0));
        sheetVos.add(sheetPVo7);


//        for(int i = 0; i < 8 ; i++){
//
//            SheetPVo sheetPVo = new SheetPVo();
//
//            int time = i*30;
//
//            int hour = time/60;
//            int minute = time%60;
//
//            sheetPVo.setTime(
//                    (hour>10?hour:"0"+hour) +
//                            ":" +
//                            (minute>10?minute:"0"+minute)
//            );//展示时间
//
//            sheetPVo.setGood(i*123.45);
//            sheetPVo.setNoGood(i*12.34);
//            sheetPVo.setProduction(i*300);
//
//            sheetPVo.setGoodRate(Double.valueOf(AllUtil.getdecimal(String.valueOf(i*0.10),2)));
//            sheetPVo.setUtilizationRate(Double.valueOf(AllUtil.getdecimal(String.valueOf(i*0.05),2)));
//
//            sheetVos.add(sheetPVo);
//
//        }

        ter020201InfoVo.setSheetVos(sheetVos);


        return ter020201InfoVo;
    }


}

