package com.steering.pss.plnsaleord.order.baseMethod;

import java.util.ArrayList;

import javax.script.ScriptException;

import CoreFS.SA06.CoreReturnObject;

import com.steering.comm.db.DBCommon;
import com.steering.pss.plnsaleord.order.baseMethod.CoreTolerOfNk;
import com.steering.pss.plnsaleord.order.model.CoreTolerOfNkParam;

/**
 * 内控公差
 * @author yangtianhai
 */
public class CoreToleranceNk extends DBCommon{
    /**
     * 查询二级工序分类
     * @return
     */
    public CoreReturnObject getTolerOfNk(ArrayList<Object> list) throws ScriptException{
        CoreReturnObject cro = new CoreReturnObject();
        CoreTolerOfNkParam tolerParam = new CoreTolerOfNkParam();
        ArrayList<Object> result = new ArrayList<Object>();
        
        double outdiameter = Double.parseDouble(list.get(0).toString());
        double wallthick = Double.parseDouble(list.get(1).toString());
        String sic = list.get(2).toString();
        double lengthmin = Double.parseDouble(list.get(3).toString());
        double lengthmax = Double.parseDouble(list.get(4).toString());
        String baseCode = list.get(5).toString();
        double lower = 0;       //公差下限
        double upper = 0;       //公差上限
        String desginKey=list.get(6).toString();
        String mscPline=list.get(7).toString();
        tolerParam.setOutdiameter(outdiameter);
        tolerParam.setWallthick(wallthick);
        tolerParam.setSic(sic);
        tolerParam.setBias_code(baseCode);
        tolerParam.setLengthmin(lengthmin);
        tolerParam.setLengthmax(lengthmax);
        tolerParam = new CoreTolerOfNk().queryTolerance(tolerParam,desginKey,mscPline,"1");
        lower = tolerParam.getWallLower();
        upper = tolerParam.getWallUpper();
        result.add(lower);
        result.add(upper);
        cro.setResult(result);
        return cro;
    }
}