浏览代码

添加全国overwrite

zhangweicheng 5 年之前
父节点
当前提交
e4cfc415b4
共有 5 个文件被更改,包括 21 次插入19 次删除
  1. 0 1
      importserver.js
  2. 2 2
      modules/reports/controllers/rpt_controller.js
  3. 3 3
      public/gljUtil.js
  4. 16 13
      public/web/gljUtil.js
  5. 0 0
      web/over_write/js/quanguo_2018.js

+ 0 - 1
importserver.js

@@ -64,7 +64,6 @@ app.use(function(err, req, res, next) {
 require('./public/stringUtil').setupDateFormat();
 let importPort = config[process.env.NODE_ENV].importPort?config[process.env.NODE_ENV].importPort:2050; 
 
-console.log(importPort);
 
 app.listen(importPort, function(){
     console.log('import server started!');

+ 2 - 2
modules/reports/controllers/rpt_controller.js

@@ -269,7 +269,7 @@ function getAllPagesCommon(user_id, prj_id, rpt_id, pageSize, orientation, custo
                             }
                         } catch (ex) {
                             console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
-                            console.log(ex);
+                            console.log(ex.message);
                             cb('Exception occurs while on going...', null);
                         }
                     };
@@ -456,7 +456,7 @@ function getBillsSummaryReportPages(req, user_id, prjIds, rpt_id, pageSize, orie
                 }
             } catch (ex) {
                 console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
-                console.log(ex);
+                console.log(ex.message);
                 cb('Exception occurs while on going...', null);
             }
         });

+ 3 - 3
public/gljUtil.js

@@ -5,9 +5,9 @@ const fs = require('fs');
 let _= require('lodash');
 const scMathUtil = require('./scMathUtil').getUtil();
 
-let gljNodeUtil = null;
-let data = fs.readFileSync(__dirname + '/web/gljUtil.js', 'utf8', 'r');
-eval(data + ' ; gljNodeUtil = gljUtil; ');
+let gljNodeUtil = require("./web/gljUtil");
+// let data = fs.readFileSync(__dirname + '/web/gljUtil.js', 'utf8', 'r');
+// eval(data + ' ; gljNodeUtil = gljUtil; ');
 
 module.exports = {
     calcProjectGLJQuantity :calcProjectGLJQuantity,

+ 16 - 13
public/web/gljUtil.js

@@ -2,7 +2,6 @@
  * Created by zhang on 2018/6/7.
  */
 
-
 let gljUtil = {
     calcProjectGLJQuantity:function (projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal,_,scMathUtil,isReport) {
         let project_gljs = projectGLJDatas.gljList, mixRatioMap = projectGLJDatas.mixRatioMap, com_electrovalence = projectGLJDatas.com_electrovalence;
@@ -180,7 +179,7 @@ let gljUtil = {
                 continue;
             }
             if(!pglj.is_adjust_price){
-                tender_glj_quantity = this.getRationGLJTenderQuantity(rg,tem_ration,q_decimal,scMathUtil);
+                tender_glj_quantity = this.getRationGLJTenderQuantity(rg,tem_ration,q_decimal,scMathUtil,pglj);
                 tender_r_quantity = this.getRationTenderQuantity(tem_ration,q_decimal,scMathUtil);
             }
             let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal);
@@ -204,7 +203,7 @@ let gljUtil = {
         result.tenderQuantity = tender_qantity_sum;
         return result;
     },
-    getRationGLJTenderQuantity:function (ration_glj,ration,q_decimal,scMathUtil) {
+    getRationGLJTenderQuantity:function (ration_glj,ration,q_decimal,scMathUtil,projectGLJ) {
         let coeMap = {
             1:'labour',  //人工
             2:'material',//材料
@@ -221,14 +220,12 @@ let gljUtil = {
             }
         }
         let coe = 1;
-        if (!calcTools.isTenderProjectGLJ(ration_glj)){
-            coe = 1;
-        }
-        else{
-            coe = ration.quantityCoe&&this.isNotEmpty(ration.quantityCoe[coeField])?ration.quantityCoe[coeField]:1;
-            coe = parseFloat(coe);
-        }
-
+        if(projectGLJ && projectGLJ.is_adjust_price == 1){
+          coe = ration.quantityCoe&&this.isNotEmpty(ration.quantityCoe[coeField])?ration.quantityCoe[coeField]:1;
+          coe = parseFloat(coe);
+        }else{
+          coe = 1;
+        }   
         if (coe == 0) coe = 1;
         let glj_quantity = scMathUtil.roundForObj(ration_glj.quantity, q_decimal);
         return scMathUtil.roundForObj(glj_quantity * coe,q_decimal);
@@ -282,7 +279,7 @@ let gljUtil = {
         }
     },
     getFlag:function (b) {
-        return _.find(b.flags,{"fieldName":"fixed"});
+        return this._.find(b.flags,{"fieldName":"fixed"});
     },
     getGLJPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,ext,tenderCoe, isReport) {
         let result = {};
@@ -504,7 +501,8 @@ let gljUtil = {
             quantity = (quantity == 0 || quantity == undefined || quantity == null || quantity == "") ? 0 : quantity;
             quantity = scMathUtil.roundForObj(quantity, rd);//计算前进行4舍5入
             glj.quantity = scMathUtil.roundForObj(glj.quantity, gd);
-            glj.tenderQuantity = this.getRationGLJTenderQuantity(glj, ration, gd, scMathUtil);
+            let pglj = calcTools.getProjectGLJ(glj);
+            glj.tenderQuantity = this.getRationGLJTenderQuantity(glj, ration, gd, scMathUtil,pglj);
 
             return scMathUtil.roundToString(quantity * glj.quantity, gd);
         }
@@ -637,4 +635,9 @@ let gljUtil = {
     hasCompMaterial:[202, 203, 204],//有组成物的材料
     hasCompMachine:[301],//有组成物的机械
     machineComposition:[201,302,303]//可以做为机械组成物的类型
+}
+
+if (typeof module !== 'undefined') {
+  gljUtil._ = require("lodash");
+  module.exports = gljUtil;
 }

+ 0 - 0
web/over_write/js/quanguo_2018.js