Browse Source

承包商主材_变值权重B 指标处理

TonyKang 4 năm trước cách đây
mục cha
commit
c0df3edb47
1 tập tin đã thay đổi với 43 bổ sung3 xóa
  1. 43 3
      modules/reports/util/rpt_construct_data_util.js

+ 43 - 3
modules/reports/util/rpt_construct_data_util.js

@@ -17,8 +17,9 @@ const gljType = require('../../common/const/glj_type_const');
 // const pm_facade = require('../../pm/facade/pm_facade');
 const GLJID_PRE = `gljId_`, COMPONENT_GLJID_PRE = `componetGljId_`;
 //import common_const = require('../../../public/common_constants');
-const { supplyType, supplyText } = require('../../../public/common_constants');
-
+const { fixedFlag, supplyType, supplyText } = require('../../../public/common_constants');
+const _ = require('lodash');
+const scMathUtil = require('../../../public/scMathUtil').getUtil();
 
 const GLJ_TYPE = {
     Labour: 1,
@@ -166,7 +167,7 @@ class Rpt_Data_Extractor {
                                 if (rst.indexOf(projectConst.LABOUR_COE < 0)) rst.push(projectConst.LABOUR_COE);
                             }
                             if (key === projectConst.PROJECTGLJ) {
-                                if (rst.indexOf(projectConst.LABOUR_COE < 0)) rst.push(projectConst.LABOUR_COE);
+                                if (rst.indexOf(projectConst.LABOUR_COE) < 0) rst.push(projectConst.LABOUR_COE);
                                 if (rst.indexOf(projectConst.RATION_GLJ) < 0) rst.push(projectConst.RATION_GLJ);
                                 if (field[JV.PROP_FIELD_EXP_MAP].indexOf("'quantity'") > 0 ||
                                     field[JV.PROP_FIELD_EXP_MAP].indexOf("'subdivisionQuantity'") > 0 ||
@@ -175,6 +176,14 @@ class Rpt_Data_Extractor {
                                     if (rst.indexOf(projectConst.BILLS) < 0) rst.push(projectConst.BILLS);
                                 }
                             }
+                            if (key === projectConst.CONTRACTOR_LIST) {
+                                if (rst.indexOf(projectConst.PROJECTGLJ) < 0) {
+                                    rst.push(projectConst.PROJECTGLJ); //为了算指标:承包人主要材料设备_变值权重B
+                                }
+                                if (rst.indexOf(projectConst.BILLS) < 0) {
+                                    rst.push(projectConst.BILLS); //为了算指标:承包人主要材料设备_变值权重B
+                                }
+                            }
                         }
                     }
                 } else if (key === projectConst.PROJECTGLJ) {
@@ -288,11 +297,42 @@ class Rpt_Data_Extractor {
             let rationGLJDatas = getModuleDataByKey(rawDataObj.prjData, "ration_glj");
             let rationDatas = getModuleDataByKey(rawDataObj.prjData, "ration");
             let billsDatas = getModuleDataByKey(rawDataObj.prjData, "bills");
+            let contractorDatas = getModuleDataByKey(rawDataObj.prjData, "contractor_list");
             let decimal = rawDataObj.prj.property.decimal.glj.quantity;
             let calcOptions = rawDataObj.prj.property.calcOptions;
             if (projectGLJDatas && rationGLJDatas && rationDatas && billsDatas) {
                 gljUtil.calcProjectGLJQuantity(projectGLJDatas.data, rationGLJDatas.data, rationDatas.data, billsDatas.data, decimal, true);
             }
+            if (contractorDatas && projectGLJDatas && billsDatas) {
+                let ttlFee = 0;
+                for (const bd of billsDatas.data) {
+                    let doc = bd._doc ? bd._doc : bd;
+                    let hasTtl = false;
+                    if (doc.flags && doc.flags.length > 0) {
+                        for (const flag of doc.flags) {
+                            let flagDoc = flag._doc ? flag._doc : flag;
+                            if (flagDoc.flag === fixedFlag.ENGINEERINGCOST) {
+                                hasTtl = true;
+                                break;
+                            }
+                        }
+                    }
+                    if (hasTtl) {
+                        for (const fee of bd.fees) {
+                            let feeDoc = fee._doc ? fee._doc : fee;                            
+                            if (feeDoc.fieldName === 'common') {
+                                // console.log(feeDoc);
+                                ttlFee = feeDoc.totalFee;
+                                break;
+                            }
+                        }
+                        break;
+                    }
+                }
+                let coeRst = gljUtil.getPriceCoeDatas(projectGLJDatas.data.gljList, contractorDatas.data, ttlFee, rawDataObj.prj.property, _, scMathUtil);
+                console.log(coeRst);
+                contractorDatas.data = coeRst;
+            }
             if (projectGLJDatas && rationGLJDatas && labourCoeDatas) {
                 //考虑调价情况
                 const newAdjPriceArr = [];