mix_ratio.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * 配合比数据结构
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/12
  6. * @version
  7. */
  8. // import mongoose from 'mongoose';
  9. let mongoose = require("mongoose");
  10. let Schema = mongoose.Schema;
  11. let collectionName = 'mix_ratio';
  12. let modelSchema = {
  13. // 自增id
  14. id: Number,
  15. // 消耗量(有别于总消耗,此字段记录配合比的消耗量)
  16. consumption: {
  17. type: String,
  18. default: 0
  19. },
  20. // 工料机总库对应id (关联用)
  21. glj_id: {
  22. type: Number,
  23. index: true
  24. },
  25. // 单价文件表id (因为选择单价文件后配合比数据也需要同步,所以记录单价文件id)
  26. unit_price_file_id: Number,
  27. // 关联项目工料机的key 不能关联id,因为单价文件导入别的项目后项目工料机id不同
  28. connect_key: {
  29. type: String,
  30. index: true
  31. },
  32. // 规格型号
  33. specs: {
  34. type: String,
  35. default: ''
  36. },
  37. // 单位
  38. unit: String,
  39. // 名称
  40. name: {
  41. type: String,
  42. index: true,
  43. default: ''
  44. },
  45. // 对应工料机code
  46. code: String,
  47. // 工料机类型
  48. type: Number
  49. };
  50. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));