schemas.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /**
  2. * Created by Zhong on 2017/9/13.
  3. */
  4. import mongoose from "mongoose";
  5. let dbm = require("../../../config/db/db_manager");
  6. let db = dbm.getCfgConnection("scConstruct");
  7. let Schema = mongoose.Schema;
  8. let coeSchema = new Schema({
  9. coeType: String, // 系数类型,指作用范围:
  10. // 单个(如:111量0.001)、人工类、材料类、机械类、全部(如:定额×0.925)。
  11. gljCode: String, // 要调整的工料机Code(当coeType=0时有效)
  12. gljName: String,
  13. operator: String, // 运算符(*、+、-、=)
  14. amount: String, // 调整的量
  15. _id: false
  16. });
  17. let coeListSchema = new Schema({
  18. libID: Number, // 所属定额定ID
  19. ID: Number, // 系数ID(流水号ID)
  20. serialNo: Number, //编号
  21. name: String, // 名称
  22. content: String, // 说明
  23. coes: [coeSchema]
  24. }, {versionKey: false});
  25. let oprSchema = new Schema({
  26. operateDate: String,
  27. operator: String
  28. },
  29. {_id: false},
  30. {versionKey: false});
  31. //定额库
  32. let RepositoryMapSchema = new Schema({
  33. "ID": Number,
  34. "dispName" : String,
  35. "appType" : String, //如:"建筑" / "公路"
  36. "compilationId": String, //编办
  37. "compilationName": String,
  38. "gljLib": Number,
  39. "descr" : String,
  40. "creator": String,
  41. "createDate": String,
  42. "recentOpr" :[oprSchema],
  43. "deleted": Boolean
  44. }, {versionKey: false});
  45. //定额章节树
  46. let rationChapterTreeSchema = new Schema({
  47. rationRepId: Number,
  48. ID:Number,
  49. ParentID:Number,
  50. NextSiblingID:Number,
  51. name: String,
  52. explanation: String,//说明
  53. ruleText: String,//计算规则
  54. jobContentSituation: String,//工作内容适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额,NONE无
  55. annotationSituation: String,//附注的适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额,NONE无
  56. isDeleted: Boolean
  57. });
  58. //定额工料机
  59. let rationGljItemSchema = new Schema({
  60. gljId: Number,
  61. consumeAmt: String,
  62. proportion: Number //配合比,暂时无需使用,默认0
  63. }, { _id: false });
  64. //定额安装增加费用
  65. let rationInstSchema = new Schema({
  66. feeItemId: String,
  67. sectionId: String
  68. },{_id: false});
  69. //辅助定额调整
  70. let rationAssItemSchema = new Schema({
  71. name: String,
  72. assistID: Number,
  73. assistCode: String,
  74. stdValue: String,
  75. stepValue: String,
  76. decimal: Number,
  77. carryBit: String,
  78. minValue: String,
  79. maxValue: String
  80. }, { _id: false });
  81. //安装增加费-费用规则
  82. let feeRuleSchema = new Schema({
  83. ID: String,
  84. code: String,
  85. rule: String,
  86. base: String,
  87. feeRate: Number,
  88. labour: Number,
  89. material: Number,
  90. machine: Number
  91. });
  92. //安装增加费-分册章节
  93. let installSectionSchema = new Schema({
  94. rationRepId: Number,
  95. ID: String,
  96. feeItemId: String,
  97. name: String,
  98. feeRule: [feeRuleSchema],
  99. deleted: false
  100. }, {versionKey: false});
  101. //安装增加费-费用项
  102. let installFeeItemSchema = new Schema({
  103. rationRepId: Number,
  104. ID: String,
  105. feeItem: String, //费用项
  106. feeType: String, //费用类型
  107. position: String, //记取位置
  108. section: [],
  109. deleted: false
  110. }, {versionKey: false});
  111. //定额
  112. var rationItemSchema = new Schema({
  113. ID:Number,
  114. code: String,
  115. name: String,
  116. unit: String,
  117. labourPrice: String,
  118. materialPrice: String,
  119. machinePrice: String,
  120. basePrice: String,
  121. sectionId: Number,
  122. rationRepId: Number,
  123. caption: String,
  124. feeType: Number,
  125. jobContent: String,
  126. annotation: String,
  127. rationGljList: [rationGljItemSchema],
  128. rationCoeList: Array,
  129. rationAssList: [rationAssItemSchema],
  130. rationInstList: [rationInstSchema],
  131. isDeleted: Boolean
  132. });
  133. //补充定额
  134. let compleRationSchema = new Schema({
  135. userId: Number,
  136. compilationId: String,
  137. rationRepId: Number,
  138. ID:Number,
  139. code: String,
  140. name: String,
  141. unit: String,
  142. labourPrice: String,
  143. materialPrice: String,
  144. machinePrice: String,
  145. basePrice: String,
  146. sectionId: Number,
  147. caption: String,
  148. feeType: Number,
  149. jobContent: String,
  150. annotation: String,
  151. rationGljList: Array,
  152. rationCoeList: Array,
  153. rationAssList: Array,
  154. deleteInfo: Schema.Types.Mixed
  155. }, {versionKey: false});
  156. let coeListModel = db.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list")
  157. let rationRepository = db.model("std_ration_lib_map", RepositoryMapSchema, "std_ration_lib_map");
  158. let rationChapterTreeModel = db.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema, "std_ration_lib_ration_chapter_trees");
  159. let rationItemModel = db.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items");
  160. let installSectionModel = db.model("std_ration_lib_installationSection", installSectionSchema, "std_ration_lib_installationSection")
  161. let installFeeItemModel = db.model("std_ration_lib_installation", installFeeItemSchema, "std_ration_lib_installation");
  162. //补充定额
  163. let compleRationModel = db.model('complementary_ration_items', compleRationSchema, 'complementary_ration_items');
  164. export{coeListModel, rationRepository, rationChapterTreeModel, rationItemModel, installFeeItemModel, installSectionModel, compleRationModel};