瀏覽代碼

量人等调价处理。

chenshilong 5 年之前
父節點
當前提交
a98c477398
共有 2 個文件被更改,包括 76 次插入37 次删除
  1. 1 0
      public/web/gljUtil.js
  2. 75 37
      web/building_saas/main/js/models/calc_program.js

+ 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;