|
|
@@ -194,7 +194,7 @@ let calcTools = {
|
|
|
delete treeNode.data.gljList;
|
|
|
if (this.isRationCategory(treeNode)) {
|
|
|
if (treeNode.data.type != rationType.volumePrice) {
|
|
|
- treeNode.data.gljList = projectObj.project.ration_glj.getGljArrByRation(treeNode.data);
|
|
|
+ treeNode.data.gljList = projectObj.project.calcProgram.getGljArrByRation(treeNode.data);
|
|
|
}
|
|
|
}
|
|
|
else if (this.isBill(treeNode)){
|
|
|
@@ -1438,6 +1438,8 @@ class CalcProgram {
|
|
|
let me = this;
|
|
|
me.project = project;
|
|
|
me.datas = [];
|
|
|
+ me.rationMap = null;//定额 - 工料机映射临时变量
|
|
|
+ me.pgljMap = null;
|
|
|
project.registerModule(ModuleNames.calc_program, me);
|
|
|
};
|
|
|
|
|
|
@@ -1637,7 +1639,8 @@ class CalcProgram {
|
|
|
let me = this;
|
|
|
// 仅用作树节点显示的工料机不能参与计算。
|
|
|
if (treeNode.sourceType === ModuleNames.ration_glj) return;
|
|
|
-
|
|
|
+ //设置定额工料机映射表
|
|
|
+ me.setRationMap();
|
|
|
treeNode.calcType = calcTools.getCalcType(treeNode);
|
|
|
let nQ = calcTools.uiNodeQty(treeNode);
|
|
|
let nTQ = calcTools.uiNodeTenderQty(treeNode);
|
|
|
@@ -1931,6 +1934,8 @@ class CalcProgram {
|
|
|
me.project.updateNodes(dataArr, function (data) {
|
|
|
let endShowTime = +new Date();
|
|
|
console.log(`保存所需时间——${endShowTime - startTime}`);
|
|
|
+ me.rationMap = null;
|
|
|
+ me.pgljMap = null;
|
|
|
if(callback){
|
|
|
callback(data);
|
|
|
};
|
|
|
@@ -2170,6 +2175,35 @@ class CalcProgram {
|
|
|
projectObj.project.calcProgram.calculate(treeNode, false, false, tenderTypes.ttCalc); // 再正向算
|
|
|
};
|
|
|
};
|
|
|
+ setRationMap(){
|
|
|
+ if(this.rationMap == null){
|
|
|
+ this.rationMap = {};
|
|
|
+ for(let glj of projectObj.project.ration_glj.datas){
|
|
|
+ if(this.rationMap[glj.rationID]){
|
|
|
+ this.rationMap[glj.rationID].push(glj)
|
|
|
+ }else {
|
|
|
+ this.rationMap[glj.rationID] = [glj];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(this.pgljMap == null ){
|
|
|
+ this.pgljMap = _.indexBy(projectObj.project.projectGLJ.datas.gljList, 'id');
|
|
|
+ }
|
|
|
+ };
|
|
|
+ getGljArrByRation(ration){
|
|
|
+ if (ration.type == rationType.gljRation){
|
|
|
+ let glj = JSON.parse(JSON.stringify(ration));
|
|
|
+ glj.type = glj.subType;
|
|
|
+ glj.quantity = 1;
|
|
|
+ glj.totalQuantity = parseFloatPlus(ration.quantity);
|
|
|
+ return [glj];
|
|
|
+ } else{
|
|
|
+ if(!this.rationMap) return [];
|
|
|
+ let result = this.rationMap[ration.ID];
|
|
|
+ result = gljOprObj.combineWithProjectGlj(result,false,ration,this.pgljMap);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// export default analyzer;
|