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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
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;

/**
 * @Description:
 * @Reference:
 * @Author: Crish
 * @CreateDate:2019-04-16-17:36
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "MES_PRODUCE_SN")
@Api("产品条码表")
public class MesProduceSn extends BaseBean {

    @Column(name = "SERIAL_NUMBER")
    @ApiParam("产品条码")
    private String serialNumber;

    @Column(name = "PART_NO")
    @ApiParam("物料号")
    private String partNo;

    @Column(name = "PART_NAME_RDD")
    @ApiParam("物料名称")
    private String partNameRdd;

    @Column(name = "QTY")
    @ApiParam("数量")
    private Double qty;

    @Column(name = "QC_STATUS")
    @ApiParam("质量状态")
    private Integer qcStatus;

    @Column(name = "SN_STATUS")
    @ApiParam("条码状态")
    private Integer snStatus;

    @Column(name = "PRINT_COUNT")
    @ApiParam("打印次数")
    private Integer printCount;

    @Column(name = "PRINT_STATUS")
    @ApiParam("打印状态")
    private Integer printStatus;

    @Column(name = "WORK_CENTER_CODE")
    @ApiParam("工作中心代码")
    private String workCenterCode;

    @Column(name = "WORK_CELL_CODE")
    @ApiParam("工作单元代码")
    private String workCellCode;

    @Column(name = "ROUTE_CODE")
    @ApiParam("流程代码")
    private String routeCode;

    @Column(name = "PROCESS_CODE")
    @ApiParam("工序代码")
    private String processCode;

    @Column(name = "NEXT_PROCESS_CODE")
    @ApiParam("下一工序代码")
    private String nextProcessCode;

    @Column(name = "IN_WC_TIME")
    @ApiParam("进产线时间")
    private String inWorkCenterTime;

    @Column(name = "OUT_WC_TIME")
    @ApiParam("出产线时间")
    private String outWorkCenterTime;

    @Column(name = "SHIPPING_TIME")
    @ApiParam("发运时间")
    private String shippingTime;

    @Column(name = "WORK_ORDER_NO")
    @ApiParam("生产工单号")
    private String workOrderNo;

    @Column(name = "CUST_SN")
    @ApiParam("客户条码")
    private String custSn;

    @Column(name = "CUST_PART_NO")
    @ApiParam("客户零件号")
    private String custPartNo;

    @Column(name = "CUST_CODE")
    @ApiParam("客户代码")
    private String custCode;

    @Column(name = "PACKAGE_SN")
    @ApiParam("包装条码")
    private String packageSn;

    @Column(name = "SN_TYPE")
    @ApiParam("条码类型")
    private String snType;

    @Column(name = "TRAY")
    @ApiParam("托盘号")
    private String tray;

    @Transient
    @ApiParam("返回信息")
    private String resultMsg;

    public double getQtyVal() {
        return this.qty == null ? 0.0d : this.qty;
    }

    public int getQcStatusVal() {
        return this.qcStatus == null ? 0 : this.qcStatus;
    }

    public int getSnStatusVal() {
        return this.snStatus == null ? 0 : this.snStatus;
    }

    public int getPrintCountVal() {
        return this.printCount == null ? 0 : this.printCount;
    }

    public int getPrintStatusVal() {
        return this.printStatus == null ? 0 : this.printStatus;
    }

    @Override
    public String toString() {
        return "MesProduceSn{" +
                "serialNumber='" + serialNumber + '\'' +
                ", partNo='" + partNo + '\'' +
                ", partNameRdd='" + partNameRdd + '\'' +
                ", qty=" + qty +
                ", qcStatus=" + qcStatus +
                ", snStatus=" + snStatus +
                ", printCount=" + printCount +
                ", printStatus=" + printStatus +
                ", workCenterCode='" + workCenterCode + '\'' +
                ", workCellCode='" + workCellCode + '\'' +
                ", routeCode='" + routeCode + '\'' +
                ", processCode='" + processCode + '\'' +
                ", nextProcessCode='" + nextProcessCode + '\'' +
                ", inWorkCenterTime='" + inWorkCenterTime + '\'' +
                ", outWorkCenterTime='" + outWorkCenterTime + '\'' +
                ", shippingTime='" + shippingTime + '\'' +
                ", workOrderNo='" + workOrderNo + '\'' +
                ", custSn='" + custSn + '\'' +
                ", custPartNo='" + custPartNo + '\'' +
                ", packageSn='" + packageSn + '\'' +
                ", resultMsg='" + resultMsg + '\'' +
                '}';
    }
}
