소스 검색

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhongzewei 7 년 전
부모
커밋
922b1d4b95

+ 4 - 0
modules/glj/controllers/glj_controller.js

@@ -619,6 +619,10 @@ class GLJController extends BaseController {
         res.json(result);
     }
 
+    async getProjectGLJsByProjectID(projectId){
+        return await getGLJListByProjectID(projectId)
+    }
+
 }
 
 /**

+ 1 - 1
modules/main/controllers/bills_controller.js

@@ -168,7 +168,7 @@ module.exports = {
     pasteBlock:async function(req,res){
         let result={
             error:0
-        }
+        };
         try {
             let data = req.body.data;
             data = JSON.parse(data);

+ 122 - 8
modules/main/facade/bill_facade.js

@@ -2,9 +2,22 @@
  * Created by zhang on 2018/1/22.
  */
 let mongoose = require('mongoose');
+let projectConst = require('../models/project_consts');
+const rationType = projectConst.rationType;
+const rationKeyArray = projectConst.rationKeyArray;
+const gljKeyArray = projectConst.gljKeyArray;
 let quantity_detail = require("./quantity_detail_facade");
+let quantity_detail_model = mongoose.model('quantity_detail');
+let ration_glj_facade = require("../../ration_glj/facade/ration_glj_facade");
 let Bills_Lib = mongoose.model('std_bills_lib_bills');
+let ration_Model = mongoose.model('ration');
+let ration_glj_Model = mongoose.model('ration_glj');
+let ration_coe_Model = mongoose.model('ration_coe');
+let ration_installation_Model = mongoose.model('ration_installation');
 let bill_Model = require('../models/bills').model;
+import GLJController from "../../glj/controllers/glj_controller";
+
+import GLJListModel from '../../glj/models/glj_list_model';
 let _ = require("lodash");
 module.exports={
     getSectionInfo : async function (data) {
@@ -44,26 +57,117 @@ module.exports={
         return null;
     },
     reorganizeFBFX:async function(data){
-       let result = {};
-       let tasks = generateBillTasks(data);
-       if(data.delete && data.delete.length > 0){
-           let qd_query={projectID: data.projectID, billID: {"$in": data.delete}};
-           await quantity_detail.deleteByQuery(qd_query) ;
+        let result = {};
+        let tasks = generateBillTasks(data);
+        if(data.delete && data.delete.length > 0){
+            let qd_query={projectID: data.projectID, billID: {"$in": data.delete}};
+            await quantity_detail.deleteByQuery(qd_query) ;
         }
         if(tasks.length > 0){
             result =await bill_Model.bulkWrite(tasks);
         }
-        return result;
+       return result;
     },
     pasteBlock : async function(data){
+        let pasteTasks = [
+            pasteRationsAndRationGLJ(data.rations,data.ration_gljs),//这一步会花费比较多时间
+            pasteOtherData(data)
+        ];
+        let [rationsAndRationGLJ,resultMap] = await Promise.all(pasteTasks);
+
+        let gljController = new GLJController();
+        let projectGLJ = await gljController.getProjectGLJsByProjectID(data.projectID);
+        resultMap.rations = rationsAndRationGLJ.rations;
+        resultMap.ration_gljs = rationsAndRationGLJ.new_ration_gljs;
+        resultMap.gljData = projectGLJ.data;
+        return resultMap;
+    }
+};
 
+async function pasteOtherData(data) {
+    let bills = data.bills;
+    let quantity_details = data.quantity_details;
+    let ration_coes = data.ration_coes;
+    let ration_installations = data.ration_installations;
+    let updateData = data.updateData;
+    let uModel = null;
+    let tasks = [];
+
+    //生成更新任务
+    for(let u of updateData){
+        if(u.type == "bills"){
+            uModel = bill_Model;
+        }else {
+            uModel = ration_Model;
+        }
+        let tem = {
+            updateOne:{
+                filter:u.query,
+                update :u.doc
+            }
+        };
+        tasks.push(tem);
+    }
 
+    bills.length > 0 ? await insertMany(bills,bill_Model):'';
+    quantity_details.length > 0 ? await insertMany(quantity_details,quantity_detail_model):'';
+    ration_coes.length > 0 ? await insertMany(ration_coes,ration_coe_Model):'';
+    ration_installations.length > 0 ? await insertMany(ration_installations,ration_installation_Model):'';
+    tasks.length>0?await uModel.bulkWrite(tasks):'';
 
+    return {bills:bills,quantity_details:quantity_details,ration_coes:ration_coes,ration_installations:ration_installations,updateData:updateData}
+}
 
+async function pasteRationsAndRationGLJ (rations,ration_gljs) {
+    let projectGljModel = new GLJListModel();
+    let gljMap = {};
+    let new_ration_gljs=[];
+    //先根据定额类型的工料机,插入到项目工料机中
+    for(let r of rations){
+        if(r.type == rationType.gljRation){
+            await getProjectGLJ(r,rationKeyArray,gljMap);
+        }
+    }
 
-        console.log(data);
+    for(let rg of ration_gljs){
+        await getProjectGLJ(rg,gljKeyArray,gljMap);
+        new_ration_gljs.push(ration_glj_facade.createNewRecord(rg));
     }
-};
+
+    rations.length>0?await insertMany(rations,ration_Model):'';
+    new_ration_gljs.length>0?await insertMany(new_ration_gljs,ration_glj_Model):'';
+
+    return{rations:rations,new_ration_gljs:new_ration_gljs};
+
+    async function getProjectGLJ (glj,keyArray,gljMap) {
+        let keyIndex = projectGljModel.getIndex(glj,keyArray);
+        let pgljResult = null;
+        if(gljMap[keyIndex]){
+            pgljResult = gljMap[keyIndex]
+        }else {
+            let p_glj = ration_glj_facade.getGLJSearchInfo(glj);
+            pgljResult = await projectGljModel.addList(p_glj);//逐条添加到项目工料机
+            gljMap[keyIndex] = pgljResult;
+        }
+        setResult(glj,pgljResult);
+    }
+
+
+    function setResult(glj,result ) {
+        let typeString = result.type+'';
+        glj.marketPrice = result.unit_price.market_price;
+        glj.adjustPrice = result.unit_price.base_price;
+        glj.basePrice = result.unit_price.base_price;
+        glj.isAdd = result.unit_price.is_add;
+        glj.projectGLJID = result.id;
+        if (typeString.startsWith("2")||typeString=='4'||typeString=='5') {//只有材料类型才显示是否暂估
+            glj.isEstimate = result.is_evaluate;
+        }
+    }
+
+
+}
+
 
 function generateBillTasks(data) {
     let tasks=[];
@@ -110,4 +214,14 @@ function generateBillTasks(data) {
         }
     }
     return tasks;
+}
+
+
+async function insertMany(datas,model) {
+    while (datas.length>1000){//因为mongoose限制了批量插入的条数为1000.所以超出限制后需要分批插入
+        let newList = datas.splice(0,1000);//一次插入1000条
+        await model.insertMany(newList);
+    }
+    await model.insertMany(datas);
+
 }

+ 2 - 1
modules/main/facade/ration_installation_facade.js

@@ -2,7 +2,8 @@
  * Created by zhang on 2018/2/24.
  */
 let mongoose = require('mongoose');
-let rationInstallationModel = mongoose.model('ration_installation');let consts = require('../models/project_consts');
+let rationInstallationModel = mongoose.model('ration_installation');
+let consts = require('../models/project_consts');
 let projectConsts = consts.projectConst;
 
 module.exports={

+ 9 - 2
modules/main/models/project_consts.js

@@ -45,5 +45,12 @@ let commonConst = {
     UT_DELETE: 'ut_delete'
 };
 
-
-module.exports = {projectConst: projectConst, commonConst: commonConst, projectConstList: projectConstList};
+const gljKeyArray =['code','name','specs','unit','type'];
+const rationKeyArray =['code','name','specs','unit','subType'];
+const rationType = {
+    ration: 1,
+    volumePrice: 2,
+    gljRation: 3,
+    install:4
+};
+module.exports = {projectConst: projectConst, commonConst: commonConst, projectConstList: projectConstList,gljKeyArray:gljKeyArray,rationKeyArray:rationKeyArray,rationType:rationType};

+ 2 - 4
modules/ration_glj/facade/ration_glj_facade.js

@@ -43,7 +43,8 @@ module.exports = {
     insertGLJAsRation: insertGLJAsRation,
     getRationTypeGLJQuantity:getRationTypeGLJQuantity,
     getInfoFromProjectGLJ:getInfoFromProjectGLJ,
-    createNewRecord:createNewRecord
+    createNewRecord:createNewRecord,
+    getGLJSearchInfo:getGLJSearchInfo
 }
 
 let operationMap = {
@@ -757,8 +758,6 @@ async function getGLJClass(info, data) {
 
 async function insertGLJAsRation(data) {
     let gljList = data.gljList;
-    //先更新counter
-    let counter = await projCounter.model.findOneAndUpdate({projectID: data.projectID}, {ration: data.rationCount}, {new: true});
     if (data.hasOwnProperty("selectedSerialNo")) { //如果需要,更新序列号。
         let query = {
             projectID: data.projectID,
@@ -783,7 +782,6 @@ async function insertGLJAsRation(data) {
         }
     }
     await ration.insertMany(gljList);
-    console.log(gljList);
     return gljList;
 }
 

+ 5 - 1
modules/reports/rpt_component/jpc_ex.js

@@ -222,7 +222,11 @@ JpcExSrv.prototype.createNew = function(){
                 if (expression) {
                     let $ME = me.formulas[i];
                     // console.log(expression);
-                    eval(expression);
+                    try {
+                        eval(expression);
+                    } catch (ex) {
+                        console.log(ex);
+                    }
                 }
             }
         }

+ 11 - 3
modules/reports/rpt_component/jpc_flow_tab.js

@@ -51,7 +51,8 @@ JpcFlowTabSrv.prototype.createNew = function(){
         let private_inner_add_grp_rec = function(vi) {
             let hasFullGrp = true, couldBreak = false;
             for (let i = 0; i < grp_lines; i++) {
-                if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
+                // if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
+                if ( (vIdx.length + i ) >= maxRecPerPage) {
                     for (let j = i; j < grp_lines; j++) {
                         grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO].push(j);
                     }
@@ -105,7 +106,12 @@ JpcFlowTabSrv.prototype.createNew = function(){
                     if (private_inner_add_grp_rec(vi)) break;
                     if (couldBreak) break;
                 } else {
-                    if (private_normal_add_rec(vi)) break;
+                    //备注: 在有group的情况下,如果grpPageInfo[JV.PROP_SEG_GRP_IDX] 范围大于 grpSequenceInfo.length,则表示已经到最后了,不要再加空白数据了
+                    if (grpPageInfo[JV.PROP_SEG_GRP_IDX] < grpSequenceInfo.length) {
+                        if (private_normal_add_rec(vi)) break;
+                    } else {
+                        break;
+                    }
                 }
             } else {
                 if (private_normal_add_rec(vi)) break;
@@ -428,7 +434,9 @@ JpcFlowTabSrv.prototype.createNew = function(){
                         private_chk_handle_rec_amt(dv, false);
                     }
                     //再处理下半部分
-                    private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec - mixSplitPoint, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
+                    let restRecAmt = maxRowRec - me.dispValueIdxLst[me.dispValueIdxLst.length - 1].length; //备注:在一些极端条件下,mixSplitPoint这个分割点不合适处理下半部分数据,以实际生成的value-index数量为准
+                    // private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec - mixSplitPoint, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
+                    private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, restRecAmt, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
                     for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                         private_chk_handle_rec_amt(dv, true);
                     }

+ 10 - 7
test/unit/reports/test_cover_01.js

@@ -25,11 +25,13 @@ cfgCacheUtil.setupDftCache();
 let fsUtil = require("../../../public/fsUtil");
 
 let demoPrjId = - 1;
-let demoRptId = 223, pagesize = "A4";
+// let demoRptId = 223, pagesize = "A4";
+let demoRptId = 261, pagesize = "A4";
 
-demoPrjId = 1220; //QA:
+// demoPrjId = 1220; //QA:
+demoPrjId = 2260;
 //*
-let userId_Leng = "59cdf14a0034a1000ba52b97"; //小冷User Id 换成_id了
+let userId_Leng = "5acac1e885bf55000bd055ba"; //小冷User Id 换成_id了
 let userId_Dft = userId_Leng;
 /*/
  let userId_Dft = "595328da1934dc327cad08eb";
@@ -47,7 +49,7 @@ fs.readFile(__dirname.slice(0, __dirname.length - 18) + '/public/web/date_util.j
 });
 
 //*
-test('测试 - 打开模板: 封-1 ', function (t) {
+test('测试 - 打开模板: 封-3 ', function (t) {
     rptTplFacade.getRptTemplate(demoRptId).then(function(rptTpl) {
         let rptDataUtil = new rptDataExtractor();
         rptDataUtil.initialize(rptTpl._doc);
@@ -57,8 +59,9 @@ test('测试 - 打开模板: 封-1 ', function (t) {
         rptTplDataFacade.prepareProjectData(userId_Dft, demoPrjId, filter, function (err, msg, rawDataObj) {
             if (!err) {
                 try {
-                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.jsp");
+                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject_建筑封-3表.jsp");
                     let tplData = rptDataUtil.assembleData(rawDataObj);
+                    // fsUtil.writeObjToFile(tplData, "D:/GitHome/ConstructionCost/tmp/rptTplAssembledData_建筑封-3表.jsp");
                     //build the report
                     let printCom = JpcEx.createNew();
                     rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_PAGE_SIZE] = pagesize;
@@ -69,7 +72,7 @@ test('测试 - 打开模板: 封-1 ', function (t) {
                     let maxPages = printCom.totalPages;
                     let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties);
                     if (pageRst) {
-                        // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
+                        fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult_建筑封-3.jsp");
                     } else {
                         console.log("oh! no pages were created!");
                     }
@@ -96,7 +99,7 @@ test('close the connection', function (t) {
         mongoose.disconnect();
         t.pass('closing db connection');
         t.end();
-    }, 8000);
+    }, 1000);
     // mongoose.disconnect();
     // t.pass('closing db connection');
     // t.end();

+ 110 - 10
web/building_saas/main/js/controllers/block_controller.js

@@ -189,7 +189,9 @@ let BlockController = {
      * @param position next/pre/sub
      */
     confirmPaste:function (blockData,selected,position) {
-        let Bills = projectObj.project.Bills;
+        let me = this;
+        let project = projectObj.project;
+        let Bills = project.Bills;
         let parent = null,next = null,pre = null;
         let updateData = [],billUpdate = null;
         let billsIDMap = {};//用来做新旧ID映射
@@ -236,15 +238,115 @@ let BlockController = {
             updateData.push(billUpdate);
         }
         dataMap.updateData = updateData;
+        dataMap.projectID = projectObj.project.ID();
         console.log(dataMap);
         $.bootstrapLoading.start();
-        CommonAjax.post('/bills/pasteBlock',dataMap,function (data) {
+        CommonAjax.post('/bills/pasteBlock',dataMap,function (result) {
              $.bootstrapLoading.end();
+             //更新前端缓存
+             me.updateCache(result);
+             //插入树节点
+             let rationNodes = me.addToTree(parentID,nextID,result.bills,result.rations);
+             //主材设备工料机插入主树
+             project.ration_glj.addToMainTree(result.ration_gljs);
+             //更新计算程序模板,并进行重新计算
+             project.calcProgram.calcRationsAndSave(rationNodes);
+        })
 
+    },
 
-        })
+    updateCache:function(result){
+        let project = projectObj.project;
+        let Bills = project.Bills,Ration = project.Ration;
+        let mainTree = project.mainTree;
+        Bills.addDatasToList(result.bills);
+        Ration.addDatasToList(result.rations);
+        project.quantity_detail.addDatasToList(result.quantity_details);
+        project.ration_glj.addDatasToList(result.ration_gljs);
+        project.ration_coe.addDatasToList(result.ration_coes);
+        project.ration_installation.addDatasToList(result.ration_installations)
+        for(let u of  result.updateData){
+            let unode = mainTree.findNode(u.query.ID);
+            if(unode){
+                for(let ukey in u.doc){
+                    unode.data[ukey] = u.doc[ukey];
+                }
+            }
+        }
+        //更新项目工料机模块信息-计算消耗量
+        project.projectGLJ.datas = result.gljData;
+        project.projectGLJ.calcQuantity();
+    },
+
+    addToTree:function (parentID,nextID,bills,rations) {
+        let project = projectObj.project;
+        let Bills = project.Bills,mainTree = project.mainTree;
+        let parentMap_b = {},parentMap_r = {};
+        let newNodes = [],firstNode = null,rationNodes=[];
+
+        createParentMap(parentMap_b,bills,'bills');
+        createParentMap(parentMap_r,rations,'ration');
+        if(parentMap_b[parentID]){
+            firstNode = loadTreeNode(parentID,nextID,parentMap_b[parentID][0],'bills');
+
+        }else if(parentMap_r[parentID]){
+            firstNode = loadTreeNode(parentID,nextID,parentMap_r[parentID][0],'ration');
+        }
+
+        ProjectController.syncDisplayNewNodes(projectObj.mainController, newNodes);
+        let sels = projectObj.mainController.sheet.getSelections();
+        //设置选中并更新下方显示
+        projectObj.mainController.setTreeSelected(firstNode);
+        projectObj.mainController.sheet.setSelection(firstNode.serialNo(), sels[0].col, 1, 1);
+        return rationNodes;
+
+        function loadTreeNode(parentID,nextID,data,type) {
+            let newNode = null;
+            if(type == 'bills'){
+                let newSource = Bills.tree.insertByData(data,parentID,nextID,true);
+                newNode = mainTree.insert(parentID, nextID,data.ID);
+                if (newNode) {
+                    newNode.source = newSource;
+                    newNode.sourceType = Bills.getSourceType();
+                    newNode.data = data;
+                    newNodes.push(newNode);
+                    let subType = 'bills';
+                    let children = parentMap_b[data.ID];
+                    if(!children){
+                        children = parentMap_r[data.ID];
+                        subType = 'ration';
+                    }
+                    if(children){
+                        for(let c of children){
+                            loadTreeNode(data.ID,-1,c,subType);
+                        }
+                    }
+
+                }
+            }else if(type == 'ration'){
+                newNode = project.mainTree.insert(parentID, nextID, data.ID);
+                newNode.source = data;
+                newNode.sourceType = project.Ration.getSourceType();
+                newNode.data = data;
+                newNodes.push(newNode);
+                rationNodes.push(newNode);
+            }
+            return newNode;
+        }
+        
+        
+        function createParentMap(parentMap,list,type) {
+            let parentKey = type=='bills'?'ParentID':'billsItemID';
+            for(let l of list){
+                let parentID = l[parentKey];
+                if(parentMap[parentID]){
+                    parentMap[parentID].push(l);
+                }else {
+                    parentMap[parentID] = [l];
+                }
+            }
+        }
 
-        //  delete fees / feesIndex /__v
     },
 
     preparePasteData : function (data,billsIDMap) {
@@ -257,8 +359,6 @@ let BlockController = {
             billsIDMap[b.ParentID]?b.ParentID = billsIDMap[b.ParentID]:'';
             billsIDMap[b.NextSiblingID]?b.NextSiblingID = billsIDMap[b.NextSiblingID]:'';
         }
-
-
         return {bills:bills,rations:rations,ration_gljs:ration_gljs,ration_coes:ration_coes,quantity_details:quantity_details,ration_installations:ration_installations};
 
         function eachData(data) {
@@ -307,6 +407,7 @@ let BlockController = {
 
         function createQuantityDetails(detailData,pdata,type) {
             let tem_detail = _.cloneDeep(detailData);
+            delete tem_detail._id;
             tem_detail.ID = uuid.v1();
             tem_detail.projectID = projectObj.project.ID();
             if(type == 'bills'){
@@ -321,6 +422,7 @@ let BlockController = {
         function createRationData(rationData) {
             let tem_ration = _.cloneDeep(rationData);
             //删除旧数据
+            delete tem_ration._id;
             delete tem_ration.fees;
             delete tem_ration.feesIndex;
             delete tem_ration.ration_gljs;
@@ -345,6 +447,7 @@ let BlockController = {
         function createBillsData(billsData) { //ID、重新生成code
             let temData = _.cloneDeep(billsData);
             //删除旧数据
+            delete  temData._id;
             delete  temData.fees;
             delete  temData.feesIndex;
             delete  temData.children;
@@ -385,7 +488,6 @@ let BlockController = {
         }
 
     },
-
     calcRationQuantityAndContain : function (billsQuantity,ration) {//计算定额工程量和含量
         let EXPString = ration.quantityEXP+"";
         if(EXPString.indexOf("QDL") != -1){
@@ -411,8 +513,7 @@ let BlockController = {
             ration.contain = tem_contain;
         }
     },
-
-   newFormatCode : function (stdCode, filterCode) {
+    newFormatCode : function (stdCode, filterCode) {
         let matchs = this.sameStdCode(stdCode, filterCode);
         let format = function (Number) {
             let s = Number + '';
@@ -438,7 +539,6 @@ let BlockController = {
         return matchs;
     },
 
-
     removeBlock:function () {
         removeLocalCache('project_block');
     }

+ 8 - 1
web/building_saas/main/js/models/bills.js

@@ -112,7 +112,14 @@ var Bills = {
             // datas load to Tree
             this.tree.loadDatas(this.datas);
         };
-
+        bills.prototype.addDatasToList = function (new_datas) {
+            let me = this;
+            if(me.datas && Array.isArray(me.datas)){
+                for(let d of new_datas){
+                    me.datas.push(d);
+                }
+            }
+        };
         bills.prototype.setMaxID = function (ID) {
             this.tree.maxNodeID(ID);
         };

+ 15 - 8
web/building_saas/main/js/models/calc_program.js

@@ -797,35 +797,42 @@ let analyzer = {
         let expr = me.standard(dispExpr);
         let invalidChars = /[^0-9\u4e00-\u9fa5\+\-\*\/\(\)\.\[\]FL%]/g;
         if (invalidChars.test(expr)){
-            hintBox.infoBox('系数提示','表达式中含有无效的字符!',1);
+            hintBox.infoBox('错误提示',`表达式中含有${hintBox.font('无效字符')}!`,1);
             return false;
         };
 
+        let i = expr.search(/\df/ig);   // 4F3
+        let j = expr.search(/\d\[/ig);  // 4[定额基价人工费]
+        if (i > -1 || j > -1){
+            hintBox.infoBox('错误提示', `表达式中${hintBox.font('缺少运算符')}!`, 1);
+            return false;
+        }
+
         let pattCn = new RegExp(/[\u4E00-\u9FA5]+/gi);
         let arrCn = expr.match(pattCn);
         let pattBase = new RegExp(/\[[\u4E00-\u9FA5]+\]/gi);
         let arrBase = expr.match(pattBase);
         if (arrCn && !arrBase){
-            hintBox.infoBox('系统提示', '定额基数必须用中括号[]括起来!', 1);
+            hintBox.infoBox('错误提示', `定额基数必须用中括号${hintBox.font('[]')}括起来!`, 1);
             return false;
         };
         if (arrCn && arrBase && (arrCn.length != arrBase.length)){
             for (let cn of arrCn){
                 let tempBase = `[${cn}]`;
                   if (!arrBase.includes(tempBase)){
-                      hintBox.infoBox('系统提示', `定额基数“${cn}”必须用中括号[]括起来!`, 1);
+                      hintBox.infoBox('错误提示', `定额基数“${hintBox.font(cn)}”必须用中括号${hintBox.font('[]')}括起来!`, 1);
                       return false;
                   }
             };
             // 这里要加一个保险。因为上面的 for 循环在“主材费 + [主材费]” 情况下有Bug
-            hintBox.infoBox('系统提示', '定额基数必须用中括号[]括起来!', 1);
+            hintBox.infoBox('错误提示', `定额基数必须用中括号${hintBox.font('[]')}括起来!`, 1);
             return false;
         };
         if (arrBase){
             for (let base of arrBase){
                 let baseName = base.slice(1, -1);
                 if (!rationCalcBases[baseName]){
-                    hintBox.infoBox('系统提示', '定额基数 [' + baseName + '] 末定义!', 1);
+                    hintBox.infoBox('错误提示', `定额基数${hintBox.font('[' +baseName + ']')}末定义!`, 1);
                     return false;
                 }
             };
@@ -836,18 +843,18 @@ let analyzer = {
             let num = F.slice(1);
             if (num > template.calcItems.length){
                 let s = hintBox.font('F'+num);
-                hintBox.infoBox('系统提示', `表达式中 “${s}” 行号引用错误!`, 1);
+                hintBox.infoBox('错误提示', `表达式中 “${hintBox.font(s)}” 行号引用错误!`, 1);
                 return false;
             };
         };
 
         let expression = me.getExpression(expr, template);
         if (me.isCycleCalc(expression, itemID, template)){
-            hintBox.infoBox('系统提示', '表达式中有循环计算!', 1);
+            hintBox.infoBox('错误提示', `表达式中有${hintBox.font('循环计算')}!`, 1);
             return false;
         };
         if (!testValue(expression)){
-            hintBox.infoBox('系统提示', '表达式语法错误!', 1);
+            hintBox.infoBox('错误提示', `表达式中有${hintBox.font('语法错误')}!`, 1);
             return false;
         };
 

+ 4 - 4
web/building_saas/main/js/models/project_glj.js

@@ -738,7 +738,7 @@ ProjectGLJ.prototype.getQuantityPerGLJ = function (ration_glj_list,rations,ratio
     let mixRatioMap = this.datas.mixRatioMap;
     let q_decimal = getDecimal("glj.quantity");
     let result={};
-    let quantitySum=0;//工料机汇总消耗量
+    let quantity_sum=0;//工料机汇总消耗量
     let sum = 0;//分部分项总消耗量
     let tech_sum = 0;//技术措施总消耗量
     for(let rg of ration_glj_list){
@@ -749,7 +749,7 @@ ProjectGLJ.prototype.getQuantityPerGLJ = function (ration_glj_list,rations,ratio
                 continue;
             }
             let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal);
-            quantitySum = scMathUtil.roundForObj(quantitySum+total,q_decimal);
+            quantity_sum = scMathUtil.roundForObj(quantity_sum+total,q_decimal);
             if(_.includes(billIDs,rg.billsItemID)){//计算分部分项
                 sum = scMathUtil.roundForObj(sum+total,q_decimal);
             }
@@ -761,7 +761,7 @@ ProjectGLJ.prototype.getQuantityPerGLJ = function (ration_glj_list,rations,ratio
         if(ra.type == rationType.gljRation&&ra.projectGLJID===pglj.id){
             let r_quantity = scMathUtil.roundForObj(ra.quantity,q_decimal);
             r_quantity = r_quantity?r_quantity:0;
-            quantitySum = scMathUtil.roundForObj(quantitySum+r_quantity,q_decimal);
+            quantity_sum = scMathUtil.roundForObj(quantity_sum+r_quantity,q_decimal);
             if(_.includes(billIDs,ra.billsItemID)){//计算分部分项
                 sum = scMathUtil.roundForObj(sum+r_quantity,q_decimal);
             }
@@ -773,6 +773,6 @@ ProjectGLJ.prototype.getQuantityPerGLJ = function (ration_glj_list,rations,ratio
     }
     result.subdivisionQuantity = sum;
     result.techQuantity = tech_sum;
-    result.quantity = quantitySum;
+    result.quantity = quantity_sum;
     return result;
 } 

+ 10 - 1
web/building_saas/main/js/models/quantity_detail.js

@@ -480,7 +480,16 @@ var quantity_detail = {
         quantity_detail.prototype.getDetailByBillID = function (billID) {
             return _.filter(this.datas,{'billID':billID});
         };
-
+        quantity_detail.prototype.addDatasToList = function (datas) {
+            let  me = projectObj.project.quantity_detail;
+            if(datas&&datas.length>0){
+                if (me.datas && Array.isArray(me.datas)) {
+                    me.datas = me.datas.concat(datas);
+                } else {
+                    me.datas = datas;
+                }
+            }
+        };
         quantity_detail.prototype.deleteByRation = function(ration){
             var detail_list = this.datas;
             _.remove(detail_list,{'rationID':ration.ID});

+ 10 - 1
web/building_saas/main/js/models/ration.js

@@ -68,7 +68,16 @@ var Ration = {
         ration.prototype.setMaxID = function (ID) {
             this.maxRationID(ID);
         }
-
+        ration.prototype.addDatasToList = function (new_datas) {
+            let me = this;
+            if(me.datas && Array.isArray(me.datas)){
+                for(let d of new_datas){
+                    me.datas.push(d);
+                }
+            }else {
+                me.datas = new_datas;
+            }
+        };
         // refresh after update
         ration.prototype.doAfterUpdate = function(err, data){
             if(data.stateRefresh){

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

@@ -780,25 +780,6 @@ var gljOprObj = {
         }
 
     },
-
-    testBatchUpdate:function () {
-        let me=gljOprObj;
-        let temA = [1,2,3];
-        me.b(1,a);
-
-
-        function a(v) {
-            let index = temA.indexOf(v);
-            if(index < temA.length-1){
-               me.b(temA[index+1],a)
-            }
-        }
-
-    },
-    b:function (g,callback) {
-        console.log(g);
-        callback(g);
-    },
     generateHtmlString: function () {
 //        return "<div id='edit'><div>";