ration_glj_temp.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. caption: String,
  44. unit: String,
  45. quantity: String, // Decimal
  46. isFromDetail:{type: Number,default:0},//1 true 2 false
  47. programID: Number,
  48. adjustState: String,
  49. content: String,
  50. rationProjName: String,
  51. comments: String,
  52. // 费用字段
  53. fees: [subSchema.feesSchema],
  54. // 标记字段
  55. flags: [subSchema.flagsSchema],
  56. deleteInfo: deleteSchema,
  57. rationAssList: [rationAssItemSchema]
  58. });
  59. mongoose.model("ration", rationSchema, "ration");
  60. var coeSchema = mongoose.Schema({
  61. coeType: String, // 系数类型,指作用范围:
  62. // 单个(如:111量0.001)、人工类、材料类、机械类、全部(如:定额×0.925)。
  63. gljID: Number, // 要调整的工料机ID(当coeType=0时有效)
  64. operator: String, // 运算符(*、+、-、=)
  65. amount: String, // 调整的量
  66. _id: false
  67. });
  68. var coeListSchema = mongoose.Schema({
  69. libID: Number, // 所属定额定ID
  70. ID: Number, // 系数ID(流水号ID)
  71. name: String, // 名称
  72. content: String, // 说明
  73. coes: [coeSchema]
  74. }, {versionKey: false});
  75. mongoose.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list");
  76. var rationGljItemSchema = mongoose.Schema({
  77. gljId: Number,
  78. consumeAmt: Number,
  79. proportion: Number //配合比,暂时无需使用,默认0
  80. }, { _id: false });
  81. var rationAssItemSchema = mongoose.Schema({
  82. name: String,
  83. assistID: Number,
  84. assistCode: String,
  85. stdValue: String,
  86. stepValue: String,
  87. decimal: Number,
  88. carryBit: String,
  89. minValue: String,
  90. maxValue: String
  91. }, { _id: false });
  92. var rationItemSchema = mongoose.Schema({
  93. ID:Number,
  94. code: String,
  95. name: String,
  96. unit: String,
  97. basePrice: Number,
  98. sectionId: Number,
  99. rationRepId: Number,
  100. caption: String,
  101. feeType: Number,
  102. rationGljList: [rationGljItemSchema],
  103. rationCoeList: Array,
  104. rationAssList: [rationAssItemSchema]
  105. });
  106. mongoose.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items");
  107. let billsSchema = new Schema({
  108. ID: Number,
  109. ParentID: Number,
  110. NextSiblingID: Number,
  111. projectID: Number,
  112. serialNo: Number,
  113. chapterID: Number,
  114. code: String,
  115. fullCode: String,
  116. name: String,
  117. unit: String,
  118. quantity: String, // Decimal
  119. isFromDetail:{type: Number,default:0},//1 true 2 false
  120. programID: Number,
  121. comments: String,
  122. // 调价
  123. xs_Labour: String, // Decimal
  124. xs_Material: String, // Decimal
  125. xs_Machine: String, // Decimal
  126. xs_FeeRate: String, // Decimal
  127. xs_LabourPrice: String, // Decimal
  128. xs_MaterialPrice: String, // Decimal
  129. xs_MachinePrice: String, // Decimal
  130. isTender_Labour: Boolean,
  131. isTender_Material: Boolean,
  132. isTender_Machine: Boolean,
  133. tenderTargetPrice: String, // Decimal
  134. tenderTargetUnitPrice: String, // Decimal
  135. tenderTargetUnitPrice: String, // Decimal
  136. // 费用字段
  137. fees: [subSchema.feesSchema],
  138. // 标记字段
  139. flags: [subSchema.flagsSchema],
  140. deleteInfo: deleteSchema
  141. });
  142. mongoose.model("bills", billsSchema);