Browse Source

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

vian 5 years ago
parent
commit
59a2004ca0

+ 2 - 1
importserver.js

@@ -62,7 +62,8 @@ app.use(function(err, req, res, next) {
 //设置外增的Date对象Format函数
 //设置外增的Date对象Format函数
 //备注: 经过测试nodejs 8.9.3版本不支持eval的方式修改prototype,为兼容考虑,把方法调整到stringUtil文件里
 //备注: 经过测试nodejs 8.9.3版本不支持eval的方式修改prototype,为兼容考虑,把方法调整到stringUtil文件里
 require('./public/stringUtil').setupDateFormat();
 require('./public/stringUtil').setupDateFormat();
-let importPort = config[process.env.NODE_ENV].importPor?config[process.env.NODE_ENV].importPor:2050; 
+let importPort = config[process.env.NODE_ENV].importPort?config[process.env.NODE_ENV].importPort:2050; 
+
 
 
 app.listen(importPort, function(){
 app.listen(importPort, function(){
     console.log('import server started!');
     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) {
                         } catch (ex) {
                             console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
                             console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
-                            console.log(ex);
+                            console.log(ex.message);
                             cb('Exception occurs while on going...', null);
                             cb('Exception occurs while on going...', null);
                         }
                         }
                     };
                     };
@@ -456,7 +456,7 @@ function getBillsSummaryReportPages(req, user_id, prjIds, rpt_id, pageSize, orie
                 }
                 }
             } catch (ex) {
             } catch (ex) {
                 console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
                 console.log("报表数据异常: userId " + user_id + ", project id: " + prj_id);
-                console.log(ex);
+                console.log(ex.message);
                 cb('Exception occurs while on going...', null);
                 cb('Exception occurs while on going...', null);
             }
             }
         });
         });

+ 3 - 3
public/gljUtil.js

@@ -5,9 +5,9 @@ const fs = require('fs');
 let _= require('lodash');
 let _= require('lodash');
 const scMathUtil = require('./scMathUtil').getUtil();
 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 = {
 module.exports = {
     calcProjectGLJQuantity :calcProjectGLJQuantity,
     calcProjectGLJQuantity :calcProjectGLJQuantity,

+ 30 - 21
public/web/gljUtil.js

@@ -180,7 +180,7 @@ let gljUtil = {
                 continue;
                 continue;
             }
             }
             if(!pglj.is_adjust_price){
             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);
                 tender_r_quantity = this.getRationTenderQuantity(tem_ration,q_decimal,scMathUtil);
             }
             }
             let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal);
             let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal);
@@ -204,7 +204,7 @@ let gljUtil = {
         result.tenderQuantity = tender_qantity_sum;
         result.tenderQuantity = tender_qantity_sum;
         return result;
         return result;
     },
     },
-    getRationGLJTenderQuantity:function (ration_glj,ration,q_decimal,scMathUtil) {
+    getRationGLJTenderQuantity:function (ration_glj,ration,q_decimal,scMathUtil,projectGLJ) {
         let coeMap = {
         let coeMap = {
             1:'labour',  //人工
             1:'labour',  //人工
             2:'material',//材料
             2:'material',//材料
@@ -221,14 +221,12 @@ let gljUtil = {
             }
             }
         }
         }
         let coe = 1;
         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;
         if (coe == 0) coe = 1;
         let glj_quantity = scMathUtil.roundForObj(ration_glj.quantity, q_decimal);
         let glj_quantity = scMathUtil.roundForObj(ration_glj.quantity, q_decimal);
         return scMathUtil.roundForObj(glj_quantity * coe,q_decimal);
         return scMathUtil.roundForObj(glj_quantity * coe,q_decimal);
@@ -282,7 +280,8 @@ let gljUtil = {
         }
         }
     },
     },
     getFlag:function (b) {
     getFlag:function (b) {
-        return _.find(b.flags,{"fieldName":"fixed"});
+      let lo_sh = typeof _ !== 'undefined'?_:this._;
+      return lo_sh.find(b.flags,{"fieldName":"fixed"});
     },
     },
     getGLJPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,ext,tenderCoe, isReport) {
     getGLJPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,ext,tenderCoe, isReport) {
         let result = {};
         let result = {};
@@ -433,14 +432,16 @@ let gljUtil = {
         return parseInt(str.substr(0,1));
         return parseInt(str.substr(0,1));
     },
     },
     sortRationGLJ:function (list, std) {
     sortRationGLJ:function (list, std) {
-        const field = std ? 'gljType' : 'type';
-        list = _.sortByAll(list, [function (item) {
-            return gljUtil.getMainType(item[field]);
-        }, gljUtil.getCodeSortMath()]);
-        return list;
+      const field = std ? 'gljType' : 'type';
+      let lo_sh = typeof _ !== 'undefined'?_:this._;
+      list = lo_sh.sortByAll(list, [function (item) {
+          return gljUtil.getMainType(item[field]);
+      }, gljUtil.getCodeSortMath()]);
+      return list;
     },
     },
     sortMixRatio:function (list) {
     sortMixRatio:function (list) {
-        return _.sortByAll(list, ["code"]);
+      let lo_sh = typeof _ !== 'undefined'?_:this._;
+      return lo_sh.sortByAll(list, ["code"]);
     },
     },
     //项目工料机 混凝土、砂浆、配合比排序与定额工料机不一样,同时,type取值的地方不一样
     //项目工料机 混凝土、砂浆、配合比排序与定额工料机不一样,同时,type取值的地方不一样
     sortProjectGLJ:function (list,lodash) {
     sortProjectGLJ:function (list,lodash) {
@@ -494,9 +495,10 @@ let gljUtil = {
         return {glj_id:-99,unit_price_file_id:unitFileID,connect_key:connect_key,consumption:consumption,code:'80CCS',name:'车船税',unit:'元',type:302,specs:'',from:"cpt"}
         return {glj_id:-99,unit_price_file_id:unitFileID,connect_key:connect_key,consumption:consumption,code:'80CCS',name:'车船税',unit:'元',type:302,specs:'',from:"cpt"}
     },
     },
     updateProperty: function (obj, doc) {
     updateProperty: function (obj, doc) {
-        _.forEach(doc, function (n, key) {
+      let lo_sh = typeof _ !== 'undefined'?_:this._;
+      lo_sh.forEach(doc, function (n, key) {
             obj[key] = n;
             obj[key] = n;
-        });
+      });
     },
     },
     getTotalQuantity:function(glj,ration,rd,gd){
     getTotalQuantity:function(glj,ration,rd,gd){
         if(ration){
         if(ration){
@@ -504,7 +506,8 @@ let gljUtil = {
             quantity = (quantity == 0 || quantity == undefined || quantity == null || quantity == "") ? 0 : quantity;
             quantity = (quantity == 0 || quantity == undefined || quantity == null || quantity == "") ? 0 : quantity;
             quantity = scMathUtil.roundForObj(quantity, rd);//计算前进行4舍5入
             quantity = scMathUtil.roundForObj(quantity, rd);//计算前进行4舍5入
             glj.quantity = scMathUtil.roundForObj(glj.quantity, gd);
             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);
             return scMathUtil.roundToString(quantity * glj.quantity, gd);
         }
         }
@@ -569,8 +572,9 @@ let gljUtil = {
         }
         }
     },
     },
     setProperty:function(Obj,updateData) {
     setProperty:function(Obj,updateData) {
+      let lo_sh = typeof _ !== 'undefined'?_:this._;
         for(let ukey in updateData){
         for(let ukey in updateData){
-            if(_.isObject(updateData[ukey]) && _.isObject(Obj[ukey])&&!_.isArray(updateData[ukey])){
+            if(lo_sh.isObject(updateData[ukey]) && lo_sh.isObject(Obj[ukey])&&!lo_sh.isArray(updateData[ukey])){
                 setProperty(Obj[ukey],updateData[ukey]);
                 setProperty(Obj[ukey],updateData[ukey]);
             }else {
             }else {
                 Obj[ukey] = updateData[ukey];
                 Obj[ukey] = updateData[ukey];
@@ -637,4 +641,9 @@ let gljUtil = {
     hasCompMaterial:[202, 203, 204],//有组成物的材料
     hasCompMaterial:[202, 203, 204],//有组成物的材料
     hasCompMachine:[301],//有组成物的机械
     hasCompMachine:[301],//有组成物的机械
     machineComposition:[201,302,303]//可以做为机械组成物的类型
     machineComposition:[201,302,303]//可以做为机械组成物的类型
+}
+
+if (typeof module !== 'undefined') {
+  gljUtil._ = require("lodash");
+  module.exports = gljUtil;
 }
 }

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