Selaa lähdekoodia

定额库乘系数调整。

Chenshilong 8 vuotta sitten
vanhempi
commit
cfeb7bc77a

+ 44 - 0
modules/rationRepository/models/coeList.js

@@ -0,0 +1,44 @@
+/**
+ * Created by CSL on 2017/5/3.
+ * 系数表。
+ */
+
+var mongoose = require("mongoose");
+var dbm = require("../../../config/db/db_manager");
+var db = dbm.getCfgConnection("rationRepository")
+
+var gljCoeSchema = mongoose.Schema({
+    coeType: String,                // 系数的作用范围:
+                                    // 0 针对本定额所有工料机。如:定额×0.925
+                                    // 1 人工类。 2 材料类。 3 机械类。
+                                    // 9 针对单个工料机。如:111量0.001
+    gljID: Number,                  // 要调整的工料机ID(当coeType=9时有效)
+    operator: String,               // 运算符(*、+、-、=)
+    amount: String                  // 调整的量
+});
+
+var coeListSchema = mongoose.Schema({
+    libID: Number,                      // 所属定额定ID
+    ID: Number,                         // 系数ID(流水号ID)
+    name: String,                       // 名称
+    content: String,                    // 说明
+    gljCoe: [gljCoeSchema]
+});
+
+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();

+ 34 - 0
modules/rationRepository/models/rationCoe.js

@@ -0,0 +1,34 @@
+/**
+ * Created by CSL on 2017/5/3.
+ * 定额系数关系表。(即附注条件。系数会被定额公用,如同一个分枝下的兄弟定额。)
+ */
+var mongoose = require("mongoose");
+var dbm = require("../../../config/db/db_manager");
+var db = dbm.getCfgConnection("rationRepository")
+
+var rationCoeSchema = mongoose.Schema({
+    ID:Number,
+    libID: Number,
+    rationID: Number,
+    //rationCode: String,
+    coeIDs: Array
+});
+
+var rationCoeModel = db.model("rationCoes",rationCoeSchema, "rationCoes")
+
+var rationCoeDAO = function(){};
+
+rationCoeDAO.prototype.getRationCoes = function (data, callback) {
+    rationCoeModel.findOne({
+            "libID": data.libID,
+            "rationID": data.rationID,
+            "$or": [{"isDeleted": null}, {"isDeleted": false}]
+        },
+        function (err, doc) {
+            if (err) callback(true, "获取定额调整系数错误!", "")
+            else callback(false, "获取定额调整系数成功", doc);
+        })
+};
+
+module.exports = new rationCoeDAO();
+