Browse Source

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

Conflicts:
	server.js
chenshilong 7 years ago
parent
commit
33849ba345

+ 1 - 1
modules/all_models/compleGlj_glj.js

@@ -30,4 +30,4 @@ const comple_glj = new Schema({
     component: [comple_gljComponent]
 }, {versionKey: false});
 
-mongoose.model('complementary_glj_lib', comple_glj);
+mongoose.model('complementary_glj_lib', comple_glj, 'complementary_glj_lib');

+ 1 - 1
modules/all_models/compleRation_ration.js

@@ -58,4 +58,4 @@ const compleRationSchema = new Schema({
     deleteInfo: deleteSchema
 }, {versionKey: false});
 
-mongoose.model('complementary_ration_items', compleRationSchema);
+mongoose.model('complementary_ration_items', compleRationSchema, 'complementary_ration_items');

+ 1 - 1
modules/all_models/compleRation_section.js

@@ -22,4 +22,4 @@ const compleRationSectionTreeSchema = new Schema({
     deleteInfo: deleteSchema
 }, {versionKey: false});
 
-mongoose.model('complementary_ration_section_tree', compleRationSectionTreeSchema);
+mongoose.model('complementary_ration_section_tree', compleRationSectionTreeSchema, 'complementary_ration_section_tree');

+ 1 - 1
modules/all_models/options.js

@@ -13,4 +13,4 @@ const optionSchema = new Schema({
     }
 }, {versionKey: false});
 
-mongoose.model('options', optionSchema);
+mongoose.model('options', optionSchema, 'options');

+ 1 - 1
modules/all_models/projects.js

@@ -32,4 +32,4 @@ const ProjectSchema = new Schema({
     "changeMark":String//更新标记  feeRate:费率文件发生了改变,unitFile 单件文件发生了改变
 });
 
-mongoose.model(collectionName, ProjectSchema);
+mongoose.model(collectionName, ProjectSchema, ccollectionName);

+ 0 - 193
modules/all_models/ration_glj_temp.js

@@ -1,193 +0,0 @@
-/**
- * Created by chen on 2017/6/29.
- */
-let subSchema = require("../../main/models/bills_sub_schemas");
-let deleteSchema = require('../../../public/models/delete_schema');
-
-var mongoose = require('mongoose'),
-    Schema = mongoose.Schema;
-//下面是临时代码,以后删除
-
-var rationAssItemSchema = mongoose.Schema({
-    name: String,
-    assistID: Number,
-    assistCode: String,
-    stdValue: Number,
-    actualValue:Number,
-    stepValue: String,
-    decimal: Number,
-    carryBit: String,
-    minValue: String,
-    maxValue: String
-}, { _id: false });
-
-
-/*var gljSchema =new Schema({
- repositoryId: Number,
- ID:Number,
- //以下是基于已有access库
- code: String,
- name: String,
- specs: String,
- unit: String,
- basePrice: Number,
- gljType: Number, //这个是UI显示上的详细分类,对应gljTypeSchema
- shortName: String,  //人工,材料,机械
- gljClass:Number
- },{versionKey:false});
-
- mongoose.model("std_ration_lib_glj_list",gljSchema,"std_ration_lib_glj_list");*/
-
-
-let rationSchema = new Schema({
-    // 公用属性部分
-    ID: String,
-    projectID: Number,
-    billsItemID: String,
-    serialNo: Number,
-    code: String,
-    name: String,
-    unit: String,
-    quantity: String,
-    contain:String,//含量
-    quantityEXP:String,//工程量表达式
-    programID: Number,
-    marketUnitFee: String,
-    marketTotalFee: String,
-    fees: [subSchema.feesSchema],
-    deleteInfo: deleteSchema,
-    type: Number,                               // 1 定额、2 量价、3 工料机定额
-    subType: Number,                            // 子类型:1人工、201材料、301机械、4主材、5设备
-    installationKey:String,//用来记录安装增加费的关联字段
-
-    // 定额特有属性:
-    libID: Number,
-    maskName: String,
-    caption: String,
-    isFromDetail:{type: Number,default:0},       // 1 true 2 false
-    adjustState: String,
-    rationProjName: String,
-    comments: String,                           // 说明
-    flags: [subSchema.flagsSchema],             // 标记字段
-    rationAssList: [rationAssItemSchema],
-    content: String,                            // 工作内容
-    ruleText: String,                            // 计算规则
-
-    //工料机特有属性
-    projectGLJID:Number,  //项目工料机ID
-    GLJID:Number,//工料机库ID
-    original_code:String, //原始编码
-    specs:String,//规格型号
-    shortName:String,//缩写
-    customQuantity:String,//自定义消耗
-    from:{type: String,default:'std'}//std, cpt  来自标准工料机库、补充工料机库
-
-},{versionKey:false});
-
-mongoose.model("ration", rationSchema, "ration");
-
-var coeSchema = mongoose.Schema({
-    coeType: String,                // 系数类型,指作用范围:
-                                    // 单个(如:111量0.001)、人工类、材料类、机械类、全部(如:定额×0.925)。
-    gljID: Number,                  // 要调整的工料机ID(当coeType=0时有效)
-    operator: String,               // 运算符(*、+、-、=)
-    amount: String,                 // 调整的量
-    _id: false
-});
-
-var coeListSchema = mongoose.Schema({
-    libID: Number,                      // 所属定额定ID
-    ID: Number,                         // 系数ID(流水号ID)
-    name: String,                       // 名称
-    content: String,                    // 说明
-    coes: [coeSchema]
-}, {versionKey: false});
-
- mongoose.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list");
-
-var rationGljItemSchema = mongoose.Schema({
-    gljId: Number,
-    consumeAmt: Number,
-    proportion: Number //配合比,暂时无需使用,默认0
-}, { _id: false });
-
-var rationAssItemSchema = mongoose.Schema({
-    name: String,
-    assistID: Number,
-    assistCode: String,
-    stdValue: String,
-    stepValue: String,
-    decimal: Number,
-    carryBit: String,
-    minValue: String,
-    maxValue: String
-}, { _id: false });
-
-//定额安装增加费用
-let rationInstSchema = mongoose.Schema({
-    feeItemId: String,
-    sectionId: String
-},{_id: false});
-
-var rationItemSchema = mongoose.Schema({
-    ID:Number,
-    code: String,
-    name: String,
-    unit: String,
-    basePrice: Number,
-    sectionId: Number,
-    rationRepId: Number,
-    caption: String,
-    feeType: Number,
-    jobContent: String,
-    annotation: String,
-    rationGljList: [rationGljItemSchema],
-    rationCoeList: Array,
-    rationAssList: [rationAssItemSchema],
-    rationInstList: [rationInstSchema]
-});
-mongoose.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items");
-
-let billsSchema = new Schema({
-    ID: String,
-    ParentID: Number,
-    NextSiblingID: Number,
-    projectID: Number,
-    serialNo: Number,
-    chapterID: Number,
-    billsLibId: Number,//清单库ID
-    code: String,
-    fullCode: String,
-    type:Number,
-    isAdd:{type: Number,default:0},//1 true 0 false是否新增
-    name: String,
-    unit: String,
-    quantity: String, // Decimal
-    feeRateID:String,
-    feeRate:String,
-    isFromDetail:{type: Number,default:0},//1 true 2 false
-    programID: Number,
-    comments: String,
-    // 调价
-    xs_Labour: String, // Decimal
-    xs_Material: String, // Decimal
-    xs_Machine: String, // Decimal
-    xs_FeeRate: String, // Decimal
-    xs_LabourPrice: String, // Decimal
-    xs_MaterialPrice: String, // Decimal
-    xs_MachinePrice: String, // Decimal
-    isTender_Labour: Boolean,
-    isTender_Material: Boolean,
-    isTender_Machine: Boolean,
-    tenderTargetPrice: String, // Decimal
-    tenderTargetUnitPrice: String, // Decimal
-    tenderTargetUnitPrice: String, // Decimal
-    // 费用字段
-    fees: [subSchema.feesSchema],
-    // 标记字段
-    flags: [subSchema.flagsSchema],
-    deleteInfo: deleteSchema,
-    installationKey:String//用来记录安装增加费的关联字段
-});
-
-mongoose.model("bills", billsSchema);

+ 1 - 1
modules/all_models/stdBills_bills.js

@@ -23,4 +23,4 @@ const stdBills_bills = new Schema({
     {versionKey: false}
 );
 
-mongoose.model('std_bills_lib_bills', stdBills_bills);
+mongoose.model('std_bills_lib_bills', stdBills_bills, 'std_bills_lib_bills');

+ 1 - 1
modules/all_models/stdRation_coe.js

@@ -22,4 +22,4 @@ const coeListSchema = new Schema({
     coes: [coeSchema]
 }, {versionKey: false});
 
-mongoose.model('std_ration_lib_coe_list', coeListSchema);
+mongoose.model('std_ration_lib_coe_list', coeListSchema, 'std_ration_lib_coe_list');

+ 1 - 1
modules/all_models/stdRation_installFeeItem.js

@@ -15,4 +15,4 @@ const installFeeItemSchema = new Schema({
     deleted: false
 }, {versionKey: false});
 
-mongoose.model('std_ration_lib_installation', installFeeItemSchema);
+mongoose.model('std_ration_lib_installation', installFeeItemSchema, 'std_ration_lib_installation');

+ 1 - 1
modules/all_models/stdRation_installSection.js

@@ -26,4 +26,4 @@ const installSectionSchema = new Schema({
     deleted: false
 }, {versionKey: false});
 
-mongoose.model('std_ration_lib_installationSection', installSectionSchema);
+mongoose.model('std_ration_lib_installationSection', installSectionSchema, 'std_ration_lib_installationSection');

+ 1 - 1
modules/all_models/stdRation_lib.js

@@ -13,4 +13,4 @@ const RepositoryMapSchema = new Schema({
     "deleted": Boolean
 });
 
-mongoose.model('std_ration_lib_map', RepositoryMapSchema);
+mongoose.model('std_ration_lib_map', RepositoryMapSchema, 'std_ration_lib_map');

+ 1 - 1
modules/all_models/stdRation_ration.js

@@ -46,4 +46,4 @@ const rationItemSchema = new Schema({
     rationInstList: [rationInstSchema]
 });
 
-mongoose.model('std_ration_lib_ration_items', rationItemSchema);
+mongoose.model('std_ration_lib_ration_items', rationItemSchema, 'std_ration_lib_ration_items');

+ 1 - 1
modules/all_models/stdRation_section.js

@@ -17,4 +17,4 @@ const rationChapterTreeSchema = new Schema({//章节树  //生成唯一id改为s
     isDeleted: Boolean
 });
 
-mongoose.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema);
+mongoose.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema, 'std_ration_lib_ration_chapter_trees');

+ 1 - 1
modules/all_models/std_glj.js

@@ -30,4 +30,4 @@ const std_glj = new Schema({
     component: [std_gljComponent]
 },{versionKey: false});
 
-mongoose.model('std_glj_lib_gljList', std_glj);
+mongoose.model('std_glj_lib_gljList', std_glj, 'std_glj_lib_gljList');

+ 1 - 1
modules/all_models/std_gljClass.js

@@ -13,4 +13,4 @@ const std_gljClass = new Schema({
     deleted: Boolean
 }, {versionKey: false});
 
-mongoose.model('std_glj_lib_gljClass', std_gljClass);
+mongoose.model('std_glj_lib_gljClass', std_gljClass, 'std_glj_lib_gljClass');

+ 1 - 1
modules/all_models/tem_bills.js

@@ -33,4 +33,4 @@ const BillsTemplateSchema = {
     calcBase: String
 };
 
-mongoose.model('temp_bills', BillsTemplateSchema);
+mongoose.model('temp_bills', BillsTemplateSchema, 'temp_bills');

+ 0 - 12
modules/common/std/schemas/std_mix_ratio.js

@@ -1,12 +0,0 @@
-/**
- * 配合比标准库数据模型
- *
- * @author CaiAoLin
- * @date 2017/7/7
- * @version
- */
-import mongoose from "mongoose";
-
-let collectionName = 'std_mix_ratio';
-let model = mongoose.model(collectionName);
-export {model as default, collectionName as collectionName};

+ 0 - 13
modules/common/std/schemas/std_ration_lib_glj_list.js

@@ -1,13 +0,0 @@
-/**
- * 定额工料机标准库数据模型
- *
- * @author CaiAoLin
- * @date 2017/7/7
- * @version
- */
-import mongoose from "mongoose";
-
-let collectionName = 'std_glj_lib_gljList';
-// 因为别处已初始化过,所以直接使用
-let model = mongoose.model(collectionName);
-export {model as default, collectionName as collectionName};

+ 2 - 2
modules/common/std/std_glj_lib_glj_list_model.js

@@ -5,8 +5,8 @@
  * @date 2017/7/11
  * @version
  */
+import mongoose from "mongoose";
 import BaseModel from "../base/base_model";
-import STDRationLibGLJListSchemas from "./schemas/std_ration_lib_glj_list";
 
 class STDGLJLibGLJListModel extends BaseModel {
 
@@ -17,7 +17,7 @@ class STDGLJLibGLJListModel extends BaseModel {
      */
     constructor() {
         let parent = super();
-        parent.model = STDRationLibGLJListSchemas;
+        parent.model = mongoose.model("std_glj_lib_gljList");
         parent.init();
     }
 

+ 2 - 2
modules/common/std/std_mix_ratio_model.js

@@ -5,8 +5,8 @@
  * @date 2017/7/10
  * @version
  */
+import mongoose from "mongoose";
 import BaseModel from "../base/base_model";
-import STDMixRatioSchema from "./schemas/std_mix_ratio";
 
 class STDMixRatioModel extends BaseModel {
 
@@ -17,7 +17,7 @@ class STDMixRatioModel extends BaseModel {
      */
     constructor() {
         let parent = super();
-        parent.model = STDMixRatioSchema;
+        parent.model = mongoose.model('std_mix_ratio');
         parent.init();
     }
 

+ 2 - 1
modules/main/facade/installation_facade.js

@@ -3,7 +3,8 @@
  */
 const mongoose = require('mongoose');
 const installSectionModel = mongoose.model("std_ration_lib_installationSection");
-const installFeeItemModel = mongoose.model("std_ration_lib_installation");let installationFeeModel = mongoose.model("installation_fee");
+const installFeeItemModel = mongoose.model("std_ration_lib_installation");
+let installationFeeModel = mongoose.model("installation_fee");
 let engineeringModel = mongoose.model('engineering_lib');
 const uuidV1 = require('uuid/v1');
 let consts = require('../../main/models/project_consts');

+ 3 - 2
modules/main/models/proj_counter_model.js

@@ -2,12 +2,13 @@
  * Created by Mai on 2017/6/13.
  */
 
+let mongoose = require("mongoose");
 let baseModel = require('./base_model');
-import {default as projCounterSchema, collectionName as collectionName} from "./schemas/proj_counter";
 
+let collectionName = 'projCounter';
 class projCounter extends baseModel {
     constructor() {
-        super(projCounterSchema);
+        super(mongoose.model(collectionName));
         this.collectionName = collectionName;
     }
 

+ 3 - 3
modules/main/models/proj_setting_model.js

@@ -2,14 +2,14 @@
  * Created by Mai on 2017/9/14.
  */
 
+let mongoose = require("mongoose");
 let baseModel = require('./base_model');
-// import {default as projSettingSchema, collectionName as collectionName, settingConst as settingConst} from "./schemas/proj_setting";
-import {default as projSettingSchema, collectionName as collectionName} from "./schemas/proj_setting";
+let collectionName = 'proj_setting';
 
 class projSettingModel extends baseModel {
 
     constructor() {
-        super(projSettingSchema);
+        super(mongoose.model(collectionName));
         this.collectionName = collectionName;
     }
 

+ 0 - 8
modules/main/models/schemas/proj_counter.js

@@ -1,8 +0,0 @@
-/**
- * Created by Mai on 2017/9/15.
- */
-
-let mongoose = require("mongoose");
-let collectionName = 'projCounter';
-let model = mongoose.model(collectionName);
-export {model as default, collectionName as collectionName};

+ 0 - 8
modules/main/models/schemas/proj_setting.js

@@ -1,8 +0,0 @@
-/**
- * Created by Mai on 2017/9/14.
- */
-
-let mongoose = require("mongoose");
-let collectionName = 'proj_setting';
-let model = mongoose.model(collectionName);
-export {model as default, collectionName as collectionName};

+ 2 - 1
public/cache/std_glj_type_util.js

@@ -1,8 +1,9 @@
 /**
  * Created by Tony on 2017/7/6.
  */
+let mongoose = require('mongoose');
 let cacheUtil = require('./cacheUtil');
-let std_glj_type_mdl = require('../models/std_glj_types');
+let std_glj_type_mdl = mongoose.model("std_glj_type");
 
 const STD_GLJ_GRP = 'std_glj_grp';
 

+ 0 - 15
public/models/delete_schema.js

@@ -1,15 +0,0 @@
-/**
- * Created by Mai on 2017/4/17.
- */
-
-var mongoose = require("mongoose");
-var Schema = mongoose.Schema;
-
-
-var deleteSchema = new Schema({
-    deleted: Boolean,
-    deleteDateTime: Date,
-    deleteBy: Number // userID
-});
-
-module.exports = deleteSchema;

+ 0 - 5
public/models/std_glj_types.js

@@ -1,5 +0,0 @@
-/**
- * Created by Tony on 2017/7/6.
- */
-let mongoose = require('mongoose');
-module.exports = mongoose.model("std_glj_type");

+ 0 - 8
server.js

@@ -20,14 +20,6 @@ dbm.connect();
 fileUtils.getGlobbedFiles('./modules/all_models/*.js').forEach(function(modelPath) {
     require(path.resolve(modelPath));
 })
-//暂时引入其它模块的model
-require('./modules/fee_rates/models/fee_rates');
-
-//引入报表模块
-fileUtils.getGlobbedFiles('./modules/reports/models/*.js').forEach(function(modelPath) {
-    require(path.resolve(modelPath));
-})
-
 //config.setupCache();
 let cfgCacheUtil = require("./config/cacheCfg");
 cfgCacheUtil.setupDftCache();