ration_glj_temp.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. // 公用属性部分
  37. ID: String,
  38. projectID: Number,
  39. billsItemID: String,
  40. serialNo: Number,
  41. code: String,
  42. name: String,
  43. unit: String,
  44. quantity: String,
  45. contain:String,//含量
  46. quantityEXP:String,//工程量表达式
  47. programID: Number,
  48. marketUnitFee: String,
  49. marketTotalFee: String,
  50. fees: [subSchema.feesSchema],
  51. deleteInfo: deleteSchema,
  52. type: Number, // 1 定额、2 量价、3 工料机定额
  53. subType: Number, // 子类型:1人工、201材料、301机械、4主材、5设备
  54. // 定额特有属性:
  55. libID: Number,
  56. maskName: String,
  57. caption: String,
  58. isFromDetail:{type: Number,default:0}, // 1 true 2 false
  59. adjustState: String,
  60. rationProjName: String,
  61. comments: String, // 说明
  62. flags: [subSchema.flagsSchema], // 标记字段
  63. rationAssList: [rationAssItemSchema],
  64. content: String, // 工作内容
  65. ruleText: String, // 计算规则
  66. //工料机特有属性
  67. projectGLJID:Number, //项目工料机ID
  68. GLJID:Number,//工料机库ID
  69. original_code:String, //原始编码
  70. specs:String,//规格型号
  71. shortName:String,//缩写
  72. customQuantity:String,//自定义消耗
  73. from:{type: String,default:'std'}//std, cpt 来自标准工料机库、补充工料机库
  74. },{versionKey:false});
  75. mongoose.model("ration", rationSchema, "ration");
  76. var coeSchema = mongoose.Schema({
  77. coeType: String, // 系数类型,指作用范围:
  78. // 单个(如:111量0.001)、人工类、材料类、机械类、全部(如:定额×0.925)。
  79. gljID: Number, // 要调整的工料机ID(当coeType=0时有效)
  80. operator: String, // 运算符(*、+、-、=)
  81. amount: String, // 调整的量
  82. _id: false
  83. });
  84. var coeListSchema = mongoose.Schema({
  85. libID: Number, // 所属定额定ID
  86. ID: Number, // 系数ID(流水号ID)
  87. name: String, // 名称
  88. content: String, // 说明
  89. coes: [coeSchema]
  90. }, {versionKey: false});
  91. mongoose.model("std_ration_lib_coe_list",coeListSchema, "std_ration_lib_coe_list");
  92. var rationGljItemSchema = mongoose.Schema({
  93. gljId: Number,
  94. consumeAmt: Number,
  95. proportion: Number //配合比,暂时无需使用,默认0
  96. }, { _id: false });
  97. var rationAssItemSchema = mongoose.Schema({
  98. name: String,
  99. assistID: Number,
  100. assistCode: String,
  101. stdValue: String,
  102. stepValue: String,
  103. decimal: Number,
  104. carryBit: String,
  105. minValue: String,
  106. maxValue: String
  107. }, { _id: false });
  108. var rationItemSchema = mongoose.Schema({
  109. ID:Number,
  110. code: String,
  111. name: String,
  112. unit: String,
  113. basePrice: Number,
  114. sectionId: Number,
  115. rationRepId: Number,
  116. caption: String,
  117. feeType: Number,
  118. rationGljList: [rationGljItemSchema],
  119. rationCoeList: Array,
  120. rationAssList: [rationAssItemSchema]
  121. });
  122. mongoose.model("std_ration_lib_ration_items",rationItemSchema, "std_ration_lib_ration_items");
  123. let billsSchema = new Schema({
  124. ID: Number,
  125. ParentID: Number,
  126. NextSiblingID: Number,
  127. projectID: Number,
  128. serialNo: Number,
  129. chapterID: Number,
  130. code: String,
  131. fullCode: String,
  132. type:Number,
  133. isAdd:{type: Number,default:0},//1 true 0 false是否新增
  134. name: String,
  135. unit: String,
  136. quantity: String, // Decimal
  137. feeRateID:String,
  138. feeRate:String,
  139. isFromDetail:{type: Number,default:0},//1 true 2 false
  140. programID: Number,
  141. comments: String,
  142. // 调价
  143. xs_Labour: String, // Decimal
  144. xs_Material: String, // Decimal
  145. xs_Machine: String, // Decimal
  146. xs_FeeRate: String, // Decimal
  147. xs_LabourPrice: String, // Decimal
  148. xs_MaterialPrice: String, // Decimal
  149. xs_MachinePrice: String, // Decimal
  150. isTender_Labour: Boolean,
  151. isTender_Material: Boolean,
  152. isTender_Machine: Boolean,
  153. tenderTargetPrice: String, // Decimal
  154. tenderTargetUnitPrice: String, // Decimal
  155. tenderTargetUnitPrice: String, // Decimal
  156. // 费用字段
  157. fees: [subSchema.feesSchema],
  158. // 标记字段
  159. flags: [subSchema.flagsSchema],
  160. deleteInfo: deleteSchema
  161. });
  162. mongoose.model("bills", billsSchema);