/**
 * Created by chen on 2017/6/29.
 */
var mongoose = require('mongoose'),
    Schema = mongoose.Schema;

var ration_glj = new Schema({
    ID:{type: String, index: true},
    GLJID:Number,
    repositoryId:Number,
    projectID: {type: Number, index: true},
    rationID:{type: String, index: true},
    projectGLJID:Number,
    name:String,
    code:String,
    //原始的编码
    original_code: {
        type: String,
        index: true
    },
    rcode:String,
    //新结构，计录替换前的工料机信息，对于混凝土，替换，计算等问题处理,替换时保存旧数据的5大项信息
    mIndexObj: Schema.Types.Mixed,
    specs:String,
    unit:String,
    shortName:String,
    billsItemID: String,
    type:Number,
    // 机型
    model: Number,
    // 调整系数ID
    adjCoe: Number,
    quantity:String,
    customQuantity:String,
    rationItemQuantity:String,
    tenderQuantity:String,//调整后消耗量
    // 定额配合比
    rationProportion: {
        type: Number,
        default: 0
    },
    // 调整配合比
    adjustProportion: {
        type: Number,
        default: 0
    },
    createType: {type: String,default:'normal'},//normal、add、replace  正常、添加工料机、替换工料机
    from:{type: String,default:'std'}//std, cpt  来自标准工料机库、补充工料机库
},{versionKey:false});

mongoose.model('ration_glj', ration_glj);
