schemas.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. jobContentSituation: String,//工作内容适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  53. isDeleted: Boolean
  54. });
  55. //定额工料机
  56. let rationGljItemSchema = new Schema({
  57. gljId: Number,
  58. consumeAmt: Number,
  59. proportion: Number //配合比,暂时无需使用,默认0
  60. }, { _id: false });
  61. //辅助定额调整
  62. let rationAssItemSchema = new Schema({
  63. name: String,
  64. assistID: Number,
  65. assistCode: String,
  66. stdValue: String,
  67. stepValue: String,
  68. decimal: Number,
  69. carryBit: String,
  70. minValue: String,
  71. maxValue: String
  72. }, { _id: false });
  73. //定额
  74. var rationItemSchema = new Schema({
  75. ID:Number,
  76. code: String,
  77. name: String,
  78. unit: String,
  79. labourPrice: Number,
  80. materialPrice: Number,
  81. machinePrice: Number,
  82. basePrice: Number,
  83. sectionId: Number,
  84. rationRepId: Number,
  85. caption: String,
  86. feeType: Number,
  87. jobContent: String,
  88. rationGljList: [rationGljItemSchema],
  89. rationCoeList: Array,
  90. rationAssList: [rationAssItemSchema],
  91. isDeleted: Boolean
  92. });
  93. let coeListModel = db.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list")
  94. let rationRepository = db.model("std_ration_lib_map", RepositoryMapSchema, "std_ration_lib_map");
  95. let rationChapterTreeModel = db.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema, "std_ration_lib_ration_chapter_trees");
  96. let rationItemModel = db.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items");
  97. export{coeListModel, rationRepository, rationChapterTreeModel, rationItemModel};