浏览代码

bugs 报表中人工费结果

zhangweicheng 6 年之前
父节点
当前提交
e75bbea692

+ 4 - 1
modules/main/facade/ration_facade.js

@@ -591,7 +591,10 @@ async function updateCoeAdjust(data,compilation) {
     //替换工料机的情况
     if (data.replace.length > 0){
         for(let r of data.replace){
-            replace.push(await  ration_glj_facade.replaceGLJByData(r,compilation)) ;
+            let r_result = await  ration_glj_facade.replaceGLJByData(r,compilation);
+            replace.push(r_result.data) ;
+            if(r_result.newRecodes.length > 0) data.add = data.add.concat(r_result.newRecodes);
+            if(r_result.deleteList.length > 0) data.delete = data.delete.concat(r_result.deleteList);
         }
     }
     let cal_result = await glj_calculate_facade.calculateQuantity({projectID:data.projectID,rationID:data.rationID},null,true);

+ 6 - 1
public/gljUtil.js

@@ -23,7 +23,8 @@ module.exports = {
     sortRationGLJ:sortRationGLJ,
     sortProjectGLJ:sortProjectGLJ,
     getCCSProjectGLJ:getCCSProjectGLJ,
-    getBaseCCSMixRatio:getBaseCCSMixRatio
+    getBaseCCSMixRatio:getBaseCCSMixRatio,
+    getMaterialCalcRationFee:getMaterialCalcRationFee
 };
 
 function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
@@ -34,6 +35,10 @@ function getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,i
     return gljNodeUtil.getGLJPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
 }
 
+function getMaterialCalcRationFee(ration,ration_gljs,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,_,scMathUtil) {
+    return gljNodeUtil.getMaterialCalcRationFee(ration,ration_gljs,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,_,scMathUtil);
+}
+
 function getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio=false) {
     return gljNodeUtil.getMarketPrice(glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil);
 }

+ 39 - 0
public/web/gljUtil.js

@@ -428,6 +428,45 @@ let gljUtil = {
             return scMathUtil.roundToString(quantity * glj.quantity, gd);
         }
     },
+    getMaterialCalcRationFee:function (ration,ration_gljs,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,_,scMathUtil) {
+        let pMap =_.indexBy(projectGLJDatas.gljList, 'id');
+        let process_decimal = decimalObj.process;
+        let ration_quantity_decimal = decimalObj.ration.quantity;
+        let glj_quantity_decimal = decimalObj.glj.quantity;
+        let glj_unitPrice_decimal = decimalObj.glj.unitPrice;
+        let assFeeRate = scMathUtil.roundForObj(projectGLJDatas.constData.assistProductionFeeRate,decimalObj.feeRate) * 0.01;//辅助生产间接费费率
+        let rationLaberFee = 0;  //定额人工费(市场价)
+        let rationMachineFee = 0; //定额施工机械使用费(市场价)
+        let rationLaberFee_b = 0;  //定额人工费(定额价)
+        let rationMachineFee_b = 0; //定额施工机械使用费(定额价)
+        let directFee = 0;//直接费
+        let rationQuantity = scMathUtil.roundForObj(ration.quantity,ration_quantity_decimal);
+        for(let g of ration_gljs){
+            let result = gljUtil.getGLJPrice(pMap[g.projectGLJID],projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,false,_,scMathUtil);
+            g.marketPrice = result.marketPrice;
+            g.basePrice = result.basePrice;
+            let quantity = scMathUtil.roundForObj(g.quantity,glj_quantity_decimal);
+            let t = scMathUtil.roundForObj(quantity * g.marketPrice * rationQuantity,process_decimal);//市场价
+            let rt = scMathUtil.roundForObj(quantity * g.basePrice * rationQuantity,process_decimal);//定额价
+            if(g.type == gljUtil.gljType.LABOUR){
+                rationLaberFee = scMathUtil.roundForObj(rationLaberFee+t,process_decimal);
+                rationLaberFee_b = scMathUtil.roundForObj(rationLaberFee_b+rt,process_decimal);
+            }else if(gljUtil.getMainType(g.type) == 3){
+                rationMachineFee = scMathUtil.roundForObj(rationMachineFee+t,process_decimal);
+                rationMachineFee_b = scMathUtil.roundForObj(rationMachineFee_b+rt,process_decimal);
+            }
+            directFee = scMathUtil.roundForObj(directFee + t,process_decimal);
+        }
+        ration.assistProductionFee = scMathUtil.roundForObj(rationLaberFee_b * assFeeRate,glj_unitPrice_decimal);//辅助生产间接费
+        ration.rationLaberFee = scMathUtil.roundForObj(rationLaberFee,glj_unitPrice_decimal);//定额人工费(市场价)
+        ration.rationMachineFee = scMathUtil.roundForObj(rationMachineFee,glj_unitPrice_decimal);//定额施工机械使用费(市场价)
+        ration.directFee = scMathUtil.roundForObj(directFee,glj_unitPrice_decimal);//直接费
+        //to do 高原取费类别的情况待确认
+        //let hs = scMathUtil.roundForObj(tt*hightFeeRate,process_decimal);//(人工定额消耗量*定额价*定额工程量+机械定额消耗量*定额价*定额工程量)*高原取费类别费率
+
+    },
+
+
     fixedFlag : {
         // 分部分项工程
         SUB_ENGINERRING: 1,

+ 0 - 2
web/building_saas/main/js/models/project_glj.js

@@ -700,7 +700,6 @@ ProjectGLJ.prototype.updateUserFreight =async function (data) {
 ProjectGLJ.prototype.getUserFreights = async function () {//初始化车船税选择
     try {
         let result =  await ajaxGet("/glj/getUserFreights");
-        console.log(result);
         return result;
     }catch (e){
         console.log(e)
@@ -878,7 +877,6 @@ ProjectGLJ.prototype.calcEachFreightOrPrice = function (temp,type,priceMap) {//
     function calcRation(ration,gljs,pMap,priceMap){
         let result = 0;
         if(gljs){
-            //to do 计算有辅助定额的情况
             let processDecimal = getDecimal("process");
             let hightFeeRate = projectObj.project.projectGLJ.getHighlandFee(ration.feeType);//高原取费类别费率
             let assFeeRate = scMathUtil.roundForObj(projectObj.project.projectGLJ.datas.constData.assistProductionFeeRate,getDecimal("feeRate")) * 0.01;//辅助生产间接费费率

+ 23 - 0
web/building_saas/main/js/views/glj_view.js

@@ -745,6 +745,29 @@ var gljOprObj = {
         return data;
 
     },
+   /* testMaterialRationFee:function () {
+        let freightID = "8db5ff10-f495-11e9-bbf9-ef28356eebc5";
+        let rationID = "da995300-05f1-11ea-8265-63369b476c76";
+        let proGLJ =  projectObj.project.projectGLJ;
+        let freightList =  proGLJ.datas.freightList;
+        let calcOptions=projectObj.project.projectInfo.property.calcOptions;
+        let decimalObj = projectObj.project.projectInfo.property.decimal;
+        let labourCoeDatas =  projectObj.project.labourCoe.datas;
+        for(let f of freightList){
+            if(f.ID == freightID){
+                let r = null;
+                let ration_gljs = [];
+                for(let ration of f.rations){
+                    if(ration.ID == rationID) r = ration;
+                }
+                for(let rg of f.ration_gljs){
+                    if(rg.rationID == rationID) ration_gljs.push(rg);
+                }
+                gljUtil.getMaterialCalcRationFee(r,ration_gljs,proGLJ.datas,calcOptions,labourCoeDatas,decimalObj,_,scMathUtil)
+                console.log(r);
+            }
+        }
+    },*/
 
     getBasePrice:function (treeNode) {//造价书中的工料机修改的节点要用到
         let proGLJ =  projectObj.project.projectGLJ;

+ 3 - 3
web/building_saas/main/js/views/zmhs_view.js

@@ -221,8 +221,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);//这个方法有再去项目工料机那里取价格,所以要在回调里调用,不像替换工料的情况
@@ -231,7 +231,7 @@ let zmhs_obj = {
         }else {
             ration_glj.reCalcWhenGLJChange({rationID:rationID});
         }
-        gljOprObj.showRationGLJSheetData(true);
+        gljOprObj.refreshView();
     },
 
     deleteGLJs:function (IDs) {