package cn.estsh.i3plus.ext.mes.pcn.pojo.model.jx;

import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtEnumUtil;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiParam;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author wangjie
 * @version 1.0
 * @date 2021/1/15 15:32
 **/
@Data
@ApiModel("JX出货检验MODEL")
public class JxOqcManageModel implements Serializable {
    
    private static final long serialVersionUID = -5483744451941064813L;
    
    @ApiParam("组织代码")
    private String organizeCode;

    @ApiParam("操作人")
    private String userInfo;

    @ApiParam("操作人ID")
    private String userId;

    @ApiParam("返回信息")
    private String msg;

    @ApiParam("条码")
    private String sn;

    @ApiParam("产品条码")
    private String serialNumber;

    @ApiParam("产品条码")
    private String productSn;

    @ApiParam("包装条码")
    private String packageNo;

    @ApiParam("大包装条码")
    private String bigPackageNo;

    @ApiParam("产量统计ID")
    private String idStr;

    @ApiParam("生产工单")
    private String workOrderNo;

    @ApiParam("物料号")
    private String partNo;

    @ApiParam("物料名称")
    private String partNameRdd;

    @ApiParam("商品码")
    private String goodsCode;

    @ApiParam("商品码2")
    private String goodsCode2;

    @ApiParam("产品类型")
    private String categoryCode3;

    @ApiParam("产品类型")
    private String categoryCode3Name;

    @ApiParam("生产线")
    private String workCenterCode;

    @ApiParam("工单类型")
    private Integer workOrderType;

    @ApiParam("工单类型名称")
    private String workOrderTypeName;

    @ApiParam("作业时间")
    private String workTime;

    @ApiParam("班次代码")
    private String shiftCode;

    @ApiParam("班次名称")
    private String shiftName;

    @ApiParam("计划数量")
    private Double planQty;

    @ApiParam("班次完工数量")
    private Double completeQty;

    @ApiParam("已检测范围数量")
    private Double checkLimit;

    @ApiParam("当前检验类型")
    private Integer curOqcNoType;

    @ApiParam("当前检验类型名称")
    private String curOqcNoTypeName;

    @ApiParam("当前抽检数量")
    private Double curSpotCheckQty;

    @ApiParam("当前批次范围")
    private Double curBatchLimit;

    @ApiParam("检验单号")
    private String oqcNo;

    @ApiParam("当前检验结果")
    private String curCheckResultName;

    @ApiParam("不良类型代码")
    private String badnessTypeCode;

    @ApiParam("不良类型名称")
    private String badnessTypeName;

    @ApiParam("不良分类代码")
    private String badnessClassifyCode;

    @ApiParam("不良分类名称")
    private String badnessClassifyName;

    @ApiParam("不良分类明细名称")
    private String badnessClassifyDetailName;

    @ApiParam("抽检数量")
    private Double spotCheckQty = new Double(1);

    @ApiParam("批次范围")
    private Double batchLimit = new Double(1);

    @ApiParam("检验类型")
    private Integer oqcNoType = 10;

    @ApiParam("检验结果")
    private Integer checkResult;

    @ApiParam("批次范围只读状态")
    private Boolean batchLimitBoo = false;

    @ApiParam("抽检数量框只读状态")
    private Map<Integer, Boolean> spotCheckQtyBooMap = new HashMap<>();

    @ApiParam("检验类型只读状态")
    private Map<Integer, Boolean> oqcNoTypeBooMap = new HashMap<>();

    @ApiParam("生成检验单只读状态")
    private Map<Integer, Boolean> genOqcBooMap = new HashMap<>();

    @ApiParam("条码框只读状态")
    private Boolean snBoo = true;

    @ApiParam("切换只读状态")
    private Boolean changeBoo = false;

    @ApiParam("合格只读状态")
    private Boolean qcBoo = false;

    @ApiParam("不合格只读状态")
    private Boolean unQcBoo = false;

    @ApiParam("重置只读状态")
    private Boolean resetBoo = true;

    @ApiParam("重载检验项只读状态")
    private Boolean reloadCheckBoo = false;

    @ApiParam("检验项目明细")
    private ListPager<JxOqcManageCheckDetailModel> detailList;

    public JxOqcManageModel() {}

    public JxOqcManageModel(String organizeCode, String userId, String userInfo, Integer oqcNoType) {
        this.organizeCode = organizeCode;
        this.userId = userId;
        this.userInfo = userInfo;
        this.oqcNoType = oqcNoType;
    }

    public JxOqcManageModel(String organizeCode, String userId, String userInfo, Integer oqcNoType, String productSn, String workOrderNo, String shiftCode, String workTime, String oqcNo) {
        this.organizeCode = organizeCode;
        this.userId = userId;
        this.userInfo = userInfo;
        this.oqcNoType = oqcNoType;
        this.productSn = productSn;
        this.workOrderNo = workOrderNo;
        this.shiftCode = shiftCode;
        this.workTime = workTime;
        this.oqcNo = oqcNo;
    }

    public JxOqcManageModel(String organizeCode, String userId, String userInfo, String sn, String idStr) {
        this.organizeCode = organizeCode;
        this.userId = userId;
        this.userInfo = userInfo;
        this.sn = sn;
        this.idStr = idStr;

        this.spotCheckQtyBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.DAILY_INSPECTION.getValue(), false);
        this.spotCheckQtyBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.TEARDOWN_INSPECTION.getValue(), false);
        this.spotCheckQtyBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.EMPTY_INSPECTION.getValue(), false);

        this.oqcNoTypeBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.DAILY_INSPECTION.getValue(), true);
        this.oqcNoTypeBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.TEARDOWN_INSPECTION.getValue(), true);
        this.oqcNoTypeBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.EMPTY_INSPECTION.getValue(), true);

        this.genOqcBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.DAILY_INSPECTION.getValue(), false);
        this.genOqcBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.TEARDOWN_INSPECTION.getValue(), false);
        this.genOqcBooMap.put(MesPcnExtEnumUtil.OQC_CHECK_TYPE.EMPTY_INSPECTION.getValue(), false);

    }

    public String toBaseString() {
        return "JxOqcManageModel{" +
                "organizeCode='" + organizeCode + '\'' +
                ", userInfo='" + userInfo + '\'' +
                ", userId='" + userId + '\'' +
                ", sn='" + sn + '\'' +
                ", serialNumber='" + serialNumber + '\'' +
                ", goodsCode='" + goodsCode + '\'' +
                ", packageNo='" + packageNo + '\'' +
                ", goodsCode2='" + goodsCode2 + '\'' +
                ", idStr='" + idStr + '\'' +
                '}';
    }

    @Override
    public String toString() {
        return "JxOqcManageModel{" +
                "organizeCode='" + organizeCode + '\'' +
                ", userInfo='" + userInfo + '\'' +
                ", userId='" + userId + '\'' +
                ", sn='" + sn + '\'' +
                ", serialNumber='" + serialNumber + '\'' +
                ", goodsCode='" + goodsCode + '\'' +
                ", packageNo='" + packageNo + '\'' +
                ", goodsCode2='" + goodsCode2 + '\'' +
                ", idStr='" + idStr + '\'' +
                ", workOrderNo='" + workOrderNo + '\'' +
                ", partNo='" + partNo + '\'' +
                ", partNameRdd='" + partNameRdd + '\'' +
                ", categoryCode3='" + categoryCode3 + '\'' +
                ", workCenterCode='" + workCenterCode + '\'' +
                ", workOrderType=" + workOrderType +
                ", workOrderTypeName='" + workOrderTypeName + '\'' +
                ", workTime='" + workTime + '\'' +
                ", shiftCode='" + shiftCode + '\'' +
                ", shiftName='" + shiftName + '\'' +
                ", planQty=" + planQty +
                ", completeQty=" + completeQty +
                '}';
    }
}
