package org.nl.acs.produceshiftorder.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_produceshiftorder")
public class Produceshiftorder extends CommonModel<Produceshiftorder> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "工单标识")
    @TableId(type= IdType.ASSIGN_ID)
    private String order_id;

    @ApiModelProperty(value = "工单编码")
    @NotBlank
    private String order_code;

    @ApiModelProperty(value = "设备编码")
    private String device_code;

    @ApiModelProperty(value = "工单状态")
    @NotBlank
    private String order_status;

    @ApiModelProperty(value = "下料数量")
    @NotNull
    private BigDecimal qty;

    @ApiModelProperty(value = "产品编码")
    @NotBlank
    private String product_code;

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

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

    @ApiModelProperty(value = "物料标识")
    @NotBlank
    private String material_uuid;

    @ApiModelProperty(value = "客户编码")
    private String cust_code;

    @ApiModelProperty(value = "客户名称")
    private String cust_name;

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

    @ApiModelProperty(value = "熔池")
    private String molten_pool;

    @ApiModelProperty(value = "重量")
    private String weight;

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

    @ApiModelProperty(value = "创建时间")
    @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 = "是否删除")
    @NotBlank
    private String is_deleted;

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