Просмотр исходного кода

1.导出接口时,在我们软件中的基数无法找到映射代号的情况下,导出招标、控制价时,基数为空;导出投标时,基数=综合合价/费率
2.建筑计价 导入重庆招标文件,“工程造价”行的公式不应丢失

zhongzewei 6 лет назад
Родитель
Сommit
07cb5b5ef7

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

@@ -1203,7 +1203,7 @@ const XMLStandard = (function () {
                     code: node.data.code,
                     rowCode: `F${serialNo}`,
                     name: node.data.name,
-                    calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
+                    calcBase: _util.transformCalcBase(exportKind, detail, node, {CalcBaseMap, FlagCalcBaseMap}),
                     feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
                     fees: node.data.fees,
                     feeType: FEE_TYPE[flag] || FEE_TYPE['0'],
@@ -1517,7 +1517,7 @@ const XMLStandard = (function () {
                             row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
                             code: node.data.code,
                             name: node.data.name,
-                            calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
+                            calcBase: _util.transformCalcBase(exportKind, detail, node, {CalcBaseMap, FlagCalcBaseMap}),
                             feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
                             fees: node.data.fees,
                             remark: node.data.remark,
@@ -1790,7 +1790,7 @@ const XMLStandard = (function () {
                         row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
                         code: node.data.code,
                         name: node.data.name,
-                        calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
+                        calcBase: _util.transformCalcBase(exportKind, detail, node, {CalcBaseMap, FlagCalcBaseMap}),
                         feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
                         commonTotalFee: totalFee,
                         notSummary: belongFlag && belongFlag === fixedFlag.MATERIAL_PROVISIONAL,   //不计入合价,只有材料(工程设备)暂估价固定节点
@@ -1841,7 +1841,7 @@ const XMLStandard = (function () {
                     code: node.data.code,
                     rowCode: `F${serialNo}`,
                     name: node.data.name,
-                    calcBase: _util.transformCalcBase(detail, node, {CalcBaseMap, FlagCalcBaseMap}),
+                    calcBase: _util.transformCalcBase(exportKind, detail, node, {CalcBaseMap, FlagCalcBaseMap}),
                     feeRate: _util.hasValue(node.data.feeRate) ? node.data.feeRate : 100,
                     fees: node.data.fees,
                     feeType: feeType,

+ 16 - 7
web/building_saas/main/js/models/exportStdInterfaceBase.js

@@ -493,11 +493,11 @@ const XML_EXPORT_BASE = (() => {
         return await entryFunc(userID, exportKind, projectData);
     }
 
-    //转换基数表达式
-    //1.有子项,则取固定清单对应基数
-    //2.无子项,有基数,a.优先转换为行代号(不可自身) b.不能转换为行代号则找对应字典
-    //3.基数中有无法转换的,设为金额
-    function transformCalcBase(tenderDetail, node, {CalcBaseMap, FlagCalcBaseMap}) {
+    // 转换基数表达式
+    // 1.有子项,则取固定清单对应基数
+    // 2.无子项,有基数,a.优先转换为行代号(不可自身) b.不能转换为行代号则找对应字典
+    // 3.基数中有无法转换的,根据导出类型决定
+    function transformCalcBase(exportKind, tenderDetail, node, {CalcBaseMap, FlagCalcBaseMap}) {
         let expr = node.data.calcBase || '';
         if (node.children.length) {
             let flag = node.getFlag();
@@ -537,9 +537,18 @@ const XML_EXPORT_BASE = (() => {
                 }
                 expr = expr.replace(new RegExp(base, 'g'), rowCode);
             });
-            //不合法 返回金额
+            //不合法
+            // 在我们软件中的基数无法找到映射代号的情况下
+            // 导出招标、控制价时,基数为空
+            // 导出投标时,基数=综合合价/费率
             if (illegal) {
-                return getFee(node.data.fees, 'common.totalFee');
+                if (exportKind === EXPORT_KIND.Bid || exportKind === EXPORT_KIND.Control) {
+                    return '';
+                } else {
+                    let totalFee = getFee(node.data.fees, 'common.totalFee'),
+                        feeRate = node.data.feeRate;
+                    return feeRate && !isNaN(feeRate) ? scMathUtil.roundTo(totalFee/feeRate, -2) : totalFee
+                }
             }
             return expr;
         }

+ 16 - 6
web/building_saas/main/js/models/importStandardInterface.js

@@ -379,9 +379,10 @@ const ImportXML = (() => {
                 let obj = {
                     rowCode: getValue(itemSrc, ['_行代号']),
                     name: getValue(itemSrc, ['_项目名称']),
+                    calcBase: getValue(itemSrc, ['_计算基础表达式'])
                 };
                 if (importFileKind === FileKind.tender) {
-                    obj.calcBase = getValue(itemSrc, ['_计算基础表达式']);
+                    // obj.calcBase = getValue(itemSrc, ['_计算基础表达式']);
                     obj.feeRate = getValue(itemSrc, ['_费率']);
                     obj.fees = [{fieldName: 'common', totalFee: getValue(itemSrc, ['_金额']) || '0'}];
                 }
@@ -1023,6 +1024,7 @@ const ImportXML = (() => {
                         name: feeBills.name,
                         rowCode: feeBills.rowCode,
                         feeRate: feeBills.feeRate,
+                        calcBase: feeBills.calcBase,
                     };
                     if (importFileKind === FileKind.tender) {
                         //subTaxData.rowCode = feeBills.rowCode;
@@ -1033,7 +1035,7 @@ const ImportXML = (() => {
                     }
                     needfulTemplate.push(subTaxData);
                     preSubTax = subTaxData;
-                } else {    //匹配固定项
+                } else {
                     let isMatched = false;
                     //匹配固定项
                     for (let match of toMatches) {
@@ -1061,7 +1063,13 @@ const ImportXML = (() => {
                             continue;
                         }
                         isMatched = true;
-                        findBills.calcBase = feeBills.calcBase;
+                        // 文件有基数则导入基数,没有则用模板的基数
+                        if (feeBills.calcBase) {
+                            findBills.calcBase = feeBills.calcBase;
+                        } else {
+                            // 用了模板的基数,基数无视基数验证
+                            findBills.ignoreValidator = true;
+                        }
                         findBills.feeRate = feeBills.feeRate;
                         findBills.rowCode = feeBills.rowCode;
                         //后台配置的feeRateID优先级比feeRate高,导入数据有费率值时,需要清空这个配置
@@ -1161,7 +1169,9 @@ const ImportXML = (() => {
             function updateZZCSItem(org, tar) {
                 for(let [k, v] of Object.entries(tar)) {
                     // 如果匹配到的清单自身已有固定ID,不更新固定ID
-                    if (k === 'flags' && Array.isArray(tar.flags) && tar.flags.length) {
+                    // 如果目标清单没有基数,模板清单基数不更新
+                    if ((k === 'flags' && Array.isArray(tar.flags) && tar.flags.length) ||
+                        (k === 'calcBase' && !tar.calcBase)) {
                         continue;
                     }
                     org[k] = v;
@@ -1291,7 +1301,7 @@ const ImportXML = (() => {
             JSCS_JXF: '{技术措施项目定额施工机具使用费}',
             JSCS_ZCF: '{技术措施项目主材费}',
             JSCS_GR: '{技术措施项目人工工日}',
-            JZMZ: '{建筑面积}',
+            JZMJ: '{建筑面积}',
             RCJJC: '{人材机价差}',
             RGJC: '{人工价差}',
             CLJC: '{材料价差}',
@@ -1325,7 +1335,7 @@ const ImportXML = (() => {
                 }
             });
             for (let bills of billsData) {
-                if (!bills.calcBase) {
+                if (!bills.calcBase || bills.ignoreValidator) {
                     continue;
                 }
                 let sub = billsData.find(data => data.ParentID === bills.ID);

+ 2 - 2
web/building_saas/pm/js/pm_import.js

@@ -448,7 +448,7 @@ const importView = (() => {
                 let blob = new Blob([JSON.stringify(importData)], {type: 'text/plain;charset=utf-8'});
                 let formData = new FormData();
                 formData.append('file', blob);
-                $.ajax({
+                /*$.ajax({
                     url: '/pm/import/importInterface',
                     type: 'POST',
                     data: formData,
@@ -469,7 +469,7 @@ const importView = (() => {
                         pr.end();
                         throw `与服务器通信发生错误${jqXHR.status} ${jqXHR.statusText}`;
                     }
-                });
+                });*/
             } catch (err) {
                 setTimeout(function () {
                     STATE.importing = false;