package cn.ezhizao.project.business.domain;

import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
import cn.ezhizao.framework.web.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;


/**
 * 报工对象 biz_daywork
 *
 * @author ezhizao
 * @date 2023-11-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "biz_daywork")
@Accessors(chain = true)
public class BizDaywork extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /** 租户（厂别）id */
    @ApiModelProperty(value = "${comment}")
    private Long tenantId;
    /** 批次号id */
    @ApiModelProperty(value = "${comment}")
    private Long lotId;
    /** 批次号 */
//    @TableField(exist = false)
    @ApiModelProperty(value = "${comment}")
    private String lotCode;

    /** 单批数 */
//    private Integer oneLotQuantity;
    /** 计划单id */
    @ApiModelProperty(value = "${comment}")
    private Long productionPlanId;

    /** 子计划id */
    @ApiModelProperty(value = "${comment}")
    private Long productionPlanDetailSubDetailId;

    /** 计划单明细id */
    @ApiModelProperty(value = "${comment}")
    private Long productionPlanDetailId;

    /** 子计划工序对应的设备id */
//    @ApiModelProperty(value = "${comment}")
//    private Long productionPlanDetailSubDetailEquipmentId;

    /** 产品id */
    @ApiModelProperty(value = "${comment}")
    private Long productId;

    /** 工艺id（通过工艺id，获取版本号） */
    @ApiModelProperty(value = "${comment}")
    private Long technologicalProcessId;


    /** 设备id */
//    @ApiModelProperty(value = "${comment}")
//    private Long equipmentDetailId;

    /** 设备编码 */
//    @Excel(name = "设备编码")
//    @ApiModelProperty(value = "设备编码")
    @TableField(exist = false)
    private String equipmentDetailCode;


    /** 开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "开始时间")
    private Date startTime;

    /** 结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "结束时间")
    private Date endTime;
    /** 载具 */
    @TableField(exist = false)
    private String carrierName;
    /** 周转中控制状态 */
    @TableField(exist = false)
    private Integer currentStatus;

    private Integer status;

    @TableField(exist = false)
    @ApiModelProperty(value = "生产数量")
    private Integer productionQuantity;

    @TableField(exist = false)
    private List<BizDayworkCarrier> dayworkCarriers;
    /** 炉号 */
    @TableField(exist = false)
    private String furnaceNumber;

    /** 工艺工序顺序 */
    @TableField(exist = false)
    private List<BizProcess> processSequence;

    /** 是否是修改 */
    private Integer isAmend;

    @TableField(exist = false)
    private BizProcess currentProcess;

    @TableField(exist = false)
    private List<BizProcess> prevProcess;

    @TableField(exist = false)
    private List<BizDayworkItem> dayworkItemList;

    private Integer processQualifiedNum;
    /** 单批量 */
    @TableField(exist = false)
    private Integer oneLotQuantity;

    @TableField(exist = false)
    private String productCode;
    @TableField(exist = false)
    private String productDescription;

    @TableField(exist = false)
    private String productionPlanNo;
    @TableField(exist = false)
    private Long lineNumber;
    @TableField(exist = false)
    private String companyAlias;
    @TableField(exist = false)
    private String technologyVersion;
    @TableField(exist = false)
    private Long workshopId;

    private Long deptId;

    @TableField(exist = false)
    private Long totalWorkingHours;
    /**
     * 临时合格数
     */
    private Integer temporaryProcessQualifiedNum;
    /**
     * 是否是尾批
     */
    private Integer isLast;
    @TableField(exist = false)
    private Integer lastLotQuantity;
    /**
     * 工段名
     */
    @TableField(exist = false)
    private String deptName;

    @TableField(exist = false)
    private String deptCode;


    /**
     * 是否回退
     */
    @TableField(exist = false)
    private Long isFallback;


    /**
     * 是否废品回收
     */
    private Long isWasteRecycling;
    /**
     * 母批号
     */
    @TableField(exist = false)
    private String fromCode;
    @TableField(exist = false)
    private Integer isWaste;

    //当前工序
    @TableField(exist = false)
    private Long technologicalProcessDetailId;

    @TableField(exist = false)
    private BizLotWaste lotWaste;
    @TableField(exist = false)
    private BizProduct product;

    @TableField(exist = false)
    private String productShaftCategoryName;

    @TableField(exist = false)
    private List<Long> dayworkIds;

    /** 在供应商管理处使用，要过滤掉，该供应商已经添加的产品 **/
    @TableField(exist = false)
    private Long supplierId;

    /** 在外协发出单添加时，选择产品使用，是否限制只能看该外协商配置好的产品 **/
    @TableField(exist = false)
    private Integer isSupplierProducts;

    /** 已经添加的daywork **/
    @TableField(exist = false)
    private List<Long> existingDayworkIds;

    /** 原箱号 **/
    @TableField(exist = false)
    private String originalCarrier;


    @TableField(exist = false)
    private Integer productNum;

    /** 工序id */
    @TableField(exist = false)
    private Long processId;



    /** 新箱号 **/
    @TableField(exist = false)
    private String newCarrier;
    @TableField(exist = false)
    private Long fromId;
    @TableField(exist = false)
    private String processStepNumber;
    @TableField(exist = false)
    private String turnoverArea;
    @TableField(exist = false)
    private String place;
    @TableField(exist = false)
    private String workshopName;

    @TableField(exist = false)
    private String keyword;
    @TableField(exist = false)
    private List<BizDayworkCarrier> originalCarrierList;
    @TableField(exist = false)
    private Long outsourceDetailId;

    /** 特殊报工使用字段 **/
    /** 是否有特殊报工 */
    @Excel(name = "是否有特殊报工")
    @ApiModelProperty(value = "是否有特殊报工")
    private Integer hasSpecial;

    @TableField(exist = false)
    private Long specialProcessId;

    /** 废品数*/
    @TableField(exist = false)
    private Long rejectSum;
    /** 投产数 */
    @TableField(exist = false)
    private Integer prodNum;

    @TableField(exist = false)
    private Integer specialIsFirst;

    @TableField(exist = false)
    private Integer itemStatus;

    /** 合格数 */
    @TableField(exist = false)
    private Integer qualifiedNum;

    /** 用户id */
    @ApiModelProperty(value = "用户id")
    private Long userId;

    /** 员工编码 */
    @Excel(name = "员工编码")
    @ApiModelProperty(value = "员工编码")
    private String userName;

    @TableField(exist = false)
    private String processAlias;

    /** 员工姓名 */
    @Excel(name = "员工姓名")
    @ApiModelProperty(value = "员工姓名")
    private String nickName;

    @TableField(exist = false)
    private List<Long>  ids;

    @TableField(exist = false)
    private BizFurnaceNoInfo furnaceNoInfo;

    @TableField(exist = false)
    private String carrierCode;

    @TableField(exist = false)
    private BizProductionPlanDetail productionPlanDetail;

    @TableField(exist = false)
    private Long protemProcessId;
    @TableField(exist = false)
    private String drawingNumber;

    @TableField(exist = false)
    private String itemNames;
    @TableField(exist = false)
    private Integer printCount;

    @TableField(exist = false)
    private List<Long> auxiliaryDeptIds;
    private Integer isSuperaddition;

    private Integer isCertificate;

    @TableField(exist = false)
    private Integer totalLotNumber;

    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date finishedTime;

    @TableField(exist = false)
    private Date queryStartTime;
    @TableField(exist = false)
    private Date queryEndTime;

    @TableField(exist = false)
    private String reportStatus;
    private Long packageResourceGroupId;
    @TableField(exist = false)
    private Long flag;
    @TableField(exist = false)
    private List<Long> flags;
    @TableField(exist = false)
    private Date turnoverDate;
    @TableField(exist = false)
    private String outsourceFormNo;
    @TableField(exist = false)
    private Integer isHistory;
    @TableField(exist = false)
    private BizDayworkItem lastDayworkItem;
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date submitTime;
    @TableField(exist = false)
    private BizCertificate certificate;
    @TableField(exist = false)
    private String specification;

    public BizDaywork() {}

    public BizDaywork(BizDaywork copy) {
        this.tenantId = copy.tenantId;
        this.lotId = copy.lotId;
        this.lotCode = copy.lotCode;
        this.productionPlanId = copy.productionPlanId;
        this.productionPlanDetailSubDetailId = copy.productionPlanDetailSubDetailId;
        this.productionPlanDetailId = copy.productionPlanDetailId;
        this.productId = copy.productId;
        this.technologicalProcessId = copy.technologicalProcessId;
        this.userId = copy.userId;
        this.userName = copy.userName;
        this.nickName = copy.nickName;
        this.startTime = copy.startTime;
        this.endTime = copy.endTime;
        this.carrierName = copy.carrierName;
        this.currentStatus = copy.currentStatus;
        this.status = copy.status;
        this.productionQuantity = copy.productionQuantity;
        this.dayworkCarriers = copy.dayworkCarriers;
        this.furnaceNumber = copy.furnaceNumber;
        this.dayworkItemList = copy.dayworkItemList;
        this.processQualifiedNum = copy.processQualifiedNum;
        this.oneLotQuantity = copy.oneLotQuantity;
        this.productDescription = copy.productDescription;
        this.productionPlanNo = copy.productionPlanNo;
        this.lineNumber = copy.lineNumber;
        this.companyAlias = copy.companyAlias;
        this.technologyVersion = copy.technologyVersion;
        this.deptId = copy.deptId;
        this.totalWorkingHours = copy.totalWorkingHours;
        this.temporaryProcessQualifiedNum = copy.temporaryProcessQualifiedNum;
        this.isLast = copy.isLast;
        this.lastLotQuantity = copy.lastLotQuantity;
        this.deptName = copy.deptName;
        this.processAlias = copy.processAlias;
        this.isFallback = copy.isFallback;
        this.isWasteRecycling = copy.isWasteRecycling;
        this.fromCode = copy.fromCode;
        this.isWaste = copy.isWaste;
        this.technologicalProcessDetailId = copy.technologicalProcessDetailId;
        this.lotWaste = copy.lotWaste;
        this.isAmend = copy.isAmend;
        this.productShaftCategoryName = copy.productShaftCategoryName;
        this.dayworkIds = copy.dayworkIds;
        this.packageResourceGroupId = copy.packageResourceGroupId;
        this.isCertificate = copy.isCertificate;
        this.setId(copy.getId());
    }

    @TableField(exist = false)
    private List<Long> lotIds;
}
