浏览代码

广东接口bugs

vian 5 年之前
父节点
当前提交
f43348e119

+ 0 - 1
web/building_saas/pm/js/pm_import.js

@@ -448,7 +448,6 @@ const importView = (() => {
                 $('#importInterface').modal('hide');
                 pr.start('导入文件', '正在生成文件,请稍候……');
                 let importData = await importXML.transformData(xmlObj);
-                debugger;
                 console.log(importData);
                 let blob = new Blob([JSON.stringify(importData)], { type: 'text/plain;charset=utf-8' });
                 // 转换成File实例

+ 24 - 17
web/over_write/js/guangdong_2018_export.js

@@ -6,6 +6,7 @@
  * @version
  */
 
+
 /*
 * 广东建设工程政府投资项目造价数据标准3.0
 * */
@@ -171,7 +172,7 @@ const XMLStandard = (function () {
     };
     // 计算程序名称-费用代号映射
     const CalculationCodeMap = {
-        '直接费': 'DEZJF',
+        '直接费': 'ZJF',
         '人工费': 'RGF',
         '材料费': 'CLF',
         '施工机具费': 'JXF',
@@ -638,7 +639,7 @@ const XMLStandard = (function () {
                         : _util.getValueByKey(basicInformation, 'tenderCompileDate')
                 },
                 // 编制单位法定代表人或其授权人
-                { name: 'Authorizer', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'authorizer') },
+                { name: 'Authorizer', mustHasValue: true, value: _util.getValueByKey(basicInformation, 'constructingUnitsPerson') },
                 // 工程总价(元)
                 {
                     name: 'Total', dName: '工程总价', type: _type.DECIMAL, required: true,
@@ -1384,7 +1385,7 @@ const XMLStandard = (function () {
                 // 暂估价
                 {
                     name: 'Appraisal', type: _type.DECIMAL,
-                    value: _util.getFeeByFlag(items, fixedFlag.ESTIMATE, 'common.totalFee')
+                    value: _util.getFee(bills.fees, 'estimate.totalFee')
                 },
                 // 机械费
                 {
@@ -1419,7 +1420,7 @@ const XMLStandard = (function () {
                 // 其他项目费
                 {
                     name: 'SundryCosts', type: _type.DECIMAL,
-                    value: _util.getFeeByFlag(items, fixedFlag.OTHER_MEASURE_FEE, 'common.totalFee')
+                    value: _util.getFeeByFlag(items, fixedFlag.OTEHER, 'common.totalFee')
                 },
                 // 暂列金额
                 {
@@ -1535,7 +1536,7 @@ const XMLStandard = (function () {
         function ExpressElement(quantityDetail) {
             const attrs = [
                 // 序号
-                { name: 'OrderNumber', dName: '序号', required: true, value: quantityDetail.seq },
+                { name: 'OrderNumber', dName: '序号', required: true, value: quantityDetail.seq + 1 }, // 软件中是从0开始,导出需要从1开始
                 // 工程量计算式
                 { name: 'Express', dName: '工程量计算式', required: true, value: quantityDetail.regex },
                 // 工程量
@@ -1678,6 +1679,8 @@ const XMLStandard = (function () {
         // 其他项目费标题
         function SundryCostsGroup(node) {
             const bills = node.data;
+            // 材料暂估价取不汇总,其他为汇总
+            const kind = node.getFlag() === fixedFlag.MATERIAL_PROVISIONAL ? SummrayKind.NO : SummrayKind.YES;
             const attrs = [
                 // 名称
                 { name: 'Name', dName: '名称', required: true, value: bills.name },
@@ -1686,7 +1689,7 @@ const XMLStandard = (function () {
                 // 费用代号
                 { name: 'Code', dName: '费用代号', required: true, value: getFeeCode(bills) },
                 // 汇总类型
-                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.YES },
+                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: kind },
                 // 备注
                 { name: 'Remark', value: bills.remark }
             ];
@@ -1695,6 +1698,8 @@ const XMLStandard = (function () {
         // 其他项目费明细
         function SundryCostsItem(node) {
             const bills = node.data;
+            // 材料暂估价取不汇总,其他为汇总
+            const kind = node.getFlag() === fixedFlag.MATERIAL_PROVISIONAL ? SummrayKind.NO : SummrayKind.YES;
             const attrs = [
                 // 名称
                 { name: 'Name', dName: '名称', required: true, value: bills.name },
@@ -1713,7 +1718,7 @@ const XMLStandard = (function () {
                 // 费用代号
                 { name: 'Code', dName: '费用代号', required: true, value: getFeeCode(bills) },
                 // 汇总类型
-                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
+                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: kind },
                 // 备注
                 { name: 'Remark', value: bills.remark }
             ];
@@ -1753,7 +1758,7 @@ const XMLStandard = (function () {
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 汇总类型
-                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
+                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.YES },
                 // 备注
                 { name: 'Remark', value: bills.remark }
             ];
@@ -1820,7 +1825,7 @@ const XMLStandard = (function () {
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 汇总类型
-                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
+                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.YES },
                 // 备注
                 { name: 'Remark', value: bills.remark }
             ];
@@ -1885,8 +1890,8 @@ const XMLStandard = (function () {
             const attrs = [
                 // 名称
                 { name: 'Name', dName: '名称', required: true, value: bills.name },
-                // 项目价值
-                { name: 'Quantity', type: _type.DECIMAL, value: bills.quantity },
+                // 项目价值,计算基数对应的金额
+                { name: 'Quantity', type: _type.DECIMAL, value: bills.tenderCalcBaseValue },
                 // 服务内容
                 { name: 'Content', value: bills.serviceContent },
                 // 计算基数
@@ -1896,7 +1901,7 @@ const XMLStandard = (function () {
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 汇总类型
-                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
+                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.YES },
                 // 备注
                 { name: 'Remark', value: bills.remark }
             ];
@@ -1936,9 +1941,9 @@ const XMLStandard = (function () {
                 // 金额
                 { name: 'Total', type: _type.DECIMAL, value: _util.getFee(bills.fees, 'common.totalFee') },
                 // 依据
-                { name: 'Reason', value: '' },
+                { name: 'Reason', value: bills.claimVisa },
                 // 汇总类型
-                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.NO },
+                { name: 'Kind', dName: '汇总类型', type: _type.INT, required: true, value: SummrayKind.YES },
                 // 备注
                 { name: 'Remark', value: bills.remark }
             ];
@@ -2490,12 +2495,12 @@ const XMLStandard = (function () {
             let rationGLJs = tenderDetail.ration_glj.datas.filter(rGLJ => rGLJ.rationID === node.data.ID);
             rationGLJs = gljUtil.sortRationGLJ(rationGLJs); // 定额人材机排序
             const rationGLJElements = rationGLJs
-                /* .filter(rGLJ => {
+                .filter(rGLJ => {
                     // 总消耗量为0的,不输出
                     const totalQuantity = gljUtil.getTotalQuantity(rGLJ, node.data, Decimal.QUANTITY, Decimal.GLJ);
                     const parsedTotalQuantity = parseFloat(totalQuantity);
                     return parsedTotalQuantity;
-                }) */
+                })
                 .map(rGLJ => {
                     const totalQuantity = gljUtil.getTotalQuantity(rGLJ, node.data, Decimal.QUANTITY, Decimal.GLJ);
                     const noCost = !+totalQuantity; // 总消耗量为0即为不计价材料
@@ -2633,7 +2638,9 @@ const XMLStandard = (function () {
             const engineeringCostNode = tenderDetail.Bills.tree.roots.find(node => node.getFlag() === fixedFlag.ENGINEERINGCOST);
             const ecTotalFee = _util.getFee(engineeringCostNode.data.fees, 'common.totalFee');
             const coeDatas = materialAdjustObj.getPriceCoeDatas(gljList, contractorList, ecTotalFee, decimalObj);
-            return gljList.map(glj => {
+            return gljList
+                .filter(glj => !!+glj.quantity) // 总消耗量为0不导出
+                .map(glj => {
                 // 人材机
                 const price = gljUtil.getGLJPrice(glj, tenderDetail.projectGLJ.datas, // 价格信息
                     tenderDetail.projectInfo.property.calcOptions, tenderDetail.labourCoe.datas, tenderDetail.projectInfo.property.decimal, false, _, scMathUtil);

+ 26 - 16
web/over_write/js/guangdong_2018_import.js

@@ -70,6 +70,11 @@ const importXML = (() => {
     // 工程量表达式相关
     const GCLMXHj = 'GCLMXHJ';
     const QDL = 'QDL';
+    // 工程量表达式累加映射
+    const summationMap = {
+        '1': 1, // 累加
+        '2': 0 // 不累加
+    };
 
     /* 
      * 从导入的xml文件中提取有用的数据
@@ -218,10 +223,10 @@ const importXML = (() => {
         }));
         clearEmptyItems(featureData);
         return featureData;
-        
+
         function clearEmptyItems(items) {
             items.forEach(item => {
-                if(!item.items) {
+                if (!item.items) {
                     return;
                 }
                 if (!item.items.length) {
@@ -237,7 +242,7 @@ const importXML = (() => {
         const summarySrc = getValue(tenderSrc, ['UnitWorksSummary']);
         const fields = [['UnitWorksSummaryGroup'], ['UnitWorksSummaryItem']];
         return extractItemsRecur(summarySrc, fields, (src, curField) => {
-            const item = { 
+            const item = {
                 code: getValue(src, ['_Number']),
                 name: getValue(src, ['_Name']),
                 quantity: getValue(src, ['_Quantity']),
@@ -410,7 +415,7 @@ const importXML = (() => {
             seq: getValue(itemSrc, ['_OrderNumber']),
             regex: getValue(itemSrc, ['_Express']),
             result: getValue(itemSrc, ['_Quantity']),
-            isSummation: +getValue(itemSrc, ['_Kind'])
+            isSummation: summationMap[getValue(itemSrc, ['_Kind'])]
         }));
     }
     // 提取定额
@@ -457,14 +462,14 @@ const importXML = (() => {
             const calculationOfItems = arrayValue(rationSrc, ['UnitPriceCalculationOfItem']);
             const fees = [];
             const codeFiedNameMap = {
-                'DEZJF': 'direct',
+                'ZJF': 'direct',
                 'RGF': 'labour',
                 'CLF': 'material',
                 'JXF': 'machine',
                 'ZCF': 'mainMaterial',
                 'SBF': 'equipment',
                 'LR': 'profit',
-                'DJ': 'common',
+                //'DJ': 'common',定额本身已经有单价这个字段,不需要从这读取
 
             };
             calculationOfItems.forEach(item => {
@@ -549,24 +554,29 @@ const importXML = (() => {
             visa: extractData(sundry, 'SiteInstructionCost', [['SiteInstructionCostGroup'], ['SiteInstructionCostItem']]),
         };
         // 提取标题和明细
-        function extractGroupOrItem(itemSrc, isGroup = true, extendAttrs = null) {
-            const source = isGroup
-                ? {
+        function extractGroupOrItem(itemSrc, isGroup = true, extendAttrs = null, field) {
+            let source;
+            if (isGroup) {
+                source = {
                     name: getValue(itemSrc, ['_Name']),
                     fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', totalFee: getValue(itemSrc, ['_Total']) }] : [],
                     feeCode: getValue(itemSrc, ['_Code']),
                     remark: getValue(itemSrc, ['_Remark'])
-                }
-                : {
+                };
+            } else {
+                source = {
                     name: getValue(itemSrc, ['_Name']),
                     unit: getValue(itemSrc, ['_Unit']),
-                    quantity: getValue(itemSrc, ['_Quantity']),
                     calcBase: getValue(itemSrc, ['_QtyFormula']),
                     feeRate: getValue(itemSrc, ['_Rate']),
                     fees: importFileKind === FileKind.tender ? [{ fieldName: 'common', unitFee: getValue(itemSrc, ['_Price']), totalFee: getValue(itemSrc, ['_Total']) }] : [],
                     feeCode: getValue(itemSrc, ['_Code']),
                     remark: getValue(itemSrc, ['_Remark'])
                 };
+                if (field !== 'MainContractorAttendanceItem') { // MainContractorAttendanceItem的quantity比较特殊,是清单基数计算后的值而不是工程量,不需要导入
+                    source.quantity = getValue(itemSrc, ['_Quantity']);
+                }
+            }
             return extendAttrs ? Object.assign(source, extendAttrs) : source;
         }
         // 提取数据
@@ -589,8 +599,8 @@ const importXML = (() => {
                         }, {})
                         : null;
                     return curField[0] === fields[0][0]
-                        ? extractGroupOrItem(itemSrc, true, groupExtend)
-                        : extractGroupOrItem(itemSrc, false, itemExtend);
+                        ? extractGroupOrItem(itemSrc, true, groupExtend, curField[0])
+                        : extractGroupOrItem(itemSrc, false, itemExtend, curField[0]);
                 })
             };
         }
@@ -1208,7 +1218,7 @@ const importXML = (() => {
                 item.ID = uuid.v1();
                 item[typeKey] = refID; // billID、rationID
                 item.projectID = tenderID;
-            }); 
+            });
         }
     }
     // 转换人材机汇总相关数据(人材机汇总、承包人材料、评标材料、暂估价材料、组成物、单价文件)
@@ -1474,7 +1484,7 @@ const importXML = (() => {
             ration,
             rationGLJ,
             rationCoe,
-            quantityDetails: [...billsQuantityDetails, ... rationQuantityDetails],
+            quantityDetails: [...billsQuantityDetails, ...rationQuantityDetails],
             ...relatedljGLJData
         };
         clean(detailData);