/**
 * 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: {}
    },
    gljClass: Number,
    gljType: Number,
    model: Number,// 机型
    shortName: String,
    unit: String,
    adjCoe: Number,
    materialType: Number,   //三材类别
    materialCoe: Number,    //三材系数
    //经济指标数据
    materialIndexType:String,//工料指标类别
    materialIndexUnit:String,//工料指标单位
    materialIndexCoe:Number,//单位转换系数
    component: [std_gljComponent],
    taxRate:String//税率
},{versionKey: false});

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