|
@@ -68,6 +68,7 @@ async function calculateQuantity(query,noNeedCal,refreshRationName = false,areaI
|
|
|
areaSetting = project.property.areaSetting;
|
|
|
}
|
|
|
if(impactRation._doc.hasOwnProperty("rationAssList")&&impactRation.rationAssList.length>0){
|
|
|
+ prepareAss(impactRation.rationAssList);
|
|
|
let temTimes = [];
|
|
|
let thirdRationCodes=[];
|
|
|
for(let i=0;i<impactRation.rationAssList.length;i++){
|
|
@@ -376,19 +377,23 @@ function getContent(coes) {
|
|
|
}
|
|
|
|
|
|
function prepareAss(assList) {//处理辅助定额,支持多个辅助定额的情况
|
|
|
- for(let a of assList){
|
|
|
- if(a.groupList && a.groupList.length > 1){//组里有多个定额的情况
|
|
|
- let newList = _.sortByAll(a.groupList,['param']);//先按参数排序
|
|
|
- for(let n of newList){
|
|
|
- if(a.actualValue > n.stdValue && a.actualValue <= parseFloat(n.param)){//落在中间,则用组里的这条定额
|
|
|
- a._doc.param = n.param;
|
|
|
- a._doc.paramName = n.paramName;
|
|
|
- a._doc.assistCode = n.assistCode;
|
|
|
- break;
|
|
|
- }
|
|
|
+ for(let a of assList){
|
|
|
+ if(a.groupList && a.groupList.length > 1){//组里有多个定额的情况
|
|
|
+ let newList = _.sortByAll(a.groupList,[function(item){
|
|
|
+ return parseFloat(item.param)
|
|
|
+ }]);//先按参数排序
|
|
|
+ let pre = 0;
|
|
|
+ for(let n of newList){
|
|
|
+ if(a.actualValue > pre && a.actualValue <= parseFloat(n.param)){//落在中间,则用组里的这条定额
|
|
|
+ a._doc.param = n.param;
|
|
|
+ a._doc.paramName = n.paramName;
|
|
|
+ a._doc.assistCode = n.assistCode;
|
|
|
+ break;
|
|
|
}
|
|
|
+ pre = parseFloat(n.param);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function calculateTimes(ass){
|