ration.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**
  2. * Created by zhang on 2018/3/22.
  3. */
  4. let mongoose = require("mongoose");
  5. let subSchema = require("../all_schemas/bills_sub_schemas");
  6. let Schema = mongoose.Schema;
  7. let deleteSchema = require('../all_schemas/delete_schema');
  8. var rationAssItemSchema = mongoose.Schema({
  9. name: String,
  10. assistID: Number,
  11. assistCode: String,
  12. stdValue: Number,
  13. actualValue:Number,
  14. stepValue: String,
  15. decimal: Number,
  16. carryBit: String,
  17. minValue: String,
  18. maxValue: String,
  19. paramName:String,//参数名称
  20. param:String,//参数
  21. thirdRationCode:String,//第三定额
  22. isAdjust:Number,//0不调整,1调整
  23. groupList:[Schema.Types.Mixed]//当有分组的时候用这个
  24. }, { _id: false });
  25. // 定额、量价、工料机定额 合并存储
  26. let rationSchema = new Schema({
  27. // 公用属性部分
  28. ID: {type: String, index: true},
  29. projectID: {type: Number, index: true},
  30. billsItemID: String,
  31. serialNo: Number,
  32. code: String,
  33. name: String,
  34. unit: String,
  35. quantity: String,
  36. contain:String,//含量
  37. quantityEXP:String,//工程量表达式
  38. programID: Number,
  39. marketUnitFee: String,
  40. marketTotalFee: String,
  41. fees: [subSchema.feesSchema],
  42. //消耗量调整系数字段
  43. quantityCoe:subSchema.quantityCoeSchema,
  44. //子目工程量调整系数
  45. rationQuantityCoe:String,
  46. tenderQuantity:String,//调整后工程量
  47. // 不调价
  48. is_adjust_price: {type: Number,default: 0},
  49. targetUnitFee:String,//目标单价
  50. targetTotalFee:String,//目标合价
  51. deleteInfo: deleteSchema,
  52. type: Number, // 1 定额、2 量价、3 工料机定额
  53. subType: Number, // 子类型:1人工、201材料、301机械、4主材、5设备
  54. from:{type: String,default:'std'}, //std, cpt 来自标准、补充
  55. fromUser: String, // 来自某个用户的定额(分享补充定额)
  56. isSubcontract: Boolean, // 是否分包
  57. installationKey:String, //用来记录安装增加费的关联字段
  58. // 定额特有属性:
  59. stdID: Number, //来自的标准定额ID
  60. libID: Number,
  61. maskName: String,
  62. caption: String,
  63. evaluationProject:{type: Number,default:0}, // 1 true 0 false 估价项目
  64. isFromDetail:{type: Number,default:0}, // 1 true 0 false
  65. adjustState: String,
  66. rationProjName: String,
  67. comments: String, // 说明
  68. flags: [subSchema.flagsSchema], // 标记字段
  69. rationAssList: [rationAssItemSchema],
  70. content: String, // 工作内容
  71. annotation: String, //附注
  72. ruleText: String, // 计算规则
  73. prefix: {type: String, default: ''}, //定额是补充、借用时用 补 借
  74. referenceRationID:String,//如果是通过模板关联子目生成的定额,这里记录对应的主定额ID
  75. // 工作内容 (选择自清单)
  76. jobContentText: String,
  77. manageFeeRate:String,//管理费率
  78. //是否记取面积增加费
  79. areaIncreaseFee:{type:Schema.Types.Mixed,default:false},//true 是,false否,null 不确定,三个状态
  80. //工料机特有属性
  81. projectGLJID:Number, //项目工料机ID
  82. GLJID:Number,//工料机库ID
  83. original_code:String, //原始编码
  84. specs:String,//规格型号
  85. shortName:String,//缩写
  86. customQuantity:String,//自定义消耗
  87. model: Number,// 机型
  88. adjCoe:Number,
  89. remark:String,
  90. bookmarkBackground:String,//书签背景色
  91. bookmarkAnnotation:String,//批注
  92. overHeight: String, // 超高降效
  93. referenceRationList: {type: Array, default: []} // 关联的定额ID列表,如超高子目关联的定额ID列表
  94. });
  95. let ration = mongoose.model("ration", rationSchema, "ration");