Schemas.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. var mongoose = require("mongoose");
  2. var RationLibMapSchema = mongoose.Schema({
  3. DisplayName:String,
  4. DBName:String
  5. })
  6. var connectMap = function(callBack){
  7. var db = mongoose.createConnection("192.168.1.184","rationLibMap",60666);
  8. callBack(db);
  9. }
  10. var MainContentSchema = mongoose.Schema({
  11. ContentItems:String,//总说明
  12. CalcRule:String//计算规则
  13. })
  14. var RationTreeSchema = mongoose.Schema({//章节树 //生成唯一id改为sectionid 改成string
  15. SectionID:Number,
  16. ParentID:Number,
  17. NextSiblingID:Number,
  18. Name:String
  19. });
  20. var SectionTextSchema = mongoose.Schema({//说明及计算规则
  21. SectionID:Number,
  22. ContentID:Number,
  23. Type:Number,
  24. Content:[],
  25. Interpretation:String,
  26. CalcRule:String
  27. })
  28. var RationItemsSchema = mongoose.Schema({//只记载定额基本元素,并未和工料机挂钩
  29. RationCode:String,
  30. RationName:String,
  31. Unit:String,
  32. BasePrice:Number,
  33. SectionID:Number,
  34. ContentID:Number,
  35. Caption:String,//显示内容
  36. FeeType:Number //取费类别,这条定额对应怎样的费率参与计算,在键定额库的时候手动输入
  37. });
  38. var GLJListSchema = mongoose.Schema({
  39. GLJCode:String,
  40. GLJName:String,
  41. Specs:String,//规格,钢筋粗细,光圆
  42. Unit:String,//单位
  43. BasePrice:Number,
  44. Type:Number //工料机类型,便于分类
  45. });
  46. var RationGLJSchema = mongoose.Schema({//定额下的工料机
  47. RationCode:String,
  48. GLJCode:String,
  49. Amount:Number,//消耗量
  50. Type:Number//工料机的类型
  51. });
  52. var GLJTypeTreeSchema = mongoose.Schema({//工料机类型树,用于分类工料机
  53. ID:Number,
  54. ParentID:Number,
  55. NextSiblingID:Number,
  56. Name:String
  57. });
  58. var MinorRationSchema = mongoose.Schema({
  59. MainCode:String,
  60. MinorIndex:Number,//辅助定额之间的排序
  61. MinorParam:Number,//参数 和自动选择相应辅助定额有关
  62. MinorName:String,//调整名称
  63. ParamName:String,//参数名称
  64. MinorCode:String,//辅助定额编码
  65. StdValue:Number,//主定额的临界值
  66. Step:Number,//辅助定额调整步距
  67. RoundDigit:Number,//不足时百分比小数保留位数
  68. RoundMode:Number//进位模式
  69. });
  70. var CoeListSchema = mongoose.Schema({//附注列表,定额的变体,比如没有挖芦苇根这个定额,则利用挖树根定额的工料机做相应调整变为挖芦苇根
  71. CoeID:Number,
  72. CoeName:String,
  73. Param:Number,//工料机总的乘以系数
  74. Type:String,//系数类型+ *
  75. G:Number,//单行人工系数
  76. L:Number,
  77. J:Number,
  78. Content:String,//调整内容
  79. MutexCoeID:Number,//互斥乘系数项ID
  80. GLJArray:[{ //除了可以整体调整工料机,还可以调整特定工料机的分项 GLJArray是分项的数组
  81. GLJ:Number,//工料机号
  82. Count:Number,//调整数量
  83. type:String//系数类型
  84. }]
  85. });
  86. var RationCoeSchema = mongoose.Schema({//定额与其附注关系
  87. ID:Number,
  88. SectionCode:Number,//附注可用于相关节点下所有的定额
  89. RationCode:String,
  90. CoeID:Number,
  91. Order:Number//排序
  92. });
  93. var Schemas = {
  94. "connectMap":connectMap,
  95. //"connectDB": connectDB,
  96. "MainContentSchema":MainContentSchema,
  97. "RationTreeSchema":RationTreeSchema,
  98. "SectionTextSchema":SectionTextSchema,
  99. "RationItemsSchema":RationItemsSchema,
  100. "GLJListSchema":GLJListSchema,
  101. "RationGLJSchema":RationGLJSchema,
  102. "GLJTypeTreeSchema":GLJTypeTreeSchema,
  103. "MinorRationSchema":MinorRationSchema,
  104. "CoeListSchema":CoeListSchema,
  105. "RationCoeSchema":RationCoeSchema,
  106. "RationLibMapSchema": RationLibMapSchema
  107. }
  108. module.exports = Schemas;