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

feat: 安徽导入导出接口,计算基数处理需求变更

vian 5 лет назад
Родитель
Сommit
1e55c021cb

+ 25 - 11
web/building_saas/standard_interface/export/anhui_maanshan.js

@@ -317,8 +317,14 @@ INTERFACE_EXPORT = (() => {
     // 清单标题 造价书的第一层数据。
     function QdBt(node, allNodes) {
       const row = node.row();
-      const fee = isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee')
-      const calcBase = node.data.calcBase ? cbParser.toFExpr(node.data.calcBase, allNodes) : '';
+      const orgFee = getFee(node.data.fees, 'common.tenderTotalFee');
+      const fee = isBidInvitation ? '0' : orgFee;
+      const titleType = BillsTitleType[node.getFlag()];
+      const calcBase = titleType === '5'
+        ? orgFee
+        : node.data.calcBase
+          ? cbParser.toFExpr(node.data.calcBase, allNodes)
+          : '';
       const attrs = [
         { name: 'Xh', value: row, type: TYPE.INT }, // 序号
         { name: 'Bm', value: node.data.code }, // 编码
@@ -326,15 +332,23 @@ INTERFACE_EXPORT = (() => {
         { name: 'Je', value: fee, type: TYPE.DECIMAL }, // 金额
         { name: 'Code', value: `F${row}` }, // 行引用
         { name: 'Jsgs', value: calcBase }, // 计算基数
-        { name: 'Lb', value: BillsTitleType[node.getFlag()], type: TYPE.INT }, // 类别
+        { name: 'Lb', value: titleType, type: TYPE.INT }, // 类别
         { name: 'Bz', value: node.data.remark }, // 备注
       ];
       Element.call(this, 'QdBt', attrs);
     }
 
     // 清单明细 (只有100-700章清单标题输出)
-    function QdMx(node) {
+    function QdMx(node, allNodes) {
       const row = node.row();
+      const iszg = node.data.specialProvisional === '专业工程';
+      const calcBaseBeFee = iszg || node.getFlag() === fixedFlag.PROVISIONAL;
+      const orgFee = getFee(node.data.fees, 'common.tenderTotalFee');
+      const calcBase = calcBaseBeFee
+        ? orgFee
+        : node.data.calcBase
+          ? cbParser.toFExpr(node.data.calcBase, allNodes)
+          : '';
       const attrs = [
         { name: 'Xh', value: row, type: TYPE.INT }, // 序号
         { name: 'Qdbm', value: node.data.code, minLen: 1 }, // 编码
@@ -352,11 +366,11 @@ INTERFACE_EXPORT = (() => {
         { name: 'Lr', value: isBidInvitation ? '0' : getFee(node.data.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL }, // 利润
         { name: 'Sj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL }, // 税金
         { name: 'Zhdj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderUnitFee'), type: TYPE.DECIMAL }, // 单价
-        { name: 'Zhhj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 合价
+        { name: 'Zhhj', value: isBidInvitation ? '0' : orgFee, type: TYPE.DECIMAL }, // 合价
         { name: 'Zgj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'estimate.tenderTotalFee'), type: TYPE.DECIMAL }, // 暂估价
-        { name: 'Iszg', value: node.data.specialProvisional === '专业工程', type: TYPE.BOOL }, // 是否暂定 如果专项暂定列选择了“专业工程”,则输出true,否则是false。
+        { name: 'Iszg', value: iszg, type: TYPE.BOOL }, // 是否暂定 如果专项暂定列选择了“专业工程”,则输出true,否则是false。
         { name: 'Djfx', value: !!node.data.unitPriceAnalysis, type: TYPE.BOOL }, // 单价分析
-        { name: 'Jsgs', value: node.data.calcBase }, // 计算基数
+        { name: 'Jsgs', value: calcBase }, // 计算基数
         { name: 'Bl', value: '' }, // 变量
         { name: 'Bz', value: node.data.remark }, // 备注
       ];
@@ -655,24 +669,24 @@ INTERFACE_EXPORT = (() => {
         const flag = node.getFlag();
         const qdbt = new QdBt(node, mainTree.items);
         if (flag === fixedFlag.ONE_SEVEN_BILLS) { // 100章到700章清单需要输出详细数据
-          qdbt.children.push(...setupSubBills(node.children));
+          qdbt.children.push(...setupSubBills(node.children, mainTree.items));
         } else if (flag === fixedFlag.DAYWORK_LABOR) {
           qdbt.children.push(setupDaywork(node.children));
         }
         qdxm.children.push(qdbt);
       });
 
-      function setupSubBills(nodes) {
+      function setupSubBills(nodes, allNodes) {
         const rst = [];
         nodes.forEach(node => {
-          const qdmx = new QdMx(node);
+          const qdmx = new QdMx(node, allNodes);
           rst.push(qdmx);
           const subIsRations = node.children.length && !node.source.children.length;
           if (subIsRations) {
             qdmx.children.push(...setupRations(node.children));
             qdmx.children.push(...setupBillsContain(node.data));
           } else {
-            qdmx.children.push(...setupSubBills(node.children));
+            qdmx.children.push(...setupSubBills(node.children, allNodes));
           }
         });
         return rst;

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

@@ -180,14 +180,18 @@ INTERFACE_IMPORT = (() => {
         if (curField === qdbt) {
           item.code = getValue(src, ['_Bm']);
           item.rowCode = getValue(src, ['_Code']); // 注意:行号标记,用于后续(通用处理)清单基数进行转换(行引用转换为ID引用) 
-          item.calcBase = getValue(src, ['_Jsgs']);
+          if (getValue(src, ['_Lb']) === '5') { // 暂列金额才导入计算基数
+            item.calcBase = getValue(src, ['_Jsgs']);
+          }
         } else if (curField === qdmx) {
           item.code = getValue(src, ['_Qdbm']);
           item.unit = getValue(src, ['_Dw']);
           item.quantity = getValue(src, ['_Sl']);
-          item.calcBase = getValue(src, ['_Jsgs']);
-          item.specialProvisional = getBool(src, ['_Iszg']) ? '专业工程' : ''; // 是否暂定
           item.unitPriceAnalysis = +getBool(src, ['_Djfx']); // 单价分析
+          item.specialProvisional = getBool(src, ['_Iszg']) ? '专业工程' : ''; // 是否暂定
+          if (item.specialProvisional) {
+            item.calcBase = getValue(src, ['_Jsgs']);
+          }
         }
         return item;
       });