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

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
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 : silliter.yuan
 * @CreateDate : 2018-11-06 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_DOC_CS_ORDER")
@Api("盘点单主表信息")
public class WmsCSOrderMaster extends BaseBean {

    private static final long serialVersionUID = 3685205378778986296L;
    @Column(name = "ORDER_NO")
    @ApiParam("单号")
    public String orderNo;

    /**
     * 单据类型:10=日常盘点,20=月度盘点,
     * 30=季度盘点,40=年度盘点
     */
    @Column(name = "ORDER_TYPE")
    @ApiParam(value = "单据类型", example = "10")
    @AnnoOutputColumn(refClass = WmsEnumUtil.CS_ORDER_TYPE.class, refForeignKey = "value", value = "description")
    public Integer orderType;

    @Column(name = "ORDER_STATUS")
    @ApiParam(value = "状态 (10-创建 20-开启盘点  30-盘点中  40-盘点完成  50-已解冻 60-已关闭)", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.CS_ORDER_STATUS.class, refForeignKey = "value", value = "description")
    public Integer orderStatus;

    @Column(name = "ACTION_PERSENT")
    @ApiParam("盘点进度")
    public String actionPersent;

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

    @Column(name = "IS_INVENTORY")
    @ApiParam(value = "是否允许清点", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer isInventory;

    @Column(name = "IS_TASK")
    @ApiParam(value = "是否生产任务", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.IS_GENERAL_TASK.class, refForeignKey = "value", value = "description")
    public Integer isTask;

    @Column(name = "IS_PART")
    @ApiParam(value = "是否散件")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer isPart;

    @Column(name = "YEAR")
    @ApiParam("年度")
    public String year;

    @Column(name = "IS_SYNC_ERP")
    @ApiParam("是否同步ERP")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer isSyncErp;

    @Transient
    @ApiParam(value = "盘点明细集")
    public List<WmsCSOrderDetails> wmsCSOrderDetailsList;

    @Transient
    @ApiParam(value = "盘点物料清单")
    public String[] wmsCSParts;

    @Transient
    @ApiParam(value = "盘点物料清单")
    public String wmsCSPartsStr;

    @Transient
    @ApiParam(value = "盘点存储区清单")
    public String[] wmsCSZones;

    @Transient
    @ApiParam(value = "盘点存储区清单")
    public String wmsCSZonesStr;

    @Transient
    @ApiParam(value = "盘点库存地清单")
    public String wmsAreaNosStr;

    @Transient
    @ApiParam(value = "盘点库位清单")
    public String[] wmsCSLocates;

    @ApiParam(value = "是否明盘 1-是 2-否")
    @Column(name = "is_obvious")
    private Integer isObvious;

    @ApiParam(value = "允许盘入的库位")
    @Column(name = "ALLOW_LOCATES")
    private String allowLocates;
    public Integer getIsInventoryVal() {
        return this.isInventory == null ? 0 : this.isInventory.intValue();
    }

}
