schemas.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. operator: String, // 运算符(*、+、-、=)
  13. amount: String, // 调整的量
  14. _id: false
  15. });
  16. let coeListSchema = new Schema({
  17. libID: Number, // 所属定额定ID
  18. ID: Number, // 系数ID(流水号ID)
  19. name: String, // 名称
  20. content: String, // 说明
  21. coes: [coeSchema]
  22. }, {versionKey: false});
  23. let oprSchema = new Schema({
  24. operateDate: String,
  25. operator: String
  26. },
  27. {_id: false},
  28. {versionKey: false});
  29. //定额库
  30. let RepositoryMapSchema = new Schema({
  31. "ID": Number,
  32. "dispName" : String,
  33. "appType" : String, //如:"建筑" / "公路"
  34. "compilationId": String, //编办
  35. "compilationName": String,
  36. "gljLib": Number,
  37. "descr" : String,
  38. "creator": String,
  39. "createDate": String,
  40. "recentOpr" :[oprSchema],
  41. "deleted": Boolean
  42. }, {versionKey: false});
  43. //定额章节树
  44. let rationChapterTreeSchema = new Schema({
  45. rationRepId: Number,
  46. ID:Number,
  47. ParentID:Number,
  48. NextSiblingID:Number,
  49. name: String,
  50. explanation: String,//说明
  51. ruleText: String,//计算规则
  52. isDeleted: Boolean
  53. });
  54. //定额工料机
  55. let rationGljItemSchema = new Schema({
  56. gljId: Number,
  57. consumeAmt: Number,
  58. proportion: Number //配合比,暂时无需使用,默认0
  59. }, { _id: false });
  60. //辅助定额调整
  61. let rationAssItemSchema = new Schema({
  62. name: String,
  63. assistID: Number,
  64. assistCode: String,
  65. stdValue: String,
  66. stepValue: String,
  67. decimal: Number,
  68. carryBit: String,
  69. minValue: String,
  70. maxValue: String
  71. }, { _id: false });
  72. //定额
  73. var rationItemSchema = new Schema({
  74. ID:Number,
  75. code: String,
  76. name: String,
  77. unit: String,
  78. labourPrice: Number,
  79. materialPrice: Number,
  80. machinePrice: Number,
  81. basePrice: Number,
  82. sectionId: Number,
  83. rationRepId: Number,
  84. caption: String,
  85. feeType: Number,
  86. rationGljList: [rationGljItemSchema],
  87. rationCoeList: Array,
  88. rationAssList: [rationAssItemSchema],
  89. isDeleted: Boolean
  90. });
  91. let coeListModel = db.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list")
  92. let rationRepository = db.model("std_ration_lib_map", RepositoryMapSchema, "std_ration_lib_map");
  93. let rationChapterTreeModel = db.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema, "std_ration_lib_ration_chapter_trees");
  94. let rationItemModel = db.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items");
  95. export{coeListModel, rationRepository, rationChapterTreeModel, rationItemModel};