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.ColumnDefault;
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 : puxiao.liao
 * @CreateDate : 2020-05-23 11:00
 * @Modify:
 **/
@Data
@Entity
@Table(name = "WMS_SERIAL_SN", indexes = {
        @Index(columnList = "BATCH_NO"),
        @Index(columnList = "STOCK_SN"),
        @Index(columnList = "PART_NO"),
        @Index(columnList = "SERIAL_SN")
})
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api(value = "产品条码信息", description = "产品条码信息")
public class WmsSerialSn extends BaseBean {

    private static final long serialVersionUID = -2540413299274882785L;

    @Column(name = "BATCH_NO")
    @ApiParam(value = "BATCH号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String batchNo;

    @Column(name = "STOCK_SN")
    @ApiParam(value = "库存条码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String stockSn;

    @Column(name = "SERIAL_SN")
    @ApiParam(value = "产品条码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String serialSn;

    @Column(name = "SRC_STOCK_SN")
    @ApiParam(value = "源库存条码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String srcStockSn;

    @Column(name = "BH_TYPE")
    @ApiParam(value = "BH类型")
    @AnnoOutputColumn(refClass = WmsEnumUtil.FG_INSTOCK_SN_TYPE.class)
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isRequire = 2, dataSrc = "FG_INSTOCK_SN_TYPE")
    private Integer bhType;

    @Column(name = "PART_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.WmsPart",
            searchColumnName = "partNo,partName", listColumnName = "partNo,partName", explicitColumnName = "partNo")
    private String partNo;

    @Column(name = "PART_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.WmsPart",
            searchColumnName = "partNo,partName", listColumnName = "partNo,partName", explicitColumnName = "partName")
    private String partNameRdd;


    @Column(name = "QTY", columnDefinition = "decimal(18,8)", nullable = false)
    @ColumnDefault("0")
    @ApiParam(value = "数量", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER, isRequire = 2)
    private Double qty;

    @Column(name = "PACKAGE_NO")
    @ApiParam(value = "包装编号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String packageNo;

    @Column(name = "LOT_NO")
    @ApiParam("生产批次")
    private String lotNo;

    public WmsSerialSn() {

    }

    public WmsSerialSn(String organizeCode, String batchNo, String stockSn, String partNo, String partNameRdd, String serialSn, String createUser, String createDatetime, String modifyUser, String modifyDatetime) {
        this.organizeCode = organizeCode;
        this.batchNo = batchNo;
        this.stockSn = stockSn;
        this.partNo = partNo;
        this.partNameRdd = partNameRdd;
        this.serialSn = serialSn;
        this.createUser = createUser;
        this.createDatetime = createDatetime;
        this.modifyUser = modifyUser;
        this.modifyDatetime = modifyDatetime;
    }
}
