schemas.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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: Number,
  62. proportion: Number //配合比,暂时无需使用,默认0
  63. }, { _id: false });
  64. //辅助定额调整
  65. let rationAssItemSchema = new Schema({
  66. name: String,
  67. assistID: Number,
  68. assistCode: String,
  69. stdValue: String,
  70. stepValue: String,
  71. decimal: Number,
  72. carryBit: String,
  73. minValue: String,
  74. maxValue: String
  75. }, { _id: false });
  76. //定额
  77. var rationItemSchema = new Schema({
  78. ID:Number,
  79. code: String,
  80. name: String,
  81. unit: String,
  82. labourPrice: Number,
  83. materialPrice: Number,
  84. machinePrice: Number,
  85. basePrice: Number,
  86. sectionId: Number,
  87. rationRepId: Number,
  88. caption: String,
  89. feeType: Number,
  90. jobContent: String,
  91. annotation: String,
  92. rationGljList: [rationGljItemSchema],
  93. rationCoeList: Array,
  94. rationAssList: [rationAssItemSchema],
  95. isDeleted: Boolean
  96. });
  97. let coeListModel = db.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list")
  98. let rationRepository = db.model("std_ration_lib_map", RepositoryMapSchema, "std_ration_lib_map");
  99. let rationChapterTreeModel = db.model("std_ration_lib_ration_chapter_trees", rationChapterTreeSchema, "std_ration_lib_ration_chapter_trees");
  100. let rationItemModel = db.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items");
  101. export{coeListModel, rationRepository, rationChapterTreeModel, rationItemModel};