package cn.estsh.i3plus.pojo.wms.bean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.annotation.DynamicField;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @Description : 物流费用记录
 * @Reference :
 * @Author :QianHuaSheng
 * @CreateDate : 2020-05-15 3:18 下午
 * @Modify:
 **/
@Data
@Entity
@Table(name = "WMS_LOGISTIC_EXPENSE_RECORDS")
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api(value = "物流费用记录")
public class WmsLogisticExpenseRecords extends BaseBean {
    private static final long serialVersionUID = 6512855224667052310L;

    @Column(name = "ORGANIZE_NAME")
    @ApiParam(value = "工厂名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String organizeName;

    @Column(name = "ORDER_NO")
    @ApiParam("单据号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String orderNo;

    @Column(name = "SHIPPING_FLAG")
    @ApiParam(value = "发往地")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String shippingFlag;

    @Column(name = "BUSI_TYPE")
    @ApiParam("业务类型")
    @AnnoOutputColumn(refClass = WmsEnumUtil.OUT_MOVEMENT_BUSI_TYPE.class, refForeignKey = "value", value = "description")
    public Integer busiType;

    @Column(name = "TRANSPORT_TYPE")
    @ApiParam(value = "运输方式")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRANSPORT_TYPE")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRANSPORT_TYPE.class, refForeignKey = "value", value = "description")
    private Integer transportType;

    @Column(name = "sum")
    @ApiParam(value = "总运输费用")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private Double sum;

    @Column(name = "LOGISTICS_VENDOR_NO")
    @ApiParam(value = "物流供应商")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String logisticsVendorNo;

    @Transient
    @ApiParam(value = "状态", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.MASTER_ORDER_STATUS.class)
    public Integer orderStatus;

    public WmsLogisticExpenseRecords(WmsDocMovementMaster docMovementMaster) {
//        this.organizeName = docMovementMaster.getorganizeName;
        this.orderNo = docMovementMaster.getOrderNo();
        this.organizeCode = docMovementMaster.getOrganizeCode();
        this.shippingFlag = docMovementMaster.getFlagNo();
        this.busiType = docMovementMaster.getBusiType();
        this.transportType = docMovementMaster.getTransportType();
        this.logisticsVendorNo = docMovementMaster.getLogisticsVendorNo();
    }

    public WmsLogisticExpenseRecords() {
    }
}
