|
@@ -3,6 +3,7 @@
|
|
|
*/
|
|
|
import gljMapModel from "./schemas";
|
|
|
import {gljModel, gljClassModel} from "./schemas";
|
|
|
+import {rationRepository} from "../../ration_repository/models/schemas";
|
|
|
import moment from "moment";
|
|
|
import counter from "../../../public/counter/counter";
|
|
|
import async from "async";
|
|
@@ -84,15 +85,24 @@ class GljMapDao extends OprDao{
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- getAllGljLib(callback){
|
|
|
- gljMapModel.find({deleted: false}, function (err, result) {
|
|
|
- if(err){
|
|
|
- callback(err, '没有定额库数据!', null);
|
|
|
- }
|
|
|
- else{
|
|
|
- callback(null, '成功', result);
|
|
|
+ async getAllGljLib(callback){
|
|
|
+ try{
|
|
|
+ let gljLibs = await gljMapModel.find({deleted: false});
|
|
|
+ for(let gljLib of gljLibs){
|
|
|
+ let tempRationLibs = [];
|
|
|
+ for(let rationLib of gljLib.rationLibs){
|
|
|
+ let rLib = await rationRepository.findOne({ID: rationLib.ID, deleted: false});
|
|
|
+ if(rLib !== undefined && rLib !== null){
|
|
|
+ tempRationLibs.push({ID: rationLib.ID, dispName: rLib.dispName});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gljLib._doc.rationLibs = tempRationLibs;
|
|
|
}
|
|
|
- })
|
|
|
+ callback(null, '成功', gljLibs);
|
|
|
+ }
|
|
|
+ catch(err){
|
|
|
+ callback(err, '没有定额库数据!', null);
|
|
|
+ }
|
|
|
}
|
|
|
createGljLib(gljLibObj, callback){
|
|
|
counter.counterDAO.getIDAfterCount(counter.moduleName.stdGljLib, 1, function (err, result) {
|