package com.dk.mdm.model.vo.pur;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.dk.common.infrastructure.annotaiton.ExportTitle;
import com.dk.common.infrastructure.handler.*;
import com.dk.common.model.pojo.PageInfo;
import com.dk.mdm.model.response.pur.PurchaseItemResponse;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 *  采购订单
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ExportTitle("采购订单")
@TableName(value = "t_psi_purchase", autoResultMap = true)
@ApiModel(value="实体类：采购订单", description="表名：t_psi_purchase")
public class PurchaseVO extends PageInfo<PurchaseVO> implements Serializable {

    /*
     * 数据库字段
     */

    /**
     * 采购订单ID
     */
    //@TableId(value = "pur_id", type = IdType.AUTO)
    @ApiModelProperty(value = "采购订单ID")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String purId;


    /**
     * 采购订单号
     */
    @Excel(name = "采购订单号")
    @ApiModelProperty(value = "采购订单号")
    private String purNo;


    /**
     * 订单类型 (【系统字典】采购订单)
     */
    @Excel(name = "订单类型 (【系统字典】采购订单)")
    @ApiModelProperty(value = "订单类型 (【系统字典】采购订单)")
    private String purType;


    /**
     * 部门
     */
    @Excel(name = "部门")
    @ApiModelProperty(value = "部门")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String orgId;


    /**
     * 员工
     */
    @Excel(name = "员工")
    @ApiModelProperty(value = "员工")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String staffId;


    /**
     * 供应商
     */
    @Excel(name = "供应商")
    @ApiModelProperty(value = "供应商")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String supId;


    /**
     * 联系人
     */
    @Excel(name = "联系人")
    @ApiModelProperty(value = "联系人")
    private String contactName;


    /**
     * 联系电话
     */
    @Excel(name = "联系电话")
    @ApiModelProperty(value = "联系电话")
    private String contactPhone;


    /**
     * 取货日期
     */
    @Excel(name = "取货日期")
    @ApiModelProperty(value = "取货日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDate pickupDate;


    /**
     * 商品总数量
     */
    @Excel(name = "商品总数量")
    @ApiModelProperty(value = "商品总数量")
    private BigDecimal sumQuantity;


    /**
     * 标价合计
     */
    @Excel(name = "标价合计")
    @ApiModelProperty(value = "标价合计")
    private BigDecimal sumStandard;


    /**
     * 合计金额
     */
    @Excel(name = "合计金额")
    @ApiModelProperty(value = "合计金额")
    private BigDecimal sumAmount;


    /**
     * 采购折扣 (合计金额/标价合计)
     */
    @Excel(name = "采购折扣 (合计金额/标价合计)")
    @ApiModelProperty(value = "采购折扣 (合计金额/标价合计)")
    private BigDecimal purDiscount;


    /**
     * 订单状态 (【系统字典】)
     */
    @Excel(name = "订单状态 (【系统字典】)")
    @ApiModelProperty(value = "订单状态 (【系统字典】)")
    private String purStatus;


    @ApiModelProperty(value = "来源单id")
    @TableField(typeHandler = UuidListTypeHandler.class)
    private List<String> fromIds;
    /**
     *来源单号
     */

    @TableField(typeHandler = StringListTypeHandler.class)
    @ApiModelProperty(value = "来源单号")
    private List<String> fromNos;


    /**
     * 入库状态 (【系统字典】)
     */
    @Excel(name = "入库状态 (【系统字典】)")
    @ApiModelProperty(value = "入库状态 (【系统字典】)")
    private String intoStatus;


    /**
     * 入库中数量
     */
    @Excel(name = "入库中数量")
    @ApiModelProperty(value = "入库中数量")
    private BigDecimal intoingQty;


    /**
     * 入库中金额
     */
    @Excel(name = "入库中金额")
    @ApiModelProperty(value = "入库中金额")
    private BigDecimal intoingAmt;


    /**
     * 已入库数量
     */
    @Excel(name = "已入库数量")
    @ApiModelProperty(value = "已入库数量")
    private BigDecimal intoQty;


    /**
     * 已入库金额
     */
    @Excel(name = "已入库金额")
    @ApiModelProperty(value = "已入库金额")
    private BigDecimal intoAmt;


    /**
     * 已入库退货数量
     */
    @Excel(name = "已入库退货数量")
    @ApiModelProperty(value = "已入库退货数量")
    private BigDecimal returnQty;


    /**
     * 已入库退货金额
     */
    @Excel(name = "已入库退货金额")
    @ApiModelProperty(value = "已入库退货金额")
    private BigDecimal returnAmt;


    /**
     * 应付金额
     */
    @Excel(name = "应付金额")
    @ApiModelProperty(value = "应付金额")
    private BigDecimal amtPayable;


    /**
     * 还款金额
     */
    @Excel(name = "还款金额")
    @ApiModelProperty(value = "还款金额")
    private BigDecimal amtHandle;


    /**
     * 剩余应付
     */
    @Excel(name = "剩余应付")
    @ApiModelProperty(value = "剩余应付")
    private BigDecimal amtResidue;


    /**
     * 备注
     */
    @Excel(name = "备注")
    @ApiModelProperty(value = "备注")
    private String remarks;


    /**
     * 附件 (index（显示顺序）、name（文件名）、path（路径）、type（类型）、time（上传时间）...)
     */
    @Excel(name = "附件 (index（显示顺序）、name（文件名）、path（路径）、type（类型）、time（上传时间）...)")
    @ApiModelProperty(value = "附件 (index（显示顺序）、name（文件名）、path（路径）、type（类型）、time（上传时间）...)")
    @TableField(typeHandler = JsonTypeHandler.class)
    private JSONArray annexPaths;


    /**
     * 制单员
     */
    @Excel(name = "制单员")
    @ApiModelProperty(value = "制单员")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String makeStaff;


    /**
     * 制单时间
     */
    @Excel(name = "制单时间")
    @ApiModelProperty(value = "制单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime makeTime;


    /**
     * 有效标识 (1：正常 0：停用)
     */
    @Excel(name = "有效标识 (1：正常 0：停用)")
    @ApiModelProperty(value = "有效标识 (1：正常 0：停用)")
    private Boolean flgValid;


    /**
     * 企业ID
     */
    @Excel(name = "企业ID")
    @ApiModelProperty(value = "企业ID")
    private Integer cpId;


    /**
     * 创建时间 (触发器自动处理)
     */
    @Excel(name = "创建时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
    @ApiModelProperty(value = "创建时间 (触发器自动处理)")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opCreateTime;


    /**
     * 创建用户 (触发器自动处理)
     */
    @Excel(name = "创建用户 (触发器自动处理)")
    @ApiModelProperty(value = "创建用户 (触发器自动处理)")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String opCreateUserId;


    /**
     * 修改时间 (触发器自动处理)
     */
    @Excel(name = "修改时间 (触发器自动处理)", format = "yyyy-MM-dd HH:mm:ss", width = 20)
    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opUpdateTime;


    /**
     * 修改用户 (触发器自动处理)
     */
    @Excel(name = "修改用户 (触发器自动处理)")
    @ApiModelProperty(value = "修改用户 (触发器自动处理)")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String opUpdateUserId;


    /**
     * 数据操作应用 (触发器自动处理)
     */
    @Excel(name = "数据操作应用 (触发器自动处理)")
    @ApiModelProperty(value = "数据操作应用 (触发器自动处理)")
    private String opAppCode;


    /**
     * 数据时间戳 (触发器自动处理)
     */
    @Excel(name = "数据时间戳 (触发器自动处理)")
    @ApiModelProperty(value = "数据时间戳 (触发器自动处理)")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opTimestamp;


    /**
     * 数据操作数据库用户 (触发器自动处理)
     */
    @Excel(name = "数据操作数据库用户 (触发器自动处理)")
    @ApiModelProperty(value = "数据操作数据库用户 (触发器自动处理)")
    private String opDbUser;

    /**
     * 仓库
     */
    @Excel(name = "仓库")
    @ApiModelProperty(value = "仓库ID")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String whId;

    @ApiModelProperty(value = "采购订单明细")
    private List<PurchaseItemVO> purchaseItemVOList;

    @ApiModelProperty(value = "删除采购订单明细")
    private List<PurchaseItemVO> deletePurchaseItemList;

    @ApiModelProperty(value = "修改采购订单明细")
    private List<PurchaseItemVO> editPurchaseItemList;


    /*
     * 相关属性
     * @TableField(exist = false)
     */

    /*
     * 关联属性 + 查询条件
     * @TableField(exist = false)
     */


    private static final long serialVersionUID = 1L;

}
