|
|
@@ -15,13 +15,13 @@ const compleRationLib = 'compleRationLib';
|
|
|
class SearchDao{
|
|
|
async getRationItem(userId, compilationId, rationRepIds, code, ID, callback){
|
|
|
let ration = null;
|
|
|
+ let otherLibs=[];
|
|
|
try{
|
|
|
- let firstLib = rationRepIds.shift();//优先取第一个
|
|
|
- if(rationRepIds.includes(firstLib)) {//去掉重复的库ID
|
|
|
- rationRepIds.splice(rationRepIds.indexOf(firstLib), 1);
|
|
|
- }
|
|
|
- if(rationRepIds.includes(compleRationLib)) {
|
|
|
- rationRepIds.splice(rationRepIds.indexOf(compleRationLib), 1);
|
|
|
+ let firstLib = rationRepIds[0];//优先取第一个
|
|
|
+ for (let l of rationRepIds){
|
|
|
+ if(l != firstLib && l != compleRationLib){
|
|
|
+ otherLibs.push(l);
|
|
|
+ }
|
|
|
}
|
|
|
if(firstLib == compleRationLib){//说明选中的是补充定额库
|
|
|
ration = await this.getCompleRation(userId,compilationId,code,ID);
|
|
|
@@ -34,7 +34,7 @@ class SearchDao{
|
|
|
ration = await this.getStdRation(firstQuery);
|
|
|
}
|
|
|
if(ration == null){//选中的定额库或者默认的定额库中没有找到定额,才走常规的流程查找其它定额库
|
|
|
- let stdQuery = {rationRepId: {$in: rationRepIds}, code: code, $or: [{isDeleted: null}, {isDeleted: false}]};
|
|
|
+ let stdQuery = {rationRepId: {$in: otherLibs}, code: code, $or: [{isDeleted: null}, {isDeleted: false}]};
|
|
|
if(ID){
|
|
|
stdQuery = {ID: ID, $or: [{isDeleted: null}, {isDeleted: false}]};
|
|
|
}
|