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

import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation;
import cn.estsh.i3plus.pojo.aps.common.BeanRelation;
import cn.estsh.i3plus.pojo.aps.holders.EBaseOrder;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Description :库存
 * @Reference :
 * @Author : jason.niu
 * @CreateDate : 2019-09-17
 * @Modify:
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "APS_INVENTORY")
@Api("库存")
public class Inventory extends BaseOrder {
    private static final long serialVersionUID = 2378846162007550439L;
    @Column(name="SPECIFY_TOP_ORDER")
    @ApiParam(value ="指定顶层订单")
    private String specifyTopOrder;

    @Column(name="SPECIFY_UP_ORDER")
    @ApiParam(value ="指定上层订单")
    private String specifyUpOrder;

    @Column(name="ASSIGN_COUNT", columnDefinition = "decimal(18,8)")
    @ApiParam(value ="已分配量")
    @FieldAnnotation(modify = false)
    private Double assignCount;

    @Column(name="EXCESS_COUNT", columnDefinition = "decimal(18,8)")
    @ApiParam(value ="多余量")
    @FieldAnnotation(modify = false)
    private Double excessCount;

    @JsonIgnore
    public Work getWork() {
        return BeanRelation.get(this, EBaseOrder.Works);
    }
}
