/**
 * Created by Zhong on 2018/3/22.
 */
/*补充工料机*/
//补充工料机的组成物可能来自标准工料机和补充工料机
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const comple_gljComponent = new Schema(
    {
        isStd: Boolean, //组成物里的工料机是否是标准的，否则是补充的
        ID: Number,
        consumeAmt: String
    },
    {_id: false},
    {versionKey: false}
);
//补充工料机跟用户和编办绑定
const comple_glj = new Schema({
    userId: String,
    compilationId: String,
    ID: Number,
    code: String,
    name: String,
    specs: String,
    unit: String,
    basePrice: String,
    gljClass: String,
    gljType: Number,
    model: Number,
    shortName: String,
    //以下仅普通材料可用
    grossWeightCoe: Number, //毛重系数
    purchaseStorageRate: Number, //采购保管费率
    offSiteTransportLossRate: Number, //场外运输损耗率
    handlingLossRate: Number, //每增一次装卸损耗率
    component: [comple_gljComponent]
}, {versionKey: false});

mongoose.model('complementary_glj_lib', comple_glj, 'complementary_glj_lib');