/*
 *  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 com.youchain.basicdata.domain.BigItem;
import com.youchain.basicdata.domain.Point;
import com.youchain.utils.BizStatus;
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;

/**
 * @author DengJiangKun
 * @website https://eladmin.vip
 * @description /
 * @date 2024-02-28
 **/
@Entity
@Data
@Table(name = "data_pick_kit_plan")
public class PickKitPlan extends BaseEntity implements Serializable {

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

    @Column(name = "`plan_number`")
    @ApiModelProperty(value = "计划号")
    private String planNumber;

    @OneToOne
    @JoinColumn(name = "`work_area_id`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "工位")
    private Area workArea;

    @Column(name = "`plan_date`")
    @ApiModelProperty(value = "计划日期")
    private Timestamp planDate;

    @OneToOne
    @JoinColumn(name = "`big_item_id`", nullable = false)
    @NotNull
    @ApiModelProperty(value = "Bom完成品工位清单")
    private BigItem bigItem;

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

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

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

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


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