Browse Source

标准人材机库,取消模板,新建的人材机库,分类为空

zhongzewei 7 years ago
parent
commit
74ea0beec6
2 changed files with 1 additions and 72 deletions
  1. 1 29
      modules/std_glj_lib/models/gljMapModel.js
  2. 0 43
      modules/std_glj_lib/models/gljModel.js

+ 1 - 29
modules/std_glj_lib/models/gljMapModel.js

@@ -5,7 +5,6 @@ const mongoose = require('mongoose');
 const gljMapModel = mongoose.model('std_glj_lib_map');
 const gljModel = mongoose.model('std_glj_lib_gljList');
 const gljClassModel = mongoose.model('std_glj_lib_gljClass');
-const gljClassTemplateModel = mongoose.model('std_glj_lib_gljClassTemplate');
 const rationRepository = mongoose.model('std_ration_lib_map');
 const engLibModel = mongoose.model('engineering_lib');
 const compleGljClassTemp = mongoose.model('complementary_glj_section_templates');
@@ -122,34 +121,7 @@ class GljMapDao extends OprDao{
                         callback(err, '创建新工料机库失败!', null);
                     }
                     else{
-                        //创建分类模板
-                        gljClassTemplateModel.find({'$or': [{isDeleted: null}, {isDeleted: false}, {deleted: false}]}, function (err, datas) {
-                            if(err){
-                                callback(err, "获取工料机类型错误!", null);
-                            }
-                            else{
-                                let rst = [];
-                                async.each(datas, function (data, cb) {
-                                    let newClassObj = {};
-                                    newClassObj.ID = data.ID;
-                                    newClassObj.ParentID = data.ParentID;
-                                    newClassObj.NextSiblingID = data.NextSiblingID;
-                                    newClassObj.Name = data.Name;
-                                    newClassObj.repositoryId = newGljLib.ID;
-                                    newClassObj.deleted = false;
-                                    gljClassModel.create(newClassObj, function(err){
-                                        if(err)cb(err);
-                                        else{
-                                            rst.push(newClassObj);
-                                            cb(null);
-                                        }
-                                    });
-                                }, function (err) {
-                                    if(err) callback(err, "新增工料机类型错误!", null);
-                                    else callback(null, '创建成功', result);
-                                });
-                            }
-                        });
+                        callback(null, '创建成功', result);
                     }
                 });
             }

+ 0 - 43
modules/std_glj_lib/models/gljModel.js

@@ -5,7 +5,6 @@ const mongoose = require('mongoose');
 const gljMapModel = mongoose.model('std_glj_lib_map');
 const gljModel = mongoose.model('std_glj_lib_gljList');
 const gljClassModel = mongoose.model('std_glj_lib_gljClass');
-const gljClassTemplateModel = mongoose.model('std_glj_lib_gljClassTemplate');
 const compilationModel = mongoose.model('compilation');
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 const rationModel = mongoose.model('std_ration_lib_ration_items');
@@ -15,48 +14,6 @@ import counter from "../../../public/counter/counter";
 import async from "async";
 
 class GljDao  extends OprDao{
-    //test
-    async deSomething (libID){
-        let pClass = await gljClassModel.find({repositoryId: libID, Name: '2013全省材料预算价格'});
-        let classIDs = [],
-            pClassIDs = [];
-        for (let p of pClass) {
-            let p1Class = await gljClassModel.find({repositoryId: libID, ParentID: p.ID});
-            for (let c of p1Class) {
-                pClassIDs.push(c.ID);
-            }
-        }
-        let subClass = await gljClassModel.find({repositoryId: libID, ParentID: {$in: pClassIDs}});
-        for (let s of subClass) {
-            classIDs.push(s.ID);
-        }
-        let subSonClass = await gljClassModel.find({repositoryId: libID, ParentID: {$in: classIDs}});
-        for (let ss of subSonClass){
-            classIDs.push(ss.ID);
-        }
-        classIDs = Array.from(new Set(classIDs));
-        //相关人材机
-        let gljs = await gljModel.find({repositoryId: libID, gljClass: {$in: classIDs}}, '-_id gljClass ID');
-        let gljIDs = [];
-        for (let g of gljs) {
-            gljIDs.push(g.ID);
-        }
-        let gljLib = await gljMapModel.findOne({ID: libID});
-        let refRationLibIDs = [];
-        for (let rl of gljLib.rationLibs) {
-            refRationLibIDs.push(rl.ID);
-        }
-        let i = 0;
-        for (let rationLibID of refRationLibIDs) {
-            await rationModel.update({rationRepId: rationLibID, 'rationGljList.gljId': {$in: gljIDs}}, {$pull: {rationGljList: {gljId: {$in: gljIDs}}}}, {multi: true});
-            console.log(`i++======================`);
-            console.log(i++);
-        }
-        await gljModel.remove({ID: {$in: gljIDs}});
-        console.log('end');
-
-    }
-    //test
     getGljTypes (gljLibId, callback){
         gljClassModel.find({"repositoryId": gljLibId, "$or": [{"isDeleted": null}, {"isDeleted": false}, {deleted: false} ]},function(err,data){
             if(err) callback("获取工料机类型错误!",false)