ソースを参照

总消耗量修改

zhangweicheng 6 年 前
コミット
55235dff4f
2 ファイル変更26 行追加1 行削除
  1. 21 0
      public/web/gljUtil.js
  2. 5 1
      web/building_saas/main/js/models/project_glj.js

+ 21 - 0
public/web/gljUtil.js

@@ -46,6 +46,27 @@ let gljUtil = {
                 }
             }
         }
+        //计算经过场外运输损耗后的总消耗量
+        for(let pglj of project_gljs ){
+            let offSiteTransportLossRate = this.getOffSiteTransportLossRate(pglj);
+            pglj.offSiteTransportLossRate = offSiteTransportLossRate;
+            offSiteTransportLossRate = offSiteTransportLossRate/100;
+            pglj.transportLossQuantity =  scMathUtil.roundForObj(pglj.quantity*offSiteTransportLossRate,q_decimal);
+            pglj.quantity = scMathUtil.roundForObj(pglj.quantity +  pglj.transportLossQuantity ,q_decimal);
+        }
+    },
+    getOffSiteTransportLossRate:function (pglj) {
+        let offSiteTransportLossRate;
+        if(pglj.unit_price){
+            if(pglj.unit_price.calcMaterial == 1){//如果是材料计算,则用修改过的新值
+                offSiteTransportLossRate = pglj.unit_price.offSiteTransportLossRate_n;
+            } else {
+                offSiteTransportLossRate = pglj.unit_price.offSiteTransportLossRate;
+            }
+        }
+        return offSiteTransportLossRate?parseFloat(offSiteTransportLossRate):0;
+
+
     },
     getQuantityPerGLJ : function (ration_glj_list,rations,rationMap,pglj,billIDs,tech_billIDS,q_decimal,_,scMathUtil,isTender) {
         let result={};

+ 5 - 1
web/building_saas/main/js/models/project_glj.js

@@ -310,10 +310,11 @@ ProjectGLJ.prototype.updateCalcMaterial =async function (projectGLJ,updateField,
                     glj.unit_price[key] = ext[key];
                 }
             }
-            if(updateField == 'calcMaterial' && value ==0){///标记为0即删除材料计算标记,要删除其下挂的原价计算,运费计算,定额计算
+            if(updateField == 'calcMaterial' && value ==0){///标记为0即删除材料计算标记,要删除其下挂的原价计算,运费计算,定额计算,消耗量重新计算
                 let connect_key = gljUtil.getIndex(glj);
                 _.remove(this.datas.originalList,{'connect_key':connect_key});
                 _.remove(this.datas.freightList,{'connect_key':connect_key});
+                this.calcQuantity();
                 // to do 删除定额计算
 
             }
@@ -467,11 +468,13 @@ ProjectGLJ.prototype.priceCalc = function (glj,dataMap) {
 
 ProjectGLJ.prototype.m_updateUnitPrice = function (datas) {//批量更新
     let me = this;
+    let calQ = false;
     let gljList = [];
     for(let d of datas){
         let g = updateUnit(d.id,d.unitPrice);
         if(g) gljList.push(g);
     }
+    if(calQ == true) this.calcQuantity();
     //刷新项目工料机表显示
     projectGljObject.refreshDataSheet();
     //重新计算相关节点
@@ -489,6 +492,7 @@ ProjectGLJ.prototype.m_updateUnitPrice = function (datas) {//批量更新
         let glj = _.find(me.datas.gljList,{'id':id});
         if(glj && !_.isEmpty(unitPrice.doc)){
             for(let key in unitPrice.doc){
+                if(key == "offSiteTransportLossRate_n") calQ = true;
                 glj.unit_price[key] = unitPrice.doc[key];
             }
         }