|
|
@@ -481,6 +481,8 @@ async function addRationGLJ(std,newRation,compilation,isMaterial,connect_key) {
|
|
|
let newRationGLJList = [];
|
|
|
let rationGLJShowList = [];
|
|
|
let projectGLJList = [];
|
|
|
+ let gljKeyMap = {};
|
|
|
+ let maxRatioMap={};
|
|
|
let unitPriceFileId = 0;
|
|
|
let property = await projectDao.getProjectProperty(newRation.projectID);
|
|
|
if(property){
|
|
|
@@ -499,9 +501,9 @@ async function addRationGLJ(std,newRation,compilation,isMaterial,connect_key) {
|
|
|
stdGLJID.push(tem_g.gljId);
|
|
|
}
|
|
|
}
|
|
|
- let stdGLJList = stdGLJID.length > 0 ? await std_glj_lib_gljList_model.find({'ID':{'$in':stdGLJID}}):[];//速度优化-------先一次性取出所有的工料机列表
|
|
|
+ let stdGLJList = stdGLJID.length > 0 ? await std_glj_lib_gljList_model.find({'ID':{'$in':stdGLJID}}).lean():[];//速度优化-------先一次性取出所有的工料机列表
|
|
|
let stdGLJMap = _.indexBy(stdGLJList, 'ID');
|
|
|
- let cptGLJList = cptGLJID.length > 0 ? await complementary_glj_model.find({'userId':std.userId,'ID':{'$in':cptGLJID}}):[];
|
|
|
+ let cptGLJList = cptGLJID.length > 0 ? await complementary_glj_model.find({'userId':std.userId,'ID':{'$in':cptGLJID}}).lean():[];
|
|
|
let cptGLJMap = _.indexBy(cptGLJList, 'ID');
|
|
|
let stdGLJMapTime = +new Date();
|
|
|
console.log("找到工料机映射表时间-------------------------------"+(stdGLJMapTime - first));
|
|
|
@@ -526,16 +528,23 @@ async function addRationGLJ(std,newRation,compilation,isMaterial,connect_key) {
|
|
|
newGLJ.adjustProportion = proportion;
|
|
|
let std_glj = getStdGlj(sub,stdGLJMap,cptGLJMap,{},ext);
|
|
|
if(std_glj){
|
|
|
+ let tindex = getIndex(newGLJ);
|
|
|
ration_glj_facade.setPropertyFromStd(newGLJ,std_glj);
|
|
|
- let [info,projectGLJ] = await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
|
|
|
+ if(std_glj.component && std_glj.component.length > 0) maxRatioMap[tindex] = std_glj.component
|
|
|
+ gljKeyMap[tindex] = newGLJ;
|
|
|
+
|
|
|
+ /* let [info,projectGLJ] = await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
|
|
|
newGLJ = ration_glj_facade.createNewRecord(info);
|
|
|
newRationGLJList.push(newGLJ);
|
|
|
rationGLJShowList.push(info);
|
|
|
- projectGLJList.push(projectGLJ);
|
|
|
+ projectGLJList.push(projectGLJ); */
|
|
|
}
|
|
|
//let InfoFromProjectGLJ = +new Date();
|
|
|
//console.log("找到项目工料机时间-------------------------------"+(InfoFromProjectGLJ - std_gljTime));
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
let before = +new Date();
|
|
|
console.log("总查询时间为-------------------------------"+(before-first));
|
|
|
@@ -767,4 +776,16 @@ function FilterNumberFromUnit (unit) {
|
|
|
} else {
|
|
|
return 1;
|
|
|
}
|
|
|
-};
|
|
|
+};
|
|
|
+
|
|
|
+getIndex(obj,tpops){
|
|
|
+ let pops = tpops?tpops:['code','name','specs','unit','type'];
|
|
|
+ let t_index = '';
|
|
|
+ let k_arr=[];
|
|
|
+ for(let p of pops){
|
|
|
+ let tmpK = (obj[p]==undefined||obj[p]==null||obj[p]=='')?'null':obj[p];
|
|
|
+ k_arr.push(tmpK);
|
|
|
+ }
|
|
|
+ t_index=k_arr.join("|-|");
|
|
|
+ return t_index;
|
|
|
+}
|