zhangweicheng 7 年之前
父節點
當前提交
1b8dced5f5
共有 51 個文件被更改,包括 340 次插入544 次删除
  1. 62 0
      modules/all_models/bills.js
  2. 1 2
      modules/users/models/schema/compilation.js
  3. 5 1
      modules/glj/models/schemas/counter.js
  4. 1 2
      modules/users/models/schema/engineering_lib.js
  5. 1 9
      modules/fee_rates/models/fee_rates.js
  6. 1 4
      modules/main/models/installation_fee.js
  7. 1 2
      modules/users/models/schema/log.js
  8. 1 2
      modules/users/models/schema/message.js
  9. 1 2
      modules/glj/models/schemas/mix_ratio.js
  10. 14 0
      modules/all_models/proj_counter.js
  11. 16 0
      modules/all_models/proj_setting.js
  12. 5 2
      modules/glj/models/schemas/glj.js
  13. 70 0
      modules/all_models/ration.js
  14. 1 3
      modules/main/models/ration_installation.js
  15. 1 2
      modules/users/models/schema/setting.js
  16. 21 0
      modules/all_models/std_glj_types.js
  17. 29 0
      modules/all_models/std_mix_ratio.js
  18. 1 2
      modules/glj/models/schemas/unit_price.js
  19. 2 3
      modules/glj/models/schemas/unit_price_file.js
  20. 1 2
      modules/users/models/schema/user.js
  21. 1 1
      modules/users/models/schema/user_message.js
  22. 48 0
      modules/all_schemas/bills_sub_schemas.js
  23. 1 19
      modules/common/std/schemas/std_mix_ratio.js
  24. 2 2
      modules/glj/models/counter_model.js
  25. 7 5
      modules/glj/models/glj_list.js
  26. 3 1
      modules/glj/models/glj_list_model.js
  27. 3 2
      modules/glj/models/mix_ratio_model.js
  28. 7 5
      modules/glj/models/unit_price_file.js
  29. 3 2
      modules/glj/models/unit_price_file_model.js
  30. 3 2
      modules/glj/models/unit_price_model.js
  31. 0 7
      modules/glj/models/user_glj_lib.js
  32. 3 2
      modules/main/facade/installation_facade.js
  33. 2 2
      modules/main/facade/ration_facade.js
  34. 1 60
      modules/main/models/bills.js
  35. 0 3
      modules/main/models/bills_exprs.js
  36. 0 3
      modules/main/models/expressions.js
  37. 0 114
      modules/main/models/glj.js
  38. 0 124
      modules/main/models/project_glj.js
  39. 1 66
      modules/main/models/ration.js
  40. 1 8
      modules/main/models/schemas/proj_counter.js
  41. 1 30
      modules/main/models/schemas/proj_setting.js
  42. 1 1
      modules/pm/models/project_model.js
  43. 2 2
      modules/users/models/compilation_model.js
  44. 2 2
      modules/users/models/engineering_lib_model.js
  45. 2 2
      modules/users/models/log_model.js
  46. 2 2
      modules/users/models/message_model.js
  47. 2 2
      modules/users/models/setting_model.js
  48. 2 1
      modules/users/models/user_message_model.js
  49. 2 2
      modules/users/models/user_model.js
  50. 2 13
      public/counter/counter.js
  51. 1 21
      public/models/std_glj_types.js

+ 62 - 0
modules/all_models/bills.js

@@ -0,0 +1,62 @@
+/**
+ * Created by zhang on 2018/3/22.
+ */
+let mongoose = require("mongoose");
+let subSchema = require("../all_schemas/bills_sub_schemas");
+let deleteSchema = require('../all_schemas/delete_schema');
+let Schema = mongoose.Schema;
+let billsSchema = new Schema({
+    ID: String,
+    ParentID: String,
+    NextSiblingID: String,
+    projectID: Number,
+    serialNo: Number,
+    chapterID: Number,
+    billsLibId: Number,
+    code: String,
+    fullCode: String,
+    type:{type: Number,default:4},//1 :大项费用 2:分部 3分项 4清单;5补项
+    isAdd:{type: Number,default:0},//1 true 0 false是否新增
+    name: String,
+    unit: String,
+    quantity: String, // Decimal
+    quantityEXP:String,//工程量表达式
+    feeRateID:Number,
+    feeRate:String,
+    isFromDetail:{type: Number,default:0},//1 true 0 false
+    programID: Number,
+    calcBase: String,
+    calcBaseValue: String,     // 计算基数表达式的值
+    // 工程量计算规则
+    ruleText: String,
+    // 说明
+    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
+    //工作内容//zhong 2017-8-31
+    jobContentText: String, //清单工作内容列显示文本, 减少第一次拉数据时的循环次数
+    jobContent: [subSchema.jobContentSchema],
+    //项目特征
+    itemCharacterText: String,//清单项目特征列显示文本
+    itemCharacter: [subSchema.itemCharacterSchema],
+    // 费用字段
+    fees: [subSchema.feesSchema],
+    // 标记字段
+    flags: [subSchema.flagsSchema],
+    installationKey:String,//用来记录安装增加费的关联字段
+    deleteInfo: deleteSchema,
+});
+
+mongoose.model("bills", billsSchema);

+ 1 - 2
modules/users/models/schema/compilation.js

@@ -76,5 +76,4 @@ let modelSchema = {
         default: 0
         default: 0
     }
     }
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 5 - 1
modules/glj/models/schemas/counter.js

@@ -19,4 +19,8 @@ let modelSchema = {
     },
     },
 };
 };
 
 
-export default mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false}));
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false}));
+
+//两个counter
+var counterSchema = new Schema(modelSchema);
+mongoose.model("counters", counterSchema);

+ 1 - 2
modules/users/models/schema/engineering_lib.js

@@ -42,6 +42,5 @@ let modelSchema = {
         default: []
         default: []
     }
     }
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
 
 

+ 1 - 9
modules/fee_rates/models/fee_rates.js

@@ -4,7 +4,7 @@
 
 
 let mongoose = require('mongoose');
 let mongoose = require('mongoose');
 let Schema = mongoose.Schema;
 let Schema = mongoose.Schema;
-let deleteSchema = require('../../../public/models/delete_schema');
+let deleteSchema = require('../all_schemas/delete_schema');
 // {ID:1,name:'工程分类',optionList:[{name:'一类工程',value:1,selected:true},{name:'二类工程',value:2,selected:false},{name:'三类工程',value:3,selected:false},{name:'四类工程',value:4,selected:false}]},
 // {ID:1,name:'工程分类',optionList:[{name:'一类工程',value:1,selected:true},{name:'二类工程',value:2,selected:false},{name:'三类工程',value:3,selected:false},{name:'四类工程',value:4,selected:false}]},
 let optionSchema = new Schema({
 let optionSchema = new Schema({
     name:String,
     name:String,
@@ -69,11 +69,3 @@ let feeRatesLibSchema = new Schema({
 },{versionKey:false});
 },{versionKey:false});
 
 
 mongoose.model('std_fee_rate_libs', feeRatesLibSchema, 'std_fee_rate_libs');
 mongoose.model('std_fee_rate_libs', feeRatesLibSchema, 'std_fee_rate_libs');
-
-
-let temSchema = new Schema({
-    projectID:Number,
-    feeRateFileID:String
-},{versionKey:false})
-
-mongoose.model('project_feerate_temp', temSchema, 'project_feerate_temp');

+ 1 - 4
modules/main/models/installation_fee.js

@@ -48,7 +48,4 @@ let installationFeeSchema = new Schema({
     feeRule:[feeRuleSchema]
     feeRule:[feeRuleSchema]
 },{versionKey:false});
 },{versionKey:false});
 
 
-let installationFeeModel = mongoose.model("installation_fee",installationFeeSchema,"installation_fee");
-
-
-export{ installationFeeModel as default}
+mongoose.model("installation_fee",installationFeeSchema,"installation_fee");

+ 1 - 2
modules/users/models/schema/log.js

@@ -29,5 +29,4 @@ let modelSchema = {
     // 创建时间
     // 创建时间
     create_time: Number
     create_time: Number
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 1 - 2
modules/users/models/schema/message.js

@@ -47,5 +47,4 @@ let modelSchema = {
     }
     }
 
 
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 1 - 2
modules/glj/models/schemas/mix_ratio.js

@@ -47,5 +47,4 @@ let modelSchema = {
     // 工料机类型
     // 工料机类型
     type: Number
     type: Number
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 14 - 0
modules/all_models/proj_counter.js

@@ -0,0 +1,14 @@
+/**
+ * Created by Mai on 2017/9/15.
+ */
+
+let mongoose = require("mongoose");
+let Schema = mongoose.Schema;
+let collectionName = 'projCounter';
+let projSettingSchema = {
+    projectID: Number,
+    bills: Number,
+    ration: Number/*,
+    volume_price: Number*/
+};
+mongoose.model(collectionName, new Schema(projSettingSchema, {versionKey: false, collection: collectionName}));

+ 16 - 0
modules/all_models/proj_setting.js

@@ -0,0 +1,16 @@
+/**
+ * Created by Mai on 2017/9/14.
+ */
+
+let mongoose = require("mongoose");
+let Schema = mongoose.Schema;
+let collectionName = 'proj_setting';
+let projSettingSchema = {
+    projectID: Number,
+    // 列设置
+    main_tree_col: {
+        type: Schema.Types.Mixed,
+        default: {}
+    }
+};
+mongoose.model(collectionName, new Schema(projSettingSchema, {versionKey: false, collection: collectionName}));

+ 5 - 2
modules/glj/models/schemas/glj.js

@@ -1,4 +1,7 @@
 /**
 /**
+ * Created by zhang on 2018/3/22.
+ */
+/**
  * 工料机数据模型
  * 工料机数据模型
  *
  *
  * @author CaiAoLin
  * @author CaiAoLin
@@ -88,6 +91,6 @@ let modelSchema = {
     connect_code: String,
     connect_code: String,
     ratio_data: Schema.Types.Mixed
     ratio_data: Schema.Types.Mixed
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false}));
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false}));
+
 
 
-export { model as default, collectionName as collectionName} ;

+ 70 - 0
modules/all_models/ration.js

@@ -0,0 +1,70 @@
+/**
+ * Created by zhang on 2018/3/22.
+ */
+let mongoose = require("mongoose");
+let subSchema = require("../all_schemas/bills_sub_schemas");
+let Schema = mongoose.Schema;
+let deleteSchema = require('../all_schemas/delete_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 });
+
+// 定额、量价、工料机定额 合并存储
+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设备
+    from:{type: String,default:'std'},          //std, cpt  来自标准、补充
+    isSubcontract: Boolean,                     // 是否分包
+    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,//自定义消耗
+    adjCoe:Number
+
+});
+
+let ration = db.model("ration", rationSchema, "ration");

+ 1 - 3
modules/main/models/ration_installation.js

@@ -18,6 +18,4 @@ var ration_installation = new Schema({
     unifiedSetting:{type: Number,default:1},//0:false 1:true  按统一设置
     unifiedSetting:{type: Number,default:1},//0:false 1:true  按统一设置
 },{versionKey:false});
 },{versionKey:false});
 
 
-let rationInstallationModel = mongoose.model('ration_installation', ration_installation,"ration_installation");
-
-export{ rationInstallationModel as default}
+mongoose.model('ration_installation', ration_installation,"ration_installation");

+ 1 - 2
modules/users/models/schema/setting.js

@@ -27,5 +27,4 @@ let modelSchema = {
     // 创建时间
     // 创建时间
     create_time: Number
     create_time: Number
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 21 - 0
modules/all_models/std_glj_types.js

@@ -0,0 +1,21 @@
+/**
+ * Created by Tony on 2017/7/6.
+ */
+let mongoose = require('mongoose');
+let Schema = mongoose.Schema;
+
+let RptCfgSchema = new Schema({
+    "typeName" : String,
+    "typesDefine": [{
+        "ID": Number,
+        "fullName": String,
+        "shortName": String,
+        "items": [{
+            "ID": Number,
+            "fullName": String,
+            "shortName": String
+        }]
+    }],
+});
+
+mongoose.model("std_glj_type", RptCfgSchema, "std_glj_type");

+ 29 - 0
modules/all_models/std_mix_ratio.js

@@ -0,0 +1,29 @@
+/**
+ * 配合比标准库数据模型
+ *
+ * @author CaiAoLin
+ * @date 2017/7/7
+ * @version
+ */
+import mongoose from "mongoose";
+
+let Schema = mongoose.Schema;
+let collectionName = 'std_mix_ratio';
+let modelSchema = {
+    // 编码
+    code: String,
+    // 名称
+    name: String,
+    // 消耗量
+    consumption: Number,
+    // 关联工料机的编码
+    connect_code: {
+        type: String,
+        index: true
+    },
+    // 对应的工料机总库id
+    glj_id: Number,
+    // 对应工料机类型
+    glj_type: Number
+};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 1 - 2
modules/glj/models/schemas/unit_price.js

@@ -52,5 +52,4 @@ let modelSchema = {
         default: 0
         default: 0
     }
     }
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 2 - 3
modules/glj/models/schemas/unit_price_file.js

@@ -6,7 +6,7 @@
  * @version
  * @version
  */
  */
 import mongoose from "mongoose";
 import mongoose from "mongoose";
-let deleteSchema = require('../../../../public/models/delete_schema');
+let deleteSchema = require('../all_schemas/delete_schema');
 let Schema = mongoose.Schema;
 let Schema = mongoose.Schema;
 let collectionName = 'unit_price_file';
 let collectionName = 'unit_price_file';
 let modelSchema = {
 let modelSchema = {
@@ -25,5 +25,4 @@ let modelSchema = {
     root_project_id: Number,
     root_project_id: Number,
     deleteInfo: deleteSchema
     deleteInfo: deleteSchema
 };
 };
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
-export {model as default, collectionName as collectionName};
+mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

+ 1 - 2
modules/users/models/schema/user.js

@@ -42,5 +42,4 @@ let schema = {
     },
     },
     create_time: Number
     create_time: Number
 };
 };
-
-export default mongoose.model(collectionName, new Schema(schema, {versionKey: false}));
+mongoose.model(collectionName, new Schema(schema, {versionKey: false}));

+ 1 - 1
modules/users/models/schema/user_message.js

@@ -36,4 +36,4 @@ let schema = {
     create_time: Number,
     create_time: Number,
 };
 };
 
 
-export default mongoose.model(collectionName, new Schema(schema, {versionKey: false}));
+mongoose.model(collectionName, new Schema(schema, {versionKey: false}));

+ 48 - 0
modules/all_schemas/bills_sub_schemas.js

@@ -0,0 +1,48 @@
+/**
+ * Created by jimiz on 2017/4/1.
+ */
+var mongoose = require("mongoose");
+var Schema = mongoose.Schema;
+
+// 费用字段
+var feesSchema = new Schema({
+    fieldName: String,
+    unitFee: String, // Decimal. 单价
+    totalFee: String, // Decimal. 合价
+    tenderUnitFee: String, // Decimal. 调价后单价
+    tenderTotalFee: String // Decimal. 调价后合价
+});
+
+// 标记字段
+var flagsSchema = new Schema({
+    fieldName: String,
+    flag: Number
+});
+
+var changesSchema = new Schema({
+    addGLJ: String,
+    modifyGLJ:String,
+    deleteGLJ:String
+});
+
+//add by Zhong2017-8-30
+//清单工作内容字段
+let jobContentSchema = new Schema({
+    content: String, //工作内容
+    serialNo: Number, //排序用
+    isChecked: Boolean //是否勾选(输出)
+}, {_id: false});
+//特征值字段
+let eigenvalueSchema = new Schema({
+    value: String,
+    isSelected: Boolean //判断哪个特征值被选中
+}, {_id: false});
+//项目特征字段
+let itemCharacterSchema = new Schema({
+    character: String, //特征
+    serialNo: Number, //排序用
+    eigenvalue: [eigenvalueSchema],//特征值
+    isChecked: Boolean //是否勾选(输出)
+}, {_id: false});
+
+module.exports = {feesSchema: feesSchema, flagsSchema: flagsSchema, jobContentSchema: jobContentSchema, itemCharacterSchema: itemCharacterSchema};

+ 1 - 19
modules/common/std/schemas/std_mix_ratio.js

@@ -7,24 +7,6 @@
  */
  */
 import mongoose from "mongoose";
 import mongoose from "mongoose";
 
 
-let Schema = mongoose.Schema;
 let collectionName = 'std_mix_ratio';
 let collectionName = 'std_mix_ratio';
-let modelSchema = {
-    // 编码
-    code: String,
-    // 名称
-    name: String,
-    // 消耗量
-    consumption: Number,
-    // 关联工料机的编码
-    connect_code: {
-        type: String,
-        index: true
-    },
-    // 对应的工料机总库id
-    glj_id: Number,
-    // 对应工料机类型
-    glj_type: Number
-};
-let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
+let model = mongoose.model(collectionName);
 export {model as default, collectionName as collectionName};
 export {model as default, collectionName as collectionName};

+ 2 - 2
modules/glj/models/counter_model.js

@@ -6,7 +6,7 @@
  * @version
  * @version
  */
  */
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
-import CounterSchema from "./schemas/counter";
+import mongoose from "mongoose";
 
 
 class CounterModel extends BaseModel {
 class CounterModel extends BaseModel {
 
 
@@ -18,7 +18,7 @@ class CounterModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = CounterSchema;
+        parent.model = mongoose.model('counter');
         parent.init();
         parent.init();
     }
     }
 
 

+ 7 - 5
modules/glj/models/glj_list.js

@@ -1,7 +1,9 @@
-/**
+//这个好像没有用到了,先注释掉,运行如无错误后删除
+/*
+/!**
  * Created by jimiz on 2017/5/10.
  * Created by jimiz on 2017/5/10.
  * 单价文件的GLJ列表,注意与项目GLJ区分
  * 单价文件的GLJ列表,注意与项目GLJ区分
- */
+ *!/
 var mongoose = require("mongoose");
 var mongoose = require("mongoose");
 var db = require("../db/unit_price_file_db");
 var db = require("../db/unit_price_file_db");
 var Schema = mongoose.Schema;
 var Schema = mongoose.Schema;
@@ -56,10 +58,10 @@ GLJListDAO.prototype.save = function(fileId, datas, callback){
                     ration.update({ID: doc.ID}, doc, updateCallback);
                     ration.update({ID: doc.ID}, doc, updateCallback);
                     break;
                     break;
                 case commonConsts.UT_DELETE:
                 case commonConsts.UT_DELETE:
-                /* 假删除
+                /!* 假删除
                  var item = new ration(doc);
                  var item = new ration(doc);
                  item.remove(cb);
                  item.remove(cb);
-                 */
+                 *!/
             }
             }
         }
         }
     }
     }
@@ -96,4 +98,4 @@ GLJListDAO.prototype.add = function(fileID, count, callback){
     });
     });
 };
 };
 
 
-module.exports = new GLJListDAO();
+module.exports = new GLJListDAO();*/

+ 3 - 1
modules/glj/models/glj_list_model.js

@@ -5,8 +5,8 @@
  * @date 2017/6/22
  * @date 2017/6/22
  * @version
  * @version
  */
  */
+import mongoose from "mongoose";
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
-import {default as GLJSchemas, collectionName as gljCollectionName} from "./schemas/glj";
 import CounterModel from "./counter_model";
 import CounterModel from "./counter_model";
 import UnitPriceModel from "./unit_price_model";
 import UnitPriceModel from "./unit_price_model";
 import UnitPriceFileModel from "./unit_price_file_model";
 import UnitPriceFileModel from "./unit_price_file_model";
@@ -18,6 +18,8 @@ import GljModel from "../../complementary_glj_lib/models/gljModel";
 const ProjectModel = require('../../pm/models/project_model').project;
 const ProjectModel = require('../../pm/models/project_model').project;
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 import decimal_facade from "../../main/facade/decimal_facade";
 import decimal_facade from "../../main/facade/decimal_facade";
+let gljCollectionName = 'glj_list';
+let GLJSchemas = mongoose.model(gljCollectionName);
 
 
 class GLJListModel extends BaseModel {
 class GLJListModel extends BaseModel {
 
 

+ 3 - 2
modules/glj/models/mix_ratio_model.js

@@ -5,9 +5,10 @@
  * @date 2017/7/12
  * @date 2017/7/12
  * @version
  * @version
  */
  */
+import mongoose from "mongoose";
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
-import {default as MixRatioSchema, collectionName as collectionName} from "./schemas/mix_ratio";
 import CounterModel from "./counter_model"
 import CounterModel from "./counter_model"
+let collectionName = 'mix_ratio';
 
 
 class MixRatioModel extends BaseModel {
 class MixRatioModel extends BaseModel {
 
 
@@ -18,7 +19,7 @@ class MixRatioModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = MixRatioSchema;
+        parent.model = mongoose.model(collectionName);
         parent.init();
         parent.init();
     }
     }
 
 

+ 7 - 5
modules/glj/models/unit_price_file.js

@@ -1,7 +1,9 @@
-/**
+//这个好像没有用到了,先注释掉,运行如无错误后删除
+/*
+/!**
  * Created by jimiz on 2017/5/10.
  * Created by jimiz on 2017/5/10.
  * 单价文件的GLJ列表,注意与项目GLJ区分
  * 单价文件的GLJ列表,注意与项目GLJ区分
- */
+ *!/
 var mongoose = require("mongoose");
 var mongoose = require("mongoose");
 var db = require("../db/unit_price_file_db");
 var db = require("../db/unit_price_file_db");
 var Schema = mongoose.Schema;
 var Schema = mongoose.Schema;
@@ -56,10 +58,10 @@ GLJListDAO.prototype.save = function(fileId, datas, callback){
                     ration.update({ID: doc.ID}, doc, updateCallback);
                     ration.update({ID: doc.ID}, doc, updateCallback);
                     break;
                     break;
                 case commonConsts.UT_DELETE:
                 case commonConsts.UT_DELETE:
-                /* 假删除
+                /!* 假删除
                  var item = new ration(doc);
                  var item = new ration(doc);
                  item.remove(cb);
                  item.remove(cb);
-                 */
+                 *!/
             }
             }
         }
         }
     }
     }
@@ -96,4 +98,4 @@ GLJListDAO.prototype.add = function(fileID, count, callback){
     });
     });
 };
 };
 
 
-module.exports = new GLJListDAO();
+module.exports = new GLJListDAO();*/

+ 3 - 2
modules/glj/models/unit_price_file_model.js

@@ -5,10 +5,11 @@
  * @date 2017/7/5
  * @date 2017/7/5
  * @version
  * @version
  */
  */
+import mongoose from "mongoose";
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
 import CounterModel from "./counter_model";
 import CounterModel from "./counter_model";
 const ProjectModel = require('../../pm/models/project_model').project;
 const ProjectModel = require('../../pm/models/project_model').project;
-import {default as UnitPriceFileSchema, collectionName as collectionName} from "./schemas/unit_price_file";
+let collectionName = 'unit_price_file';
 
 
 class UnitPriceFileModel extends BaseModel {
 class UnitPriceFileModel extends BaseModel {
 
 
@@ -19,7 +20,7 @@ class UnitPriceFileModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = UnitPriceFileSchema;
+        parent.model = mongoose.model(collectionName);
         parent.init();
         parent.init();
     }
     }
 
 

+ 3 - 2
modules/glj/models/unit_price_model.js

@@ -5,13 +5,14 @@
  * @date 2017/6/30
  * @date 2017/6/30
  * @version
  * @version
  */
  */
+import mongoose from "mongoose";
 import BaseModel from "../../common/base/base_model"
 import BaseModel from "../../common/base/base_model"
 import GLJTypeConst from "../../common/const/glj_type_const"
 import GLJTypeConst from "../../common/const/glj_type_const"
 import CounterModel from "./counter_model"
 import CounterModel from "./counter_model"
 import MixRatioModel from "./mix_ratio_model";
 import MixRatioModel from "./mix_ratio_model";
-import {default as UnitPriceSchema, collectionName as collectionName} from "./schemas/unit_price";
 import _ from "lodash";
 import _ from "lodash";
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
 const scMathUtil = require('../../../public/scMathUtil').getUtil();
+let collectionName = 'unit_price';
 let decimal_facade = require('../../main/facade/decimal_facade');
 let decimal_facade = require('../../main/facade/decimal_facade');
 
 
 class UnitPriceModel extends BaseModel {
 class UnitPriceModel extends BaseModel {
@@ -23,7 +24,7 @@ class UnitPriceModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = UnitPriceSchema;
+        parent.model = mongoose.model(collectionName);
         parent.init();
         parent.init();
     }
     }
 
 

+ 0 - 7
modules/glj/models/user_glj_lib.js

@@ -1,7 +0,0 @@
-/**
- *
- *
- * @author CaiAoLin
- * @date 2017/7/5
- * @version
- */

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

@@ -1,9 +1,10 @@
 /**
 /**
  * Created by zhang on 2018/1/31.
  * Created by zhang on 2018/1/31.
  */
  */
+let mongoose = require('mongoose');
 import {installSectionModel,installFeeItemModel} from "../../complementary_ration_lib/models/schemas";
 import {installSectionModel,installFeeItemModel} from "../../complementary_ration_lib/models/schemas";
-import installationFeeModel from "../models/installation_fee";
-import engineeringModel from "../../users/models/schema/engineering_lib";
+let installationFeeModel = mongoose.model("installation_fee");
+let engineeringModel = mongoose.model('engineering_lib');
 const uuidV1 = require('uuid/v1');
 const uuidV1 = require('uuid/v1');
 let consts = require('../../main/models/project_consts');
 let consts = require('../../main/models/project_consts');
 
 

+ 2 - 2
modules/main/facade/ration_facade.js

@@ -11,8 +11,8 @@ let ration_coe = mongoose.model('ration_coe');
 let ration_model = require('../models/ration');
 let ration_model = require('../models/ration');
 let bill_model = require('../models/bills');
 let bill_model = require('../models/bills');
 let decimal_facade = require('./decimal_facade');
 let decimal_facade = require('./decimal_facade');
-import installationFeeModel from "../models/installation_fee";
-import rationInstallationModel from "../models/ration_installation";
+let installationFeeModel = mongoose.model("installation_fee");
+let rationInstallationModel = mongoose.model('ration_installation');
 const uuidV1 = require('uuid/v1');
 const uuidV1 = require('uuid/v1');
 let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
 let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
 let coeMolde = mongoose.model('std_ration_lib_coe_list');
 let coeMolde = mongoose.model('std_ration_lib_coe_list');

+ 1 - 60
modules/main/models/bills.js

@@ -2,10 +2,6 @@
  * Created by jimiz on 2017/4/1.
  * Created by jimiz on 2017/4/1.
  */
  */
 let mongoose = require("mongoose");
 let mongoose = require("mongoose");
-let db = require("../db/project_db");
-let subSchema = require("./bills_sub_schemas");
-let deleteSchema = require('../../../public/models/delete_schema');
-let Schema = mongoose.Schema;
 let async = require("async");
 let async = require("async");
 let counter = require("../../../public/counter/counter.js");
 let counter = require("../../../public/counter/counter.js");
 let consts = require('./project_consts');
 let consts = require('./project_consts');
@@ -14,62 +10,7 @@ let commonConsts = consts.commonConst;
 let quantity_detial = require('../facade/quantity_detail_facade');
 let quantity_detial = require('../facade/quantity_detail_facade');
 let projectModel = require('../../pm/models/project_schema');
 let projectModel = require('../../pm/models/project_schema');
 
 
-
-let billsSchema = new Schema({
-    ID: String,
-    ParentID: String,
-    NextSiblingID: String,
-    projectID: Number,
-    serialNo: Number,
-    chapterID: Number,
-    billsLibId: Number,
-    code: String,
-    fullCode: String,
-    type:{type: Number,default:4},//1 :大项费用 2:分部 3分项 4清单;5补项
-    isAdd:{type: Number,default:0},//1 true 0 false是否新增
-    name: String,
-    unit: String,
-    quantity: String, // Decimal
-    quantityEXP:String,//工程量表达式
-    feeRateID:Number,
-    feeRate:String,
-    isFromDetail:{type: Number,default:0},//1 true 0 false
-    programID: Number,
-    calcBase: String,
-    calcBaseValue: String,     // 计算基数表达式的值
-    // 工程量计算规则
-    ruleText: String,
-    // 说明
-    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
-    //工作内容//zhong 2017-8-31
-    jobContentText: String, //清单工作内容列显示文本, 减少第一次拉数据时的循环次数
-    jobContent: [subSchema.jobContentSchema],
-    //项目特征
-    itemCharacterText: String,//清单项目特征列显示文本
-    itemCharacter: [subSchema.itemCharacterSchema],
-    // 费用字段
-    fees: [subSchema.feesSchema],
-    // 标记字段
-    flags: [subSchema.flagsSchema],
-    installationKey:String,//用来记录安装增加费的关联字段
-    deleteInfo: deleteSchema,
-});
-
-let bills = db.model("bills", billsSchema);
+let bills = mongoose.model("bills");
 let baseModel = require('./base_model');
 let baseModel = require('./base_model');
 
 
 class billsModel extends baseModel {
 class billsModel extends baseModel {

+ 0 - 3
modules/main/models/bills_exprs.js

@@ -1,3 +0,0 @@
-/**
- * Created by jimiz on 2017/4/10.
- */

+ 0 - 3
modules/main/models/expressions.js

@@ -1,3 +0,0 @@
-/**
- * Created by jimiz on 2017/4/10.
- */

+ 0 - 114
modules/main/models/glj.js

@@ -1,114 +0,0 @@
-/**
- * Created by jimiz on 2017/4/1.
- * 定额工料机
- */
-var mongoose = require("mongoose");
-var db = require("../db/project_db");
-var Schema = mongoose.Schema;
-var counter = require("../../../public/counter/counter.js");
-var deleteSchema = require('../../../public/models/delete_schema');
-var consts = require('./project_consts');
-var projectGLJ = require('./project_glj');
-var projectConsts = consts.projectConst;
-var commonConsts = consts.commonConst;
-
-var GLJSchema = new Schema({
-    ID: Number,
-    GLJID: Number,
-    rGLJID: Number,
-    rationID: String,
-    billsItemID: String,
-    projectID: Number,
-    orgRQuantity: String, //Decimal
-    rQuantity: String, //Decimal
-    customQuantity: String, //Decimal
-    quantity: String, //Decimal
-    deleteInfo: deleteSchema
-    // to do
-
-});
-
-var GLJ = db.model("GLJ", GLJSchema, "GLJ");
-
-var GLJDAO = function(){};
-
-GLJDAO.prototype.getData = function(projectID, callback){
-
-    function combineGLJs(gljList){
-        var pGLJIndex = {};
-        projectGLJ.getData(projectID, function (err, message, datas) {
-            if (!err) {
-                for (var i = 0; i < datas.length; i++){
-                    var data = datas[i];
-                    pGLJIndex[data.ID] = data;
-                }
-
-                for (var j = 0; j < gljList.length; j++){
-                    var glj = gljList[j];
-                    var pGLJ = pGLJIndex[glj.ID];
-                    for (var p in data) {
-                        if (p != 'ID' && p != 'code' && p != 'name' && p != 'projectID' && p != 'deleteInfo') {
-                            pGLJ[p] = glj[p];
-                        }
-                    }
-                }
-                callback(0, projectConsts.GLJ, gljList);
-            }
-            else {
-                callback(2, 'can not get unitPriceFile gljList', null);
-            }
-        })
-    }
-
-    GLJ.find({'$or': [{projectID: projectID, deleteInfo: null}, {projectID: projectID, 'deleteInfo.deleted': {$in: [null, false]}}]}, '-_id', function(err, datas){
-        if (!err) {
-            combineGLJs(datas);
-        } else {
-            callback(1, '', null);
-        };
-    });
-};
-
-GLJDAO.prototype.save = function(datas, callback){
-    var functions = [];
-    var data;
-
-    function saveOne(data) {
-        return function (cb) {
-            switch (data.updateType) {
-                case commonConsts.UT_UPDATE:
-                    GLJ.update({ID: data.ID}, data, cb);
-                    break;
-                case commonConsts.UT_CREATE:
-                    GLJ.create(data, cb);
-                    break;
-                case commonConsts.UT_DELETE:
-                /* 假删除
-                 var item = new GLJ(doc);
-                 item.remove(cb);
-                 */
-            }
-        }
-    }
-    for (var i = 0; i < datas.length; i++){
-        data = datas[i];
-        functions.push(saveOne(data));
-    }
-
-    async.parallel(functions, callback);
-};
-
-GLJDAO.prototype.getItemTemplate = function(callback){
-    var data = new bills;
-    /* to do: 需要根据标准配置库填充fees和flags字段,是否需要更多的参数? */
-    callback(0, '', data);
-};
-
-GLJDAO.prototype.allocIDs = function(IDStep, callback){
-    counter.counterDAO.getIDAfterCount(counter.moduleName.GLJ, IDStep, function(err, highID){
-        var lowID = highID - IDStep + 1;
-        callback(0, '', {lowID: lowID, highID: highID});
-    });
-};
-
-module.exports = new GLJDAO();

+ 0 - 124
modules/main/models/project_glj.js

@@ -1,124 +0,0 @@
-/**
- * Created by jimiz on 2017/4/1.
- * 工料机汇总
- */
-
-var mongoose = require("mongoose");
-var db = require("../db/project_db");
-var Schema = mongoose.Schema;
-var deleteSchema = require('../../../public/models/delete_schema');
-var consts = require('./project_consts');
-var projectConsts = consts.projectConst;
-var commonConsts = consts.commonConst;
-var unitPriceFile = require('../../glj/models/unit_price_file');
-var upGLJList = require('../../glj/models/glj_list');
-var projectProperties = require('./prj_properties.js')
-
-var projectGLJSchema = new Schema({
-    ID: Number,
-    code: String,
-    name: String,
-    projectID: Number,
-    amount: String, // Decimal
-    isInterim: Boolean, // 是否暂估
-    provideType: Number, // 供货方式
-    partyAAmount: String, // Decimal 甲供数量
-    deliveryType: String, // 交货方式
-    deliveryPlace: String, // 送达地点
-    noTender: Boolean,
-    deleteInfo: deleteSchema
-});
-
-var projectGLJ = db.model("projectGLJ", projectGLJSchema, "projectGLJ");
-
-var projectGLJDAO = function(){};
-
-projectGLJDAO.prototype.getData = function(projectID, callback){
-
-    function combineGLJData(fileID, gljList){
-        var gljIndex = {};
-
-        upGLJList.getData(fileID, function (err, message, datas) {
-            if (!err) {
-                for (var i = 0; i < datas.length; i++){
-                    var data = datas[i];
-                    gljIndex[data.code + '_' + data.name] = data;
-                }
-
-                for (var j = 0; j < gljList.length; j++){
-                    var pGLJ = gljList[j];
-                    var glj = gljIndex[pGLJ.code + '_' + pGLJ.name];
-                    for (var p in data) {
-                        if (p != 'ID' && p != 'fileID' && p != 'deleteInfo') {
-                            pGLJ[p] = glj[p];
-                        }
-                    }
-                }
-                callback(0, projectConsts.PROJECTGLJ, gljList);
-            }
-            else {
-                callback(3, 'can not get unitPriceFile gljList', null);
-            }
-        })
-    }
-
-    function getGLJDatas(gljList){
-        projectProperties.getData(projectID, function (err, message, datas) {
-            if (!err) {
-                var fileID = datas[0];
-                combineGLJData(fileID, gljList);
-            } else {
-                callback(2, 'can not get unitPriceFileID', null);
-            }
-
-        })
-    }
-
-    projectGLJ.find({'$or': [{projectID: projectID, deleteInfo: null}, {projectID: projectID, 'deleteInfo.deleted': {$in: [null, false]}}]}, '-_id', function(err, datas){
-        if (!err) {
-            getGLJDatas(datas);
-        } else {
-            callback(1, 'can not get projectGLJ', null);
-        }
-    });
-};
-
-// 工料机汇总的工料机不在这里新增,只能由add方法新增,删除需要在前端projectGLJ判断:1、是新工料机;2、没有定额引用,才可以删除
-projectGLJDAO.prototype.save = function(projectID, datas, callback){
-    var functions = [];
-    var data;
-
-    function saveOne(data) {
-        return function (cb) {
-
-            switch (doc.updateType) {
-                case commonConsts.UT_UPDATE:
-                    projectGLJ.update({ID: doc.ID}, doc, cb);
-                    break;
-                // commonConsts.UT_DELETE:
-                 // 假删除
-                 // var item = new ration(doc);
-                 // item.remove(cb);
-
-            }
-        }
-    }
-    for (var i = 0; i < datas.length; i++){
-        functions.push(saveOne(data));
-    }
-
-    async.parallel(functions, callback);
-};
-
-projectGLJDAO.prototype.add = function(projectID, fileID, count, callback){
-    function addGLJ(err, datas){
-
-    }
-    unitPriceFile.add(fileID, count, callback);
-};
-
-projectGLJDAO.prototype.syncData = function(projectID, datas, callback){
-
-};
-
-module.exports = new projectGLJDAO();

+ 1 - 66
modules/main/models/ration.js

@@ -2,10 +2,6 @@
  * Created by jimiz on 2017/4/1.
  * Created by jimiz on 2017/4/1.
  */
  */
 let mongoose = require("mongoose");
 let mongoose = require("mongoose");
-let db = require("../db/project_db");
-let subSchema = require("./bills_sub_schemas");
-let Schema = mongoose.Schema;
-let deleteSchema = require('../../../public/models/delete_schema');
 let async = require("async");
 let async = require("async");
 let counter = require("../../../public/counter/counter.js");
 let counter = require("../../../public/counter/counter.js");
 let consts = require('./project_consts');
 let consts = require('./project_consts');
@@ -13,68 +9,7 @@ let projectConsts = consts.projectConst;
 let commonConsts = consts.commonConst;
 let commonConsts = consts.commonConst;
 let quantity_detial = require('../facade/quantity_detail_facade');
 let quantity_detial = require('../facade/quantity_detail_facade');
 
 
-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 });
-
-// 定额、量价、工料机定额 合并存储
-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设备
-    from:{type: String,default:'std'},          //std, cpt  来自标准、补充
-    isSubcontract: Boolean,                     // 是否分包
-    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,//自定义消耗
-    adjCoe:Number
-
-});
-
-let ration = db.model("ration", rationSchema, "ration");
+let ration = mongoose.model("ration");
 let baseModel = require('./base_model');
 let baseModel = require('./base_model');
 
 
 class rationModel extends baseModel {
 class rationModel extends baseModel {

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

@@ -3,13 +3,6 @@
  */
  */
 
 
 let mongoose = require("mongoose");
 let mongoose = require("mongoose");
-let Schema = mongoose.Schema;
 let collectionName = 'projCounter';
 let collectionName = 'projCounter';
-let projSettingSchema = {
-    projectID: Number,
-    bills: Number,
-    ration: Number/*,
-    volume_price: Number*/
-};
-let model = mongoose.model(collectionName, new Schema(projSettingSchema, {versionKey: false, collection: collectionName}));
+let model = mongoose.model(collectionName);
 export {model as default, collectionName as collectionName};
 export {model as default, collectionName as collectionName};

+ 1 - 30
modules/main/models/schemas/proj_setting.js

@@ -3,35 +3,6 @@
  */
  */
 
 
 let mongoose = require("mongoose");
 let mongoose = require("mongoose");
-let Schema = mongoose.Schema;
 let collectionName = 'proj_setting';
 let collectionName = 'proj_setting';
-/*let settingConst = {
-    billsCalcMode: {
-        rationContent: 0, rationPriceConverse: 1, rationPrice: 2, billsPrice: 3
-    },
-    zanguCalcType: {
-        common: 0, gatherMaterial: 1
-    }
-}*/
-/*let billsCalcModeConst = {
-    
-};*/
-let projSettingSchema = {
-    projectID: Number,
-    // 列设置
-    main_tree_col: {
-        type: Schema.Types.Mixed,
-        default: {}
-    }/*,
-    billsCalcMode: {
-        type: Number,
-        default: settingConst.billsCalcMode.rationContent
-    },
-    zanguCalcType: {
-        type: Number,
-        default: settingConst.zanguCalcType.common
-    }*/
-};
-let model = mongoose.model(collectionName, new Schema(projSettingSchema, {versionKey: false, collection: collectionName}));
-// export {model as default, collectionName as collectionName, settingConst as settingConst};
+let model = mongoose.model(collectionName);
 export {model as default, collectionName as collectionName};
 export {model as default, collectionName as collectionName};

+ 1 - 1
modules/pm/models/project_model.js

@@ -4,7 +4,7 @@
 import mongoose from 'mongoose';
 import mongoose from 'mongoose';
 import async_c from 'async';
 import async_c from 'async';
 import UnitPriceFileModel from "../../glj/models/unit_price_file_model";
 import UnitPriceFileModel from "../../glj/models/unit_price_file_model";
-import UnitPriceFiles from '../../glj/models/schemas/unit_price_file';
+let UnitPriceFiles = mongoose.model('unit_price_file');
 import {
 import {
     defaultDecimal,
     defaultDecimal,
     billsQuantityDecimal,
     billsQuantityDecimal,

+ 2 - 2
modules/users/models/compilation_model.js

@@ -6,7 +6,7 @@
  * @version
  * @version
  */
  */
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
-import CompilationSchema from "./schema/compilation";
+import mongoose from "mongoose";
 
 
 class CompilationModel extends BaseModel {
 class CompilationModel extends BaseModel {
 
 
@@ -17,7 +17,7 @@ class CompilationModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = CompilationSchema;
+        parent.model =  mongoose.model('compilation');
         parent.init();
         parent.init();
     }
     }
 
 

+ 2 - 2
modules/users/models/engineering_lib_model.js

@@ -5,8 +5,8 @@
  * @date 2017/8/31
  * @date 2017/8/31
  * @version
  * @version
  */
  */
+import mongoose from "mongoose";
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
-import EngineeringLibSchema from "./schema/engineering_lib";
 
 
 class EngineeringLibModel extends BaseModel {
 class EngineeringLibModel extends BaseModel {
     /**
     /**
@@ -16,7 +16,7 @@ class EngineeringLibModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = EngineeringLibSchema;
+        parent.model = mongoose.model('engineering_lib');
         parent.init();
         parent.init();
     }
     }
 
 

+ 2 - 2
modules/users/models/log_model.js

@@ -7,7 +7,7 @@
  */
  */
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
 import LogType from "../../common/const/log_type_const";
 import LogType from "../../common/const/log_type_const";
-import LogSchema from "./schema/log";
+import mongoose from "mongoose";
 import UAParser from "ua-parser-js";
 import UAParser from "ua-parser-js";
 import Request from "request";
 import Request from "request";
 
 
@@ -20,7 +20,7 @@ class LogModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = LogSchema;
+        parent.model = mongoose.model('log');
         parent.init();
         parent.init();
     }
     }
 
 

+ 2 - 2
modules/users/models/message_model.js

@@ -6,7 +6,7 @@
  * @version
  * @version
  */
  */
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
-import MessageSchema from "./schema/message";
+import mongoose from "mongoose";
 
 
 class MessageModel extends BaseModel {
 class MessageModel extends BaseModel {
 
 
@@ -18,7 +18,7 @@ class MessageModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = MessageSchema;
+        parent.model = mongoose.model('message');
         parent.init();
         parent.init();
     }
     }
 
 

+ 2 - 2
modules/users/models/setting_model.js

@@ -7,7 +7,7 @@
  */
  */
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
 import SettingType from "../../common/const/setting_type_const";
 import SettingType from "../../common/const/setting_type_const";
-import SettingSchema from "./schema/setting";
+import mongoose from "mongoose";
 
 
 class SettingModel extends BaseModel {
 class SettingModel extends BaseModel {
 
 
@@ -46,7 +46,7 @@ class SettingModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = SettingSchema;
+        parent.model = mongoose.model('setting');
         parent.init();
         parent.init();
     }
     }
 
 

+ 2 - 1
modules/users/models/user_message_model.js

@@ -8,6 +8,7 @@
 import BaseModel from "../../common/base/base_model";
 import BaseModel from "../../common/base/base_model";
 import UserMessageSchema from "./schema/user_message";
 import UserMessageSchema from "./schema/user_message";
 import MessageModel from "./message_model";
 import MessageModel from "./message_model";
+import mongoose from "mongoose";
 
 
 class UserMessageModel extends BaseModel {
 class UserMessageModel extends BaseModel {
 
 
@@ -18,7 +19,7 @@ class UserMessageModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = UserMessageSchema;
+        parent.model = mongoose.model('user_message');
         parent.init();
         parent.init();
     }
     }
 
 

+ 2 - 2
modules/users/models/user_model.js

@@ -5,7 +5,7 @@
  * @date 2017/6/9
  * @date 2017/6/9
  * @version
  * @version
  */
  */
-import userSchema from "./schema/user";
+import mongoose from "mongoose";
 import Request from "request";
 import Request from "request";
 import BaseModel from "../../common/base/base_model"
 import BaseModel from "../../common/base/base_model"
 import LogModel from "./log_model";
 import LogModel from "./log_model";
@@ -41,7 +41,7 @@ class UserModel extends BaseModel {
      */
      */
     constructor() {
     constructor() {
         let parent = super();
         let parent = super();
-        parent.model = userSchema;
+        parent.model = mongoose.model('user');
         parent.init();
         parent.init();
     }
     }
 
 

+ 2 - 13
public/counter/counter.js

@@ -2,18 +2,7 @@
  * Created by Tony on 2017/3/21.
  * Created by Tony on 2017/3/21.
  */
  */
 var mongoose = require('mongoose');
 var mongoose = require('mongoose');
-var dbm = require("../../config/db/db_manager");
-var projectdb = dbm.getCfgConnection("scConstruct");
-
-var Schema = mongoose.Schema;
-var counterSchema = new Schema({
-    _id: String,
-    sequence_value: Number
-});
-counterSchema.statics.findAndModify = function (query, sort, doc, options, callback) {
-    return this.collection.findAndModify(query, sort, doc, options, callback);
-};
-var counterModel = projectdb.model("counters", counterSchema);
+var counterModel = mongoose.model("counters");
 
 
 // All counter Must predefine in DB
 // All counter Must predefine in DB
 const COUNTER_MODULE_NAME = {
 const COUNTER_MODULE_NAME = {
@@ -49,7 +38,7 @@ counterDAO.prototype.getIDAfterCount = function(moduleName, stepCount, callback)
     } else if (!(/^-?\d+$/.test(stepCount))) {
     } else if (!(/^-?\d+$/.test(stepCount))) {
         sc = Math.round(stepCount + 0.5);
         sc = Math.round(stepCount + 0.5);
     }
     }
-    counterModel.findAndModify({_id: moduleName}, [], { $inc: { sequence_value: sc } }, {'new':true}, callback);
+    counterModel.findOneAndUpdate({_id: moduleName}, { $inc: { sequence_value: sc } }, {'new':true}, callback);//findOneAndUpdate
 }
 }
 
 
 counterDAO.prototype.getCurrentID = function(moduleName, callback) {
 counterDAO.prototype.getCurrentID = function(moduleName, callback) {

+ 1 - 21
public/models/std_glj_types.js

@@ -2,24 +2,4 @@
  * Created by Tony on 2017/7/6.
  * Created by Tony on 2017/7/6.
  */
  */
 let mongoose = require('mongoose');
 let mongoose = require('mongoose');
-let dbm = require("../../config/db/db_manager");
-let smartcostdb = dbm.getCfgConnection("scConstruct");
-let Schema = mongoose.Schema;
-
-let RptCfgSchema = new Schema({
-    "typeName" : String,
-    "typesDefine": [{
-        "ID": Number,
-        "fullName": String,
-        "shortName": String,
-        "items": [{
-            "ID": Number,
-            "fullName": String,
-            "shortName": String
-        }]
-    }],
-});
-
-let std_glj_type_mdl = smartcostdb.model("std_glj_type", RptCfgSchema, "std_glj_type");
-
-module.exports = std_glj_type_mdl;
+module.exports = mongoose.model("std_glj_type");