package com.scm.contract.model.print;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.scm.contract.model.apply.LabelApplicationDetail;
import lombok.Data;

import java.util.Date;

/**
 * @author zuo
 * @date 2024/7/31 16:08
 */
@Data
@TableName(value = "reprint_code")
public class ReprintCode {

    /**
     * id
     */
    @TableId
    private String id;

    /**
     * labelApplicationId
     */
    @TableField(value = "`labelApplicationId`")
    private String labelApplicationId;

    /**
     * labelApplicationDetailId
     */
    @TableField(value = "`detailId`")
    private String detailId;

    /**
     * 是否打印 1打印中 2打印完成
     */
    @TableField(value = "`isPrint`")
    private Integer isPrint;

    /**
     * 打印狀態，答应机返回的状态id
     */
    @TableField(value = "`printStatus`")
    private Integer printStatus;

    /**
     * 需求数量
     */
    @TableField(value = "`number`")
    private Long number;

    /**
     * 标签类型id（对应字典表）
     */
    @TableField(value = "`tagTypeId`")
    private String tagTypeId;

    /**
     * 物料id
     */
    @TableField(value = "`materielId`")
    private String materielId;

    /**
     * 物料编码
     */
    @TableField(value = "`materielCode`")
    private String materielCode;

    /**
     * 物料描述
     */
    @TableField(value = "`materielDescribe`")
    private String materielDescribe;

    /**
     * 商品编码
     */
    @TableField(value = "`goodsCode`")
    private String goodsCode;


    /**
     * 商品名称
     */
    @TableField(value = "`goodsName`")
    private String goodsName;

    /**
     * 最小包装单元數量
     */
    @TableField(value = "`minimumPackingNumber`")
    private Integer minimumPackingNumber;

    /**
     * 最小包装单元单位
     */
    @TableField(value = "`minimumPackingUnit`")
    private String minimumPackingUnit;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy/MM/dd HH:mm:ss")
    @TableField(value = "`createTime`")
    private Date cTime;

    /**
     * 修改时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy/MM/dd HH:mm:ss")
    @TableField(value = "`updateTime`")
    private Date updateTime;

    public ReprintCode() {
    }

    public ReprintCode(LabelApplicationDetail detail, Long number) {
        this.id = IdWorker.getIdStr();
        this.labelApplicationId = detail.getLabelApplicationId();
        this.detailId = detail.getId();
        this.isPrint = 1;
        this.number = number;
        this.tagTypeId = detail.getTagTypeId();
        this.materielId = detail.getMaterielId();
        this.materielCode = detail.getMaterielCode();
        this.materielDescribe = detail.getMaterielDescribe();
        this.goodsCode = detail.getGoodsCode();
        this.goodsName = detail.getGoodsName();
        this.minimumPackingNumber = detail.getMinimumPackingNumber();
        this.minimumPackingUnit = detail.getMinimumPackingUnit();
    }
}
