浏览代码

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/ConstructionCost

vian 5 年之前
父节点
当前提交
eebbc4d4eb

+ 15 - 10
modules/ration_glj/facade/glj_calculate_facade.js

@@ -68,6 +68,7 @@ async function calculateQuantity(query,noNeedCal,refreshRationName = false,areaI
             areaSetting = project.property.areaSetting;
         }
          if(impactRation._doc.hasOwnProperty("rationAssList")&&impactRation.rationAssList.length>0){
+             prepareAss(impactRation.rationAssList);
              let temTimes = [];
              let thirdRationCodes=[];
              for(let i=0;i<impactRation.rationAssList.length;i++){
@@ -376,19 +377,23 @@ function getContent(coes) {
 }
 
 function prepareAss(assList) {//处理辅助定额,支持多个辅助定额的情况
-    for(let a of assList){
-        if(a.groupList && a.groupList.length > 1){//组里有多个定额的情况
-            let newList = _.sortByAll(a.groupList,['param']);//先按参数排序
-            for(let n of newList){
-                if(a.actualValue > n.stdValue && a.actualValue <= parseFloat(n.param)){//落在中间,则用组里的这条定额
-                    a._doc.param = n.param;
-                    a._doc.paramName = n.paramName;
-                    a._doc.assistCode = n.assistCode;
-                    break;
-                }
+  for(let a of assList){
+    if(a.groupList && a.groupList.length > 1){//组里有多个定额的情况
+        let newList = _.sortByAll(a.groupList,[function(item){
+           return parseFloat(item.param)
+        }]);//先按参数排序
+        let pre = 0;
+        for(let n of newList){
+            if(a.actualValue > pre && a.actualValue <= parseFloat(n.param)){//落在中间,则用组里的这条定额
+                a._doc.param = n.param;
+                a._doc.paramName = n.paramName;
+                a._doc.assistCode = n.assistCode;
+                break;
             }
+            pre = parseFloat(n.param);
         }
     }
+  }
 }
 
 function calculateTimes(ass){

+ 1 - 0
public/web/gljUtil.js

@@ -581,6 +581,7 @@ let gljUtil = {
         let property = tproperty?tproperty:projectObj.project.property;
         if (!glj.is_adjust_price&&property.tenderSetting && isDef(property.tenderSetting.gljPriceTenderCoe) ){
             tenderCoe = parseFloat(property.tenderSetting.gljPriceTenderCoe);
+            if (tenderCoe == 0) tenderCoe = 1;
         }
         return tenderCoe;
 

+ 75 - 37
web/building_saas/main/js/models/calc_program.js

@@ -210,7 +210,8 @@ let calcTools = {
         else if (this.isBill(treeNode)){
             let nodeQ = this.uiNodeQty(treeNode);
             let q = nodeQ ? nodeQ : 1;
-            let rNodes = projectObj.project.Ration.getRationNodes(treeNode);
+            let allNodes = projectObj.project.Ration.getRationNodes(treeNode);
+            let rNodes = allNodes.filter(function (node) {return node.data.type != rationType.volumePrice});
             let rations = rNodes.map(function (node) {return node.data});
             treeNode.data.gljList = projectObj.project.ration_glj.getGatherGljArrByRations(rations, needOneBill, q);
         };
@@ -724,8 +725,17 @@ let calcTools = {
         }
         else {
             if (isRCJZC(treeNode, baseName)) {
-                if (treeNode.data.type == rationType.volumePrice)
-                    result = treeNode.data.marketUnitFee ? parseFloat(treeNode.data.marketUnitFee).toDecimal(decimalObj.ration.unitPrice) : 0
+                if (treeNode.data.type == rationType.volumePrice){
+                    if (isTender){
+                        let coe = this.tenderCoe_GLJPrice();
+                        if (treeNode.data.marketUnitFee)
+                            result =  (parseFloat(treeNode.data.marketUnitFee) * coe).toDecimal(decimalObj.ration.unitPrice)
+                        else
+                            result =  0;
+                    }
+                    else
+                        result = treeNode.data.marketUnitFee ? parseFloat(treeNode.data.marketUnitFee).toDecimal(decimalObj.ration.unitPrice) : 0
+                }
                 else if (treeNode.data.type == rationType.gljRation)
                 // result = treeNode.data.basePrice ? parseFloat(treeNode.data.basePrice).toDecimal(decimalObj.ration.unitPrice) : 0;
                 // 这里因为是算基数所以要取基价,但不能直接取basePrice,受限于项目属性的三个选项。
@@ -908,6 +918,58 @@ let calcTools = {
     uiNodeQty: function (treeNode){
         return parseFloatPlus(treeNode.data.quantity).toDecimal(decimalObj.decimal("quantity", treeNode));
     },
+
+    // 在项目工料机里检查该工料机是否参与调价
+    isTenderGLJ: function (glj){
+        let projGLJ = this.getProjectGLJ(glj);
+        return !(projGLJ && projGLJ.is_adjust_price == 1);
+    },
+    // 取单价调价系数
+    tenderCoe_GLJPrice: function (){
+        let coe = 1;
+        if (projectObj.project.property.tenderSetting && projectObj.project.property.tenderSetting.gljPriceTenderCoe){
+            coe = projectObj.project.property.tenderSetting.gljPriceTenderCoe;
+            if (coe == '0') coe = 1;  // 这里加个保护
+        };
+        return coe;
+    },
+    tenderCoe_NodeQty: function (treeNode){
+        let coe = 1;
+        if (treeNode.data.rationQuantityCoe){
+            coe = treeNode.data.rationQuantityCoe;
+            if (coe == '0') coe = 1;  // 这里加个保护
+        };
+        return coe;
+    },
+    tenderCoe_GLJQty: function (treeNode, glj){
+        let coe = 1;
+        if (!treeNode.data.quantityCoe) return coe;
+
+        if (gljType.LABOUR == glj.type){
+            if (treeNode.data.quantityCoe.labour)
+                coe = treeNode.data.quantityCoe.labour;
+        }
+        else if (baseMaterialTypes.indexOf(glj.type)){
+            if (treeNode.data.quantityCoe.material)
+                coe = treeNode.data.quantityCoe.material;
+        }
+        else if (baseMachineTypes.indexOf(glj.type)){
+            if (treeNode.data.quantityCoe.machine)
+                coe = treeNode.data.quantityCoe.machine;
+        }
+        else if (gljType.MAIN_MATERIAL == glj.type){
+            if (treeNode.data.quantityCoe.main)
+                coe = treeNode.data.quantityCoe.main;
+        }
+        else if (gljType.EQUIPMENT == glj.type){
+            if (treeNode.data.quantityCoe.equipment)
+                coe = treeNode.data.quantityCoe.equipment;
+        };
+
+        if (coe == '0') coe = 1;   // 这里加个保护
+        return coe;
+    },
+
     uiNodeTenderQty: function (treeNode){
         return this.calcNodeTenderQty(treeNode);
     },
@@ -937,35 +999,13 @@ let calcTools = {
     calcGLJTenderQty: function (treeNode, glj){
         if (treeNode.data.quantityCoe == undefined){
             glj.tenderQuantity = glj.quantity;
-            return glj.tenderQuantity;
-        };
-
-        let qCoe = 1;
-        let projGLJ = calcTools.getProjectGLJ(glj);
-        if (projGLJ.is_adjust_price != 1) {      // 先检查项目工料机里,该工料机是否参与调价
-            if (gljType.LABOUR == glj.type){
-                if (treeNode.data.quantityCoe.labour)
-                    qCoe = treeNode.data.quantityCoe.labour;
-            }
-            else if (baseMaterialTypes.indexOf(glj.type)){
-                if (treeNode.data.quantityCoe.material)
-                    qCoe = treeNode.data.quantityCoe.material;
-            }
-            else if (baseMachineTypes.indexOf(glj.type)){
-                if (treeNode.data.quantityCoe.machine)
-                    qCoe = treeNode.data.quantityCoe.machine;
-            }
-            else if (gljType.MAIN_MATERIAL == glj.type){
-                if (treeNode.data.quantityCoe.main)
-                    qCoe = treeNode.data.quantityCoe.main;
-            }
-            else if (gljType.EQUIPMENT == glj.type){
-                if (treeNode.data.quantityCoe.equipment)
-                    qCoe = treeNode.data.quantityCoe.equipment;
-            };
         }
-        if (qCoe == '0' || qCoe == 0) qCoe = 1;   // 这里加个保护
-        glj.tenderQuantity = (glj.quantity * qCoe).toDecimal(decimalObj.glj.quantity);
+        else{
+            let coe = 1;
+            if (this.isTenderGLJ(glj))
+                coe = this.tenderCoe_GLJQty(treeNode, glj);
+            glj.tenderQuantity = (glj.quantity * coe).toDecimal(decimalObj.glj.quantity);
+        }
         return glj.tenderQuantity;
     },
     calcGLJTenderPrice: function (glj) {
@@ -974,15 +1014,13 @@ let calcTools = {
             glj.tenderPrice = projectObj.project.projectGLJ.getTenderMarketPrice(projGLJ);
         }else{
             let pCoe = 1;
-            if (projGLJ.is_adjust_price != 1){      // 先检查项目工料机里,该工料机是否参与调价
-                if (projectObj.project.property.tenderSetting && projectObj.project.property.tenderSetting.gljPriceTenderCoe)
-                    pCoe = projectObj.project.property.tenderSetting.gljPriceTenderCoe;
-            };
-            if (pCoe == '0' || pCoe == 0) pCoe = 1;   // 这里加个保护
+            // 先从项目工料机里检查该工料机是否参与调价
+            if (projGLJ.is_adjust_price != 1) pCoe = this.tenderCoe_GLJPrice();
             glj.tenderPrice = (glj.marketPrice * pCoe).toDecimal(decimalObj.glj.unitPrice);
         };
         return glj.tenderPrice;
     },
+
     // 界面显示的工料机价格,包括定额价、市场价等。参数 price 传入一个普通的价格数值即可。
     uiGLJPrice: function (price, glj){
         if (price){
@@ -2429,7 +2467,7 @@ class CalcProgram {
     distributeTargetTotalFee(treeNode){
         if (!treeNode) return;
 
-        if (treeNode.data.feesIndex['common']){     // 空清单忽略
+        if (treeNode.data.feesIndex && treeNode.data.feesIndex['common']){     // 空清单忽略
             // 默认能够执行到这里时每个节点已经被初始化,缓存已删除
             treeNode.data.tender_activeTotal = treeNode.data.feesIndex['common'].totalFee;
 

+ 5 - 3
web/building_saas/main/js/views/calc_program_view.js

@@ -16,13 +16,15 @@ let calcProgramObj = {
             {headerName: "费率", headerWidth: CP_Col_Width.feeRate, dataCode: "feeRate", dataType: "Number"},
             {headerName: "单价", headerWidth: CP_Col_Width.unitFee, dataCode: "unitFee", dataType: "Number"},
             {headerName: "合价", headerWidth: CP_Col_Width.totalFee, dataCode: "totalFee", dataType: "Number"},
+            {headerName: "调后单价", headerWidth: CP_Col_Width.unitFee, dataCode: "tenderUnitFee", dataType: "Number"},
+            {headerName: "调后合价", headerWidth: CP_Col_Width.totalFee, dataCode: "tenderTotalFee", dataType: "Number"},
             {headerName: "费用类别", headerWidth:CP_Col_Width.displayFieldName, dataCode:"displayFieldName", dataType: "String", hAlign: "center"},
             {headerName: "基数说明", headerWidth: CP_Col_Width.statement, dataCode: "statement", dataType: "String"},
             {headerName: "备注", headerWidth: CP_Col_Width.memo, dataCode: "memo", dataType: "String"}
         ],
         view: {
             comboBox: [],
-            lockColumns: [0,1,2,3,4,5,6,7,8,9],
+            lockColumns: [0,1,2,3,4,5,6,7,8,9,10],
             colHeaderHeight: CP_Col_Width.colHeader,
             rowHeaderWidth: CP_Col_Width.rowHeader
         }
@@ -33,8 +35,8 @@ let calcProgramObj = {
         me.sheet = sheet;
         for (let col of me.setting.header){
             if (col.headerName == '费率') col.tofix = decimalObj.feeRate;
-            if (col.headerName == '单价') col.tofix = decimalObj.ration.unitPrice;
-            if (col.headerName == '合价') col.tofix = decimalObj.ration.totalPrice;
+            if (col.headerName == '单价' || col.headerName == '调后单价') col.tofix = decimalObj.ration.unitPrice;
+            if (col.headerName == '合价' || col.headerName == '调后合价') col.tofix = decimalObj.ration.totalPrice;
         };
         sheetCommonObj.initSheet(me.sheet, me.setting, 1);
     },

+ 8 - 0
web/building_saas/main/js/views/glj_col.js

@@ -279,6 +279,13 @@ let gljCol = {
             }
         };
 
+        let CalcProgramHeader = calcProgramObj.setting.header;
+        for (let e of CalcProgramHeader){
+            if (e.dataCode == 'tenderUnitFee' || e.dataCode == 'tenderTotalFee'){
+                e.visible = showFields;
+            }
+        };
+
         if (needRefresh){
             if(projectGljObject.projectGljSpread) {
                 projectGljObject.projectGljSheet = projectGljObject.projectGljSpread .getSheet(0);
@@ -286,6 +293,7 @@ let gljCol = {
             }
             if (subSpread) {
                 gljOprObj.initSheet(subSpread.getSheet(0), false);
+                gljOprObj.initSheet(subSpread.getSheet(2), false);
             }
         };
     },

+ 0 - 2
web/building_saas/main/js/views/glj_view.js

@@ -137,10 +137,8 @@ var gljOprObj = {
     onRationGLJSelectionChange:function(sender,args){
         let me = gljOprObj;
         let selected = args.newSelections[0] ? args.newSelections[0] : {row: 0, col: 0};
-        console.log("selected changed-------");
         //这主要记录是否点击了sheet以外的地方,如果点击了sheet里的单元格,则将cancelUpdate设置为true不触发提交更新操作
         me.cancelUpdate = true;//取消延时任务由这里进行判断处理
-        console.log("change to true");
         me.sheetInitSelection(selected);
         if(me.rationGljEditObj){
             if(ifNeedUpdate(selected)){