/** * Created by chen on 2017/7/12. */ let mongoose = require('mongoose'); let _=require("lodash"); let ration_glj = mongoose.model('ration_glj'); let ration = mongoose.model('ration'); let ration_coe = mongoose.model('ration_coe'); let std_ration_lib_ration_items = mongoose.model('std_ration_lib_ration_items'); let glj_type_util = require('../../../public/cache/std_glj_type_util'); module.exports={ calculateQuantity:calculateQuantity, getGLJTypeByID:getGLJTypeByID } //辅助定额调整、替换工料机、标准附注条件调整、添加工料机、自定义消耗量(包括删除工料机)、自定义乘系数、市场单价调整 let stateSeq ={ ass:1, replase:2, coe:3, add:4, cusQuantity:5, cusCoe:6, adjMak:7 } async function calculateQuantity(query,isMarkPriceAjust){ try { let result ={ glj_result:[], rationID:query.rationID }; let impactRation = await ration.findOne({projectID:query.projectID,ID:query.rationID,deleteInfo:null}); let gljList = await ration_glj.find(query)//{projectID:query.projectID,rationID:query.rationID} let coeList = await ration_coe.find({projectID:query.projectID,rationID:query.rationID}).sort('seq').exec(); let assList=[]; let assRation = null; let adjustState=[]; if(impactRation._doc.hasOwnProperty("rationAssList")&&impactRation.rationAssList.length>0){ for(let i=0;i1){ for(let i=0;i