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

import cn.estsh.i3plus.pojo.aps.annotation.FieldAnnotation;
import cn.estsh.i3plus.pojo.aps.common.BaseAPS;
import cn.estsh.i3plus.pojo.aps.common.BeanRelation;
import cn.estsh.i3plus.pojo.aps.holders.EOrderFeedback;
import cn.estsh.i3plus.pojo.aps.holders.EPlanFeedback;
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 : 2020-03-19
 * @Modify:
 **/
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "APS_ORDER_FEEDBACK")
@Api("订单反馈")
public class OrderFeedback extends BaseAPS {
    private static final long serialVersionUID = 7822380202121225936L;

    @Column(name="ORDER_ID")
    @ApiParam(value ="顶层订单号")
    @FieldAnnotation(relation = "Order", modify = false)
    private Long orderId;

    @Column(name="DELIVER_RATE")
    @ApiParam(value ="发货百分比")
    private Double deliverRate;

    @Column(name="QUALIFIED_RATE")
    @ApiParam(value ="成品合格百分比")
    private Double qualifiedRate;

    @Column(name="INVENTORY_COUNT")
    @ApiParam(value ="库存扣减数量")
    private Double inventoryCount;

    @Column(name="LAST_OPERATION_COUNT")
    @ApiParam(value ="硫化报工数量")
    private Double lastOperationCount;

    @Column(name="UNQUALIFIED_COUNT")
    @ApiParam(value ="不良数量")
    private Double unqualifiedCount;

    @Column(name="QUALIFIED_COUNT")
    @ApiParam(value ="成品合格数量")
    private Double qualifiedCount;

    @Column(name="ADD_UNQUALIFIED_COUNT")
    @ApiParam(value ="累加不良数量")
    @FieldAnnotation(display = false)
    private Double addUnqualifiedCount;

    @Column(name="ADD_QUALIFIED_COUNT")
    @ApiParam(value ="累加合格数量")
    @FieldAnnotation(display = false)
    private Double addQualifiedCount;

    public BaseOrder getOrder() {
        return BeanRelation.get(this, EOrderFeedback.Order);
    }

    public void setOrder(BaseOrder order) {
        this.orderId = order != null ? order.getId() : 0l;
        BeanRelation.set(this, EOrderFeedback.Order, order);
    }
}
