/*
*  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.Item;
import com.youchain.basicdata.domain.Point;
import com.youchain.basicdata.domain.Stock;
import com.youchain.modules.system.domain.Dept;
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 houjianlan
* @date 2023-10-20
**/
@Entity
@Data
@Table(name="data_count_record")
public class CountRecord  extends BaseEntity implements Serializable {

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

    @OneToOne
    @JoinColumn(name = "`item_id`")
    @ApiModelProperty(value = "物料序号")
    private Item item;

    @OneToOne
    @JoinColumn(name = "`item_key_id`")
    @ApiModelProperty(value = "物料序号")
    private ItemKey itemKey;

    @Column(name = "`bill_code`")
    @ApiModelProperty(value = "单据号")
    private String billCode;

    @OneToOne
    @JoinColumn(name = "`count_detail_id`")
    @ApiModelProperty(value = "盘点明细ID")
    private CountDetail countDetail;

    @OneToOne
    @JoinColumn(name = "`src_stock_id`")
    @ApiModelProperty(value = "源容器")
    private Stock srcStock;

    @OneToOne
    @JoinColumn(name = "`dst_stock_id`")
    @ApiModelProperty(value = "目标容器")
    private Stock dstStock;

    @OneToOne
    @JoinColumn(name = "`src_point_id`")
    @ApiModelProperty(value = "源点位")
    private Point srcPoint;

    @OneToOne
    @JoinColumn(name = "`dst_point_id`")
    @ApiModelProperty(value = "目标点位")
    private Point dstPoint;

    @Column(name = "`src_stock_code`")
    @ApiModelProperty(value = "源容器编码")
    private String srcStockCode;

    @Column(name = "`dst_stock_code`")
    @ApiModelProperty(value = "目标容器编码")
    private String dstStockCode;

    @Column(name = "`src_point_code`")
    @ApiModelProperty(value = "源点位编码")
    private String srcPointCode;

    @Column(name = "`dst_point_code`")
    @ApiModelProperty(value = "目标点位编码")
    private String dstPointCode;

    @Column(name = "`inv_status`")
    @ApiModelProperty(value = "属性6")
    private String invStatus;

    @Column(name = "`task_status`")
    @ApiModelProperty(value = "属性6")
    private String taskStatus;

    @Column(name = "`be_skip`")
    @ApiModelProperty(value = "跳过")
    private Boolean beSkip=false;

    @Column(name = "`be_back`")
    @ApiModelProperty(value = "退回")
    private Boolean beBack=false;

    @Column(name = "`plan_qty`")
    @ApiModelProperty(value = "计划数量")
    private Double planQty=0d;

    @Column(name = "`count_qty`")
    @ApiModelProperty(value = "移位数量")
    private Double countQty=0d;

    @Column(name = "`inv_id`")
    @ApiModelProperty(value = "库存ID")
    private Long invId;

    @OneToOne
    @JoinColumn(name = "`dept_id`")
    @ApiModelProperty(value = "仓库ID")
    private Dept dept;


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