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.util.List;

/**
 * 仓库管理对象 t_base_storage
 *
 * @author tony
 * @date 2024-06-19
 */
@Data
@TableName(resultMap = "com.zbf.system.mapper.TBaseStorageMapper.TBaseStorageResult")
public class TBaseStorage extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Excel(name = "主键")
    private Long id;

    /**
     * 厂区
     */
    private String factoryId;

    /**
     * 所属部门
     */
    private Long deptId;

    /**
     * 仓库编号
     */
    @Excel(name = "仓库编号", required = true, headerColor = IndexedColors.RED)
    private String storageId;
    /**
     * 仓库名称
     */
    @Excel(name = "仓库名称", required = true, headerColor = IndexedColors.RED)
    private String storageShortName;
    /**
     * 仓库名称
     */
    @Excel(name = "仓库名称", required = true, headerColor = IndexedColors.RED)
    private String storageName;

    /**
     * 仓库地址
     */
    private String storageAddress;

    /**
     * 仓库联系人名称
     */
    private String storageConcatsName;

    /**
     * 仓库联系人方式
     */
    private String storageConcatsMobile;



    /**
     * 立体库
     */
    private String autoStatus;
    /**
     * 是否是AGV库 0：否 1：是
     */
    @Excel(name = "是否是AGV库", dictType = "common_zero_or_one")
    private String isAgv;
    /**
     * 状态
     */
    private String status;
    @Excel(name = "仓库类型", required = true, headerColor = IndexedColors.RED, dictType = "storage_type")
    private String type;

    private List<String> storageList;

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

    public static JSONArray getColumnsJson() {
        JSONArray columns = new JSONArray();
        Field[] fields = TBaseStorage.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 String getStorageShortName() {
        return storageShortName;
    }

    public void setStorageShortName(String storageShortName) {
        this.storageShortName = storageShortName;
    }

    public Long getId() {
        return id;
    }

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

    public String getFactoryId() {
        return factoryId;
    }

    public void setFactoryId(String factoryId) {
        this.factoryId = factoryId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public String getStorageId() {
        return storageId;
    }

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

    public String getStorageName() {
        return storageName;
    }

    public void setStorageName(String storageName) {
        this.storageName = storageName;
    }

    public String getStorageAddress() {
        return storageAddress;
    }

    public void setStorageAddress(String storageAddress) {
        this.storageAddress = storageAddress;
    }

    public String getStorageConcatsName() {
        return storageConcatsName;
    }

    public void setStorageConcatsName(String storageConcatsName) {
        this.storageConcatsName = storageConcatsName;
    }

    public String getStorageConcatsMobile() {
        return storageConcatsMobile;
    }

    public void setStorageConcatsMobile(String storageConcatsMobile) {
        this.storageConcatsMobile = storageConcatsMobile;
    }

    public String getAutoStatus() {
        return autoStatus;
    }

    public void setAutoStatus(String autoStatus) {
        this.autoStatus = autoStatus;
    }

    public String getIsAgv() {
        return isAgv;
    }

    public void setIsAgv(String isAgv) {
        this.isAgv = isAgv;
    }

    public String getStatus() {
        return status;
    }

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

    public String getType() {
        return type;
    }

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

    public List<String> getStorageList() {
        return storageList;
    }

    public void setStorageList(List<String> storageList) {
        this.storageList = storageList;
    }

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

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

    @Override
    public String toString() {
        return "TBaseStorage{" +
                "id=" + id +
                ", factoryId='" + factoryId + '\'' +
                ", deptId=" + deptId +
                ", storageId='" + storageId + '\'' +
                ", storageName='" + storageName + '\'' +
                ", storageAddress='" + storageAddress + '\'' +
                ", storageConcatsName='" + storageConcatsName + '\'' +
                ", storageConcatsMobile='" + storageConcatsMobile + '\'' +
                ", autoStatus='" + autoStatus + '\'' +
                ", isAgv='" + isAgv + '\'' +
                ", status='" + status + '\'' +
                ", type='" + type + '\'' +
                '}';
    }
}


















