/*
*  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 com.youchain.basicdata.domain.StockType;
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 hjl
* @date 2023-08-14
**/
@Entity
@Data
@Table(name="data_asn_detail")
public class AsnDetail  extends BaseEntity implements Serializable {

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

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

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

    @OneToOne
    @JoinColumn(name = "`stock_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "容器")
    private Stock stock;

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

    @Column(name = "`po`")
    @ApiModelProperty(value = "MO票")
    private String po;

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

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

    @Column(name = "`received_qty`")
    @ApiModelProperty(value = "收货数量")
    private Double receivedQty=0d;

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

    @Column(name = "`put_qty`")
    @ApiModelProperty(value = "上架数量")
    private Double putQty=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;

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

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

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

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