ration_glj_temp.js 4.4 KB

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