package com.dk.mdm.model.response.ivt;

import cn.afterturn.easypoi.excel.annotation.Excel;
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.JsonTypeHandler;
import com.dk.common.infrastructure.handler.TimestampTypeHandler;
import com.dk.common.infrastructure.handler.UuidTypeHandler;
import com.dk.common.model.pojo.PageInfo;
import com.dk.common.model.vo.AnnexVO;
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
@NoArgsConstructor
@AllArgsConstructor
@ExportTitle("入库单")
public class InboundResponse  {

    /*
     * 数据库字段
     */

    /**
     * 入库单ID
     */
    @ApiModelProperty(value = "入库单ID")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String intoId;


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

    /**
     * 入库类型 (【系统字典】采购入库、销退入库、其他入库)
     */
    @Excel(name = "入库类型 (【系统字典】采购入库、销退入库、其他入库)")
    @ApiModelProperty(value = "入库类型 (【系统字典】采购入库、销退入库、其他入库)")
    private String intoType;


    /**
     * 来源单ID (采购订单、出库退货)
     */
    @ApiModelProperty(value = "来源单ID (采购订单、出库退货)")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String fromId;


    /**
     * 来源单号
     */
    @Excel(name = "来源单号")
    @ApiModelProperty(value = "来源单号")
    private String fromNo;


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

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

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

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

    /**
     * 收货仓库
     */
    @Excel(name = "仓库")
    @ApiModelProperty(value = "收货仓库")
    private String whName;

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


    /**
     * 客户
     */
    @ApiModelProperty(value = "客户")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String cusId;


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


    /**
     * 入库状态 (【系统字典】)
     */
    @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 = "入库日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDate intoDate;


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


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


    /**
     * 制单员
     */
    @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;


    /**
     * 应收款单
     */
    @ApiModelProperty(value = "应收款单")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String receivableId;


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


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


    @ApiModelProperty(value = "自动办理标识")
    private Boolean flgAutoHandle;

    @ApiModelProperty(value = "自动办理参数")
    private Boolean flgHandleSetting;

    @Excel(name = "无货出库自动入库标识")
    @ApiModelProperty(value = "无货出库自动入库标识")
    private Boolean flgNegInto;



    @Excel(name = "入库原因")
    @ApiModelProperty(value = "入库原因")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String intoReason;


    /**
     * 组织名称
     */
    @Excel(name = "组织名称",width = 20, type = 10)
    @ApiModelProperty(value = "组织名称")
    private String orgName;

    /**
     * 员工名称
     */
    @Excel(name = "员工名称", width = 20, type = 10)
    @ApiModelProperty(value = "员工名称")
    private String staffName;

    /**
     * 员工名称
     */
    @Excel(name = "制单员", width = 20, type = 10)
    @ApiModelProperty(value = "制单员")
    private String makeStaffName;


    /**
     * 供应商名称
     */
    @Excel(name = "供应商名称")
    @ApiModelProperty(value = "供应商名称")
    private String supplierName;

    /**
     * 供应商名称
     */
    @Excel(name = "入库状态名称")
    @ApiModelProperty(value = "入库状态名称")
    private String intoStatusName;

    /**
     * 入库类型名称
     */
    @Excel(name = "入库类型名称")
    @ApiModelProperty(value = "入库类型名称")
    private String intoTypeName;


    @ApiModelProperty(value = "入库单明细")
    private List<InboundItemResponse> goodsList;

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

    /*
     * 关联属性 + 查询条件
     * @TableField(exist = false)
     */
    @ApiModelProperty(value = "入库单明细")
    private List<InboundItemResponse> inboundItemList;


    @Excel(name = "入库原因")
    @ApiModelProperty(value = "入库原因")
    private String intoReasonName;

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

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

    @Excel(name = "客户电话")
    @ApiModelProperty(value = "客户电话")
    private String cusPhone;

    @ApiModelProperty(value = "行政区划 (a1：省 a2：市 a3：区)")
    @TableField(typeHandler = JsonTypeHandler.class)
    private JSONObject addressArea;

    @Excel(name = "小区或POI")
    @ApiModelProperty(value = "小区或POI")
    private String addressName;

    @Excel(name = "门牌号")
    @ApiModelProperty(value = "门牌号")
    private String addressNo;

    @ApiModelProperty(value = "地址坐标(gcj02) (LAT：纬度的值 LON：经度的值)")
    @TableField(typeHandler = JsonTypeHandler.class)
    private JSONObject addressGcj02;

    @Excel(name = "详细地址")
    @ApiModelProperty(value = "详细地址")
    private String addressFull;

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

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

    @Excel(name = "销售渠道")
    @ApiModelProperty(value = "销售渠道")
    private String channelName;


    @Excel(name = "客户来源")
    @ApiModelProperty(value = "客户来源")
    private String cusFromName;

    @ApiModelProperty(value = "供应商退货地址")
    private String returnAddress;

    @ApiModelProperty(value = "供应商")
    private String supName;

    @ApiModelProperty(value = "是否付款")
    private Boolean paymentFlag;


    private BigDecimal purSumAmount;

    private BigDecimal purReturnAmt;


    private static final long serialVersionUID = 1L;

}
