ration.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. }, { _id: false });
  20. // 定额、量价、工料机定额 合并存储
  21. let rationSchema = new Schema({
  22. // 公用属性部分
  23. ID: String,
  24. projectID: Number,
  25. billsItemID: String,
  26. serialNo: Number,
  27. code: String,
  28. name: String,
  29. unit: String,
  30. quantity: String,
  31. contain:String,//含量
  32. quantityEXP:String,//工程量表达式
  33. programID: Number,
  34. marketUnitFee: String,
  35. marketTotalFee: String,
  36. fees: [subSchema.feesSchema],
  37. deleteInfo: deleteSchema,
  38. type: Number, // 1 定额、2 量价、3 工料机定额
  39. subType: Number, // 子类型:1人工、201材料、301机械、4主材、5设备
  40. from:{type: String,default:'std'}, //std, cpt 来自标准、补充
  41. isSubcontract: Boolean, // 是否分包
  42. installationKey:String, //用来记录安装增加费的关联字段
  43. // 定额特有属性:
  44. libID: Number,
  45. maskName: String,
  46. caption: String,
  47. isFromDetail:{type: Number,default:0}, // 1 true 2 false
  48. adjustState: String,
  49. rationProjName: String,
  50. comments: String, // 说明
  51. flags: [subSchema.flagsSchema], // 标记字段
  52. rationAssList: [rationAssItemSchema],
  53. content: String, // 工作内容
  54. ruleText: String, // 计算规则
  55. prefix: {type: String, default: ''}, //定额是补充、借用时用 补 借
  56. //工料机特有属性
  57. projectGLJID:Number, //项目工料机ID
  58. GLJID:Number,//工料机库ID
  59. original_code:String, //原始编码
  60. specs:String,//规格型号
  61. shortName:String,//缩写
  62. customQuantity:String,//自定义消耗
  63. adjCoe:Number,
  64. remark:String
  65. });
  66. let ration = mongoose.model("ration", rationSchema, "ration");