package com.zbf.system.domain;

import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zbf.common.annotation.Excel;
import com.zbf.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;

import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.List;

/**
 * 托盘对象 t_base_pallet
 *
 * @author sunits
 * @date 2024-06-16
 */
@Data
@TableName(resultMap = "com.zbf.system.mapper.TBasePalletMapper.TBasePalletResult")
public class TBasePallet extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 所属仓库
     */
    @Excel(name = "所属仓库")
    private String storageId;
    /**
     * 托盘编号
     */
    @Excel(name = "容器编号", required = true, headerColor = IndexedColors.RED)
    private String palletId;

    /**
     * 托盘名称
     */
    @Excel(name = "容器名称")
    private String palletName;

    /**
     * 托盘简称
     */
    @Excel(name = "容器简称")
    private String pyName;

    /**
     * 类型
     */
    private String palletType;

    /**
     * 长
     */
//    @Excel(name = "长")
    private BigDecimal palletLong;

    /**
     * 宽
     */
//    @Excel(name = "宽")

    private BigDecimal palletWidth;

    /**
     * 高
     */
//    @Excel(name = "高")
    private BigDecimal palletHeight;

    /**
     * 体积
     */
//    @Excel(name = "体积")
    private BigDecimal volume;

    /**
     * 承重
     */
//    @Excel(name = "承重")
    private BigDecimal bearWeight;

    /**
     * 状态
     */
    @Excel(name = "占用状态",dictType="location_type",type = Excel.Type.EXPORT)
    private String status;
    /**
     * 是否有锁
     */
    @Excel(name = "禁用状态",dictType = "common_status",type = Excel.Type.EXPORT)
    private String isLock;
    /**
     * 版本
     */
    private String version;

    /**
     * 用户ID
     */
    private String userId;

    /**
     * 工作类型
     */
    private String workType;


    @Excel(name = "容器类型",headerColor= IndexedColors.RED,needMerge = true,comboDictType = "container_type")
    private String type;

    private String palletEpc;
    /**
     * 选中的数据
     */
    private String[] selectIds;

    private List<Long> ids;

    public String getPalletEpc() {
        return palletEpc;
    }

    public void setPalletEpc(String palletEpc) {
        this.palletEpc = palletEpc;
    }

    public List<Long> getIds() {
        return ids;
    }

    public void setIds(List<Long> ids) {
        this.ids = ids;
    }

    public String getStorageId() {
        return storageId;
    }

    public void setStorageId(String storageId) {
        this.storageId = storageId;
    }

    public String getIsLock() {
        return isLock;
    }

    public void setIsLock(String isLock) {
        this.isLock = isLock;
    }

    public static JSONArray getColumnsJson() {
        JSONArray columns = new JSONArray();
        Field[] fields = TBasePallet.class.getDeclaredFields();
        int key = 0;
        for (Field field : fields) {
            Excel excelAnnotation = field.getAnnotation(Excel.class);
            if (excelAnnotation != null) {
                JSONObject column = new JSONObject();
                column.put("seq", key++);
                column.put("key", field.getName());
                column.put("label", excelAnnotation.name());
                column.put("visible", true);  // 假设所有列默认都是可见的
                column.put("columnName", field.getName());  // 设置列ID
                columns.put(column);
            }
        }
        return columns;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPalletId() {
        return palletId;
    }

    public void setPalletId(String palletId) {
        this.palletId = palletId;
    }

    public String getPalletName() {
        return palletName;
    }

    public void setPalletName(String palletName) {
        this.palletName = palletName;
    }

    public String getPyName() {
        return pyName;
    }

    public void setPyName(String pyName) {
        this.pyName = pyName;
    }

    public String getPalletType() {
        return palletType;
    }

    public void setPalletType(String palletType) {
        this.palletType = palletType;
    }

    public BigDecimal getPalletLong() {
        return palletLong;
    }

    public void setPalletLong(BigDecimal palletLong) {
        this.palletLong = palletLong;
    }

    public BigDecimal getPalletWidth() {
        return palletWidth;
    }

    public void setPalletWidth(BigDecimal palletWidth) {
        this.palletWidth = palletWidth;
    }

    public BigDecimal getPalletHeight() {
        return palletHeight;
    }

    public void setPalletHeight(BigDecimal palletHeight) {
        this.palletHeight = palletHeight;
    }

    public BigDecimal getVolume() {
        return volume;
    }

    public void setVolume(BigDecimal volume) {
        this.volume = volume;
    }

    public BigDecimal getBearWeight() {
        return bearWeight;
    }

    public void setBearWeight(BigDecimal bearWeight) {
        this.bearWeight = bearWeight;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getWorkType() {
        return workType;
    }

    public void setWorkType(String workType) {
        this.workType = workType;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String[] getSelectIds() {
        return selectIds;
    }

    public void setSelectIds(String[] selectIds) {
        this.selectIds = selectIds;
    }

    @Override
    public String toString() {
        return "TBasePallet{" +
                "id=" + id +
                ", palletId='" + palletId + '\'' +
                ", palletName='" + palletName + '\'' +
                ", pyName='" + pyName + '\'' +
                ", palletType='" + palletType + '\'' +
                ", palletLong=" + palletLong +
                ", palletWidth=" + palletWidth +
                ", palletHeight=" + palletHeight +
                ", volume=" + volume +
                ", bearWeight=" + bearWeight +
                ", status='" + status + '\'' +
                ", version='" + version + '\'' +
                ", userId='" + userId + '\'' +
                ", workType='" + workType + '\'' +
                ", type='" + type + '\'' +
                '}';
    }

}


















