schemas.js 3.3 KB

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