Pārlūkot izejas kodu

feat:安徽-马鞍山导出接口更新

vian 5 gadi atpakaļ
vecāks
revīzija
7f45b28e5b

+ 9 - 0
public/common_constants.js

@@ -157,6 +157,14 @@
         CONTROL: 3 // 控制价
     };
 
+    // 定额类型
+    const RationType = {
+        RATION: 1,
+        VOLUME_PRICE:2,
+        GLJ_RATION: 3,
+        INSTALL: 4,
+    };
+
     return {
         fixedFlag,
         GRANULARITY,
@@ -170,5 +178,6 @@
         PageTarget,
         BlankType,
         EXPORT_KIND,
+        RationType,
     };
 })

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

@@ -141,10 +141,10 @@ const volumePriceMaps = {
     5: "量设"
 };
 const rationType = {
-    ration: 1,
-    volumePrice: 2,
-    gljRation: 3,
-    install:4
+    ration: commonConstants.RationType.RATION,
+    volumePrice: commonConstants.RationType.VOLUME_PRICE,
+    gljRation: commonConstants.RationType.GLJ_RATION,
+    install: commonConstants.RationType.INSTALL
 };
 const rationPrefix = { //定额前缀,补/借
     none: '',

+ 383 - 110
web/building_saas/standard_interface/export/anhui_maanshan.js

@@ -30,15 +30,13 @@ INTERFACE_EXPORT = (() => {
         const {
             EXPORT_KIND: { BID_INVITATION, BID_SUBMISSION, CONTROL },
             fixedFlag,
+            SourceType,
+            RationType,
         } = window.commonConstants
 
-        const { isEmptyVal, isDef } = window.commonUtil;
+        const GljType = gljUtil.gljType;
 
-        const czzt = {
-            [BID_INVITATION]: '招标',
-            [BID_SUBMISSION]: '投标',
-            [CONTROL]: '招标控制',
-        };
+        const { isEmptyVal, isDef } = window.commonUtil;
 
         const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
         const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
@@ -48,15 +46,24 @@ INTERFACE_EXPORT = (() => {
 
         // 建设项目基本信息
         function JingJiBiao(projectName, information) {
+            const taxModeMap = {
+                '一般计税': '1',
+                '简易计税': '2',
+            };
+            const czzt = {
+                [BID_INVITATION]: '招标',
+                [BID_SUBMISSION]: '投标',
+                [CONTROL]: '招标控制',
+            };
             const attrs = [
                 { name: 'Xmbh', value: getValueByKey(information, 'projNum') }, // 项目编号
                 { name: 'Xmmc', value: projectName }, // 项目名称
                 { name: 'Bzlx', value: '清单' }, // 项目编制类型
                 { name: 'Jjyj', value: '【18清单】2018部颁清单计价依据' }, // 计价依据
-                { name: 'Xmqzzh', value: getValueByKey(information, '') }, // 项目起止桩号
-                { name: 'Jsdw', value: getValueByKey(information, '') }, // 建设单位
+                { name: 'Xmqzzh', value: getValueByKey(information, 'startAndChainages') }, // 项目起止桩号
+                { name: 'Jsdw', value: getValueByKey(information, 'constructingUnits') }, // 建设单位
                 { name: 'Czzt', value: czzt[exportKind] }, // 操作状态:招标、投标、招标控制,即导出接口时,所选的文件类型
-                { name: 'Jsfs', value: getValueByKey(information, '') || '1', type: TYPE.INT }, // 计税方式,默认1。1=一般计税 2=简易计税
+                { name: 'Jsfs', value: taxModeMap[getValueByKey(information, 'taxMode')] || '1', type: TYPE.INT }, // 计税方式,默认1。1=一般计税 2=简易计税
                 { name: 'Version', value: '1.0' },
             ];
             Element.call(this, 'JingJiBiao', attrs);
@@ -67,14 +74,14 @@ INTERFACE_EXPORT = (() => {
         // 招标信息
         function ZhaoBiaoXx(information) {
             const attrs = [
-                { name: 'Zbr', value: getValueByKey(information, '') }, // 招标人
-                { name: 'Zxr', value: getValueByKey(information, '') }, // 造价咨询人
-                { name: 'ZbrDb', value: getValueByKey(information, '') }, // 招标人法定代表人或其授权人
-                { name: 'ZxrDb', value: getValueByKey(information, '') }, // 造价咨询人法定代表人或其授权人
-                { name: 'Bzr', value: getValueByKey(information, '') }, // 编制人
-                { name: 'Fhr', value: getValueByKey(information, '') }, // 复核人
-                { name: 'BzTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 编制时间
-                { name: 'FhTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 复核时间
+                { name: 'Zbr', value: getValueByKey(information, 'tendereeName') }, // 招标人
+                { name: 'Zxr', value: getValueByKey(information, 'costConsultant') }, // 造价咨询人
+                { name: 'ZbrDb', value: getValueByKey(information, 'tenderAuthorizer') }, // 招标人法定代表人或其授权人
+                { name: 'ZxrDb', value: getValueByKey(information, 'consultantAuthorizer') }, // 造价咨询人法定代表人或其授权人
+                { name: 'Bzr', value: getValueByKey(information, 'tenderCompiler') }, // 编制人
+                { name: 'Fhr', value: getValueByKey(information, 'tenderExaminer') }, // 复核人
+                { name: 'BzTime', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE }, // 编制时间
+                { name: 'FhTime', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE }, // 复核时间
             ];
             // 额外字段
             const extraMap = {
@@ -92,17 +99,17 @@ INTERFACE_EXPORT = (() => {
         }
 
         // 招标控制价信息
-        function ZhaoBiaoKzXx(information) {
+        function ZhaoBiaoKzXx(information, totalCost) {
             const attrs = [
-                { name: 'Zbr', value: getValueByKey(information, '') }, // 招标人
-                { name: 'Zxr', value: getValueByKey(information, '') }, // 造价咨询人
-                { name: 'ZbrDb', value: getValueByKey(information, '') }, // 招标人法定代表人或其授权人
-                { name: 'ZxrDb', value: getValueByKey(information, '') }, // 造价咨询人法定代表人或其授权人
-                { name: 'Bzr', value: getValueByKey(information, '') }, // 编制人
-                { name: 'Fhr', value: getValueByKey(information, '') }, // 复核人
-                { name: 'BzTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 编制时间
-                { name: 'FhTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 复核时间
-                { name: 'Zbkzj', value: getValueByKey(information, ''), type: TYPE.DECIMAL }, // 控制价总价(元),取“投标报价”的金额。
+                { name: 'Zbr', value: getValueByKey(information, 'tendereeName') }, // 招标人
+                { name: 'Zxr', value: getValueByKey(information, 'costConsultant') }, // 造价咨询人
+                { name: 'ZbrDb', value: getValueByKey(information, 'tenderAuthorizer') }, // 招标人法定代表人或其授权人
+                { name: 'ZxrDb', value: getValueByKey(information, 'consultantAuthorizer') }, // 造价咨询人法定代表人或其授权人
+                { name: 'Bzr', value: getValueByKey(information, 'tenderCompiler') }, // 编制人
+                { name: 'Fhr', value: getValueByKey(information, 'tenderExaminer') }, // 复核人
+                { name: 'BzTime', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE }, // 编制时间
+                { name: 'FhTime', value: getValueByKey(information, 'reviewTime'), type: TYPE.DATE }, // 复核时间
+                { name: 'Zbkzj', value: totalCost, type: TYPE.DECIMAL }, // 控制价总价(元),取“投标报价”的金额。
             ];
             // 额外字段
             const extraMap = {
@@ -120,14 +127,14 @@ INTERFACE_EXPORT = (() => {
         }
 
         // 招标控制价信息
-        function TouBiaoXx(information) {
+        function TouBiaoXx(information, totalCost) {
             const attrs = [
-                { name: 'Zbr', value: getValueByKey(information, '') }, // 招标人
+                { name: 'Zbr', value: getValueByKey(information, 'tendereeName') }, // 招标人
                 { name: 'Tbr', value: getValueByKey(information, '') }, // 投标人
                 { name: 'TbrDb', value: getValueByKey(information, '') }, // 投标人法定代表或其授权
-                { name: 'Bzr', value: getValueByKey(information, '') }, // 编制人
-                { name: 'BzTime', value: getValueByKey(information, ''), type: TYPE.DATE }, // 编制时间
-                { name: 'Tbzj', value: getValueByKey(information, ''), type: TYPE.DECIMAL }, // 控制价总价(元),取“投标报价”的金额。
+                { name: 'Bzr', value: getValueByKey(information, 'tenderCompiler') }, // 编制人
+                { name: 'BzTime', value: getValueByKey(information, 'compilationTime'), type: TYPE.DATE }, // 编制时间
+                { name: 'Tbzj', value: totalCost, type: TYPE.DECIMAL }, // 控制价总价(元),取“投标报价”的金额。
             ];
             // 额外字段
             const extraMap = {
@@ -171,56 +178,55 @@ INTERFACE_EXPORT = (() => {
             Element.call(this, 'JjFlb');
         }
 
-        // 费率明细名称-编码映射表
-        const FeeRateCodeMap = {
-            冬季施工增加费: 'DJF',
-            雨季施工增加费: 'YJF',
-            夜间施工增加费: 'YEF',
-            工地转移费: 'ZYF',
-            高原施工增加费: 'GYF',
-            风沙地区增加费: 'FSF',
-            沿海地区增加费: 'YHF',
-            行车干扰增加费: 'XCF',
-            施工辅助费: 'SFF',
-            养老保险费: 'YLF',
-            失业保险费: 'SYF',
-            医疗保险费: 'YBF',
-            住房公积金: 'ZFF',
-            工伤保险费: 'GSF',
-            基本费用: 'JBF',
-            主副食运费补贴: 'YFF',
-            职工探亲补贴: 'TQF',
-            职工取暖补贴: 'QNF',
-            财务费用: 'CWF',
-            利润: 'LR',
-            税金: 'SJ',
-        };
-        // 费率工程名称-取费类别映射表
-        const FeeRateTypeMap = {
-            土方: 1,
-            石方: 3,
-            运输: 2,
-            路面: 4,
-            隧道: 11,
-            构造物I: 5,
-            '构造物I(不计冬)': 16,
-            构造物II: 6,
-            '构造物III(桥梁)': 9,
-            '构造物III(除桥以外不计雨)': 8,
-            技术复杂大桥: 10,
-            '钢材及钢结构(桥梁)': 12,
-            '钢材及钢结构(除桥以外不计夜)': 13,
-            '费率为0': 17,
-            '路面(不计雨)': 4,
-            '构造物I(不计雨)': 16,
-            '构造物III(除桥以外)': 8,
-            '钢材及钢结构(除桥以外)': 13,
-            设备: 15,
-            量价: 14,
-
-        };
         // 计价费率表明细,造价书费率页面左侧最底层数据
         function JjFlbMx(rootItem, item) {
+            // 费率明细名称-编码映射表
+            const FeeRateCodeMap = {
+                '冬季施工增加费': 'DJF',
+                '雨季施工增加费': 'YJF',
+                '夜间施工增加费': 'YEF',
+                '工地转移费': 'ZYF',
+                '高原施工增加费': 'GYF',
+                '风沙地区增加费': 'FSF',
+                '沿海地区增加费': 'YHF',
+                '行车干扰增加费': 'XCF',
+                '施工辅助费': 'SFF',
+                '养老保险费': 'YLF',
+                '失业保险费': 'SYF',
+                '医疗保险费': 'YBF',
+                '住房公积金': 'ZFF',
+                '工伤保险费': 'GSF',
+                '基本费用': 'JBF',
+                '主副食运费补贴': 'YFF',
+                '职工探亲补贴': 'TQF',
+                '职工取暖补贴': 'QNF',
+                '财务费用': 'CWF',
+                '利润': 'LR',
+                '税金': 'SJ',
+            };
+            // 费率工程名称-取费类别映射表
+            const FeeRateTypeMap = {
+                '土方': 1,
+                '石方': 3,
+                '运输': 2,
+                '路面': 4,
+                '隧道': 11,
+                '构造物I': 5,
+                '构造物I(不计冬)': 16,
+                '构造物II': 6,
+                '构造物III(桥梁)': 9,
+                '构造物III(除桥以外不计雨)': 8,
+                '技术复杂大桥': 10,
+                '钢材及钢结构(桥梁)': 12,
+                '钢材及钢结构(除桥以外不计夜)': 13,
+                '费率为0': 17,
+                '路面(不计雨)': 4,
+                '构造物I(不计雨)': 16,
+                '构造物III(除桥以外)': 8,
+                '钢材及钢结构(除桥以外)': 13,
+                '设备': 15,
+                '量价': 14,
+            };
             const rate = isEmptyVal(item.rate) ? '100' : item.rate; // 为空时输出=100,为0时输出=0
             const attrs = [
                 { name: 'Bm', value: FeeRateCodeMap[item.name] }, // 编码
@@ -296,12 +302,206 @@ INTERFACE_EXPORT = (() => {
                 { name: 'Sl', value: node.data.quantity, type: TYPE.DECIMAL }, // 工程量
                 { name: 'Sl2', value: '0', type: TYPE.DECIMAL }, // 工程量2
                 { name: 'Rgf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'labour.tenderTotalFee'), type: TYPE.DECIMAL }, // 人工费
+                { name: 'Clf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'material.tenderTotalFee'), type: TYPE.DECIMAL }, // 材料费
+                { name: 'Jxf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'machine.tenderTotalFee'), type: TYPE.DECIMAL }, // 机械费
+                { name: 'Sbf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'equipment.tenderTotalFee'), type: TYPE.DECIMAL }, // 设备费
+                { name: 'Csf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL }, // 措施费
+                { name: 'Glf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL }, // 企业管理费
+                { name: 'Gf', value: isBidInvitation ? '0' : getFee(node.data.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL }, // 规费
+                { 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: '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: 'Djfx', value: !!node.data.unitPriceAnalysis, type: TYPE.BOOL }, // 单价分析
+                { name: 'Jsgs', value: node.data.calcBase }, // 计算基数
+                { name: 'Bl', value: '' }, // 变量
+                { name: 'Bz', value: node.data.remark }, // 备注
             ];
             Element.call(this, 'QdMx', attrs);
         }
 
+        // 定额组价
+        function Qdxdezj() {
+            Element.call(this, 'Qdxdezj');
+        }
+
+        // 定额租价明细 招标文件不输出
+        function QdxdezjMx(ration) {
+            const typeMap = {
+                [RationType.RATION]: '1',
+                [RationType.VOLUME_PRICE + GljType.LABOUR]: '2',
+                [RationType.VOLUME_PRICE + GljType.GENERAL_MATERIAL]: '3',
+                [RationType.VOLUME_PRICE + GljType.GENERAL_MACHINE]: '4',
+                [RationType.VOLUME_PRICE + GljType.EQUIPMENT]: '2',
+            };
+            const typeKey = (ration.type || '') + (ration.subType || '');
+            const type = typeMap[typeKey];
+            const attrs = [
+                { name: 'Debm', value: ration.code }, // 编码
+                { name: 'Mc', value: ration.name }, // 名称
+                { name: 'Dw', value: ration.unit }, // 单位
+                { name: 'Sl', value: ration.tenderQuantity }, // 工程量
+                { name: 'Dj', value: getFee(ration.fees, 'common.tenderUnitFee'), type: TYPE.DECIMAL }, // 单价
+                { name: 'Hj', value: getFee(ration.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 合价
+                { name: 'Rgf', value: getFee(ration.fees, 'labour.tenderTotalFee'), type: TYPE.DECIMAL }, // 人工费
+                { name: 'Clf', value: getFee(ration.fees, 'material.tenderTotalFee'), type: TYPE.DECIMAL }, // 材料费
+                { name: 'Jxf', value: getFee(ration.fees, 'machine.tenderTotalFee'), type: TYPE.DECIMAL }, // 机械费
+                { name: 'Sbf', value: getFee(ration.fees, 'equipment.tenderTotalFee'), type: TYPE.DECIMAL }, // 设备费
+                { name: 'Csf', value: getFee(ration.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL }, // 措施费
+                { name: 'Glf', value: getFee(ration.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL }, // 企业管理费
+                { name: 'Gf', value: getFee(ration.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL }, // 规费
+                { name: 'Lr', value: getFee(ration.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL }, // 利润
+                { name: 'Sj', value: getFee(ration.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL }, // 税金
+                { name: 'Delb', value: type, type: TYPE.INT }, // 取定额/量价/设备的类别。(1=普通定额,2=人工,3=材料,4=机械,5=设备)
+                { name: 'Iszd', value: 'false', type: TYPE.BOOL }, // 暂时,全部取fals
+            ];
+            Element.call(this, 'QdxdezjMx', attrs);
+        }
+
+        // 定额人材机含量
+        function Qdxdercjhl() {
+            Element.call(this, 'Qdxdercjhl');
+        }
+
+        // 定额人材机含量明细
+        function QdxdercjhlMx(rcjID, quantity) {
+            const attrs = [
+                { name: 'RcjId', value: rcjID }, // 人材机资源ID
+                { name: 'Sl', value: quantity, type: TYPE.DECIMAL }, // 消耗量
+            ]
+            Element.call(this, 'QdxdercjhlMx', attrs);
+        }
+
+        // 清单人材机含量
+        function Qdxrcjhl() {
+            Element.call(this, 'Qdxrcjhl');
+        }
+
+        // 清单人材机含量明细
+        function QdxrcjhlMx(item) {
+            const attrs = [
+                { name: 'RcjId', value: item.rcjID }, // 人材机资源ID
+                { name: 'Rcjhl', value: item.contain, type: TYPE.DECIMAL }, // 含量:取叶子清单下所有的人材机的含量,=各定额下的人材机总消耗量之和,再除以清单工程量
+                { name: 'Rcjhj', value: item.totalPrice, type: TYPE.DECIMAL }, // 合价:人材机含量*人材机预算价
+                { name: 'Zgjbz', value: item.isEvaluate, type: TYPE.BOOL }, // 是否暂估,根据资源ID,读取工料机汇总界面对应的“是否暂估”
+                { name: 'Zcbz', value: 'false', type: TYPE.BOOL }, // 主材标记,公路上无此概念,默认输出=fales
+                { name: 'Zyclbz', value: item.isMainMaterial, type: TYPE.BOOL }, // 根据资源ID,读取工料机汇总界面对应的“主要材料”
+            ]
+            Element.call(this, 'QdxrcjhlMx', attrs);
+        }
+
+        // 计日工
+        function Jrg() {
+            Element.call(this, 'Jrg');
+        }
+
+        // 计日工标题
+        function JrgBt(node) {
+            const typeMap = {
+                [fixedFlag.LABOUR_SERVICE]: '1',
+                [fixedFlag.MATERIAL]: '2',
+                [fixedFlag.CONSTRUCTION_MACHINE]: '3',
+            };
+            const attrs = [
+                { name: 'Name', value: node.data.name }, // 名称
+                { name: 'Je', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 金额
+                { name: 'Lb', value: typeMap[node.getFlag()], type: TYPE.INT }, // 类别:1=劳务;2=材料;3=施工机械
+                { name: 'Bz', value: node.data.remark }, // 备注
+            ];
+            Element.call(this, 'JrgBt', attrs);
+        }
+
+        // 计日工明细
+        function JrgMx(node) {
+            const attrs = [
+                { name: 'Bh', value: node.data.code }, // 编码
+                { name: 'Name', value: node.data.name }, // 名称
+                { name: 'Dw', value: node.data.unit }, // 单位
+                { name: 'Sl', value: node.data.quantity }, // 工程量
+                { name: 'Dj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderTotalFee'), type: TYPE.DECIMAL }, // 单价
+                { name: 'Hj', value: isBidInvitation ? '0' : getFee(node.data.fees, 'common.tenderUnitFee'), type: TYPE.DECIMAL }, // 合价
+            ];
+            Element.call(this, 'JrgBJrgMx', attrs);
+        }
+
+        // 暂估材料表
+        function ZgCl() {
+            Element.call(this, 'ZgCl');
+        }
+
+        // 暂估材料明细
+        function ZgClMx(glj) {
+            const attrs = [
+                { name: 'Xh', value: glj.seq }, // 序号
+                { name: 'RcjId', value: projectGLJIDToRcjID[glj.projectGLJID] }, // 资源ID
+                { name: 'Bm', value: glj.code }, // 编码
+                { name: 'Mc', value: glj.name }, // 名称
+                { name: 'Ggxh', value: glj.specs }, // 规格型号
+                { name: 'Dw', value: glj.unit }, // 单位
+                { name: 'Sl', value: BID_INVITATION ? '0' : glj.quantity, type: TYPE.DECIMAL }, // 工程量
+                { name: 'Dj', value: BID_INVITATION ? '0' : glj.market_price, type: TYPE.DECIMAL }, // 单价
+                { name: 'Hj', value: BID_INVITATION ? '0' : glj.market_price, type: TYPE.DECIMAL }, // 合价
+            ]
+            Element.call(this, 'ZgClMx', attrs);
+        }
         // 组装数据 --------------------------------------
 
+        // 组装建设项目数据
+        function setupConstruction(constructionData) {
+            const information = constructionData.property && constructionData.property.basicInformation || [];
+            const summaryInfo = constructionData.summaryInfo[constructionData.ID];
+            const jingJiBiao = new JingJiBiao(constructionData.name, information);
+            if (isBidInvitation) {
+                jingJiBiao.children.push(new ZhaoBiaoXx(information));
+            } else if (isControl) {
+                jingJiBiao.children.push(new ZhaoBiaoKzXx(information, summaryInfo.totalCost));
+            } else {
+                jingJiBiao.children.push(new TouBiaoXx(information, summaryInfo.totalCost));
+            }
+            // 将单位工程工程特征中,单项工程编号、名称相同的,插入到建设项目和分段(单位工程)的中间层。
+            const midLayerMap = {}; // 单项工程key(code@name)与单项工程节点映射
+            for (const tenderData of constructionData.children) {
+                const feature = tenderData.property && tenderData.property.projectFeature || [];
+                const midLayerCode = getValueByKey(feature, 'singleProjNo');
+                const midLayerName = getValueByKey(feature, 'singleProjName');
+                const midLayerKey = `${midLayerCode}@${midLayerName}`;
+                if (!midLayerMap[midLayerKey]) {
+                    jingJiBiao.children.push(midLayerMap[midLayerKey] = new Dxgcxx(midLayerCode, midLayerName));
+                }
+                midLayerMap[midLayerKey].children.push(setupTender(tenderData, feature));
+            }
+            const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
+            return [{
+                data: jingJiBiao,
+                exportKind,
+                fileName: `${constructionData.name}${suffix}`
+            }];
+        }
+
+        // getData接口数据
+        let curDetail;
+
+        // 需要先设置项目人材机的关联ID(从1开始),因为定额人材机等一些节点需要用到这个关联ID
+        const projectGLJIDToRcjID = {}; // 项目人材机ID与新生成的整形ID映射
+        const projectGLJMap = {}; // 项目人材机与项目人材机数据映射
+
+        // 组装单位工程数据
+        function setupTender(tenderData, feature) {
+            curDetail = tenderDetailMap[tenderData.ID];
+            curDetail.projectGLJ.datas.gljList.forEach((glj, index) => {
+                projectGLJIDToRcjID[glj.id] = index + 1;
+                projectGLJMap[glj.id] = glj;
+            });
+            const dwgcxx = new Dwgcxx(tenderData.name, feature);
+            dwgcxx.children.push(
+                setupFeeRate(curDetail.FeeRate),
+                setupBills(curDetail.mainTree)
+            );
+            return dwgcxx;
+        }
+
         // 组装费率数据
         function setupFeeRate(feeRateDetail) {
             const qfxx = new Qfxx();
@@ -332,42 +532,115 @@ INTERFACE_EXPORT = (() => {
             const qdxm = new QdXm();
             const qdbtData = mainTree.roots.map(node => new QdBt(node));
             qdxm.children.push(...qdbtData);
+
+            mainTree.roots.forEach(node => {
+                const flag = node.getFlag();
+                const qdbt = new QdBt(node);
+                if (flag === fixedFlag.ONE_SEVEN_BILLS) { // 100章到700章清单需要输出详细数据
+                    qdbt.children.push(...setupSubBills(node.children));
+                } else if (flag === fixedFlag.DAYWORK_LABOR) {
+                    qdbt.children.push(setupDaywork(node.children));
+                }
+                qdxm.children.push(qdbt);
+            });
+
+            function setupSubBills(nodes) {
+                const rst = [];
+                nodes.forEach(node => {
+                    const qdmx = new QdMx(node);
+                    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));
+                    }
+                });
+                return rst;
+            }
+
+            function setupDaywork(nodes) {
+                const dayworkRoot = new Jrg();
+                const dayworkBT = nodes.map(node => {
+                    const bt = new JrgBt(node);
+                    const dayworkMX = node.children.map(child => new JrgMx(child));
+                    bt.children.push(...dayworkMX);
+                    return bt;
+                });
+                dayworkRoot.children.push(...dayworkBT);
+                return dayworkRoot;
+            }
+
             return qdxm;
         }
 
-        // 组装单位工程数据
-        function setupTender(tenderData, feature) {
-            const detail = tenderDetailMap[tenderData.ID];
-            const dwgcxx = new Dwgcxx(tenderData.name, feature);
-            dwgcxx.children.push(
-                setupFeeRate(detail.FeeRate),
-                setupBills(detail.mainTree)
-            );
-            return dwgcxx;
+        // 组装定额、定额人材机数据
+        function setupRations(rationNodes) {
+            // 招标文件不输出
+            if (isBidInvitation) {
+                return [];
+            }
+            const rationRoot = new Qdxdezj();
+            const rationEles = rationNodes.map(node => {
+                const rationEle = new QdxdezjMx(node.data);
+                // 定额人材机
+                const rationGLJList = curDetail.ration_glj.datas.filter(glj => glj.rationID === node.data.ID);
+                const rationGLJRoot = new Qdxdercjhl();
+                const rationGLJEles = rationGLJList.map(glj => new QdxdercjhlMx(projectGLJIDToRcjID[glj.projectGLJID], glj.tenderQuantity));
+                rationGLJRoot.children.push(...rationGLJEles);
+                rationEle.children.push(rationGLJRoot);
+                return rationEle;
+            });
+            rationRoot.children.push(...rationEles);
+            return [rationRoot];
         }
 
-        // 组装建设项目数据
-        function setupConstruction(constructionData) {
-            const information = constructionData.property && constructionData.property.basicInformation || [];
-            const jingJiBiao = new JingJiBiao(constructionData.name, information);
-            // 将单位工程工程特征中,单项工程编号、名称相同的,插入到建设项目和分段(单位工程)的中间层。
-            const midLayerMap = {}; // 单项工程key(code@name)与单项工程节点映射
-            for (const tenderData of constructionData.children) {
-                const feature = tenderData.property && tenderData.property.projectFeature || [];
-                const midLayerCode = getValueByKey(feature, 'singleProjNo');
-                const midLayerName = getValueByKey(feature, 'singleProjName');
-                const midLayerKey = `${midLayerCode}@${midLayerName}`;
-                if (!midLayerMap[midLayerKey]) {
-                    jingJiBiao.children.push(midLayerMap[midLayerKey] = new Dxgcxx(midLayerCode, midLayerName));
-                }
-                midLayerMap[midLayerKey].children.push(setupTender(tenderData, feature));
+        // 组装清单人材机含量数据
+        function setupBillsContain(bills) {
+            if (isBidInvitation) {
+                return [];
             }
-            const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
-            return [{
-                data: jingJiBiao,
-                exportKind,
-                fileName: `${constructionData.name}${suffix}`
-            }];
+            // 读取清单下的人材机,先将各定额下的人材机汇总,相同的合并(相同的项目人材机ID)
+            const gljList = curDetail.ration_glj.datas.filter(glj => glj.billsItemID === bills.ID);
+            if (!gljList) {
+                return [];
+            }
+            const map = {};
+            gljList.forEach(glj => {
+                if (!map[glj.projectGLJID]) {
+                    const projectGLJ = projectGLJMap[glj.projectGLJID];
+                    map[glj.projectGLJID] = {
+                        rcjID: projectGLJIDToRcjID[glj.projectGLJID],
+                        totalQuantity: glj.tenderQuantity,
+                        price: glj.tenderPrice,
+                        isEvaluate: !!projectGLJ.is_evaluate,
+                        isMainMaterial: !!projectGLJ.is_main_material
+                    };
+                } else {
+                    map[glj.projectGLJID].totalQuantity = scMathUtil.roundTo(map[glj.projectGLJID].totalQuantity + glj.tenderQuantity, -6);
+                }
+            });
+            const containItems = Object
+                .values(map)
+                .map(glj => {
+                    const contain = glj.totalQuantity / (bills.quantity || 1);
+                    return {
+                        rcjID: glj.rcjID,
+                        contain: scMathUtil.roundTo(contain, -6), // 固定取6位
+                        totalPrice: scMathUtil.roundTo(contain * glj.price, -2), // 固定取2位
+                        isEvaluate: glj.isEvaluate,
+                        isMainMaterial: glj.isMainMaterial
+                    };
+                });
+            const root = new Qdxrcjhl();
+            root.children.push(...containItems.map(item => new QdxrcjhlMx(item)));
+            return [root]
+        }
+
+        // 组装暂估材料
+        function setupEvaluationList(evaluationListDetail) {
+
         }
 
         return setupConstruction(projectData);

+ 3 - 1
web/building_saas/standard_interface/export/base.js

@@ -703,7 +703,9 @@ const INTERFACE_EXPORT_BASE = (() => {
                 await setTimeoutSync(() => { }, TIMEOUT_TIME); // 需要请求项目详细数据的时候,间隔一段时间再初始单位工程数据,减少服务器压力
             }
             // 获取单位工程详细数据
-            await getTenderDetail(tenderItem.ID, userID);
+            const detail = await getTenderDetail(tenderItem.ID, userID);
+            // 人材机汇总排序
+            gljUtil.sortRationGLJ(detail.projectGLJ.datas.gljList);
         }
         // 提取相关项目的详细导出数据
         return await entryFunc(areaKey, exportKind, projectData, tenderDetailMap);