package com.ruoyi.web.sales.domain;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.web.base.domain.base.Base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

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

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sales_order")
@ApiModel(value = "SalesOrder对象", description = "销售订单")
public class SalesOrder extends Base {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "单据日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "单据日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date documentDate;

    @ApiModelProperty(value = "单据编号")
    @Excel(name = "单据编号")
    private String orderNum;

    @ApiModelProperty(value = "销售日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "销售日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date saleDate;

    @ApiModelProperty(value = "客户编号")
    @Excel(name = "客户编号")
    private String customerNum;

    @ApiModelProperty(value = "客户名称")
    @Excel(name = "客户名称")
    private String customerName;

    @ApiModelProperty(value = "市场编号")
    @Excel(name = "市场编号")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String marketNum;

    @ApiModelProperty(value = "物流线编号")
    @Excel(name = "物流线编号")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String lineNum;

    @ApiModelProperty(value = "业务员编号")
    @Excel(name = "业务员编号")
    private String employeeNum;

    /** 自 base_employee 带出，不落库 */
    @TableField(exist = false)
    @ApiModelProperty(value = "业务员姓名")
    @Excel(name = "业务员")
    private String employeeName;

    /** 自 base_customer 带出，不落库 */
    @TableField(exist = false)
    @ApiModelProperty(value = "应收客户")
    @Excel(name = "应收客户")
    private String receivableCustomer;

    @ApiModelProperty(value = "总计金额")
    @Excel(name = "总计金额")
    @TableField(value = "total_amount", insertStrategy = FieldStrategy.NOT_NULL, updateStrategy = FieldStrategy.NOT_NULL)
    private String totalAmount;

    @ApiModelProperty(value = "备注1")
    @Excel(name = "备注1")
    private String remark1;

    @ApiModelProperty(value = "审核状态")
    @Excel(name = "审核状态", readConverterExp = "0=未审核,1=已审核")
    private Integer auditStatus;

    @TableField(exist = false)
    @ApiModelProperty(value = "货品清单")
    private List<SalesOrderGoods> goods;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "单据日期开始")
    private Date documentDateStart;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "单据日期结束")
    private Date documentDateEnd;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "销售日期开始")
    private Date saleDateStart;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "销售日期结束")
    private Date saleDateEnd;
}
