/*
 *  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.basicdata.domain;

import com.youchain.base.BaseEntity;
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;
import java.util.Date;

/**
 * @author JiangKun
 * @website https://eladmin.vip
 * @description /
 * @date 2024-01-05
 **/
@Entity
@Data
@Table(name = "base_automatic_planning")
public class AutomaticPlanning extends BaseEntity implements Serializable {

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

    @OneToOne
    @JoinColumn(name = "`sh_area_id`")
    @ApiModelProperty(value = "收货仓库")
    private Area shArea;
    @Column(name = "`code`")
    @ApiModelProperty(value = "流水")
    private String code;
    @Column(name = "`status`")
    @ApiModelProperty(value = "状态")
    private String status;
    @Column(name = "`fx_quantity`")
    @ApiModelProperty(value = "铺线数量")
    private Integer fxQuantity=0;

    @Column(name = "`jh_quantity`")
    @ApiModelProperty(value = "计划数量")
    private Integer jhQuantity=0;

    @Column(name = "`sx_quantity`")
    @ApiModelProperty(value = "上线计划数量")
    private Integer sxQuantity=0;

    @Column(name = "`batch_num`")
    @ApiModelProperty(value = "分批数量")
    private Integer batchNum=0;

    @Column(name = "`sh_hour`")
    @ApiModelProperty(value = "送货小时数")
    private Integer shHour=0;

    @Column(name = "`hy_quantity`")
    @ApiModelProperty(value = "耗用数量")
    private Integer hyQuantity=0;

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

    @Column(name = "`enabled`")
    @ApiModelProperty(value = "状态：1启用、0禁用")
    private Boolean enabled;

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

    @Column(name = "`start_num`")
    @ApiModelProperty(value = "开始机号")
    private String startNum;

    @Column(name = "`zd_start_num`")
    @ApiModelProperty(value = "指定开始机号")
    private String zdStartNum;

    @Column(name = "`end_num`")
    @ApiModelProperty(value = "截止机号")
    private String endNum;

    @Column(name = "`sc_end_num`")
    @ApiModelProperty(value = "生产截止机号")
    private String scEndNum;

    @Column(name = "`hy_start_num`")
    @ApiModelProperty(value = "耗用开始机号")
    private String hyStartNum;

    @Column(name = "`hy_end_num`")
    @ApiModelProperty(value = "耗用截止机号")
    private String hyEndNum;

    @Column(name = "`jh_date`")
    @ApiModelProperty(value = "计划日期")
    private Date jhDate;

    @Column(name = "`is_sx`")
    @ApiModelProperty(value = "是否上线")
    private Boolean isSx=Boolean.TRUE;

    @Column(name = "`is_end`")
    @ApiModelProperty(value = "按照输入end IDNO耗用")
    private Boolean isEnd=Boolean.FALSE;



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