stdRation_ration.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * Created by Zhong on 2018/3/22.
  3. */
  4. /*定额库-定额*/
  5. const mongoose = require("mongoose");
  6. const Schema = mongoose.Schema;
  7. const rationGljItemSchema = new Schema(
  8. {
  9. gljId: Number,
  10. consumeAmt: Number,
  11. proportion: { type: Number, default: 0 }, //配合比,暂时无需使用,默认0
  12. lossRateID: String,
  13. lossRateNo: Number,
  14. lossRateName: String,
  15. lossRate: Number,
  16. },
  17. { _id: false }
  18. );
  19. const rationAssItemSchema = new Schema(
  20. {
  21. name: String,
  22. assistID: Number,
  23. assistCode: String,
  24. stdValue: String,
  25. stepValue: String,
  26. decimal: Number,
  27. carryBit: String,
  28. minValue: String,
  29. maxValue: String,
  30. paramName: String, //参数名称
  31. param: String, //参数
  32. thirdRationCode: String, //第三定额
  33. },
  34. { _id: false }
  35. );
  36. //定额安装增加费用
  37. const rationInstSchema = new Schema(
  38. {
  39. feeItemId: String,
  40. sectionId: String,
  41. },
  42. { _id: false }
  43. );
  44. const rationItemSchema = new Schema({
  45. ID: Number,
  46. code: String,
  47. name: String,
  48. unit: String,
  49. basePrice: Number,
  50. sectionId: Number,
  51. rationRepId: { type: Number, index: true },
  52. caption: String,
  53. feeType: String,
  54. oilStoneRatio: Number, // 油石比
  55. jobContent: String,
  56. annotation: String,
  57. rationGljList: [rationGljItemSchema],
  58. rationCoeList: Array,
  59. rationAssList: [rationAssItemSchema],
  60. rationInstList: [rationInstSchema],
  61. rationTemplateList: {
  62. type: Array,
  63. default: [],
  64. },
  65. isDeleted: { type: Boolean, default: false },
  66. });
  67. mongoose.model(
  68. "std_ration_lib_ration_items",
  69. rationItemSchema,
  70. "std_ration_lib_ration_items"
  71. );
  72. mongoose.model(
  73. "std_ration_lib_ration_items_backup",
  74. rationItemSchema,
  75. "std_ration_lib_ration_items_backup"
  76. );