Просмотр исходного кода

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

TonyKang 4 лет назад
Родитель
Сommit
1c3d233561

+ 2 - 2
modules/glj/controllers/glj_controller.js

@@ -450,9 +450,9 @@ class GLJController extends BaseController {
         let result={error:0};
         try {
             let data = JSON.parse(request.body.data);
-            result.data = await glj_facade.insertElectrovalence(data,request.session.sessionCompilation._id);
+            result.data = await glj_facade.insertElectrovalence(data.glj,data.engineerID);
         }catch (err){
-            logger.err(err);
+            logger.err(err.stack);
             result.error=1;
             result.message = err.message;
         }

+ 3 - 3
modules/glj/facade/glj_facade.js

@@ -223,11 +223,11 @@ async function getUserFreights(req) {
 }
 
 //插入综合电价中的属性
-async function insertElectrovalence(data,compilationID) {
+async function insertElectrovalence(data,engineerID) {
     let result = {};
     let projectGljModel = new GLJListModel();
-    let lib = await std_glj_lib_model.findOne({compilationId:compilationID}).lean();
-    let stdGLJs = await std_glj_lib_gljList_model.find({'repositoryId':lib.ID,'code':data.code}).lean();
+    let libID = await ration_glj.getGLJLibByEngineerID(engineerID)
+    let stdGLJs = await std_glj_lib_gljList_model.find({'repositoryId':libID,'code':data.code}).lean();
     for(let std of stdGLJs){
         let sIndex = projectGljModel.getIndex(std,['code','specs','unit','gljType']);//机械台班下拉列表名字里kw和数据库里名字kw大小写不一致,忽略名字做对应
         if(sIndex == projectGljModel.getIndex(data,['code','specs','unit','type'])){

+ 10 - 1
modules/main/facade/project_facade.js

@@ -172,8 +172,17 @@ async function updateNodes(datas) {
     } else {
       task.updateOne = {
         filter: {},
-        update: _.cloneDeep(node.data)
+        update: {}//_.cloneDeep(node.data)
       };
+      for(let key in node.data){
+        if(key.indexOf('function(') !== -1) {//有时候会出现field里包含一串 function(e){if(e.length>0)... 这些东西,本地测试又不出现,所以这里先把这些field删除看看
+          delete node.data[key];
+        }else{
+          task.updateOne.update[key] = node.data[key];
+        }
+      }
+
+
       task.updateOne.filter[idFiled] = node.data[idFiled]; //现在复制项目也重新生成一个新的ID了,所以ID是唯一的
       delete task.updateOne.update[idFiled]; //防止误操作
     }

+ 1 - 0
public/web/tree_sheet/tree_sheet_helper.js

@@ -185,6 +185,7 @@ var TREE_SHEET_HELPER = {
                 }
                 if(colSetting.visible == false) return;//隐藏列不做其它操作
                 if (colSetting.data.getText && Object.prototype.toString.apply(colSetting.data.getText) === "[object Function]") {
+                    if(colSetting.data.field=="quantity") sheet.setFormatter(iRow, iCol, '@');//输入 % 号时会出现奇怪的现像, %一直追加在后面
                     cell.value(colSetting.data.getText(node));
                 } else if(['outPutMaxPrice', 'outPutLimitPrice'].includes(colSetting.data.field) && node.sourceType === projectObj.project.Bills.getSourceType()){//主要清单有三种状态,所以直接显示就好,不走最后的逻辑
                     cell.value(node.data[colSetting.data.field]===undefined?false:node.data[colSetting.data.field]);

+ 1 - 0
web/building_saas/main/js/models/calc_program.js

@@ -2113,6 +2113,7 @@ class CalcProgram {
         item.dispExprUser = analyzer.getDispExprUser(item.dispExpr, lc);
         if (item.expression == "HJ") item.compiledExpr = "$CE.HJ()";
         else item.compiledExpr = analyzer.getCompiledExpr(item.expression, lc);
+        item.statement = analyzer.getStatement(item.expression, template);
 
         if (item.feeRateID) {
           let orgFeeRate = item.feeRate;

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

@@ -58,7 +58,7 @@ ProjectGLJ.prototype.loadData = function (callback = null,error=null) {
 
 //更新项目工料机数据和缓存
 ProjectGLJ.prototype.refreshByDatas = function(datas){
-    this.datas = datas;
+    this.loadToCache(datas);
     this.calcQuantity();
 };
 

+ 2 - 1
web/building_saas/main/js/views/electrovalence_view.js

@@ -300,8 +300,9 @@ let electrovalenceObj = {
           projectID: projectObj.project.ID()
         };
         tem.ID = uuid.v1();
+        let engineerID = projectObj.project.projectInfo.property.engineering_id;
         $.bootstrapLoading.start();
-        let result = await ajaxPost('/glj/insertElectrovalence', tem);
+        let result = await ajaxPost('/glj/insertElectrovalence', {engineerID,glj:tem});
         //插入项目工料机列表
         if (type == "add" && (!result.projetcGLJData || result.projetcGLJData.length == 0)) {
           alert("没有找到该工料机,请检查工料机库");

+ 6 - 4
web/building_saas/main/js/views/project_view.js

@@ -1112,6 +1112,8 @@ var projectObj = {
                         //将焦点行设置成原本的行,以插入定额
                         me.mainController.setTreeSelected(me.project.mainTree.items[orgRow]);
                     }
+                    /* 
+                    2021-04-26 只插入清单不插入定额  
                     //插入定额
                     me.project.Ration.addNewRation(null, rationType.ration, function () {
                         newRow = sheet.getActiveRowIndex();
@@ -1121,7 +1123,7 @@ var projectObj = {
                             newCol = codeCol;
                         }
                         sheet.setActiveCell(newRow, newCol);
-                    },true,null,false);
+                    },true,null,false); */
                 }
             }
             //在定额/量价/人材机的编码单元格回车,焦点应跳动至本行的工程量单元格
@@ -1139,7 +1141,7 @@ var projectObj = {
                 //如果其后有定额/量价/人材机(空行:编码为空不算),焦点应跳动至下一行定额/量价/人材机的工程量,不需处理
 
                 //如果其后没有定额/量价/人材机(空行也没有),则自动在其后插入一行定额空行,焦点跳动至定额空行的编码单元格
-                if(!nextSibling){
+              /*   if(!nextSibling){
                     let codeCol = colSettingObj.getColByField('code');
                     let codeVisible = colSettingObj.getVisible('code');
                     me.project.Ration.addNewRation(null, rationType.ration, function () {
@@ -1149,9 +1151,9 @@ var projectObj = {
                         }
                         sheet.setActiveCell(newRow, newCol);
                     }, true,null,false);
-                }
+                } */
                 //如果其后有定额空行,焦点跳动至定额空行的编码单元格
-                else if(nextSibling && !(isDef(nextSibling.data.code) && nextSibling.data.code.toString().trim() !== '')) {
+                if(nextSibling && !(isDef(nextSibling.data.code) && nextSibling.data.code.toString().trim() !== '')) {
                     let codeCol = colSettingObj.getColByField('code');
                     let codeVisible = colSettingObj.getVisible('code');
                     if(codeCol !== null && codeVisible !== false){

+ 2 - 2
web/building_saas/standard_interface/export/guangdong_zhongshan.js

@@ -923,12 +923,12 @@ INTERFACE_EXPORT = (() => {
           },
           {
             name: "Price",
-            value: b.tenderPrice,
+            value: b.marketPrice || '0',
             type: TYPE.DECIMAL
           },
           {
             name: "LimitedPrice",
-            value: b.tenderPrice,
+            value: b.marketPrice || '0',
             type: TYPE.DECIMAL
           },
           {

+ 2 - 1
web/building_saas/standard_interface/import/guangdong_zhongshan.js

@@ -159,7 +159,8 @@ INTERFACE_IMPORT = (() => {
 
     function setUpBidEvaluation(b) { 
       return {
-        code: b._Code,
+        seq: b._Code,
+        code: b._Number,
         name: b._Name,
         specs: b.Specification,
         unit: b._Unit,

+ 33 - 2
web/over_write/js/guangxi_2021.js

@@ -205,7 +205,11 @@ if (typeof baseFigureTemplate !== 'undefined') {
       },
       // 建筑安装工程费(不含设备费) 算法:取清单固定类别是“建筑安装工程费”的金额,扣除设备购置。
       JZAZGCFBHSB(tender) {
-          return cbTools.getFeeWithDeduction(fixedFlag.CONSTRUCTION_INSTALL_FEE, [fixedFlag.EQUIPMENT_ACQUISITION_FEE], tender, 'common');
+          let baseFee = this['JZAZGCF'](tender);
+          const fixedNode = projectObj.project.mainTree.roots.find(node => node.getFlag() === fixedFlag.CONSTRUCTION_INSTALL_FEE);
+          const equipmentFee = cbTools.getEquipmentFee(fixedNode, tender);
+          baseFee = (baseFee - equipmentFee).toDecimal(decimalObj.process);
+          return baseFee.toDecimal(decimalObj.bills.totalPrice);
       },
       // 定额建筑安装工程费(不含专项费用) 算法:取清单固定类别是“建筑安装工程费”的定额建安费,扣除“专项费用”行的定额建安费。
       DEJZAZGCFBHZX(tender) {
@@ -305,7 +309,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
       },
       // 招标费 算法:按“指标建筑安装工程费”为基数,以累进办法计算。
       ZBF(tender) {
-          const baseFee = this['ZBJZAZGCF'](tender);
+          const baseFee = this['DEJZAZGCF'](tender);
           if (!tender) {
               calcBase.baseProgressiveFee = baseFee;
           }
@@ -413,6 +417,33 @@ function overwriteRationCalcBases() {
     };
 };
 
+if (typeof projectObj !== 'undefined') {
+    projectObj.isInsertEquipmentVisable = function (selected) {
+        return true;   //广西不管是预算或者工程量清单,都是显示   
+    }
+  }
+  
+
+if (typeof feeRateObject !== 'undefined') {
+    feeRateObject.feeRateSpecialHandle = function (subRate, value) {
+        let result = {};
+        if (subRate.name == "工地转移(km)" && value && value < 50) {//工地转移50km以内按50km算
+            result.valueKey = "50";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        if (subRate.name == "综合里程(km)" && value && value < 3) {//综合里程3km以内按3km算
+            result.valueKey = "3";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        if (subRate.name == "施工进出场(km)" && value && value < 5) {//施工进出场5km以内按3km算
+            result.valueKey = "5";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        return result;
+    }
+}
+
+
 (function overwriteFeeTypes() {
     if (typeof cpFeeTypes == 'undefined') return;
     cpFeeTypes = [

+ 26 - 1
web/over_write/js/guangxiyusuan_2021.js

@@ -108,7 +108,11 @@ if (typeof baseFigureTemplate !== 'undefined') {
       },
       // 建筑安装工程费(不含设备费) 算法:取清单固定类别是“建筑安装工程费”的金额,扣除设备购置。
       JZAZGCFBHSB(tender) {
-          return cbTools.getFeeWithDeduction(fixedFlag.CONSTRUCTION_INSTALL_FEE, [fixedFlag.EQUIPMENT_ACQUISITION_FEE], tender, 'common');
+        let baseFee = this['JZAZGCF'](tender);
+        const fixedNode = projectObj.project.mainTree.roots.find(node => node.getFlag() === fixedFlag.CONSTRUCTION_INSTALL_FEE);
+        const equipmentFee = cbTools.getEquipmentFee(fixedNode, tender);
+        baseFee = (baseFee - equipmentFee).toDecimal(decimalObj.process);
+        return baseFee.toDecimal(decimalObj.bills.totalPrice);
       },
       // 建筑安装工程费(不含安全生产费) 算法:取清单固定类别是“建筑安装工程费”的金额,扣除“安全生产费”的金额。
       JZAZGCFBHSC(tender) {
@@ -230,6 +234,27 @@ function overwriteRationCalcBases() {
     };
 };
 
+if (typeof projectObj !== 'undefined') {
+    projectObj.isInsertEquipmentVisable = function (selected) {
+        return true;   //广西不管是预算或者工程量清单,都是显示   
+    }
+  }
+
+if (typeof feeRateObject !== 'undefined') {
+    feeRateObject.feeRateSpecialHandle = function (subRate, value) {
+        let result = {};
+        if (subRate.name == "工地转移(km)" && value && value < 50) {//工地转移50km以内按50km算
+            result.valueKey = "50";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        if (subRate.name == "施工进出场(km)" && value && value < 5) {//施工进出场5km以内按5km算
+            result.valueKey = "5";
+            result.value = scMathUtil.roundForObj(value, getDecimal("feeRate"));//设置显示的节点值
+        }
+        return result;
+    }
+}
+
 (function overwriteFeeTypes() {
     if (typeof cpFeeTypes == 'undefined') return;
     cpFeeTypes = [

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

@@ -473,7 +473,7 @@ if (typeof baseFigureTemplate !== 'undefined') {
 
 if (typeof projectObj !== 'undefined') {
   projectObj.isInsertEquipmentVisable = function (selected) {
-      return true;   //全国不管是预算或者工程量清单,都是隐藏   
+      return true;   //全国不管是预算或者工程量清单,都是显示   
   }
 }