/**
 * Created by Zhong on 2018/3/22.
 */
/*标准工料机*/
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
//标准工料机的组成物只来自标准工料机
const std_gljComponent = new Schema(
    {
        ID: Number,
        consumeAmt: Number,
        consumeAmtProperty: {
            type: Schema.Types.Mixed,
            default: {}
        }
    },
    {_id: false},
    {versionKey: false}
);

const std_glj = new Schema({
    deleted: Boolean,
    repositoryId: {type: Number,index: true},
    ID: {type: Number,index: true},
    code: String,
    name: String,
    specs: String,
    basePrice: Number,
    priceProperty: {
        type: Schema.Types.Mixed,
        default: {}
    },
    model: Number,
    gljClass: Number,
    gljType: Number,
    shortName: String,
    unit: String,
    //以下仅普通材料可用
    grossWeightCoe: Number, //毛重系数
    purchaseStorageRate: Number, //采购保管费率
    offSiteTransportLossRate: Number, //场外运输损耗率
    handlingLossRate: Number, //每增一次装卸损耗率
    component: [std_gljComponent]
},{versionKey: false});

mongoose.model('std_glj_lib_gljList', std_glj, 'std_glj_lib_gljList');
