ソースを参照

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

TonyKang 6 年 前
コミット
950d97edf2

+ 6 - 3
modules/complementary_glj_lib/models/gljModel.js

@@ -48,7 +48,8 @@ class GljDao {
 
 
     async getQueryByType ({userID, compilationId, gljLibId, type, replace, location, classList, search}) {
     async getQueryByType ({userID, compilationId, gljLibId, type, replace, location, classList, search}) {
         let model = null,
         let model = null,
-            query = {};
+            query = {},
+            matchLocation = false;
         if (type === libType.stdGLJ) {
         if (type === libType.stdGLJ) {
             model = stdGljModel;
             model = stdGljModel;
             query.repositoryId = gljLibId;
             query.repositoryId = gljLibId;
@@ -68,6 +69,7 @@ class GljDao {
             const replaceData = await model.findOne(replaceQuery);
             const replaceData = await model.findOne(replaceQuery);
             if (replaceData) {
             if (replaceData) {
                 query.gljClass = replaceData.gljClass;
                 query.gljClass = replaceData.gljClass;
+                matchLocation = true;
             }
             }
         }
         }
         // 替换过滤类型
         // 替换过滤类型
@@ -82,7 +84,8 @@ class GljDao {
         }
         }
         return {
         return {
             model,
             model,
-            query
+            query,
+            matchLocation
         };
         };
     }
     }
 
 
@@ -90,7 +93,7 @@ class GljDao {
         const queryData = await this.getQueryByType(condition);
         const queryData = await this.getQueryByType(condition);
         // 定位(替换初始化)
         // 定位(替换初始化)
         // 替换触发的人材机选择界面,只有在初始化时才定位,其他操作下是正常的分页
         // 替换触发的人材机选择界面,只有在初始化时才定位,其他操作下是正常的分页
-        if (condition.location) {
+        if (queryData.matchLocation) {
             // 返回的数据,为编码小于等于替换的编码,再加附加条数
             // 返回的数据,为编码小于等于替换的编码,再加附加条数
             const limitQuery = _.cloneDeep(queryData.query);
             const limitQuery = _.cloneDeep(queryData.query);
             limitQuery.code = {$lte: condition.replace.code};
             limitQuery.code = {$lte: condition.replace.code};

+ 11 - 3
modules/pm/facade/pm_facade.js

@@ -714,7 +714,15 @@ async function getIndexReportData(prj_id, filters) {
 function getSortedDataByTree(data) {
 function getSortedDataByTree(data) {
     // NextSiblingID-数据映射
     // NextSiblingID-数据映射
     const mapping = {};
     const mapping = {};
-    data.forEach(item => mapping[item.NextSiblingID] = item);
+    data.forEach(item => {
+        // 错误数据兼容处理
+        // 由于之前的导入建设项目,会导致最后的一个项目的NextSiblingID为空,为非正确的-1
+        // 因此把项目中NextSibling为空的数据设置为NextSiblingID为-1
+        if (!item.NextSiblingID) {
+            item.NextSiblingID = -1;
+        }
+        mapping[item.NextSiblingID] = item;
+    });
     let lastItem = data.find(item => +item.NextSiblingID === -1);
     let lastItem = data.find(item => +item.NextSiblingID === -1);
     if (!lastItem) {
     if (!lastItem) {
         return data;
         return data;
@@ -752,7 +760,7 @@ async function getSummaryInfoByTender(tenderID, summaryType) {
     let summaryInfo = await getSummaryInfo([project.ID]);
     let summaryInfo = await getSummaryInfo([project.ID]);
     if(summaryType === projectType.engineering){ // 汇总到单项工程级别
     if(summaryType === projectType.engineering){ // 汇总到单项工程级别
         parent = engineering;
         parent = engineering;
-        let tenders = await projectModel.find({ParentID: engineering.ID, $or: notDeleted});
+        let tenders = await projectModel.find({ParentID: engineering.ID, $or: notDeleted}).lean();
         tenders = getSortedDataByTree(tenders);
         tenders = getSortedDataByTree(tenders);
         for(let t of tenders){
         for(let t of tenders){
             if(summaryInfo[t.ID]){
             if(summaryInfo[t.ID]){
@@ -762,7 +770,7 @@ async function getSummaryInfoByTender(tenderID, summaryType) {
         }
         }
     } else { // 汇总到建设项目级别
     } else { // 汇总到建设项目级别
         parent = project;
         parent = project;
-        let engs = await projectModel.find({ParentID: project.ID, $or: notDeleted});
+        let engs = await projectModel.find({ParentID: project.ID, $or: notDeleted}).lean();
         engs = getSortedDataByTree(engs);
         engs = getSortedDataByTree(engs);
         for(let e of engs){
         for(let e of engs){
             if(summaryInfo[e.ID]){
             if(summaryInfo[e.ID]){

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

@@ -793,7 +793,8 @@ const XMLStandard = (function () {
         //如果是“投标”,且采用了信息价差额法,则导出;如果采用了指数法,则导出,但数量、风险系数、基准单价、投标单价,都取0。
         //如果是“投标”,且采用了信息价差额法,则导出;如果采用了指数法,则导出,但数量、风险系数、基准单价、投标单价,都取0。
         function DifferentiaGljDetail(adjustType, source) {
         function DifferentiaGljDetail(adjustType, source) {
             let attrs = [
             let attrs = [
-                {name: '关联材料号', value: getGljCode(source.id), minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
+                //getGljCode(source.id)
+                {name: '关联材料号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '单位', value: source.unit, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
@@ -819,7 +820,8 @@ const XMLStandard = (function () {
         //如果是“投标”,且采用了指数法,则导出;如果采用了信息价差额法,则导出,但定值权重A取1,变值权重B、基本价格指数、现行价格指数取0。
         //如果是“投标”,且采用了指数法,则导出;如果采用了信息价差额法,则导出,但定值权重A取1,变值权重B、基本价格指数、现行价格指数取0。
         function ExponentialGljDetail(adjustType, source) {
         function ExponentialGljDetail(adjustType, source) {
             let attrs = [
             let attrs = [
-                {name: '关联材料号', value: getGljCode(source.id), minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
+                // getGljCode(source.id)
+                {name: '关联材料号', value: source.code, minLen: 1, maxLen: 20, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '名称', value: source.name, minLen: 1, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE, required: true},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '规格', value: source.specs, maxLen: 255, whiteSpace: _config.WHITE_SPACE.COLLAPSE},
                 {name: '变值权重B', value: adjustType === _config.ADJUST_TYPE.coe ? source.varWeight : '0', type: _config.TYPE.DECIMAL, required: true},
                 {name: '变值权重B', value: adjustType === _config.ADJUST_TYPE.coe ? source.varWeight : '0', type: _config.TYPE.DECIMAL, required: true},
@@ -1393,8 +1395,8 @@ const XMLStandard = (function () {
                         continue;
                         continue;
                     }
                     }
                     let gljSource = {
                     let gljSource = {
-                        //code: rGlj.code,
-                        code: getGljCode(rGlj.projectGLJID),
+                        code: rGlj.code,
+                        //code: getGljCode(rGlj.projectGLJID),
                         quantity: rGlj.quantity,
                         quantity: rGlj.quantity,
                         totalQuantity: gljUtil.getTotalQuantity(rGlj,  rationData, decimal.glj.quantity, decimal.ration.quantity)
                         totalQuantity: gljUtil.getTotalQuantity(rGlj,  rationData, decimal.glj.quantity, decimal.ration.quantity)
                     };
                     };
@@ -1948,8 +1950,8 @@ const XMLStandard = (function () {
                         feeType = '4';
                         feeType = '4';
                     }
                     }
                     let gljSource = {
                     let gljSource = {
-                        //code: glj.code,
-                        code: getGljCode(glj.id),
+                        code: glj.code,
+                        //code: getGljCode(glj.id),
                         name: glj.name,
                         name: glj.name,
                         specs: glj.specs,
                         specs: glj.specs,
                         unit: glj.unit,
                         unit: glj.unit,
@@ -1982,7 +1984,11 @@ const XMLStandard = (function () {
                         for (let ratio of ratioData) {
                         for (let ratio of ratioData) {
                             let pGLJ = detail.projectGLJ.datas.gljList.find(d => d.original_code === ratio.code);
                             let pGLJ = detail.projectGLJ.datas.gljList.find(d => d.original_code === ratio.code);
                             if (pGLJ) {
                             if (pGLJ) {
-                                let gljRatio = new GljRatio({code: getGljCode(pGLJ.id), quantity: ratio.consumption});
+                                let gljRatio = new GljRatio({
+                                    code: pGLJ.code,
+                                    //code: getGljCode(pGLJ.id),
+                                    quantity: ratio.consumption
+                                });
                                 gljEle.children.push(gljRatio);
                                 gljEle.children.push(gljRatio);
                             }
                             }
                         }
                         }
@@ -1990,7 +1996,8 @@ const XMLStandard = (function () {
                     gljSummary.children.push(gljEle);
                     gljSummary.children.push(gljEle);
                     gljSource.totalPrice = scMathUtil.roundForObj(gljSource.quantity * gljSource.marketPrice,
                     gljSource.totalPrice = scMathUtil.roundForObj(gljSource.quantity * gljSource.marketPrice,
                         detail.projectInfo.property.decimal.bills.totalPrice);
                         detail.projectInfo.property.decimal.bills.totalPrice);
-                    //评标和暂估材料表下的材料明细中的人材机代码,要求单位工程内唯一,由于人材机汇总也有这个限制,所以这里不再处理
+                    //评标和暂估材料表下的材料明细中的人材机代码,要求单位工程内唯一,由于人材机汇总也有这个限制,所以
+                    // 这里不再处理
                     if (glj.is_eval_material) { //评标
                     if (glj.is_eval_material) { //评标
                         gljSource.serialNo = evalBidSeq++;
                         gljSource.serialNo = evalBidSeq++;
                         evalBidMaterial.children.push(new MaterialDetail('evalBidMaterial', gljSource));
                         evalBidMaterial.children.push(new MaterialDetail('evalBidMaterial', gljSource));