Browse Source

fix: 导入电子招投标文件,大项费用匹配逻辑变更

BUG #3188
vian 4 years ago
parent
commit
b958573ee8

+ 16 - 6
web/building_saas/standard_interface/export/anhui_chizhou.js

@@ -428,6 +428,14 @@ INTERFACE_EXPORT = (() => {
         }
 
         function createZaoJHZB(Bid, ZaoJHZB) {
+            const flagToLB = {
+                [fixedFlag.ONE_SEVEN_BILLS]: '1',
+                [fixedFlag.PROVISIONAL_TOTAL]: '2',
+                [fixedFlag.BILLS_TOTAL_WT_PROV]: '3',
+                [fixedFlag.DAYWORK_LABOR]: '4',
+                [fixedFlag.PROVISIONAL]: '5',
+                [fixedFlag.TOTAL_COST]: '6',
+            };
             const map_ZC_LB = [
                 {reg: /(第?100章?至第?700章?)/, zc: '', lb: '1'},
                 {reg: /已包含在清单合计中的材料/, zc: '', lb: '2'},
@@ -444,10 +452,13 @@ INTERFACE_EXPORT = (() => {
                 {reg: /第700章/, zc: '700', lb: '17'}
             ]
 
-            function getZCLB(name, kind){
-                let rst = '';
+            function getZCLB(flag, name, kind){
+                let rst = kind === 2 ? flagToLB[flag] || '' : '';
+                if (rst) {
+                    return rst;
+                }
+                const trimName = (name || '').replace(/\s/g, '');
                 for (let i = 0; i < map_ZC_LB.length; i++){
-                    const trimName = (name || '').replace(/\s/g, '');
                     if (map_ZC_LB[i].reg.test(trimName)){
                         if (kind == 1)
                             rst = map_ZC_LB[i].zc
@@ -465,7 +476,6 @@ INTERFACE_EXPORT = (() => {
                 else
                     return (node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : 0);
             }
-            debugger;
             let nodes = [vTree.roots[0], ...vTree.roots[0].children, ...vTree.roots.slice(1)];
 
             let hzmxNo = 0;
@@ -474,10 +484,10 @@ INTERFACE_EXPORT = (() => {
                 hzmxNo++;
                 let attrs = [
                     { name: '序号', value: hzmxNo },
-                    { name: '章次', value: getZCLB(node.data.name, 1) },
+                    { name: '章次', value: getZCLB(node.getFlag(), node.data.name, 1) },
                     { name: '名称', value: node.data.name },
                     { name: '金额', value: getJE(node) },
-                    { name: '类别', value: getZCLB(node.data.name, 2) },
+                    { name: '类别', value: getZCLB(node.getFlag(), node.data.name, 2) },
                     { name: '备注', value: node.data.remark }
                 ];
                 const zaoJHZMX = new CreateNode('造价汇总明细', attrs);

+ 3 - 2
web/building_saas/standard_interface/import/anhui_chizhou.js

@@ -83,13 +83,14 @@ INTERFACE_IMPORT = (() => {
         .filter(item => !getValue(item, ['_章次']))
         .map(item => ({
           name: getValue(item, ['_名称']),
-          remark: getValue(item, ['_备注'])
+          remark: getValue(item, ['_备注']),
+          titleType: getValue(item, ['_类别'])
         }));
       let oneSevenBills;
       let dayWorkBills;
       roots.forEach(item => {
         const simpleName = item.name ? item.name.replace(/\s/g, '') : '';
-        if (/100章至第700章|100章至700章/.test(simpleName)) {
+        if (item.titleType === '1' || /100章至第700章|100章至700章/.test(simpleName)) {
           oneSevenBills = item;
         } else if (/计日工合计/.test(simpleName)) {
           dayWorkBills = item;

+ 3 - 1
web/building_saas/standard_interface/import/anhui_maanshan.js

@@ -184,7 +184,9 @@ INTERFACE_IMPORT = (() => {
         if (curField === qdbt) {
           item.code = getValue(src, ['_Bm']);
           item.rowCode = getValue(src, ['_Code']); // 注意:行号标记,用于后续(通用处理)清单基数进行转换(行引用转换为ID引用) 
-          if (getValue(src, ['_Lb']) === '5') { // 暂列金额才导入计算基数
+          const titleType = getValue(src, ['_Lb']);
+          item.titleType = titleType;
+          if (titleType === '5') { // 暂列金额才导入计算基数
             item.calcBase = getValue(src, ['_Jsgs']);
           }
         } else if (curField === qdmx) {

+ 17 - 7
web/building_saas/standard_interface/import/base.js

@@ -228,6 +228,16 @@ const INTERFACE_EXPORT_BASE = (() => {
 
   const { fixedFlag, BillType } = window.commonConstants;
 
+  // 标题类别 - flag 映射
+  const titleTypeToFlag = {
+    1: fixedFlag.ONE_SEVEN_BILLS,
+    2: fixedFlag.PROVISIONAL_TOTAL,
+    3: fixedFlag.BILLS_TOTAL_WT_PROV,
+    4: fixedFlag.DAYWORK_LABOR,
+    5: fixedFlag.PROVISIONAL,
+    6: fixedFlag.TOTAL_COST,
+  }
+
   /**
    * 将提取出来的清单合并进清单模板
    * @param {Array} source - 从xml提取出来的清单
@@ -241,21 +251,21 @@ const INTERFACE_EXPORT_BASE = (() => {
       if (!parent) {
         bills.seq = index;
       }
-
       const simpleName = bills.name ? bills.name.replace(/\s/g, '') : '';
+      const titleType = bills.titleType || '0';
       let matched;
       if (!parent) {
-        if (/100章.*700章|100章.*900章/.test(simpleName)) {
+        if (titleTypeToFlag[titleType] === fixedFlag.ONE_SEVEN_BILLS || /100章.*700章|100章.*900章/.test(simpleName)) {
           matched = target.find(bills => getFlag(bills) === fixedFlag.ONE_SEVEN_BILLS);
-        } else if (/包含在清单合计中的材料、工程设备、专业工程暂估/.test(simpleName)) {
+        } else if (titleTypeToFlag[titleType] === fixedFlag.PROVISIONAL_TOTAL || /包含在清单合计中的材料、工程设备、专业工程暂估/.test(simpleName)) {
           matched = target.find(bills => getFlag(bills) === fixedFlag.PROVISIONAL_TOTAL);
-        } else if (/清单合计减去材料、工程设备、专业工程暂估价/.test(simpleName)) {
+        } else if (titleTypeToFlag[titleType] === fixedFlag.BILLS_TOTAL_WT_PROV || /清单合计减去材料、工程设备、专业工程暂估价/.test(simpleName)) {
           matched = target.find(bills => getFlag(bills) === fixedFlag.BILLS_TOTAL_WT_PROV);
-        } else if (/计日工合计/.test(simpleName)) {
+        } else if (titleTypeToFlag[titleType] === fixedFlag.DAYWORK_LABOR || /计日工合计/.test(simpleName)) {
           matched = target.find(bills => getFlag(bills) === fixedFlag.DAYWORK_LABOR);
-        } else if (/暂列金额[((]不含/.test(simpleName)) {
+        } else if (titleTypeToFlag[titleType] === fixedFlag.PROVISIONAL || /暂列金额[((]不含/.test(simpleName)) {
           matched = target.find(bills => getFlag(bills) === fixedFlag.PROVISIONAL);
-        } else if (/报价/.test(simpleName)) {
+        } else if (titleTypeToFlag[titleType] === fixedFlag.TOTAL_COST || /报价/.test(simpleName)) {
           matched = target.find(bills => getFlag(bills) === fixedFlag.TOTAL_COST);
         }
       } else {