| 
					
				 | 
			
			
				@@ -260,6 +260,9 @@ ProjectGLJ.prototype.updatePrice = function (recode, updateField, newval,from,cb 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let pgljID = from=="rg"?recode.projectGLJID:recode.id;//和定额工料机统一接口,项目工料机ID取值不一样 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let glj = _.find(projectGljs, {'id': pgljID}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (glj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(glj.unit_price[updateField] == newval){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let data = {id: glj.unit_price.id, field: updateField, newval: newval,project_id:glj.project_id}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let callback = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (updateField == 'base_price') { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -657,59 +660,75 @@ ProjectGLJ.prototype.getShortNameByID = function (ID) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ProjectGLJ.prototype.calcQuantity  = function (){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let project_gljs = this.datas.gljList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let mixRatioConnectData = this.datas.mixRatioConnectData; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let mixRatioSubdivisionMap = {}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let mixRatioTechMap={}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let mixRatioMap = this.datas.mixRatioMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let rations = projectObj.project.Ration.datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let rationMap = _.indexBy(rations,'ID'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let quantityMap={}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let rationGljGroup = _.groupBy(projectObj.project.ration_glj.datas,'projectGLJID') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let q_decimal = getDecimal("glj.quantity"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for(let pglj of project_gljs ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(pglj.quantity !== 0 && pglj.quantity !== '0'){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let result = this.getQuantityPerGLJ(pglj,mixRatioSubdivisionMap,mixRatioTechMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let pg_index = gljOprObj.getIndex(pglj,gljKeyArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pglj.subdivisionQuantity = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pglj.techQuantity = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        pglj.quantity = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(rationGljGroup[pglj.id]){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let result = this.getQuantityPerGLJ(rationGljGroup[pglj.id],rations,rationMap,pglj,quantityMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             pglj.subdivisionQuantity = result.subdivisionQuantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             pglj.techQuantity = result.techQuantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            pglj.quantity = result.quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        quantityMap[pg_index] = pglj; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     //计算做为组成物的消耗量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    for(let pg of project_gljs ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(pg.quantity !== 0 && pg.quantity !== '0'){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let pg_index = gljOprObj.getIndex(pg,gljKeyArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(mixRatioConnectData[pg_index]){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(mixRatioSubdivisionMap[pg_index]){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pg.subdivisionQuantity = scMathUtil.roundForObj(mixRatioSubdivisionMap[pg_index]+pg.subdivisionQuantity,getDecimal("glj.quantity")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(mixRatioTechMap[pg_index]){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    pg.techQuantity = scMathUtil.roundForObj(mixRatioTechMap[pg_index]+pg.techQuantity,getDecimal("glj.quantity")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for(let pkey in mixRatioMap){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let mixRatioList = mixRatioMap[pkey]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for(let m of mixRatioList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let m_index = gljOprObj.getIndex(m,gljKeyArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let m_glj = quantityMap[m_index]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let p_glj = quantityMap[pkey]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(m_glj&&p_glj){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let quantity = scMathUtil.roundForObj(p_glj.quantity*parseFloat(m.consumption),q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let techQuantity = scMathUtil.roundForObj(p_glj.techQuantity*parseFloat(m.consumption),q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                let subdivisionQuantity = scMathUtil.roundForObj(p_glj.subdivisionQuantity*parseFloat(m.consumption),q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                m_glj.quantity =  scMathUtil.roundForObj(m_glj.quantity+quantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                m_glj.techQuantity =  scMathUtil.roundForObj(m_glj.techQuantity+techQuantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                m_glj.subdivisionQuantity =  scMathUtil.roundForObj(m_glj.subdivisionQuantity+subdivisionQuantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-ProjectGLJ.prototype.getQuantityPerGLJ = function (pglj,mixRatioSubdivisionMap,mixRatioTechMap) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ProjectGLJ.prototype.getQuantityPerGLJ = function (ration_glj_list,rations,rationMap,pglj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let billIDs =   projectObj.project.Bills.getSubdivisionProjectLeavesID();//取分部分项上的所有叶子清单ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let tech_billIDS =  projectObj.project.Bills.getTechLeavesID();//取所有技术措施项目叶子清单ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let ration_glj_list = projectObj.project.ration_glj.datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let tech_billIDS =  projectObj.project.Bills.getTechLeavesID();//取所有技术措施项目叶子清单IDs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let mixRatioMap = this.datas.mixRatioMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let rations = projectObj.project.Ration.datas; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let q_decimal = getDecimal("glj.quantity"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let result={}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let sum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    let tech_sum = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let quantitySum=0;//工料机汇总消耗量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let sum = 0;//分部分项总消耗量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    let tech_sum = 0;//技术措施总消耗量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for(let rg of ration_glj_list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(rg.projectGLJID==pglj.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let tem_ration = rationMap[rg.rationID]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let r_quantity = scMathUtil.roundForObj(tem_ration.quantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let glj_quantity = scMathUtil.roundForObj(rg.quantity, q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(!r_quantity){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            quantitySum = scMathUtil.roundForObj(quantitySum+total,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(_.includes(billIDs,rg.billsItemID)){//计算分部分项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               let total = calcQuantity(rg,mixRatioSubdivisionMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-               sum = scMathUtil.roundForObj(sum+total,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sum = scMathUtil.roundForObj(sum+total,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(_.includes(tech_billIDS,rg.billsItemID)){//计算技术措施项目消耗量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let tech_total = calcQuantity(rg,mixRatioTechMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tech_sum = scMathUtil.roundForObj(tech_sum+tech_total,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                tech_sum = scMathUtil.roundForObj(tech_sum+total,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     for(let ra of rations){//计算定额类型工料机的消耗量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(ra.type == rationType.gljRation&&ra.projectGLJID===pglj.id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             let r_quantity = scMathUtil.roundForObj(ra.quantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             r_quantity = r_quantity?r_quantity:0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            quantitySum== scMathUtil.roundForObj(quantitySum+r_quantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(_.includes(billIDs,ra.billsItemID)){//计算分部分项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 sum = scMathUtil.roundForObj(sum+r_quantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -721,25 +740,6 @@ ProjectGLJ.prototype.getQuantityPerGLJ = function (pglj,mixRatioSubdivisionMap,m 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     result.subdivisionQuantity = sum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     result.techQuantity = tech_sum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    result.quantity = quantitySum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    function calcQuantity(rg,quantityMap) { //计算工料机在所属定额下的总消耗量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let tem_ration = _.find(rations,{"ID":rg.rationID}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let total = parseFloat(gljOprObj.getTotalQuantity(rg,tem_ration)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let r_index = gljOprObj.getIndex(rg,gljKeyArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(mixRatioMap.hasOwnProperty(r_index)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            let mixRatioList = mixRatioMap[r_index]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            for(let m of mixRatioList){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let m_index = gljOprObj.getIndex(m,gljKeyArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                let m_quantity = scMathUtil.roundForObj(total*m.consumption,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(quantityMap[m_index]){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    quantityMap[m_index] = scMathUtil.roundForObj(quantityMap[m_index]+m_quantity,q_decimal); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    quantityMap[m_index] = m_quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return total; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }  
			 |