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


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 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 : gcj
 * @CreateDate : 2019-12-06 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_CAR")
@Api("车辆信息")
public class WmsCar extends BaseBean {

    private static final long serialVersionUID = -905792638347428695L;
    @Column(name = "CAR_NO")
    @ApiParam(value = "车牌号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String carNo;

    @Column(name = "CAR_DESC")
    @ApiParam(value = "车辆描述")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String carDesc;

    @Column(name = "MAX_CAPACITY")
    @ApiParam(value = "载重量(KG)")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String maxCapacity;

    @Column(name = "DRIVER_NO")
    @ApiParam(value = "默认驾驶员")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsTmsDriver",
            searchColumnName = "driverNo,driverName", listColumnName = "driverNo,driverName", explicitColumnName = "driverNo")
    private String driverNo;

    @Column(name = "PHONE")
    @ApiParam(value = "车主电话")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String phone;

    @Column(name = "VENDOR_NO")
    @ApiParam(value = "所属供应商")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.BasVendor",
            searchColumnName = "vendorNo,vendorName", listColumnName = "vendorNo,vendorName", explicitColumnName = "vendorNo")
    private String vendorNo;

    @Column(name = "DRIVER_NAME_RDD")
    @ApiParam("驾驶员名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsTmsDriver",
            searchColumnName = "driverNo,driverName", listColumnName = "driverNo,driverName", explicitColumnName = "driverName")
    private String driverNameRdd;

    @Column(name = "VENDOR_NAME_RDD")
    @ApiParam(value = "供应商名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.BasVendor",
            searchColumnName = "vendorNo,vendorName", listColumnName = "vendorNo,vendorName", explicitColumnName = "vendorName")
    private String vendorNameRdd;

    @Column(name = "MAP_LOCATION")
    @ApiParam("经纬度")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT, isRequire = 2)
    private String mapLocation;

    @Column(name = "VOLUME", columnDefinition = "decimal(18,8)")
    @ApiParam(value = "容积", example = "1")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER, isRequire = 2)
    private Double volume;

    @Transient
    @ApiParam(value = "需要(辆)")
    private Integer carQty;

    @Transient
    @ApiParam(value = "车辆序号")
    private Integer seq;

    public WmsCar() {
    }

    public WmsCar(WmsCar car, Integer seq, String carDesc) {
        this.id = car.id;
        this.organizeCode = car.organizeCode;
        this.volume = car.volume;
        this.carNo = seq.toString();
        this.carDesc = carDesc;
    }
}
