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.fasterxml.jackson.annotation.JsonFormat;
import com.zbf.common.annotation.Excel;
import com.zbf.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.poi.ss.usermodel.IndexedColors;

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

/**
 * 物料对象 t_base_goods
 *
 * @author sunits
 * @date 2024-06-15
 */
@Data
@TableName(resultMap = "com.zbf.system.mapper.TBaseGoodsMapper.TBaseGoodsResult")
public class TBaseGoods extends BaseEntity {
    private static final long serialVersionUID = 1L;

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

    /**
     * 物料编号
     */
    @Excel(name = "物料编号", headerColor = IndexedColors.RED)
    private String goodsId;

    /**
     * 物料名称
     */
    @Excel(name = "物料名称", headerColor = IndexedColors.RED)
    private String goodsName;

    /**
     * 物料简称 简码
     */
    private String goodsShortName;

    /**
     * 助记码
     */

    private String pyName;

    /**
     * 条形码
     */
    private String barcode;

    /**
     * 分类
     */
    @Excel(name = "物料分类", headerColor = IndexedColors.RED)
    private String goodsTypeId;

    /**
     * 规格
     */
    @Excel(name = "规格",  headerColor = IndexedColors.RED)
    private String specification;

    /**
     * 型号
     */
    private String model;

    /**
     * 计划单价（含税）
     */
    @Excel(name = "计划单价")
    private BigDecimal price;

    /**
     * 长
     */
    private BigDecimal glength;

    /**
     * 宽
     */
    private BigDecimal gwidth;

    /**
     * 高
     */
    private BigDecimal gheight;

    /**
     * 物料描述
     */
    @Excel(name = "物料描述")
    private String recoil;

    /**
     * 体积
     */
    private BigDecimal gvolume;

    /**
     * 商品重量单位 （字典表获取下拉）
     */
    private String scaleUnit;

    /**
     * 物料单位
     */
    @Excel(name = "物料单位", headerColor = IndexedColors.RED)
    private String unit;

    /**
     * 库存上限
     */
    @Excel(name = "库存上限")
    private BigDecimal warnUp;

    /**
     * 库存下限
     */
    @Excel(name = "库存下限")
    private BigDecimal warnDown;

    /**
     * 产地
     */
    private String produceArea;

    /**
     * 毛重
     */
    private BigDecimal grossWeight;

    /**
     * 重量
     */
    private BigDecimal netWeight;

    /**
     * 供应商编号
     */
    private String providerId;

    /**
     * 海关编码 （HS编码）
     */
    private String hsnumber;

    /**
     * ABC分类
     */
    @Excel(name = "ABC分类")
    private String abc;

    /**
     * 危险品   0否 1是
     */
    private String hazardous;

    /**
     * 存储条件
     */
    private String storageConditions;

    /**
     * 保质期（天数）
     */
    @Excel(name = "保质期")
    private BigDecimal period;

    /**
     * 保质期单位
     */
    @Excel(name = "保质期单位")
    private String periodUnit;

    /**
     * 增值税
     */
    private BigDecimal addtax;

    /**
     * 季节
     */
    private String season;

    /**
     * 关税税率
     */
    private BigDecimal tariffrate;

    /**
     * 状态
     */
    private String status;

    /**
     * 版本
     */
    private String version;

    /**
     * 图片
     */
    private String img;

    /**
     * 创建时间
     */

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createDate;

    /**
     * 修改时间
     */

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date updateDate;

    /**
     * 是否是批号管理 0否 1是
     */

    private String scFlag;

    /**
     * 计划金额
     */

    private BigDecimal costPrice;

    /**
     * 中标方
     */
    private String customerId;

    /**
     * 是否开放
     */
    private String isOpen;

    /**
     * 默认存储库区
     */
    private String defaultStorageAreaId;

    /**
     * 物料属性
     */
    private String materialCharacteristics;

    /**
     * 复检日期
     */
    private BigDecimal recheckDays;

    /**
     * 默认存储仓库
     */
    private String defaultStorageId;

    /**
     * 所属仓库
     */
    @Excel(name = "所属仓库")
    private String storageId;

    /**
     * 复检单生成提前天数
     */
    private BigDecimal reinspectionDays;

    /**
     * 是否需要取样领料
     */
    private String isSampling;

    /**
     * 物料查询
     */
    private String goodsSearch;
    /**
     * 选中的数据
     */

    private String goodsEpc;

    private String goodsTid;

    private String containerCode;

    public String getContainerCode() {
        return containerCode;
    }

    public void setContainerCode(String containerCode) {
        this.containerCode = containerCode;
    }

    public String getGoodsEpc() {
        return goodsEpc;
    }

    public void setGoodsEpc(String goodsEpc) {
        this.goodsEpc = goodsEpc;
    }

    public String getGoodsTid() {
        return goodsTid;
    }

    public void setGoodsTid(String goodsTid) {
        this.goodsTid = goodsTid;
    }

    private String[] selectIds;

    public String getGoodsSearch() {
        return goodsSearch;
    }

    public void setGoodsSearch(String goodsSearch) {
        this.goodsSearch = goodsSearch;
    }

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

    /**
     * 是否选中
     */
    private String isCheck;

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

    public Long getId() {
        return id;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsShortName(String goodsShortName) {
        this.goodsShortName = goodsShortName;
    }

    public String getGoodsShortName() {
        return goodsShortName;
    }

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

    public String getPyName() {
        return pyName;
    }

    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }

    public String getBarcode() {
        return barcode;
    }

    public void setGoodsTypeId(String goodsTypeId) {
        this.goodsTypeId = goodsTypeId;
    }

    public String getGoodsTypeId() {
        return goodsTypeId;
    }

    public void setSpecification(String specification) {
        this.specification = specification;
    }

    public String getSpecification() {
        return specification;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getModel() {
        return model;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setGlength(BigDecimal glength) {
        this.glength = glength;
    }

    public BigDecimal getGlength() {
        return glength;
    }

    public void setGwidth(BigDecimal gwidth) {
        this.gwidth = gwidth;
    }

    public BigDecimal getGwidth() {
        return gwidth;
    }

    public void setGheight(BigDecimal gheight) {
        this.gheight = gheight;
    }

    public BigDecimal getGheight() {
        return gheight;
    }

    public void setRecoil(String recoil) {
        this.recoil = recoil;
    }

    public String getRecoil() {
        return recoil;
    }

    public void setGvolume(BigDecimal gvolume) {
        this.gvolume = gvolume;
    }

    public BigDecimal getGvolume() {
        return gvolume;
    }

    public void setScaleUnit(String scaleUnit) {
        this.scaleUnit = scaleUnit;
    }

    public String getScaleUnit() {
        return scaleUnit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getUnit() {
        return unit;
    }

    public void setWarnUp(BigDecimal warnUp) {
        this.warnUp = warnUp;
    }

    public BigDecimal getWarnUp() {
        return warnUp;
    }

    public void setWarnDown(BigDecimal warnDown) {
        this.warnDown = warnDown;
    }

    public BigDecimal getWarnDown() {
        return warnDown;
    }

    public void setProduceArea(String produceArea) {
        this.produceArea = produceArea;
    }

    public String getProduceArea() {
        return produceArea;
    }

    public void setGrossWeight(BigDecimal grossWeight) {
        this.grossWeight = grossWeight;
    }

    public BigDecimal getGrossWeight() {
        return grossWeight;
    }

    public void setNetWeight(BigDecimal netWeight) {
        this.netWeight = netWeight;
    }

    public BigDecimal getNetWeight() {
        return netWeight;
    }

    public void setProviderId(String providerId) {
        this.providerId = providerId;
    }

    public String getProviderId() {
        return providerId;
    }

    public void setHsnumber(String hsnumber) {
        this.hsnumber = hsnumber;
    }

    public String getHsnumber() {
        return hsnumber;
    }

    public void setAbc(String abc) {
        this.abc = abc;
    }

    public String getAbc() {
        return abc;
    }

    public void setHazardous(String hazardous) {
        this.hazardous = hazardous;
    }

    public String getHazardous() {
        return hazardous;
    }

    public void setStorageConditions(String storageConditions) {
        this.storageConditions = storageConditions;
    }

    public String getStorageConditions() {
        return storageConditions;
    }

    public void setPeriod(BigDecimal period) {
        this.period = period;
    }

    public BigDecimal getPeriod() {
        return period;
    }

    public void setPeriodUnit(String periodUnit) {
        this.periodUnit = periodUnit;
    }

    public String getPeriodUnit() {
        return periodUnit;
    }

    public void setAddtax(BigDecimal addtax) {
        this.addtax = addtax;
    }

    public BigDecimal getAddtax() {
        return addtax;
    }

    public void setSeason(String season) {
        this.season = season;
    }

    public String getSeason() {
        return season;
    }

    public void setTariffrate(BigDecimal tariffrate) {
        this.tariffrate = tariffrate;
    }

    public BigDecimal getTariffrate() {
        return tariffrate;
    }

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

    public String getStatus() {
        return status;
    }

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

    public String getVersion() {
        return version;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getImg() {
        return img;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setScFlag(String scFlag) {
        this.scFlag = scFlag;
    }

    public String getScFlag() {
        return scFlag;
    }

    public void setCostPrice(BigDecimal costPrice) {
        this.costPrice = costPrice;
    }

    public BigDecimal getCostPrice() {
        return costPrice;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    public String getCustomerId() {
        return customerId;
    }

    public void setIsOpen(String isOpen) {
        this.isOpen = isOpen;
    }

    public String getIsOpen() {
        return isOpen;
    }

    public void setDefaultStorageAreaId(String defaultStorageAreaId) {
        this.defaultStorageAreaId = defaultStorageAreaId;
    }

    public String getDefaultStorageAreaId() {
        return defaultStorageAreaId;
    }

    public void setMaterialCharacteristics(String materialCharacteristics) {
        this.materialCharacteristics = materialCharacteristics;
    }

    public String getMaterialCharacteristics() {
        return materialCharacteristics;
    }

    public void setRecheckDays(BigDecimal recheckDays) {
        this.recheckDays = recheckDays;
    }

    public BigDecimal getRecheckDays() {
        return recheckDays;
    }

    public void setDefaultStorageId(String defaultStorageId) {
        this.defaultStorageId = defaultStorageId;
    }

    public String getDefaultStorageId() {
        return defaultStorageId;
    }

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

    public String getStorageId() {
        return storageId;
    }

    public void setReinspectionDays(BigDecimal reinspectionDays) {
        this.reinspectionDays = reinspectionDays;
    }

    public BigDecimal getReinspectionDays() {
        return reinspectionDays;
    }

    public void setIsSampling(String isSampling) {
        this.isSampling = isSampling;
    }

    public String getIsSampling() {
        return isSampling;
    }

    public void setIsCheck(String isCheck) {
        this.isCheck = isCheck;
    }

    public String getIsCheck() {
        return isCheck;
    }

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

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

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("goodsId", getGoodsId())
                .append("goodsName", getGoodsName())
                .append("goodsShortName", getGoodsShortName())
                .append("pyName", getPyName())
                .append("barcode", getBarcode())
                .append("goodsTypeId", getGoodsTypeId())
                .append("specification", getSpecification())
                .append("model", getModel())
                .append("price", getPrice())
                .append("glength", getGlength())
                .append("gwidth", getGwidth())
                .append("gheight", getGheight())
                .append("recoil", getRecoil())
                .append("gvolume", getGvolume())
                .append("scaleUnit", getScaleUnit())
                .append("unit", getUnit())
                .append("warnUp", getWarnUp())
                .append("warnDown", getWarnDown())
                .append("produceArea", getProduceArea())
                .append("grossWeight", getGrossWeight())
                .append("netWeight", getNetWeight())
                .append("providerId", getProviderId())
                .append("hsnumber", getHsnumber())
                .append("abc", getAbc())
                .append("hazardous", getHazardous())
                .append("storageConditions", getStorageConditions())
                .append("period", getPeriod())
                .append("periodUnit", getPeriodUnit())
                .append("addtax", getAddtax())
                .append("season", getSeason())
                .append("tariffrate", getTariffrate())
                .append("remark", getRemark())
                .append("status", getStatus())
                .append("version", getVersion())
                .append("img", getImg())
                .append("createBy", getCreateBy())
                .append("createDate", getCreateDate())
                .append("updateDate", getUpdateDate())
                .append("scFlag", getScFlag())
                .append("costPrice", getCostPrice())
                .append("customerId", getCustomerId())
                .append("isOpen", getIsOpen())
                .append("defaultStorageAreaId", getDefaultStorageAreaId())
                .append("updateBy", getUpdateBy())
                .append("materialCharacteristics", getMaterialCharacteristics())
                .append("recheckDays", getRecheckDays())
                .append("defaultStorageId", getDefaultStorageId())
                .append("storageId", getStorageId())
                .append("reinspectionDays", getReinspectionDays())
                .append("isSampling", getIsSampling())
                .append("isCheck", getIsCheck())
                .toString();
    }
}


















