Kaynağa Gözat

自办运输没保存问题

zhangweicheng 5 yıl önce
ebeveyn
işleme
92d624a5bc

+ 4 - 4
web/building_saas/main/js/models/project_glj.js

@@ -924,7 +924,7 @@ ProjectGLJ.prototype.getHighlandFee = function (feeType) {
     return rate*0.01
 };
 
-ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
+ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap,needUpdate=false) {//
     if(temp){
          if(type == "freight" && temp.conveyance !="自办运输") return null;
         let sum =0;
@@ -934,7 +934,7 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
         let decimal = type == "freight"?getDecimal("glj.unitPrice"):getDecimal("glj.unitPriceHasMix");
         //因为材料计算的数据是保存在单价文件里的,有可能存在共享的情况,这样的话就不能用单价文件里的项目工料机ID来匹配,要用5大项匹配
         let pgljMap = {};
-        if(!temp.rations || temp.rations.length == 0 )return null;//没有定额时不计算
+        if(needUpdate==false && (!temp.rations || temp.rations.length == 0))return null;//没有定额时不计算
         for(let pg of this.datas.gljList){
             pgljMap[gljUtil.getIndex(pg)] = pg
         }
@@ -953,7 +953,7 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
         }
         sum = scMathUtil.roundForObj(sum,decimal)+"";
         if(type == "freight"){
-          let exp = `((${expList.join("+")})+${temp.otherFee})x${temp.weightCoe}`
+          let exp = expList.length == 0?`${temp.otherFee}x${temp.weightCoe}`:`((${expList.join("+")})+${temp.otherFee})x${temp.weightCoe}`
           let ndoc = {};
           if(temp.unitFreight != sum) ndoc['unitFreight'] = sum;
           if(temp.exp != exp) ndoc['exp'] = exp;
@@ -1000,7 +1000,7 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
             let hs = scMathUtil.roundForObj(tt*hightFeeRate,processDecimal);//(人工定额消耗量*定额价*定额工程量+机械定额消耗量*定额价*定额工程量)*高原取费类别费率
             exp = expList.join("+");
             if(hightFeeRate!=0) exp += `+${tt}x${hightFeeRate*100}%`;
-            if(assFeeRate!=0) exp += '+'+assList.join("+");
+            if(assFeeRate!=0 && assList.length > 0) exp += '+'+assList.join("+");
             result = scMathUtil.roundForObj(as + result,processDecimal);
             result = scMathUtil.roundForObj(hs + result,processDecimal);
             heightFee = hs;

+ 3 - 3
web/building_saas/main/js/views/material_calc_view.js

@@ -455,7 +455,7 @@ materialCalcObj = {
          };
         return newData;
     },
-    getFreightEXP:function(obj,doc){
+    getFreightEXP:function(obj,doc,needUpdate){
       let item = _.clone(obj);
       if(doc) gljUtil.setProperty(item,doc);
       let material = materialCalcObj.getMaterialSelected();
@@ -465,7 +465,7 @@ materialCalcObj = {
       }
       //(单位运价×(1+运距增加率%)+装卸费单价×装卸次数+其它费用)×单位毛重×加权系数
       if(item.conveyance == "自办运输"){
-        let t = projectObj.project.projectGLJ.calcEachFreightOrPrice(item,"freight",{})
+        let t = projectObj.project.projectGLJ.calcEachFreightOrPrice(item,"freight",{},needUpdate);
         return t.doc.exp;
       }
 
@@ -599,7 +599,7 @@ materialCalcObj = {
                         let t_f = me.getSavedFreight(value, material);
                         if (t_f) doc = t_f;
                     }
-                    doc.exp = this.getFreightEXP(recode,doc);                            
+                    doc.exp = this.getFreightEXP(recode,doc,true);                            
                 }
             }
             if (!_.isEmpty(newData)) addDatas.push(newData);