|
@@ -51,7 +51,7 @@ async function calculateQuantity(query,isMarkPriceAjust){
|
|
|
}
|
|
|
}
|
|
|
for(let i =0;i<gljList.length;i++ ){
|
|
|
- let r = await calculateQuantityPerGLJ(gljList[i],impactRation,coeList,assList,adjustState,isMarkPriceAjust);
|
|
|
+ let r = await calculateQuantityPerGLJ(gljList[i],i,coeList,assList,adjustState,isMarkPriceAjust);
|
|
|
result.glj_result.push(r);
|
|
|
}
|
|
|
|
|
@@ -85,7 +85,7 @@ function generateUpdateTasks(result) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-async function calculateQuantityPerGLJ(glj,ration,coeList,assList,adjustState,isMarkPriceAjust) {
|
|
|
+async function calculateQuantityPerGLJ(glj,index,coeList,assList,adjustState,isMarkPriceAjust) {
|
|
|
let quantity = glj.quantity;
|
|
|
let result={
|
|
|
query:{
|
|
@@ -112,7 +112,7 @@ async function calculateQuantityPerGLJ(glj,ration,coeList,assList,adjustState,is
|
|
|
}
|
|
|
result.doc.quantity =_.round(quantity,3);
|
|
|
}
|
|
|
- generateAdjustState(glj,coeList,adjustState);
|
|
|
+ generateAdjustState(glj,coeList,adjustState,index);
|
|
|
return result;
|
|
|
}catch (err){
|
|
|
throw err;
|
|
@@ -134,23 +134,25 @@ function calculateAss(quantity,assList,glj) {
|
|
|
return quantity;
|
|
|
}
|
|
|
|
|
|
-function generateAdjustState(glj,coeList,adjustState) {
|
|
|
+function generateAdjustState(glj,coeList,adjustState,index) {
|
|
|
//替换工料机 and 添加工料机
|
|
|
|
|
|
// to do
|
|
|
|
|
|
//标准附注条件调整 + 自定义乘系数
|
|
|
- for(let i=0;i<coeList.length;i++){
|
|
|
- if(coeList[i].isAdjust==1){
|
|
|
- if(i==coeList.length-1){
|
|
|
- adjustState.push({index:stateSeq.cusCoe,content:coeList[i].content});
|
|
|
- }else {
|
|
|
- adjustState.push({index:stateSeq.coe,content:"调 : "+coeList[i].content});
|
|
|
+ if(0==index){
|
|
|
+ for(let i=0;i<coeList.length;i++){
|
|
|
+ if(coeList[i].isAdjust==1){
|
|
|
+ if(i==coeList.length-1){
|
|
|
+ adjustState.push({index:stateSeq.cusCoe,content:coeList[i].content});
|
|
|
+ }else {
|
|
|
+ adjustState.push({index:stateSeq.coe,content:"调 : "+coeList[i].content});
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //自定义消耗量
|
|
|
+ //自定义消耗量
|
|
|
if(glj._doc.hasOwnProperty('customQuantity')){
|
|
|
if(glj.customQuantity!==null){
|
|
|
adjustState.push({index:stateSeq.cusQuantity,content:glj.code+'量'+glj.customQuantity});
|