Explorar el Código

广东2018人材机下拉相关
内蒙费用定额定额基价计算相关

zhongzewei hace 6 años
padre
commit
4bf868fb8b

+ 14 - 5
modules/ration_repository/models/ration_item.js

@@ -494,13 +494,21 @@ rationItemDAO.prototype.updateRationBasePrc = function (basePrcArr, overWriteUrl
                                     }
                                     }
                                     if(theGlj)
                                     if(theGlj)
                                     if(theGlj.ID === adjGljId){
                                     if(theGlj.ID === adjGljId){
-                                        gljArr.push({gljId: theGlj.ID, basePrice: adjBasePrice, gljParentType: gljParentType});
+                                        gljArr.push({gljId: theGlj.ID, basePrice: adjBasePrice, gljParentType: gljParentType, unit: theGlj.unit});
                                     } else {
                                     } else {
                                         if(theGlj.priceProperty && Object.keys(theGlj.priceProperty).length > 0){
                                         if(theGlj.priceProperty && Object.keys(theGlj.priceProperty).length > 0){
                                             let priceKeys = Object.keys(theGlj.priceProperty);
                                             let priceKeys = Object.keys(theGlj.priceProperty);
-                                            gljArr.push({gljId: theGlj.ID, basePrice: parseFloat(theGlj.priceProperty[priceKeys[0]]), gljParentType: gljParentType});
+                                            gljArr.push({
+                                                gljId: theGlj.ID,
+                                                basePrice: parseFloat(theGlj.priceProperty[priceKeys[0]]),
+                                                gljParentType: gljParentType,
+                                                unit: theGlj.unit});
                                         } else {
                                         } else {
-                                            gljArr.push({gljId: theGlj.ID, basePrice: parseFloat(theGlj.basePrice), gljParentType: gljParentType});
+                                            gljArr.push({
+                                                gljId: theGlj.ID,
+                                                basePrice: parseFloat(theGlj.basePrice),
+                                                gljParentType: gljParentType,
+                                                unit: theGlj.unit});
                                         }
                                         }
                                     }
                                     }
                                 }
                                 }
@@ -729,10 +737,11 @@ rationItemDAO.prototype.calcForRation = function (stdGljList, ration, overWriteU
                 gljId: glj.ID,
                 gljId: glj.ID,
                 basePrice: parseFloat(glj.priceProperty[priceKeys[0]]),
                 basePrice: parseFloat(glj.priceProperty[priceKeys[0]]),
                 consumeAmt: rationGlj.consumeAmt,
                 consumeAmt: rationGlj.consumeAmt,
-                gljParentType: gljPType
+                gljParentType: gljPType,
+                unit: glj.unit
             });
             });
         } else {
         } else {
-            gljArr.push({gljId: glj.ID, basePrice: parseFloat(glj.basePrice), consumeAmt: rationGlj.consumeAmt, gljParentType: gljPType});
+            gljArr.push({gljId: glj.ID, basePrice: parseFloat(glj.basePrice), consumeAmt: rationGlj.consumeAmt, gljParentType: gljPType, unit: glj.unit});
         }
         }
         let updatePrc = null;
         let updatePrc = null;
         let overWriteCalc = false;  //需要重写算法
         let overWriteCalc = false;  //需要重写算法

+ 30 - 0
web/over_write/js/guangdong_2018.js

@@ -0,0 +1,30 @@
+'use strict';
+//允许使用的工料机类型:人工、普通材料、混凝土、砂浆、配合比、商品混凝土、商品砂浆
+//机械台班、机上人工、机械组成物、主材、设备、企业管理费
+if(typeof allowGljType !== 'undefined'){
+    allowGljType = [1, 201, 202, 203, 204, 205, 206, 301, 302, 303, 4,5, 6];
+}
+if(typeof allowComponent !== 'undefined'){
+    //允许含有组成物的工料机类型:混凝土、砂浆、配合比、机械台班、主材
+    allowComponent = [202, 203, 204, 301, 4];
+}
+if(typeof componentType !== 'undefined'){
+    //可以作为组成物的工料机类型:普通材料、机械组成物、机上人工、主材
+    componentType = [201, 302, 303, 4];
+}
+if(typeof machineAllowComponent !== 'undefined'){
+    //允许含有组成物的机械工料机类型:机械台班器仪表
+    machineAllowComponent = [301];
+}
+if(typeof machineComponent !== 'undefined'){
+    //可以作为机械工料机组成物的工料机类型:机械组成物、机上人工
+    machineComponent = [302, 303];
+}
+if(typeof materialAllowComponent !== 'undefined'){
+    //允许含有组成物的材料工料机类型:混凝土、砂浆、配合比
+    materialAllowComponent = [202, 203, 204];
+}
+if(typeof materialComponent !== 'undefined'){
+    //可以作为材料工料机组成物的工料机类型:普通材料
+    materialComponent = [201];
+}

+ 15 - 8
web/over_write/js/neimenggu_2017.js

@@ -36,7 +36,7 @@ if(typeof materialComponent !== 'undefined'){
     //可以作为材料工料机组成物的工料机类型:普通材料
     //可以作为材料工料机组成物的工料机类型:普通材料
     materialComponent = [201];
     materialComponent = [201];
 }
 }
-//覆盖前端基价计算
+//覆盖前端定额基价计算
 //基价=人工费+材料费+机械费+管理费利润
 //基价=人工费+材料费+机械费+管理费利润
 //管理费利润=Round(人工费*(管理费消耗量+利润消耗量)%,2) 注:书中管理费、利润的单位都是“%”
 //管理费利润=Round(人工费*(管理费消耗量+利润消耗量)%,2) 注:书中管理费、利润的单位都是“%”
 if (typeof rationGLJOprObj !== 'undefined' && typeof rationGLJOprObj.rationCal !== 'undefined') {
 if (typeof rationGLJOprObj !== 'undefined' && typeof rationGLJOprObj.rationCal !== 'undefined') {
@@ -50,12 +50,14 @@ if (typeof rationGLJOprObj !== 'undefined' && typeof rationGLJOprObj.rationCal !
             let cacheArr = me.cache['_GLJ_' + me.currentRationItem.ID];
             let cacheArr = me.cache['_GLJ_' + me.currentRationItem.ID];
             cacheArr.forEach(function (gljData) {
             cacheArr.forEach(function (gljData) {
                 if(gljData.gljType && gljData.basePrice && gljData.consumeAmt){
                 if(gljData.gljType && gljData.basePrice && gljData.consumeAmt){
-                    let parent = me.distTypeTree.distTypes[me.distTypeTree.prefix + gljData.gljType].parent;
-                    if(parent && parent.data.ID <= 3){
-                        price['gljType' + parent.data.ID].push(scMathUtil.roundTo(gljData.basePrice * gljData.consumeAmt, -3));//取三位
-                    }
-                    if(!parent && gljData.gljType <= 3){
-                        price['gljType' + gljData.gljType].push(scMathUtil.roundTo(gljData.basePrice * gljData.consumeAmt, -3));//取三位
+                    let parentGLJType = parseInt(String(gljData.gljType)[0]);
+                    if (parentGLJType <= 3) { // 人工、材料、机械
+                        // 单位为%,单条基价计算为定额价*消耗量*0.01
+                        if (gljData.unit === '%') {
+                            price['gljType' + parentGLJType].push(scMathUtil.roundTo(gljData.basePrice * gljData.consumeAmt * 0.01, -3));//取三位
+                        } else {
+                            price['gljType' + parentGLJType].push(scMathUtil.roundTo(gljData.basePrice * gljData.consumeAmt, -3));//取三位
+                        }
                     }
                     }
                     if([6, 7].includes(gljData.gljType)){
                     if([6, 7].includes(gljData.gljType)){
                         manageProfitConsume = scMathUtil.roundTo(manageProfitConsume + gljData.consumeAmt, -6);
                         manageProfitConsume = scMathUtil.roundTo(manageProfitConsume + gljData.consumeAmt, -6);
@@ -100,6 +102,7 @@ if (typeof rationGLJOprObj !== 'undefined' && typeof rationGLJOprObj.rationCal !
 
 
 if (typeof module !== 'undefined') {
 if (typeof module !== 'undefined') {
     module.exports = {
     module.exports = {
+        // 计算定额基价
         calcRation: function (gljArr, scMathUtil) {
         calcRation: function (gljArr, scMathUtil) {
             let labourPrc = [],
             let labourPrc = [],
                 materialPrc = [],
                 materialPrc = [],
@@ -109,7 +112,11 @@ if (typeof module !== 'undefined') {
                 updatePrc = {labourPrice: 0, materialPrice: 0, machinePrice: 0, manageProfitPrice: 0, basePrice: 0};
                 updatePrc = {labourPrice: 0, materialPrice: 0, machinePrice: 0, manageProfitPrice: 0, basePrice: 0};
             gljArr.forEach(function (gljItem) {
             gljArr.forEach(function (gljItem) {
                 if(gljItem.gljParentType !== -1){
                 if(gljItem.gljParentType !== -1){
-                    singlePrc = scMathUtil.roundTo(gljItem.basePrice * gljItem.consumeAmt, -3);
+                    if (gljItem.gljParentType <= 3 && gljItem.unit === '%') {
+                        singlePrc = scMathUtil.roundTo(gljItem.basePrice * gljItem.consumeAmt * 0.01, -3);
+                    } else {
+                        singlePrc = scMathUtil.roundTo(gljItem.basePrice * gljItem.consumeAmt, -3);
+                    }
                     if(gljItem.gljParentType === 1){
                     if(gljItem.gljParentType === 1){
                         labourPrc.push(singlePrc);
                         labourPrc.push(singlePrc);
                     } else if(gljItem.gljParentType ===2){
                     } else if(gljItem.gljParentType ===2){