Sfoglia il codice sorgente

项目工料机调量处理:调整后总消耗量的汇总计算

chenshilong 6 anni fa
parent
commit
b0391bebc8

+ 17 - 7
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);

+ 5 - 4
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);
         }

+ 3 - 2
web/building_saas/main/js/views/glj_col.js

@@ -39,10 +39,11 @@ let gljCol = {
             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
             {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
-            {headerName: "市场调价", headerWidth: 70, dataCode: "tenderPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
+            {headerName: "调后市场价", headerWidth: 75, dataCode: "tenderPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"
             {headerName: "调整价", headerWidth: 70, dataCode: "adjustPrice", hAlign: "right", dataType: "Number"},//,decimalField:"glj.unitPrice"
             {headerName: "定额价", headerWidth: 70, dataCode: "basePrice", hAlign: "right", dataType: "Number",validator:"number"},//decimalField:'glj.unitPrice',
             {headerName: "总消耗量", headerWidth: 90, dataCode: "quantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
+            {headerName: "调后总消耗量", headerWidth: 90, dataCode: "tenderQuantity", hAlign: "right", dataType: "Number",decimalField:'glj.quantity'},
             {headerName: "暂估", headerWidth: 45, dataCode: "is_evaluate", hAlign: "center", dataType: "String",cellType:'checkBox'},
             {headerName: "主要\n材料", headerWidth: 45, dataCode: "is_main_material", hAlign: "center", dataType: "String",cellType:'checkBox'},
             {headerName: "不调价", headerWidth: 55, dataCode: "is_adjust_price", dataType: "String",cellType: "checkBox"},
@@ -61,7 +62,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
     },

+ 1 - 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,