package com.xunhong.erp.turbo.biz.infrastructure.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.xunhong.erp.turbo.api.biz.dto.enums.PurchaseOrderPricingMethodEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.PurchaseOrderStateEnum;
import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author shenyifei
 */
@Data
@TableName(value = "purchase_order")
@EqualsAndHashCode(callSuper = true)
public class PurchaseOrderDO extends BaseDO<PurchaseOrderDO> {

	/**
	 * 订单ID
	 */
	@TableId(value = "order_id", type = IdType.ASSIGN_ID)
	private Long orderId;

	/**
	 * 订单编号
	 */
	@TableField(value = "order_sn")
	private String orderSn;

	/**
	 * 步骤标识
	 */
	@TableField(value = "active")
	private Integer active;

	/**
	 * 产地负责人
	 */
	@TableField(value = "origin_principal")
	private String originPrincipal;

	/**
	 * 报价方式：1_按毛重报价；2_按净重报价；
	 */
	@TableField(value = "pricing_method")
	private PurchaseOrderPricingMethodEnum pricingMethod;

	/**
	 * 销售金额
	 */
	@TableField(value = "sale_amount")
	private BigDecimal saleAmount;

	/**
	 * 包装费
	 */
	@TableField(value = "package_fee")
	private BigDecimal packageFee;

	/**
	 * 平均单价(元/斤)
	 */
	@TableField(value = "avg_unit_price")
	private BigDecimal avgUnitPrice;

	/**
	 * 是否返点
	 */
	@TableField(value = "rebate")
	private Boolean rebate;

	/**
	 * 毛重(斤)
	 */
	@TableField(value = "gross_weight")
	private BigDecimal grossWeight;

	/**
	 * 净重(斤)
	 */
	@TableField(value = "net_weight")
	private BigDecimal netWeight;

	/**
	 * 成本合计
	 */
	@TableField(value = "total_cost")
	private BigDecimal totalCost;

	/**
	 * 运费
	 */
	@TableField(value = "freight_charge")
	private BigDecimal freightCharge;

	/**
	 * 瓜农数量
	 */
	@TableField(value = "supplier_count")
	private Integer supplierCount;

	/**
	 * 订单状态: 0-草稿, 1-待审核, 2-待老板审核, 3-已发货(待付款), 4-已付款, 5-已完结
	 */
	@TableField(value = "state")
	private PurchaseOrderStateEnum state;

	/**
	 * 备注
	 */
	@TableField(value = "remark")
	private String remark;

	/**
	 * 创建人ID
	 */
	@TableField(value = "created_by")
	private Long createdBy;

	/**
	 * 创建人姓名
	 */
	@TableField(value = "created_by_name")
	private String createdByName;

	@TableField(exist = false)
	private OrderVehicleDO orderVehicleDO;

	@TableField(exist = false)
	private OrderDealerDO orderDealerDO;

	@TableField(exist = false)
	private OrderCompanyDO orderCompanyDO;

	@TableField(exist = false)
	private OrderRebateDO orderRebateDO;

	@TableField(exist = false)
	private List<OrderSupplierDO> orderSupplierDOList;

	@TableField(exist = false)
	private List<OrderCostDO> orderCostDOList;
}

