/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.youchain.businessdata.domain;

import com.youchain.base.BaseEntity;
import com.youchain.basicdata.domain.Area;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author jiangkun
* @date 2024-02-21
**/
@Entity
@Data
@Table(name="data_pick_out")
public class PickOut  extends BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "ID")
    private Long id;

    @Column(name = "`order_no`")
    @ApiModelProperty(value = "单号")
    private String orderNo;

    @Column(name = "`bh_no`")
    @ApiModelProperty(value = "备货单号")
    private String bhNo;

    @Column(name = "`plate_no`")
    @ApiModelProperty(value = "车牌号")
    private String plateNo;

    @Column(name = "`order_qty`")
    @ApiModelProperty(value = "订单数量")
    private Double orderQty=0d;

    @Column(name = "`dispatch_qty`")
    @ApiModelProperty(value = "出库数量")
    private Double dispatchQty = 0d;

    @Column(name = "`enabled`")
    @ApiModelProperty(value = "是否启用")
    private Boolean enabled;

    @Column(name = "`description`")
    @ApiModelProperty(value = "备注")
    private String description;

    @Column(name = "`status`")
    @ApiModelProperty(value = "状态")
    private String status = "OPEN";
    @OneToOne
    @JoinColumn(name = "`area_id`")
    @ApiModelProperty(value = "出库库区")
    private Area area;
    @OneToOne
    @JoinColumn(name = "`sh_area_id`")
    @ApiModelProperty(value = "收货库区")
    private Area shArea;

    @Column(name = "`sl_by`")
    @ApiModelProperty(value = "接收人")
    private String slBy;

    @Column(name = "`sl_qty`")
    @ApiModelProperty(value = "收料数量")
    private Double slQty=0d;

    @Column(name = "`sl_date`")
    @ApiModelProperty(value = "接收日期")
    private Timestamp slDate;

    @Column(name = "`tl_date`")
    @ApiModelProperty(value = "投料日期")
    private Timestamp tlDate;

    @Column(name = "`tl_by`")
    @ApiModelProperty(value = "投料人")
    private String tlBy;

    @Column(name = "`tl_qty`")
    @ApiModelProperty(value = "投料数量")
    private Double tlQty=0d;

    @Column(name = "`gc_code`")
    @ApiModelProperty(value = "接收工厂")
    private String gcCode;

    public void copy(PickOut source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
