package org.nl.acs.materialbase.domain;

import org.nl.acs.common.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @author jiaolm
* @date 2023-05-09
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("acs_materialbase")
public class Materialbase extends CommonModel<Materialbase> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "物料标识")
    @TableId(type= IdType.ASSIGN_ID)
    private String material_id;

    @ApiModelProperty(value = "物料编码")
    @NotBlank
    private String material_code;

    @ApiModelProperty(value = "物料名称 ")
    @NotBlank
    private String material_name;

    @ApiModelProperty(value = "规格")
    private String material_spec;

    @ApiModelProperty(value = "型号")
    private String material_model;

    @ApiModelProperty(value = "基本计量单位")
    @NotBlank
    private String base_unit_id;

    @ApiModelProperty(value = "工程图号")
    private String print_no;

    @ApiModelProperty(value = "长度单位")
    private String len_unit_id;

    @ApiModelProperty(value = "物料长度")
    private BigDecimal length;

    @ApiModelProperty(value = "物料宽度")
    private BigDecimal width;

    @ApiModelProperty(value = "物料高度")
    private BigDecimal height;

    @ApiModelProperty(value = "重量单位")
    private String weight_unit_id;

    @ApiModelProperty(value = "物料毛重")
    private BigDecimal gross_weight;

    @ApiModelProperty(value = "物料净重")
    private BigDecimal net_weight;

    @ApiModelProperty(value = "体积单位")
    private String cubage_unit_id;

    @ApiModelProperty(value = "物料体积")
    private BigDecimal cubage;

    @ApiModelProperty(value = "外径")
    private BigDecimal outer_diameter;

    @ApiModelProperty(value = "壁厚")
    private BigDecimal wall_thickness;

    @ApiModelProperty(value = "创建者")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_by;

    @ApiModelProperty(value = "创建时间")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_time;

    @ApiModelProperty(value = "修改者")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_by;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_time;

    @ApiModelProperty(value = "启用时间")
    private String is_used_time;

    @ApiModelProperty(value = "是否启用")
    @NotBlank
    private String is_used;

    @ApiModelProperty(value = "是否删除")
    @NotBlank
    private String is_delete;

    public void copyFrom(Materialbase source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
