123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- /**
- * Created by CSL on 2017/5/3.
- * 系数表。
- */
- var mongoose = require("mongoose");
- var dbm = require("../../../config/db/db_manager");
- var db = dbm.getCfgConnection("rationRepository")
- var coeSchema = mongoose.Schema({
- coeType: String, // 系数类型,指作用范围:
- // 0 针对单个工料机。如:111量0.001
- // 1 人工类。 2 材料类。 3 机械类。
- // 9 针对本定额所有工料机。如:定额×0.925 (可以用123代替,但9的好处是前端不用做多余的过滤判断,提高效率)
- gljID: Number, // 要调整的工料机ID(当coeType=0时有效)
- operator: String, // 运算符(*、+、-、=)
- amount: String, // 调整的量
- _id: false
- });
- var coeListSchema = mongoose.Schema({
- libID: Number, // 所属定额定ID
- ID: Number, // 系数ID(流水号ID)
- name: String, // 名称
- content: String, // 说明
- coes: [coeSchema]
- });
- var coeListModel = db.model("coeLists",coeListSchema, "coeLists")
- var coeListDAO = function(){};
- coeListDAO.prototype.getCoe = function (data, callback) {
- coeListModel.findOne({
- "libID": data.libID,
- "ID": data.ID,
- "$or": [{"isDeleted": null}, {"isDeleted": false}]
- },
- function (err, doc) {
- if (err) callback(true, "获取系数明细错误!", "")
- else callback(false, "获取系数明细成功", doc);
- })
- };
- module.exports = new coeListDAO();
|