|
@@ -3,14 +3,15 @@
|
|
|
*/
|
|
|
import UnitPriceFileModel from "../../glj/models/unit_price_file_model";
|
|
|
let ProjectsData = require('../models/project_model').project;
|
|
|
-let projectM = require('../../main/models/project');
|
|
|
-let projectSchema = require("../models/project_schema");
|
|
|
let labourCoe = require('../../main/facade/labour_coe_facade');
|
|
|
let projType = require('../models/project_model').projType;
|
|
|
let fileType = require('../models/project_model').fileType;
|
|
|
const engineering = require("../../common/const/engineering");
|
|
|
let EngineeringLibModel = require("../../users/models/engineering_lib_model");
|
|
|
let fee_rate_facade = require("../../fee_rates/facade/fee_rates_facade");
|
|
|
+let billsModel = require('../../main/models/bills').model;
|
|
|
+let rationsModel = require('../../main/models/ration').model;
|
|
|
+let projectModel = require("../models/project_schema");
|
|
|
|
|
|
//统一回调函数
|
|
|
let callback = function(req, res, err, message, data){
|
|
@@ -61,7 +62,7 @@ module.exports = {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 该方法主要用于项目属性位置提交保存混合型数据,这些数据来自不同的表,包括projects.property、ration、bills、labour_coes.
|
|
|
+ // CSL, 2017-12-14 该方法用于项目属性:提交保存混合型数据,这些数据来自不同的表,包括projects.property、ration、bills、labour_coes.
|
|
|
updateMixDatas: function(req, res){
|
|
|
let callBackInner = function (err, message, data) {
|
|
|
if (err === 0) {
|
|
@@ -78,16 +79,22 @@ module.exports = {
|
|
|
labourCoe.save(datas.labourCoes.updateData, callBackInner);
|
|
|
};
|
|
|
|
|
|
- if (datas.rations.length > 0){
|
|
|
- // projectM.save(data, callBackInner);
|
|
|
- };
|
|
|
-
|
|
|
+ // 清单:每文档doc只存储一条清单,每条清单都必须定位一次文档,无法合并处理
|
|
|
if (datas.bills.length > 0){
|
|
|
+ for (let bill of datas.bills){
|
|
|
+ billsModel.update({projectID: datas.projectID, ID: bill.ID, deleteInfo: null}, bill, callBackInner);
|
|
|
+ };
|
|
|
+ };
|
|
|
|
|
|
+ // 定额:每文档doc只存储一条定额,每条定额都必须定位一次文档,无法合并处理
|
|
|
+ if (datas.rations.length > 0){
|
|
|
+ for (let ration of datas.rations){
|
|
|
+ rationsModel.update({projectID: datas.projectID, ID: ration.ID, deleteInfo: null}, ration, callBackInner);
|
|
|
+ };
|
|
|
};
|
|
|
|
|
|
if (Object.keys(datas.properties).length > 0){
|
|
|
- projectSchema.update({ID: datas.projectID}, datas.properties, callBackInner);
|
|
|
+ projectModel.update({ID: datas.projectID}, datas.properties, callBackInner);
|
|
|
};
|
|
|
},
|
|
|
updateFiles: async function(req, res){
|