package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.rulematch.strategy;


import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesEquipVariableRwExtService;
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentVariable;
import cn.estsh.i3plus.pojo.mes.model.MesEquipVariableRwResult;
import cn.estsh.i3plus.pojo.mes.model.StationRequestBean;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description : 发送加工参数的抽象类
 * @Author : zxw
 **/
public abstract class AbstractWriteVariableService {

    @Autowired
    private IMesEquipVariableRwExtService equipVariableRwExtService;

    /**
     * 写值
     * @param value
     * @param equipmentVariable
     * @param kepwareFlag
     */
    public MesEquipVariableRwResult writeVariable(StationRequestBean reqBean, String value, MesEquipmentVariable equipmentVariable, String kepwareFlag, Integer foreignKey, Integer index) {
        // 需要不同的策略不同的转换方式
        String newValue = transferValue(reqBean, value, foreignKey, index);
        MesEquipVariableRwResult mesEquipVariableRwResult = equipVariableRwExtService.writeVariable(newValue, equipmentVariable, kepwareFlag);

        return  mesEquipVariableRwResult;
    }


    public abstract String transferValue(StationRequestBean reqBean, String value, Integer foreignKey, Integer index);

/*    public abstract void handlerValue();

    public abstract void removeValue();*/
}
