package com.aps.macroplanner.data;

/**
 * 单元-工序关联 — 定义某个工序在某个单元(Unit)上的产能参数。
 *
 * <p>一个 Operation 可以有多个 UnitOperation，表示同一工序可在不同单元/产线执行，
 * 每个单元的产能消耗、批次大小可能不同。</p>
 *
 * <p>例如: "采购 R1" 可以由供应商 A (0.5h/件) 和供应商 B (0.8h/件) 执行。</p>
 */
public class UnitOperation {
    private final String unitId;        // 所属单元ID
    private final double capacityCoeff; // 产能消耗系数 (单件耗时)
    private final boolean hasLotSize;   // 是否有批次大小
    private final double lotSize;       // 批次大小
    private final double qtpfactor;     // QuantityToProcessFactor

    public UnitOperation(String unitId, double capacityCoeff,
                         boolean hasLotSize, double lotSize, double qtpfactor) {
        this.unitId = unitId;
        this.capacityCoeff = capacityCoeff;
        this.hasLotSize = hasLotSize;
        this.lotSize = lotSize;
        this.qtpfactor = qtpfactor;
    }

    public String getUnitId() { return unitId; }
    public double getCapacityCoeff() { return capacityCoeff; }
    public boolean hasLotSize() { return hasLotSize; }
    public double getLotSize() { return lotSize; }
    public double getQtpfactor() { return qtpfactor; }

    @Override
    public String toString() {
        return unitId + "(产能" + capacityCoeff + "h/件" +
                (hasLotSize ? ", 批次" + lotSize : "") + ")";
    }
}