/** * 配合比数据结构 * * @author CaiAoLin * @date 2017/7/12 * @version */ const mongoose = require('mongoose'); let Schema = mongoose.Schema; let collectionName = 'mix_ratio'; let modelSchema = { // 自增id id: Number, // 消耗量(有别于总消耗,此字段记录配合比的消耗量) consumption: { type: String, default: 0 }, // 工料机总库对应id (关联用) glj_id: { type: Number, index: true }, // 单价文件表id (因为选择单价文件后配合比数据也需要同步,所以记录单价文件id) unit_price_file_id: {type: Number, index: true}, // 关联项目工料机的key 不能关联id,因为单价文件导入别的项目后项目工料机id不同 connect_key: { type: String, index: true }, // 规格型号 specs: { type: String, default: '' }, // 单位 unit: String, // 名称 name: { type: String, index: true, default: '' }, // 对应工料机code code: String, // 工料机类型 type: Number, model: Number// 机型 }; mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));