schemas.js 3.5 KB

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