ration_glj_temp.js 5.8 KB

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