var mongoose = require("mongoose"); var RationLibMapSchema = mongoose.Schema({ DisplayName:String, DBName:String }) var connectMap = function(callBack){ var db = mongoose.createConnection("192.168.1.184","rationLibMap",60666); callBack(db); } var MainContentSchema = mongoose.Schema({ ContentItems:String,//总说明 CalcRule:String//计算规则 }) var RationTreeSchema = mongoose.Schema({//章节树 //生成唯一id改为sectionid 改成string SectionID:Number, ParentID:Number, NextSiblingID:Number, Name:String }); var SectionTextSchema = mongoose.Schema({//说明及计算规则 SectionID:Number, ContentID:Number, Type:Number, Content:[], Interpretation:String, CalcRule:String }) var RationItemsSchema = mongoose.Schema({//只记载定额基本元素,并未和工料机挂钩 RationCode:String, RationName:String, Unit:String, BasePrice:Number, SectionID:Number, ContentID:Number, Caption:String,//显示内容 FeeType:Number //取费类别,这条定额对应怎样的费率参与计算,在键定额库的时候手动输入 }); var GLJListSchema = mongoose.Schema({ GLJCode:String, GLJName:String, Specs:String,//规格,钢筋粗细,光圆 Unit:String,//单位 BasePrice:Number, Type:Number //工料机类型,便于分类 }); var RationGLJSchema = mongoose.Schema({//定额下的工料机 RationCode:String, GLJCode:String, Amount:Number,//消耗量 Type:Number//工料机的类型 }); var GLJTypeTreeSchema = mongoose.Schema({//工料机类型树,用于分类工料机 ID:Number, ParentID:Number, NextSiblingID:Number, Name:String }); var MinorRationSchema = mongoose.Schema({ MainCode:String, MinorIndex:Number,//辅助定额之间的排序 MinorParam:Number,//参数 和自动选择相应辅助定额有关 MinorName:String,//调整名称 ParamName:String,//参数名称 MinorCode:String,//辅助定额编码 StdValue:Number,//主定额的临界值 Step:Number,//辅助定额调整步距 RoundDigit:Number,//不足时百分比小数保留位数 RoundMode:Number//进位模式 }); var CoeListSchema = mongoose.Schema({//附注列表,定额的变体,比如没有挖芦苇根这个定额,则利用挖树根定额的工料机做相应调整变为挖芦苇根 CoeID:Number, CoeName:String, Param:Number,//工料机总的乘以系数 Type:String,//系数类型+ * G:Number,//单行人工系数 L:Number, J:Number, Content:String,//调整内容 MutexCoeID:Number,//互斥乘系数项ID GLJArray:[{ //除了可以整体调整工料机,还可以调整特定工料机的分项 GLJArray是分项的数组 GLJ:Number,//工料机号 Count:Number,//调整数量 type:String//系数类型 }] }); var RationCoeSchema = mongoose.Schema({//定额与其附注关系 ID:Number, SectionCode:Number,//附注可用于相关节点下所有的定额 RationCode:String, CoeID:Number, Order:Number//排序 }); var Schemas = { "connectMap":connectMap, //"connectDB": connectDB, "MainContentSchema":MainContentSchema, "RationTreeSchema":RationTreeSchema, "SectionTextSchema":SectionTextSchema, "RationItemsSchema":RationItemsSchema, "GLJListSchema":GLJListSchema, "RationGLJSchema":RationGLJSchema, "GLJTypeTreeSchema":GLJTypeTreeSchema, "MinorRationSchema":MinorRationSchema, "CoeListSchema":CoeListSchema, "RationCoeSchema":RationCoeSchema, "RationLibMapSchema": RationLibMapSchema } module.exports = Schemas;