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

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
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.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_outbound", autoResultMap = true)
@ApiModel(value="实体类：出库单", description="表名：t_psi_outbound")
public class OutboundResponse extends PageInfo<OutboundResponse> implements Serializable {

    /*
     * 数据库字段
     */

    /**
     * 出库单ID
     */
//    @TableId(value = "out_id", type = IdType.AUTO)
    @ApiModelProperty(value = "出库单ID")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String outId;
    /**
     * 库存数量
     */
    @Excel(name = "库存数量")
    @ApiModelProperty(value = "库存数量")
    private BigDecimal invQty;

    @Excel(name = "可用量")
    @ApiModelProperty(value = "可用量")
    private BigDecimal usableQty;
    /**
     * 小数位数 ([0-6]能改大，不能改小)
     */
    @ApiModelProperty(value = "小数位数 ([0-6]能改大，不能改小)")
    @TableField(exist = false)
    private Integer decimalPlaces;

    @Excel(name = "包装")
    @ApiModelProperty(value = "包装")
    private BigDecimal packBox;
    /**
     * 辅助单位标识
     */
    @Excel(name = "辅助单位标识")
    @ApiModelProperty(value = "辅助单位标识")
    private Boolean flgSubUnit;
    @Excel(name = "包装单位名称")
    @ApiModelProperty(value = "包装单位名称")
    private String subUnitName;

    @Excel(name = "基本单位名称")
    @ApiModelProperty(value = "基本单位名称")
    private String unitName;
    @Excel(name = "箱（出库中）")
    @ApiModelProperty(value = "箱（出库中）")
    private  Integer outingBox;

    @Excel(name = "片（出库中）")
    @ApiModelProperty(value = "片（出库中）")
    private  BigDecimal outingPiece;

    @Excel(name = "箱（已出库）")
    @ApiModelProperty(value = "箱（已出库）")
    private  Integer outBox;

    @Excel(name = "片（已出库）")
    @ApiModelProperty(value = "片（已出库）")
    private  BigDecimal outPiece;
    /**
     * 出库单号
     */
    @Excel(name = "出库单号")
    @ApiModelProperty(value = "出库单号")
    private String outNo;


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


    /**
     * 来源单ID (销售订单、入库退货)
     */
    @Excel(name = "来源单ID (销售订单、入库退货)")
    @ApiModelProperty(value = "来源单ID (销售订单、入库退货)")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String fromId;


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


    /**
     * 部门
     */
    @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 cusId;


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

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

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


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


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


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


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


    /**
     * 已出库退货数量
     */
    @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 outDate;
    /**
     * 修改时间 (触发器自动处理)
     */
    @ApiModelProperty(value = "修改时间 (触发器自动处理)")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(typeHandler = TimestampTypeHandler.class)
    private LocalDateTime opUpdateTime;

    /**
     * 备注
     */
    @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 List<AnnexVO> 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;


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


    /**
     * 有效标识 (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 = "自动办理标识")
    @ApiModelProperty(value = "自动办理标识")
    private Boolean flgAutoHandle;

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


    @ApiModelProperty(value = "出库原因")
    @TableField(typeHandler = UuidTypeHandler.class)
    private String outReason;


    @Excel(name = "出库原因")
    @ApiModelProperty(value = "出库原因")
    private String outReasonName;

    @Excel(name = "箱")
    @ApiModelProperty(value = "箱")
    private  Integer box;

    @Excel(name = "片")
    @ApiModelProperty(value = "片")
    private  BigDecimal piece;

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

    @ApiModelProperty(value = "来源单号")
    private String biznisNo;

    @ApiModelProperty(value = "组织名称")
    private String orgName;

    @ApiModelProperty(value = "员工姓名")
    private String staffName;

    @ApiModelProperty(value = "客户编码")
    private String cusCode;

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

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

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

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

    @ApiModelProperty(value = "客户来源")
    private String cusFrom;

    @ApiModelProperty(value = "客户来源名称")
    private String cusFromName;

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

    @ApiModelProperty(value = "制单员")
    private String makeStaffName;

    @ApiModelProperty(value = "出库状态")
    private String outStatusName;

    @ApiModelProperty(value = "出库类型")
    private String outTypeName;

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

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

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

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

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

    @ApiModelProperty(value = "销售渠道")
    private String salesChannel;

    @ApiModelProperty(value = "销售渠道")
    private String channelId;



    private BigDecimal sumOutAmt;


    private BigDecimal sumOutQty;



    private static final long serialVersionUID = 1L;

}
