ration_glj_temp.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * Created by chen on 2017/6/29.
  3. */
  4. let subSchema = require("../../main/models/bills_sub_schemas");
  5. let deleteSchema = require('../../../public/models/delete_schema');
  6. var mongoose = require('mongoose'),
  7. Schema = mongoose.Schema;
  8. //下面是临时代码,以后删除
  9. var rationAssItemSchema = mongoose.Schema({
  10. name: String,
  11. assistID: Number,
  12. assistCode: String,
  13. stdValue: Number,
  14. actualValue:Number,
  15. stepValue: String,
  16. decimal: Number,
  17. carryBit: String,
  18. minValue: String,
  19. maxValue: String
  20. }, { _id: false });
  21. var gljSchema =new Schema({
  22. repositoryId: Number,
  23. ID:Number,
  24. //以下是基于已有access库
  25. code: String,
  26. name: String,
  27. specs: String,
  28. unit: String,
  29. basePrice: Number,
  30. gljType: Number, //这个是UI显示上的详细分类,对应gljTypeSchema
  31. gljDistType: String //人工,材料,机械
  32. },{versionKey:false});
  33. mongoose.model("std_ration_lib_glj_list",gljSchema,"std_ration_lib_glj_list");
  34. let rationSchema = new Schema({
  35. ID: Number,
  36. projectID: Number,
  37. billsItemID: Number,
  38. serialNo: Number,
  39. libID: Number,
  40. code: String,
  41. name: String,
  42. maskName: String,
  43. unit: String,
  44. quantity: String, // Decimal
  45. programID: Number,
  46. adjustState: String,
  47. content: String,
  48. rationProjName: String,
  49. comments: String,
  50. // 费用字段
  51. fees: [subSchema.feesSchema],
  52. // 标记字段
  53. flags: [subSchema.flagsSchema],
  54. deleteInfo: deleteSchema,
  55. rationAssList: [rationAssItemSchema]
  56. });
  57. mongoose.model("ration", rationSchema, "ration");
  58. var coeSchema = mongoose.Schema({
  59. coeType: String, // 系数类型,指作用范围:
  60. // 单个(如:111量0.001)、人工类、材料类、机械类、全部(如:定额×0.925)。
  61. gljID: Number, // 要调整的工料机ID(当coeType=0时有效)
  62. operator: String, // 运算符(*、+、-、=)
  63. amount: String, // 调整的量
  64. _id: false
  65. });
  66. var coeListSchema = mongoose.Schema({
  67. libID: Number, // 所属定额定ID
  68. ID: Number, // 系数ID(流水号ID)
  69. name: String, // 名称
  70. content: String, // 说明
  71. coes: [coeSchema]
  72. }, {versionKey: false});
  73. mongoose.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list");
  74. var rationGljItemSchema = mongoose.Schema({
  75. gljId: Number,
  76. consumeAmt: Number,
  77. proportion: Number //配合比,暂时无需使用,默认0
  78. }, { _id: false });
  79. var rationAssItemSchema = mongoose.Schema({
  80. name: String,
  81. assistID: Number,
  82. assistCode: String,
  83. stdValue: String,
  84. stepValue: String,
  85. decimal: Number,
  86. carryBit: String,
  87. minValue: String,
  88. maxValue: String
  89. }, { _id: false });
  90. var rationItemSchema = mongoose.Schema({
  91. ID:Number,
  92. code: String,
  93. name: String,
  94. unit: String,
  95. basePrice: Number,
  96. sectionId: Number,
  97. rationRepId: Number,
  98. caption: String,
  99. feeType: Number,
  100. rationGljList: [rationGljItemSchema],
  101. rationCoeList: Array,
  102. rationAssList: [rationAssItemSchema]
  103. });
  104. mongoose.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items")