package com.haha.entity;

import com.baomidou.mybatisplus.annotation.IdType;
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.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 设备补货单明细实体
 */
@Data
@TableName("t_replenishment_order_item")
public class ReplenishmentOrderItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 补货单ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long orderId;

    /**
     * 设备SN号
     */
    private String deviceId;

    /**
     * 商品ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long productId;

    /**
     * 商品编码
     */
    private String productCode;

    /**
     * 商品名称
     */
    private String productName;

    /**
     * 计划补货数量
     */
    private Integer plannedQuantity;

    /**
     * 实际补货数量
     */
    private Integer actualQuantity;

    /**
     * 补货前库存
     */
    private Integer beforeStock;

    /**
     * 补货后库存
     */
    private Integer afterStock;

    /**
     * 单价
     */
    private BigDecimal unitPrice;

    /**
     * 小计金额
     */
    private BigDecimal totalPrice;

    /**
     * 货架层号
     */
    private Integer shelfNum;

    /**
     * 货道位置
     */
    private String position;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    private LocalDateTime createTime;

    /**
     * 商品图片（非数据库字段，查询时填充）
     */
    @TableField(exist = false)
    private String productImage;
}
