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;

/**
 * @Description : 物流运费审批
 * @Reference :
 * @Author :QianHuaSheng
 * @CreateDate : 2020-05-14 11:41 上午
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_LOGISTICS_FREIGHT_APPROVAL")
@Api("物流运费审批")
public class WmsLogisticsFreightApproval extends BaseBean {
    private static final long serialVersionUID = -1385266737512278984L;

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

    @Column(name = "BUSI_TYPE")
    @ApiParam("单据类型")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "OUT_MOVEMENT_BUSI_TYPE")
    @AnnoOutputColumn(refClass = WmsEnumUtil.OUT_MOVEMENT_BUSI_TYPE.class)
    private Integer busiType;

    @Column(name = "APPROVAL_STATUS")
    @ApiParam("审批状态")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "APPROVAL_STATUS")
    @AnnoOutputColumn(refClass = WmsEnumUtil.APPROVAL_STATUS.class)
    private Integer approvalStatus;

    @Column(name = "SUPPLY_WAREHOUSE")
    @ApiParam("供货仓库")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String supplyWarehouse;

    @Column(name = "DEMAND_WAREHOUSE")
    @ApiParam("需求仓库")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String demandWarehouse;

    @Column(name = "CUST_NO")
    @ApiParam("客户代码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String custNo;

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

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

    @Column(name = "PLACE_OF_ORIGIN_CODE")
    @ApiParam(value = "客户发出地代码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String placeOfOriginCode;

    @Column(name = "PLACE_OF_ORIGIN_DESC")
    @ApiParam(value = "客户发出地描述")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String placeOfOriginDesc;

    @Column(name = "CUST_DELIVERY_CODE")
    @ApiParam(value = "客户发往地代码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String custDeliveryCode;

    @Column(name = "CUST_DELIVERY_DESC")
    @ApiParam(value = "客户发往地描述")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String custDeliveryDesc;

    @Column(name = "is_urgent")
    @ApiParam(value = "是否紧急")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class)
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    private Integer isUrgent;

    @Column(name = "SRC_WH_NO")
    @ApiParam("源仓库代码")
    public String assignSrcWhNo;

    @Column(name = "REMAKE")
    @ApiParam("备注")
    public String remake;

    @Column(name = "DEST_WH_NO")
    @ApiParam("目标仓库代码")
    public String assignDestWhNo;

    @Column(name = "FLAG_NO")
    @ApiParam(value = "客户发往地编号")
    private String flagNo;

    //正常运输 和非正常运输
    @Column(name = "BUSINESS_TYPE")
    @ApiParam(value = "运输方式")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "NORMAL_ABNORMAL")
    @AnnoOutputColumn(refClass = WmsEnumUtil.NORMAL_ABNORMAL.class)
    private Integer businessType;

    public WmsLogisticsFreightApproval(WmsDocMovementMaster docMovementMaster) {
        this.orderNo = docMovementMaster.getOrderNo();
        this.organizeCode = docMovementMaster.getOrganizeCode();
        this.busiType = docMovementMaster.getBusiType();
        this.organizeCode = docMovementMaster.getOrganizeCode();
        this.approvalStatus = WmsEnumUtil.APPROVAL_STATUS.APPROVE_PROCESSING.getValue();
        this.supplyWarehouse = docMovementMaster.getAssignSrcWhNo();
        this.demandWarehouse = docMovementMaster.getAssignDestWhNo();
        this.custNo = docMovementMaster.getCustNo();
        this.logisticsVendorNo = docMovementMaster.getLogisticsVendorNo();
        this.transportType = docMovementMaster.getTransportType();
        this.placeOfOriginCode = docMovementMaster.getFlagNo();
        this.custDeliveryCode = docMovementMaster.getAssignSrcWhNo();
        this.isUrgent = WmsEnumUtil.TRUE_OR_FALSE.FALSE.getValue();
        this.assignSrcWhNo = docMovementMaster.getAssignSrcWhNo();
        this.assignDestWhNo = docMovementMaster.getAssignDestWhNo();
        this.flagNo = docMovementMaster.getFlagNo();
        this.businessType = docMovementMaster.getBusinessType();
    }

    public WmsLogisticsFreightApproval() {

    }
}
