فهرست منبع

Merge branch '1.0.0_online' of http://192.168.1.41:3000/SmartCost/ConstructionCost into 1.0.0_online

zeweizhong 6 سال پیش
والد
کامیت
6d0a30b966

+ 19 - 8
public/web/gljUtil.js

@@ -27,6 +27,7 @@ let gljUtil = {
             pglj[sField] = result.subdivisionQuantity;
             pglj[tField] = result.techQuantity;
             pglj[qField] = result.quantity;
+            pglj.tenderQuantity = result.tenderQuantity;
             quantityMap[pg_index] = pglj;
         }
         //计算做为组成物的消耗量
@@ -38,9 +39,11 @@ let gljUtil = {
                 let p_glj = quantityMap[pkey];
                 if(m_glj&&p_glj){
                     let quantity = scMathUtil.roundForObj(parseFloat(p_glj[qField])*parseFloat(m.consumption),q_decimal);
+                    let tenderQuantity = scMathUtil.roundForObj(parseFloat(p_glj.tenderQuantity)*parseFloat(m.consumption),q_decimal);
                     let techQuantity = scMathUtil.roundForObj(parseFloat(p_glj[tField])*parseFloat(m.consumption),q_decimal);
                     let subdivisionQuantity = scMathUtil.roundForObj(parseFloat(p_glj[sField])*parseFloat(m.consumption),q_decimal);
                     m_glj[qField] =  scMathUtil.roundForObj(parseFloat(m_glj[qField])+quantity,q_decimal);
+                    m_glj.tenderQuantity =  scMathUtil.roundForObj(parseFloat(m_glj.tenderQuantity)+tenderQuantity,q_decimal);
                     m_glj[tField] =  scMathUtil.roundForObj(parseFloat(m_glj[tField])+techQuantity,q_decimal);
                     m_glj[sField] =  scMathUtil.roundForObj(parseFloat(m_glj[sField])+subdivisionQuantity,q_decimal);
                 }
@@ -52,19 +55,24 @@ let gljUtil = {
         let quantity_sum=0;//工料机汇总消耗量
         let sum = 0;//分部分项总消耗量
         let tech_sum = 0;//技术措施总消耗量
+        let tender_qantity_sum = 0;
         for(let rg of ration_glj_list){
             let tem_ration = rationMap[rg.rationID];
             let r_quantity = tem_ration?scMathUtil.roundForObj(tem_ration.quantity,q_decimal):0;
             let glj_quantity = scMathUtil.roundForObj(rg.quantity, q_decimal);
+            let tender_r_quantity = r_quantity;
+            let tender_glj_quantity = glj_quantity;
             if(!r_quantity){
                 continue;
             }
-            if(isTender == true){
-                glj_quantity = this.getRationGLJTenderQuantity(rg,tem_ration,q_decimal,scMathUtil);
-                r_quantity = this.getRationTenderQuantity(tem_ration,q_decimal,scMathUtil);
+            if(!pglj.is_adjust_price){
+                tender_glj_quantity = this.getRationGLJTenderQuantity(rg,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 tender_total = scMathUtil.roundForObj(tender_glj_quantity*tender_r_quantity, q_decimal);
             quantity_sum = scMathUtil.roundForObj(quantity_sum+total,q_decimal);
+            tender_qantity_sum = scMathUtil.roundForObj(tender_qantity_sum+tender_total,q_decimal);
             if(_.includes(billIDs,rg.billsItemID)){//计算分部分项
                 sum = scMathUtil.roundForObj(sum+total,q_decimal);
             }
@@ -72,7 +80,8 @@ let gljUtil = {
                 tech_sum = scMathUtil.roundForObj(tech_sum+total,q_decimal);
             }
         }
-        for(let ra of rations){//计算定额类型工料机的消耗量
+        //2019-11-07 定额类型工料机已经屏蔽,如果打开,记得加上调价后的消耗量
+        /*for(let ra of rations){//计算定额类型工料机的消耗量
             if(ra.type == this.rationType.gljRation&&ra.projectGLJID===pglj.id){
                 let r_quantity = scMathUtil.roundForObj(ra.quantity,q_decimal);
                 r_quantity = r_quantity?r_quantity:0;
@@ -87,11 +96,11 @@ let gljUtil = {
                     tech_sum = scMathUtil.roundForObj(tech_sum+r_quantity,q_decimal);
                 }
             }
-
-        }
+        }*/
         result.subdivisionQuantity = sum;
         result.techQuantity = tech_sum;
         result.quantity = quantity_sum;
+        result.tenderQuantity = tender_qantity_sum;
         return result;
     },
     getRationGLJTenderQuantity:function (ration_glj,ration,q_decimal,scMathUtil) {
@@ -109,7 +118,8 @@ let gljUtil = {
               coeField = coeMap[key];
             }
         }
-        let coe = ration.quantityCoe&&this.isNotEmpty(ration.quantityCoe[coeField])?ration.quantityCoe[coeField]:1;
+        let coe = 1;
+        coe = ration.quantityCoe&&this.isNotEmpty(ration.quantityCoe[coeField])?ration.quantityCoe[coeField]:1;
         coe = parseFloat(coe);
         let glj_quantity = scMathUtil.roundForObj(ration_glj.quantity, q_decimal);
         return scMathUtil.roundForObj(glj_quantity * coe,q_decimal);
@@ -164,9 +174,10 @@ let gljUtil = {
     getFlag:function (b) {
         return _.find(b.flags,{"fieldName":"fixed"});
     },
-    getGLJPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil) {
+    getGLJPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,tenderCoe) {
         let result = {};
         result.marketPrice = this.getMarketPrice(glj,projectGLJDatas,calcOptions,decimalObj,isRadio,_,scMathUtil);
+        result.tenderPrice = this.getMarketPrice(glj,projectGLJDatas,calcOptions,decimalObj,isRadio,_,scMathUtil,tenderCoe);
         if(this.calcPriceDiff(glj,calcOptions)==true){//计取价差
             result.basePrice = this.getBasePrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
             result.adjustPrice = this.getAdjustPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);

+ 2 - 2
public/web/sheet/sheet_common.js

@@ -23,8 +23,8 @@ var sheetCommonObj = {
         var spreadNS = GC.Spread.Sheets;
         sheet.suspendPaint();
         sheet.suspendEvent();
-        if(setting.frozenCols)  sheet.frozenColumnCount(setting.frozenCols);//冻结列
-        sheet.setRowCount(1, spreadNS.SheetArea.colHeader);
+        if(setting.frozenCols)  sheet.frozenColumnCount(setting.frozenCols);//冻结列s
+        sheet.setRowCount(setting.headRows ? setting.headRows : 1, spreadNS.SheetArea.colHeader);
         sheet.setColumnCount(setting.header.length, spreadNS.SheetArea.viewport);
 
         if (setting && setting.view && setting.view.colHeaderHeight) {

+ 32 - 27
web/building_saas/main/js/models/calc_program.js

@@ -841,7 +841,8 @@ let calcTools = {
         if (this.isBill(treeNode))                 // 清单只有一个工程量,没有调整后工程量。
             return this.uiNodeQty(treeNode)
         else{
-            let qCoe = (treeNode.data.rationQuantityCoe == undefined || treeNode.data.rationQuantityCoe == null || treeNode.data.rationQuantityCoe == 0) ? 1 : treeNode.data.rationQuantityCoe;
+            let qCoe = (treeNode.data.rationQuantityCoe == undefined || treeNode.data.rationQuantityCoe == null ||
+                treeNode.data.rationQuantityCoe == 0) ? 1 : treeNode.data.rationQuantityCoe;
             treeNode.data.tenderQuantity = (this.uiNodeQty(treeNode) * qCoe).toDecimal(decimalObj.decimal("quantity", treeNode));
             return treeNode.data.tenderQuantity;
         }
@@ -853,38 +854,42 @@ let calcTools = {
         };
 
         let qCoe = 1;
-        if (gljType.LABOUR == glj.type){
-            if (treeNode.data.quantityCoe.labour)
-                qCoe = treeNode.data.quantityCoe.labour;
-        }
-        else if (baseMaterialTypes.indexOf(glj.type)){
-            if (treeNode.data.quantityCoe.material)
-                qCoe = treeNode.data.quantityCoe.material;
-        }
-        else if (baseMachineTypes.indexOf(glj.type)){
-            if (treeNode.data.quantityCoe.machine)
-                qCoe = treeNode.data.quantityCoe.machine;
-        }
-        else if (gljType.MAIN_MATERIAL == glj.type){
-            if (treeNode.data.quantityCoe.main)
-                qCoe = treeNode.data.quantityCoe.main;
+        let projGLJ = calcTools.getProjectGLJ(glj);
+        if (projGLJ.is_adjust_price != 1) {      // 先检查项目工料机里,该工料机是否参与调价
+            if (gljType.LABOUR == glj.type){
+                if (treeNode.data.quantityCoe.labour)
+                    qCoe = treeNode.data.quantityCoe.labour;
+            }
+            else if (baseMaterialTypes.indexOf(glj.type)){
+                if (treeNode.data.quantityCoe.material)
+                    qCoe = treeNode.data.quantityCoe.material;
+            }
+            else if (baseMachineTypes.indexOf(glj.type)){
+                if (treeNode.data.quantityCoe.machine)
+                    qCoe = treeNode.data.quantityCoe.machine;
+            }
+            else if (gljType.MAIN_MATERIAL == glj.type){
+                if (treeNode.data.quantityCoe.main)
+                    qCoe = treeNode.data.quantityCoe.main;
+            }
+            else if (gljType.EQUIPMENT == glj.type){
+                if (treeNode.data.quantityCoe.equipment)
+                    qCoe = treeNode.data.quantityCoe.equipment;
+            };
         }
-        else if (gljType.EQUIPMENT == glj.type){
-            if (treeNode.data.quantityCoe.equipment)
-                qCoe = treeNode.data.quantityCoe.equipment;
-        };
-
         glj.tenderQuantity = (glj.quantity * qCoe).toDecimal(decimalObj.glj.quantity);
     },
     calcGLJTenderPrice: function (glj) {
-        if (!glj.projectGLJID){   // 量价定额虚拟出来的工料机,没有projectGLJID,在项目工料机中查不到。
+        let projGLJ = calcTools.getProjectGLJ(glj);
+        if (projGLJ == null){   // 量价定额虚拟出来的工料机,在项目工料机中查不到。
+            glj.tenderPrice = projectObj.project.projectGLJ.getTenderMarketPrice(projGLJ);
+        }else{
             let pCoe = 1;
-            if (projectObj.project.property.tenderSetting && projectObj.project.property.tenderSetting.gljPriceTenderCoe)
-                pCoe = projectObj.project.property.tenderSetting.gljPriceTenderCoe;
+            if (projGLJ.is_adjust_price != 1){      // 先检查项目工料机里,该工料机是否参与调价
+                if (projectObj.project.property.tenderSetting && projectObj.project.property.tenderSetting.gljPriceTenderCoe)
+                    pCoe = projectObj.project.property.tenderSetting.gljPriceTenderCoe;
+            };
             glj.tenderPrice = (glj.marketPrice * pCoe).toDecimal(decimalObj.glj.unitPrice);
-        }else{
-            let projGLJ = calcTools.getProjectGLJ(glj);
-            glj.tenderPrice = projectObj.project.projectGLJ.getTenderMarketPrice(projGLJ);
         };
     },
     // 界面显示的工料机价格,包括定额价、市场价等。参数 price 传入一个普通的价格数值即可。

+ 12 - 6
web/building_saas/main/js/models/project_glj.js

@@ -323,6 +323,7 @@ ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
         $.bootstrapLoading.end();
         let supplyChangeIDs = [],evaluate_gljs = [],rationNodes = [];
         console.log(updateMap);
+        let needCalcQuantity = false;
         for(let idKey in updateMap){
             let gljID = parseInt(idKey);
             let glj = me.getByID(gljID);
@@ -333,9 +334,8 @@ ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
             if(doc.hasOwnProperty("supply")||doc.hasOwnProperty("supply_quantity")){
                 supplyChangeIDs.push(gljID);
             }
-            if(doc.hasOwnProperty("is_evaluate")){
-                evaluate_gljs.push(glj);
-            }
+            if(doc.hasOwnProperty("is_evaluate")) evaluate_gljs.push(glj);
+            if(doc.hasOwnProperty("is_adjust_price")) needCalcQuantity = true;
         }
         if(supplyChangeIDs.length>0){
             let temRationNodes = calcTools.getRationsByProjectGLJ(supplyChangeIDs);
@@ -352,7 +352,7 @@ ProjectGLJ.prototype.batchUpdateGLJProperty = function (updateMap,callback) {
                 projectObj.mainController.refreshTreeNode(projectObj.project.mainTree.roots);
             });
         }
-
+        if(needCalcQuantity) me.calcQuantity();
         if(callback){
             callback();
         }
@@ -475,6 +475,7 @@ ProjectGLJ.prototype.pGljUpdate= function (data,callback) {
         if(data.field == 'is_evaluate'){
             impactList =  me.changeIsEvaluate(data.id);
         }
+        if(data.field == "is_adjust_price") me.calcQuantity();
         if(callback){
             callback(impactList);
         }
@@ -845,11 +846,16 @@ ProjectGLJ.prototype.getTenderMarketPrice = function (glj,isRadio) {
     let proGLJ =  projectObj.project.projectGLJ;
     let calcOptions=projectObj.project.projectInfo.property.calcOptions;
     let decimalObj = projectObj.project.projectInfo.property.decimal;
+    let tenderCoe = this.getTenderPriceCoe(glj);
+    return gljUtil.getMarketPrice(glj,proGLJ.datas,calcOptions,decimalObj,isRadio,_,scMathUtil,tenderCoe);
+};
+
+ProjectGLJ.prototype.getTenderPriceCoe = function(glj){
     let tenderCoe = 1;
-    if (projectObj.project.property.tenderSetting && gljUtil.isDef(projectObj.project.property.tenderSetting.gljPriceTenderCoe) ){
+    if (!glj.is_adjust_price&&projectObj.project.property.tenderSetting && gljUtil.isDef(projectObj.project.property.tenderSetting.gljPriceTenderCoe) ){
         tenderCoe = parseFloat(projectObj.project.property.tenderSetting.gljPriceTenderCoe);
     }
-    return gljUtil.getMarketPrice(glj,proGLJ.datas,calcOptions,decimalObj,isRadio,_,scMathUtil,tenderCoe);
+    return tenderCoe
 };
 
 ProjectGLJ.prototype.isEstimateType = function(type){

+ 1 - 1
web/building_saas/main/js/views/glj_col.js

@@ -60,7 +60,7 @@ let gljCol = {
             {headerName: "备注", headerWidth: 100, dataCode: "remark", hAlign: "left", dataType: "String"}
         ],
         view: {
-            lockColumns: ["code","name","specs","unit","short_name","adjustPrice","quantity"]
+            lockColumns: ["code","name","specs","unit","short_name","tenderPrice","adjustPrice","quantity","tenderQuantity"]
         },
         frozenCols:4
     },

+ 3 - 1
web/building_saas/main/js/views/glj_view.js

@@ -782,10 +782,12 @@ var gljOprObj = {
         let calcOptions=projectObj.project.projectInfo.property.calcOptions;
         let decimalObj = projectObj.project.projectInfo.property.decimal;
         let labourCoeDatas =  projectObj.project.labourCoe.datas;
+        let tenderCoe = projectObj.project.projectGLJ.getTenderPriceCoe(glj);
         glj = glj?glj:_.find(proGLJ.datas.gljList, {'id': data.projectGLJID});
         if(glj){
-            let result = gljUtil.getGLJPrice(glj,proGLJ.datas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
+            let result = gljUtil.getGLJPrice(glj,proGLJ.datas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,tenderCoe);
             data.marketPrice = result.marketPrice;
+            data.tenderPrice = result.tenderPrice;
             data.basePrice =  result.basePrice;
             data.adjustPrice = result.adjustPrice;
             data.marketUnitFee = data.marketPrice;//更新树节点市场单价列的值

+ 2 - 0
web/building_saas/main/js/views/project_glj_view.js

@@ -703,6 +703,7 @@ let projectGljObject={
             type:glj.type,
             short_name:projectGLJ.getShortNameByID(glj.type),
             quantity:glj.quantity,
+            tenderQuantity:glj.tenderQuantity,
             supply:glj.supply,
             supply_quantity:glj.supply_quantity,
             materialType:glj.materialType,
@@ -769,6 +770,7 @@ let projectGljObject={
     },
     initSheet: function (sheet,setting) {
         var me = this;
+
         sheetCommonObj.initSheet(sheet, setting, 30);
         sheet.bind(GC.Spread.Sheets.Events.ValueChanged, me.onSheetValueChange);
     },

+ 1 - 0
web/building_saas/main/js/views/tender_price_view.js

@@ -48,6 +48,7 @@ let tender_obj={
         this.tenderSheet = this.tenderSpread.getSheet(0);
         this.tenderTree = cacheTree.createNew(this);
         this.tenderTreeSetting = this.createTenderTreeSetting();
+        console.log(this.tenderTreeSetting);
         TREE_SHEET_HELPER.initSetting($('#tenderSpread')[0], this.tenderTreeSetting );
         this.tenderTreeSetting.setAutoFitRow = MainTreeCol.getEvent("setAutoFitRow");
         this.tenderController = TREE_SHEET_CONTROLLER.createNew(this.tenderTree, this.tenderSheet, this.tenderTreeSetting);

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

@@ -222,7 +222,8 @@ let zmhs_obj = {
         }
         projectObj.mainController.refreshTreeNode(nodes, false);
 
-        let rationID= ration_glj.updateCacheAfterAdjust(result.ration_glj);
+        let rationID = result.ration.ID;
+        ration_glj.updateCacheAfterAdjust(result.ration_glj);
         if(result.projectGLJDatas){//有添加、替换、工料机等需重新加载的情况
             projectObj.project.projectGLJ.refreshByDatas(result.projectGLJDatas);
             if(result.add && result.add.length > 0) ration_glj.addToMainTree(result.add);//这个方法有再去项目工料机那里取价格,所以要在回调里调用,不像替换工料的情况