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;
import java.util.List;


/**
 * @Description : 运输规则表
 * @Reference :
 * @Author : puxiao.liao
 * @CreateDate : 2020-03-06 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_TRANSPORT_RULE")
@Api("运输规则表")
public class WmsTransportRule extends BaseBean {
    private static final long serialVersionUID = 6120257805546343124L;

    @Column(name = "COMMAND_TYPE")
    @ApiParam(value = "指令类型")
    @AnnoOutputColumn(refClass = WmsEnumUtil.IMPORT_ORDER_TYPE.class, refForeignKey = "value", value = "description")
    private String commandType;

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

    @Column(name = "BUSI_SCENE_TYPE")
    @ApiParam("业务场景")
    @AnnoOutputColumn(refClass = WmsEnumUtil.BUSI_SCENE_TYPE.class, refForeignKey = "value", value = "description")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.URL,
            isRequire = 2, dataSrc = "/wms/wms-enum/dictionary/code?code=BUSI_SCENE_TYPE_DICTIONARY", listColumnName = "name", explicitColumnName = "dictionaryValue")
    public Integer busiSceneType;


    @Column(name = "SRC_AREA_NO")
    @ApiParam("发货库存地")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    public String srcAreaNo;


    @Column(name = "DEST_AREA_NO")
    @ApiParam("目标库存地")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    public String destAreaNo;

    @Column(name = "OUT_VENDOR_NO")
    @ApiParam("委外供应商编码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    public String outVendorNo;

    @Column(name = "PART_NO")
    @ApiParam("物料编码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    public String partNo;

    @Column(name = "CUST_NO")
    @ApiParam("客户编号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    public String custNo;

    @Column(name = "IS_TRANSPORT")
    @ApiParam("是否安排运输")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    public Integer isTransport;

    @Column(name = "REMARK",length = 255)
    @ApiParam("备注")
    public String remark;

    @ApiParam("物料编码")
    @Transient
    public List<String> partNoLst;
}
