package com.scm.contract.model.apply;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.set.direwolf.core.mybatis.BaseEntity;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
 * @author zuo
 * @date 2024/6/4 17:56
 */

@TableName(value = "label_application_detail")
@Data
public class LabelApplicationDetail extends BaseEntity<LabelApplicationDetail, String> {

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

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

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

    /**
     * 标签类型名称
     */
    @TableField(exist = false)
    private String tagTypeName;

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

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

    /**
     * 单价
     */
    @TableField(value = "`unitPrice`")
    private Double unitPrice;

    /**
     * 物料编码
     */
    @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;


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

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

    /**
     * 预期收货时间
     */
    @TableField(value = "`expectedReceiptDate`")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy/MM/dd HH:mm:ss")
    private Date expectedReceiptDate;

    /**
     * 申领人员名子
     */
    @TableField(value = "`applicantName`")
    private String applicantName;

    /**
     * 配送方式id
     */
    @TableField(value = "`deliveryMethodId`")
    private String deliveryMethodId;

    /**
     * 发货单号
     */
    @TableField(value = "`deliveryOrderNo`")
    private String deliveryOrderNo;

    /**
     * 收件人
     */
    @TableField(value = "`recipient`")
    private String recipient;


    /**
     * 收货地址
     */
    @TableField(value = "`address`")
    private String address;

    /**
     * 电话
     */
    @TableField(value = "`phone`")
    private String phone;


    /**
     * 邮箱
     */
    @TableField(value = "`mail`")
    private String mail;

    /**
     * 是否已经发放
     */
    @TableField(value = "`isSend`")
    private Boolean isSend;

    /**
     * 打印时间
     */
    @TableField
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy/MM/dd HH:mm:ss")
    private Date printTime;

    /**
     * 打印狀態，答应机返回的状态名称
     */
    @TableField(exist = false)
    private String printStatusName;

    /**
     * 供应商名称
     */
    @TableField(exist = false)
    private String providerName;

    /**
     * 流水范围
     */
    @TableField(exist = false)
    private List<String> serialNumberRange;

    /**
     * 总价
     */
    @TableField(exist = false)
    private Double amount;

    /**
     * 配送方式名称
     */
    @TableField(exist = false)
    private String deliveryMethodName;

    /**
     * 是否重打中
     */
    @TableField(exist = false)
    private Boolean isReprinting;

    public LabelApplicationDetail() {
    }

    public LabelApplicationDetail(LabelApplicationDetail oldDetail, LabelApplicationDetail detail, boolean isSend) {
        this.id = oldDetail.getId();
        this.labelApplicationId = oldDetail.getLabelApplicationId();
        this.tagTypeId = oldDetail.getTagTypeId();
        this.tagTypeName = oldDetail.getTagTypeName();
        this.materielId = oldDetail.getMaterielId();
        this.number = oldDetail.getNumber();
        this.unitPrice = oldDetail.getUnitPrice();
        this.materielCode = oldDetail.getMaterielCode();
        this.materielDescribe = oldDetail.getMaterielDescribe();
        this.goodsCode = oldDetail.getGoodsCode();
        this.goodsName = oldDetail.getGoodsName();
        this.minimumPackingNumber = oldDetail.getMinimumPackingNumber();
        this.minimumPackingUnit = oldDetail.getMinimumPackingUnit();
        this.isPrint = oldDetail.getIsPrint();
        this.printStatus = oldDetail.getPrintStatus();
        this.expectedReceiptDate = oldDetail.getExpectedReceiptDate();
        this.applicantName = oldDetail.getApplicantName();
        this.deliveryMethodId = detail.getDeliveryMethodId();
        this.deliveryOrderNo = detail.getDeliveryOrderNo();
        this.recipient = detail.getRecipient();
        this.address = oldDetail.getAddress();
        this.phone = oldDetail.getPhone();
        this.mail = oldDetail.getMail();
        this.isSend = isSend;
        this.printStatusName = oldDetail.getPrintStatusName();
        this.providerName = oldDetail.getProviderName();
        this.serialNumberRange = oldDetail.getSerialNumberRange();
        this.amount = oldDetail.getAmount();
        this.deliveryMethodName = oldDetail.getDeliveryMethodName();
    }
}
