| 
					
				 | 
			
			
				@@ -25,7 +25,7 @@ let stateSeq ={ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-async function calculateQuantity(query){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+async function calculateQuantity(query,isMarkPriceAjust){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          let  result ={ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              glj_result:[], 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -48,10 +48,13 @@ async function calculateQuantity(query){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          for(let i =0;i<gljList.length;i++ ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             let r = await calculateQuantityPerGLJ(gljList[i],impactRation,coeList,assList,adjustState); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             let r = await calculateQuantityPerGLJ(gljList[i],impactRation,coeList,assList,adjustState,isMarkPriceAjust); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				              result.glj_result.push(r); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         await ration_glj.bulkWrite(generateUpdateTasks(result.glj_result)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         console.log(result.glj_result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(isMarkPriceAjust==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            await ration_glj.bulkWrite(generateUpdateTasks(result.glj_result)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          adjustState= _.sortByOrder(adjustState, ['index'], ['asc']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          adjustState=_.map(adjustState, _.property('content')); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          let adjustStateString = adjustState.join(';'); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -79,7 +82,7 @@ function generateUpdateTasks(result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-async function calculateQuantityPerGLJ(glj,ration,coeList,assList,adjustState) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+async function calculateQuantityPerGLJ(glj,ration,coeList,assList,adjustState,isMarkPriceAjust) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let quantity =  glj.quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     let result={ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         query:{ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -92,20 +95,20 @@ async function calculateQuantityPerGLJ(glj,ration,coeList,assList,adjustState) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //to do 添加/替换工料机调整 内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(!glj._doc.hasOwnProperty('customQuantity')||glj.customQuantity==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            quantity =glj.rationItemQuantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            quantity =calculateAss(quantity,assList,glj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            quantity = calculateQuantityByCoes(quantity,coeList,glj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            quantity = glj.customQuantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let customerCoe = _.last(coeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(customerCoe.isAdjust==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            quantity = calculateQuantityByCustomerCoes(quantity,customerCoe,glj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(isMarkPriceAjust==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(!glj._doc.hasOwnProperty('customQuantity')||glj.customQuantity==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quantity =glj.rationItemQuantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quantity =calculateAss(quantity,assList,glj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quantity = calculateQuantityByCoes(quantity,coeList,glj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quantity = glj.customQuantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let customerCoe = _.last(coeList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(customerCoe.isAdjust==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                quantity = calculateQuantityByCustomerCoes(quantity,customerCoe,glj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            result.doc.quantity =quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        result.doc.quantity =quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         generateAdjustState(glj,coeList,adjustState); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }catch (err){ 
			 |