/**
 * Created by zhang on 2018/6/7.
 */
import fs from 'fs';
let _= require('lodash');
const scMathUtil = require('./scMathUtil').getUtil();

let gljNodeUtil = null;
let data = fs.readFileSync(__dirname + '/web/gljUtil.js', 'utf8', 'r');
eval(data + ' ; gljNodeUtil = gljUtil; ');

module.exports = {
    calcProjectGLJQuantity :calcProjectGLJQuantity,
    getGLJPrice:getGLJPrice,
    calcPriceDiff:calcPriceDiff,
    getMarketPrice:getMarketPrice,
    getBasePrice:getBasePrice,
    getAdjustPrice:getAdjustPrice,
    getGljTypeSeq:getGljTypeSeq
};

function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
    gljNodeUtil.calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal,_,scMathUtil);
}

function getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
    return gljNodeUtil.getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
}

function getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
    return gljNodeUtil.getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
}

function getBasePrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
    return gljNodeUtil.getBasePrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
}

function getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false,_,scMathUtil) {
    return gljNodeUtil.getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
}

function calcPriceDiff(glj,calcOptions) {
    gljNodeUtil.calcPriceDiff(glj,calcOptions);
}

function getGljTypeSeq() {
    return gljNodeUtil.getGljTypeSeq();
}