Forráskód Böngészése

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

TonyKang 6 éve
szülő
commit
808d861b43

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

@@ -17,7 +17,7 @@ const uuidV1 = require('uuid/v1');
 let std_glj_lib_gljList_model = mongoose.model('std_glj_lib_gljList');
 let complementary_glj_model =  mongoose.model('complementary_glj_lib');
 let rationItemModel = mongoose.model("std_ration_lib_ration_items");
-let complementaryGljModel = mongoose.model('complementary_glj_lib');
+let complementaryRationModel = mongoose.model('complementary_ration_items');
 
 let coeMolde = mongoose.model('std_ration_lib_coe_list');
 let _= require('lodash');
@@ -75,13 +75,13 @@ async function getSameSectionRations(data,userId){
         let ration = await rationItemModel.findOne({rationRepId:libID,code:code},['sectionId']);
         sectionId = ration.sectionId
     }else {
-        let ration = await complementaryGljModel.findOne({userId:userId,code:code},['sectionId']);
+        let ration = await complementaryRationModel.findOne({userId:userId,code:code},['sectionId']);
         sectionId = ration.sectionId
     }
     if(sectionId){
         //{
         let stdRations = await rationItemModel.find({sectionId: sectionId});
-        let comRations = await complementaryGljModel.find({userId: userId, sectionId: sectionId});
+        let comRations = await complementaryRationModel.find({userId: userId, sectionId: sectionId});
         rations = stdRations.concat(comRations);
         rations = _.sortBy(rations,'code');
     }
@@ -491,7 +491,7 @@ async function CalculateQuantity (ration,billsItemID,projectID) {
     let decimalObject =await decimal_facade.getProjectDecimal(projectID,project);
     let quantity_decimal = (decimalObject&&decimalObject.ration&&decimalObject.ration.quantity)?decimalObject.ration.quantity:3;
     let pbill = await bill_model.model.findOne({projectID:projectID,ID:billsItemID});
-    let  t_unit = ration.unit.replace(/^\d+/,"");
+    let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):"";
     if(t_unit!=pbill.unit){//如果定额工程量的单位去除前面的数字后不等于清单单位,定额工程量保持不变
         return ;
     }

+ 1 - 1
modules/ration_glj/routes/ration_glj_route.js

@@ -13,7 +13,7 @@ module.exports = function (app) {
     rgRouter.post('/replaceGLJ',rgController.replaceGLJ);
     rgRouter.post('/mReplaceGLJ',rgController.mReplaceGLJ);
     rgRouter.post('/updateRationGLJByEdit',rgController.updateRationGLJByEdit);
-    rgRouter.post('/getGLJClass', rgController.getGLJClass);
+    rgRouter.post('/getGLJClass/:engineerID', rgController.getGLJClass);
     app.use('/rationGlj',rgRouter);
 }
 

+ 6 - 0
web/building_saas/complementary_glj_lib/js/glj.js

@@ -139,6 +139,12 @@ let repositoryGljObj = {
         let me = this;
         CommonAjax.post('complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
+            //兼容多单价情况
+            for(let sGlj of me.stdGljList){
+                if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined') {
+                    sGlj.basePrice = sGlj.priceProperty.price1;
+                }
+            }
             me.complementaryGljList = rstData.complementaryGljs;
             me.workBook.getSheet(0).setRowCount(me.stdGljList.length);
             me.sortGlj(me.stdGljList);

+ 6 - 0
web/building_saas/complementary_ration_lib/js/gljSelect.js

@@ -43,6 +43,12 @@ let gljSelOprObj = {
         let me = this;
         CommonAjax.post('/complementartGlj/api/getGljItems', {stdGljLibId: stdGljLibId}, function (rstData) {
             me.stdGljList = rstData.stdGljs;
+            //兼容多单价,计算补充定额价格时,套多单价人材机的时候,默认取第一个价格
+            for(let sGlj of me.stdGljList){
+                if(sGlj.priceProperty && typeof sGlj.priceProperty.price1 !== 'undefined'){
+                    sGlj.basePrice = sGlj.priceProperty.price1;
+                }
+            }
             me.complementaryGljList = rstData.complementaryGljs;
             me.switchToGljId(me.stdGljList);
             me.switchToGljId(me.complementaryGljList);

+ 6 - 2
web/building_saas/main/js/controllers/block_controller.js

@@ -242,7 +242,7 @@ let BlockController = {
             for(let d of blockData.datas){
                 d.billsItemID = parentID;
                 let billsQuantity = scMathUtil.roundForObj(parent.data.quantity,getDecimal("quantity",parent));
-                this.calcRationQuantityAndContain(billsQuantity,d);
+                this.calcRationQuantityAndContain(billsQuantity,d,parent.data.unit);
                 //如果粘贴位置不属于分部分项工程,或者不是安装工程,则把安装增加费内容置空
                 if(!Bills.isFBFX(parent)|| !project.isInstall()){
                     d.ration_installations = [];
@@ -552,10 +552,14 @@ let BlockController = {
             firstSerialNo += 1;
         }
     },
-    calcRationQuantityAndContain : function (billsQuantity,ration) {//计算定额工程量和含量
+    calcRationQuantityAndContain : function (billsQuantity,ration,billsUnit) {//计算定额工程量和含量
         let EXPString = ration.quantityEXP+"";
         if(EXPString.indexOf("QDL") != -1){
             if(EXPString=="QDL"){//定额的工程量是直接通过清单量填进来的;
+                let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):"";
+                if(t_unit!=billsUnit){//如果定额的单位去除前面的数字后不等于清单单位,定额工程量保持不变
+                    return ;
+                }
                 let times = parseInt(ration.unit);
                 if(isNaN(times)){
                     times = 1;

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

@@ -398,7 +398,8 @@ function getGLJData(actionType) {
 }
 
 function showGLJClassTree(record) {
-    CommonAjax.post('/rationGlj/getGLJClass',record, function (data) {
+    let engineerID = projectInfoObj.projectInfo.property.engineering_id;
+    CommonAjax.post('/rationGlj/getGLJClass/'+engineerID,record, function (data) {
         if(data.exist==true){
             alert("当前人材机已存在。");
         }else {