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.Index;
import javax.persistence.Table;

/**
 * @Description :物料扩展属性
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2020-04-07
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_PART_EXTEND", indexes = {
        @Index(columnList = "ORGANIZE_CODE")
})
@Api("物料扩展属性表")
public class WmsPartExtend extends BaseBean {

    private static final long serialVersionUID = 353287580297379377L;
    @Column(name = "PART_NO")
    @ApiParam(value = "物料编码")
    private String partNo;

    @Column(name = "IS_SETTLE")
    @ApiParam(value = "是否内部交易")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    private Integer isSettle;

    @Column(name = "SETTLE_FACTORY_CODE")
    @ApiParam(value = "结算工厂")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String settleFactoryCode;

    @Column(name = "SETTLE_REC_ERP_WH")
    @ApiParam(value = "结算物料收货库存")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String settleRecErpWh;

    @Column(name = "VALUATION_CLASS")
    @ApiParam(value = "评估类")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String valuationClass;

    @Column(name = "VALUATION_CLASS_NAME")
    @ApiParam(value = "评估类描述")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String valuationClassName;

    @Column(name = "MC_CODE")
    @ApiParam(value = "MRP控制者")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String mcCode;

    @Column(name = "MC_NAME")
    @ApiParam(value = "MRP控制者名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String mcName;

    @Column(name = "IS_STEEL")
    @ApiParam(value = "是否为钢卷料")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "PART_STEEL_TYPE")
    private Integer isSteel;

    @Column(name = "IS_PACKAGE_MATERIAL")
    @ApiParam(value = "是否为包材")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    private Integer isPackageMaterial;

    @Column(name = "RECEIVING_TYPE")
    @ApiParam(value = "收货类型")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String receivingType;

    @Column(name = "LOT_CONTROL")
    @ApiParam(value = "批次控制")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String lotControl;

    @Column(name = "RANGE_LOT")
    @ApiParam(value = "批次容差")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer rangeLot;

    @Column(name = "QUALITY_RATE")
    @ApiParam(value = "质检率")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Double qualityRate;

    @Column(name = "ROUTING")
    @ApiParam(value = "工艺")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String routing;

    @Column(name = "PO_PART_MULTIPLE")
    @ApiParam(value = "乘倍包装")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String poPartMultiple;

    @Column(name = "RANGE_QTY_RATE")
    @ApiParam(value = "数量容差")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer rangeQtyRate;

    @Column(name = "RANGE_INVENTORY")
    @ApiParam(value = "盘点容差")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer rangeInventory;

    @Column(name = "PROD_LINE")
    @ApiParam(value = "产品类")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String prodLine;

    @Column(name = "SUPPLY_TYPE")
    @ApiParam(value = "供货类型")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "PART_SUPPLY_TYPE")
    private Integer supplyType;

    @Column(name = "RECEIVING_MODE")
    @ApiParam(value = "收货方式")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "PART_RECEIVING_METHOD")
    private Integer receivingMethod;

    @Column(name = "PRE_RECEIVING_DAY")
    @ApiParam(value = "预收货天数")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer preReceivingDay;

    @Column(name = "IS_WAY_CALCULATION")
    @ApiParam(value = "是否计算在途库存")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    private Integer isWayCalculation;

    @Column(name = "IS_AUTO_PURCHASE")
    @ApiParam(value = "是否自动采购")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    private Integer isAutoPurchase;

    @Column(name = "AUTO_PURCHASE_QTY")
    @ApiParam(value = "自动采购数量")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer autoPurchaseQty;

    @Column(name = "QC_SKIP_CYCLE")
    @ApiParam(value = "质检跳批周期")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer qcSkipCycle;

    @Column(name = "QC_PASS_COUNT")
    @ApiParam(value = "质检合格次数")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer qcPassCount;

    @Column(name = "LAST_QC_TIME")
    @ApiParam(value = "首次质检时间合格")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String lastQcTime;

    @Column(name = "CYCLE_IQC")
    @ApiParam(value = "周期内免检", example = "1")
    private Integer cycleIqc;

    public Integer getQcPassCount() {
        return this.qcPassCount == null ? 0 :this.qcPassCount.intValue();
    }
}
