浏览代码

Merge branch 'budget' of http://192.168.1.41:3000/SmartCost/ConstructionCost into budget

zhangweicheng 4 年之前
父节点
当前提交
27ff5aec40
共有 3 个文件被更改,包括 25 次插入2 次删除
  1. 16 0
      modules/main/facade/bill_facade.js
  2. 3 1
      modules/pm/facade/pm_facade.js
  3. 6 1
      modules/reports/controllers/rpt_controller.js

+ 16 - 0
modules/main/facade/bill_facade.js

@@ -183,6 +183,22 @@ module.exports={
         });
         return map;
     },
+    // 获取概算汇总单项工程级别数据(拍好序的,报表接口用)
+    getSinglesBudgetSummary: async function (constructionID) {
+        const items = await this.getBudgetSummary(constructionID, true);
+        // 去除建设项目层级
+        items.shift();
+        items.forEach(item => {
+            // 方便报表取值处理
+            if (item.projType === 'Engineering') {
+                item.engineeringName = item.name || '';
+            } else if (item.projType === 'Tender') {
+                item.tenderName = item.name || '';
+            }
+        });
+        return items;
+    },
+
     // 获取概算汇总数据(拍好序的)
     // 如果isSimple为true,只进行工程费用部分汇总,只返回工程费用部分数据
     getBudgetSummary: async function (constructionID, isSimple = false) {

+ 3 - 1
modules/pm/facade/pm_facade.js

@@ -2478,6 +2478,7 @@ async function exportMainData(userID,projectID) {
     result['compilationID'] = project.compilation;
     result['from'] = "construction";
     result.projects.push(project);
+    tenderIDs.push(project.ID);
     let subProjects = await  projectModel.find({"$or": [{'ParentID':projectID}, {"property.rootProjectID": projectID}]});
     for(let s of subProjects){
         if(!s.deleteInfo || !s.deleteInfo.deleted){
@@ -2525,6 +2526,7 @@ async function exportTenderData(data){
     let result = {};
     let projectSetting =  await projectSettingModel.findOne({"projectID": data.projectID}, '-_id');
     if(projectSetting) result['projSetting'] = projectSetting;
+    result.projectID = data.projectID;
     result.bills = await billsModel.find({"projectID": data.projectID});
     result.rations = await rationModel.find({'$or': [{projectID: data.projectID, deleteInfo: null}, {projectID: data.projectID, 'deleteInfo.deleted': {$in: [null, false]}}]});
     result.projectGLJs = await gljListModel.find({'project_id':data.projectID});
@@ -2833,7 +2835,7 @@ async function handleEachProject(data,projectIDMap,labourCoeFileIDMap,calcProgra
     let bills = [],rations = [],projectGLJs = [],installationFees=[],rationGLJs=[],rationCoes=[],quantityDetails=[],rationInstallations=[],rationTemplates=[],evaluateList=[],bidList=[],contractorList=[];
     let newProjectSetting =null,newCalcProgramsFile = null,newLabourCoe = null;
     let billsIDMap = {},projectGLJIDMap={},rationIDMap = {};
-    let newProjectID = projectIDMap[data.projSetting.projectID];
+    let newProjectID = projectIDMap[data.projectID];
     //生成安装增加费设置
     if(data.installationFees && data.installationFees.length > 0){
         for(let ins of data.installationFees){

+ 6 - 1
modules/reports/controllers/rpt_controller.js

@@ -212,7 +212,12 @@ async function getAllPagesCommon(construct_id, user_id, prj_id, prj_ids, rpt_id,
             let promiseArr = [null, null, null];
             if (summaryRst.length > 0) {
                 if (summaryRst.indexOf(`Budget`) >= 0 || summaryRst.indexOf(`BudgetDetail`) >= 0) {
-                    promiseArr[0] = bill_facade.getBudgetSummary(construct_id); //与其他汇总类的请求互斥,不能同时出现!
+                    if (flag.budgetSumType && flag.budgetSumType === 'budget_single') {
+                        //单项工程
+                        promiseArr[0] = bill_facade.getSinglesBudgetSummary(construct_id); //与其他汇总类的请求互斥,不能同时出现!
+                    } else {
+                        promiseArr[0] = bill_facade.getBudgetSummary(construct_id); //与其他汇总类的请求互斥,不能同时出现!
+                    }
                 }
                 if (summaryRst.indexOf(`Construct`) >= 0 || summaryRst.indexOf(`ConstructDetail`) >= 0) {
                     promiseArr[0] = pm_facade.getSummaryInfoByTender(prj_id, pm_facade.projectType.project);