/*
*  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.Stock;
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.NotNull;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author huojin
* @date 2023-08-16
**/
@Entity
@Data
@Table(name="data_pick_detail")
public class PickDetail  extends BaseEntity implements Serializable {

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

    @Column(name = "`pick_id`")
    @ApiModelProperty(value = "订单序号")
    private Long pickId;

    @OneToOne
    @JoinColumn(name = "`item_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "物料")
    private Item item;

    @Column(name = "`line_no`")
    @ApiModelProperty(value = "行号")
    private Long lineNo;

    @Column(name = "`po`")
    @ApiModelProperty(value = "po订单号")
    private String po;

    @Column(name = "`status`")
    @ApiModelProperty(value = "状态")
    private String status;

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

    @Column(name = "`allocated_qty`")
    @ApiModelProperty(value = "分配数量")
    private Double allocatedQty=0d;

    @Column(name = "`picked_qty`")
    @ApiModelProperty(value = "拣货数量")
    private Double pickedQty=0d;

    @Column(name = "`shipped_qty`")
    @ApiModelProperty(value = "发运数量")
    private Double shippedQty=0d;

    @Column(name = "`weight`")
    @ApiModelProperty(value = "重量")
    private Double weight=0d;

    @Column(name = "`volume`")
    @ApiModelProperty(value = "体积")
    private Double volume=0d;

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

    @Column(name = "`prop_c1`")
    @ApiModelProperty(value = "批次号")
    private String propC1;

    @Column(name = "`prop_c2`")
    @ApiModelProperty(value = "序列号")
    private String propC2;

    @Column(name = "`prop_c3`")
    @ApiModelProperty(value = "属性3")
    private String propC3;

    @Column(name = "`prop_c4`")
    @ApiModelProperty(value = "属性4")
    private String propC4;

    @Column(name = "`prop_c5`")
    @ApiModelProperty(value = "属性5")
    private String propC5;

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

    @Column(name = "`prop_d1`")
    @ApiModelProperty(value = "生产日期")
    private Timestamp propD1;

    @Column(name = "`prop_d2`")
    @ApiModelProperty(value = "到期日期")
    private Timestamp propD2;

    @Column(name = "`dept_id`")
    @ApiModelProperty(value = "仓库ID")
    private Long deptId;

    @Column(name = "`source_name`")
    @ApiModelProperty(value = "来源名称")
    private String sourceName;

    @Column(name = "`source_id`")
    @ApiModelProperty(value = "来源序号")
    private Long sourceId;

    public PickDetail(){

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