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