Pārlūkot izejas kodu

中山接口相关

zhangweicheng 5 gadi atpakaļ
vecāks
revīzija
0462b824b5

+ 71 - 38
web/building_saas/standard_interface/export/guangdong_zhongshan.js

@@ -92,6 +92,17 @@ INTERFACE_EXPORT = (() => {
     '安拆辅助费':1
   }
 
+  const RoadGradeMap = {
+    "高速公路": "0",
+    "一级公路": "1",
+    "二级公路": "2",
+    "三级公路": "3",
+    "四级公路": "4",
+    "等外公路": "5",
+    "独立桥梁": "6",
+    "独立隧道": "7"
+  }
+
   function getBasePrice(projectGLJID, tenderProject) {
     let glj = _.find(tenderProject.projectGLJ.datas.gljList, {
       id: projectGLJID
@@ -889,15 +900,29 @@ INTERFACE_EXPORT = (() => {
         }
         list.push(item);
 
+        function getCalcType(node) {
+          /*           
+          判断是否父项:
+           是父项,则取1;
+          是叶子项,则判断其下有无套定额/量价/工料机:
+                有则取1;
+                无则判断有无基数计算:
+               有则取2;
+               无则取3 */
+          if (node.children && node.children.length > 0) {
+            return 1; //是父项,则取1, 有套定额/量价/工料机,也取1
+          } else {
+            return node.data.calcBase && node.data.calcBase != "" ? 2 : 3
+          }
+        }
+
         function bill(bNode, level) {
           let data = bNode.data;
           let CostKind = 3;
           if (data.name.indexOf("安全生产费") != -1) CostKind = 1;
           if (data.name.indexOf("暂列金额") != -1) CostKind = 2;
           //1 = 工程量×综合单价;2 = 计算基数×费率;3 = 工程量×单价。
-          let CalcType = 2;
-          if (data.calcFlag == 2) CalcType = 3;
-          if (data.calcFlag == 1) CalcType = 1;
+          let CalcType = getCalcType(bNode);
           //取暂估价类型。读取造价书界面的专项暂定列。0=材料暂估价,1=工程设备暂估价,2=专业工程暂估价,没有选的输出为空。
           let ProvisionalType = "";
           if (data.specialProvisional == "材料") ProvisionalType = 0;
@@ -1233,37 +1258,45 @@ INTERFACE_EXPORT = (() => {
     function Params(tenderProject) {
       let feature = tenderProject.property.projectFeature ? tenderProject.property.projectFeature : [];
       let featrueMap = {};
+      let baseMap = {};
       for (let f of feature) {
         featrueMap[f.key] = f;
       }
+      let baseInfo = _.find(tenderProject.property.basicInformation, {
+        dispName: "基本信息",
+      });
+      for (let i of baseInfo.items) {
+        let key = i.key;
+        //if (i.dispName == "编制日期") key = "编制时间";
+        baseMap[key] = i;
+      }
+
+
       let BuildType = "";
-      if (featrueMap["buildType"] == 0) BuildType = "新建";
-      if (featrueMap["buildType"] == 1) BuildType = "改(扩)建";
+      if (baseMap["natureConstruction"].value == "新建") BuildType = 0;
+      if (baseMap["natureConstruction"].value == "改扩建") BuildType = 1;
       let Terrain = "";
-      if (featrueMap["terrainCategory"] == 0) Terrain = "平原微丘陵区";
-      if (featrueMap["terrainCategory"] == 1) Terrain = "山岭重丘陵区";
-      let DesignSpeed = "";
-      if (featrueMap["designSpeed"] == 0) DesignSpeed = "高速公路";
-      if (featrueMap["designSpeed"] == 1) DesignSpeed = "一级公路";
-      if (featrueMap["designSpeed"] == 2) DesignSpeed = "二级公路";
-      if (featrueMap["designSpeed"] == 3) DesignSpeed = "三级公路";
-      if (featrueMap["designSpeed"] == 4) DesignSpeed = "四级公路";
+      if (baseMap["terrainCategory"].value == "平原微丘") Terrain = 0;
+      if (baseMap["terrainCategory"].value == "山岭重丘") Terrain = 1;
+      let DesignSpeed = featrueMap["designSpeed"].value;
       let Structure = "";
-      if (featrueMap["structure"] == 0) Structure = "沥青路面";
-      if (featrueMap["structure"] == 1) Structure = "水泥混凝土路面";
-      if (featrueMap["structure"] == 2) Structure = "其他类型路面";
+      if (featrueMap["pavementStructure"].value == "沥青路面") Structure = 0;
+      if (featrueMap["pavementStructure"].value == "水泥混凝土路面") Structure = 1;
+      if (featrueMap["pavementStructure"].value == "其他类型路面") Structure = 2;
+      let RoadGrade = "";
+      if (RoadGradeMap[baseMap["roadGrade"].value]) RoadGrade = RoadGradeMap[baseMap["roadGrade"].value];
 
       const attrs = [{
           name: "PrjArea",
-          value: featrueMap["projAddress"] ? featrueMap["projAddress"].value : "",
+          value: baseMap["location"] ? baseMap["location"].value : "",
         },
         {
           name: "StartPileNo",
-          value: featrueMap["startStation"] ? featrueMap["startStation"].value : "",
+          value: baseMap["startChainages"] ? baseMap["startChainages"].value : "",
         },
         {
           name: "EndPileNo",
-          value: featrueMap["endingStation"] ? featrueMap["endingStation"].value : "",
+          value: baseMap["endChainages"] ? baseMap["endChainages"].value : "",
         },
         {
           name: "BuildType",
@@ -1275,7 +1308,7 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "RoadGrade",
-          value: featrueMap["roadGrade"] ? featrueMap["roadGrade"].value : "",
+          value: RoadGrade,
         },
         {
           name: "DesignSpeed",
@@ -1350,7 +1383,7 @@ INTERFACE_EXPORT = (() => {
       if(isBidInvitation) attrs = [] //招标
       if (isControl) attrs.splice(1, 5); //控制价
       if (isBidSubmission) { //投标文件时,读工程特征中的 招标控制价 值
-        let tenderSumLimit = _.find(feature, { "dispName": "招标控制价" }); 
+        let tenderSumLimit = _.find(feature, { "key": "tenderSumLimit" }); 
         if(tenderSumLimit) attrs[0].value = tenderSumLimit.value
       } 
       Element.call(this, "SummaryOfCost", attrs);
@@ -1374,27 +1407,27 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "Manage",
-          value: baseMap["constructingUnits"] ? baseMap["constructingUnits"].value : "",
+          value: baseMap["constructingUnit"] ? baseMap["constructingUnit"].value : "",
         },
         {
           name: "Designer",
-          value: baseMap["designUnits"] ? baseMap["designUnits"].value : "",
+          value: baseMap["designUnit"] ? baseMap["designUnit"].value : "",
         },
         {
           name: "Compile",
-          value: baseMap["establishUnit"] ? baseMap["establishUnit"].value : "",
+          value: baseMap["compileUnit"] ? baseMap["compileUnit"].value : "",
         },
         {
           name: "CompileApprover",
-          value: baseMap["tenderCompiler"] ? baseMap["tenderCompiler"].value : "",
+          value: baseMap["compileApprover"] ? baseMap["compileApprover"].value : "",
         },
         {
           name: "CompileCertNo",
-          value: baseMap["authorNo"] ? baseMap["authorNo"].value : "",
+          value: baseMap["compileCertNo"] ? baseMap["compileCertNo"].value : "",
         },
         {
           name: "CompileDate",
-          value: baseMap["establishDate"] ? baseMap["establishDate"].value : "",
+          value: baseMap["compileDate"] ? baseMap["compileDate"].value : "",
         },
         {
           name: "Review",
@@ -1402,43 +1435,43 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "ReviewApprover",
-          value: baseMap["tenderExaminer"] ? baseMap["tenderExaminer"].value : "",
+          value: baseMap["reviewApprover"] ? baseMap["reviewApprover"].value : "",
         },
         {
           name: "ReviewCertNo",
-          value: baseMap["certificateReviewer"] ? baseMap["certificateReviewer"].value : "",
+          value: baseMap["reviewCertNo"] ? baseMap["reviewCertNo"].value : "",
         },
         {
           name: "ReviewDate",
-          value: baseMap["reviewTime"] ? baseMap["reviewTime"].value : "",
+          value: baseMap["reviewDate"] ? baseMap["reviewDate"].value : "",
         },
         {
           name: "Examine",
-          value: baseMap["auditUnit"] ? baseMap["auditUnit"].value : "",
+          value: baseMap["examineUnit"] ? baseMap["examineUnit"].value : "",
         },
         {
           name: "ExamineApprover",
-          value: baseMap["auditor"] ? baseMap["auditor"].value : "",
+          value: baseMap["examineApprover"] ? baseMap["examineApprover"].value : "",
         },
         {
           name: "ExamineCertNo",
-          value: baseMap["auditorNo"] ? baseMap["auditorNo"].value : "",
+          value: baseMap["examineCertNo"] ? baseMap["examineCertNo"].value : "",
         },
         {
           name: "ExamineDate",
-          value: baseMap["reviewTime"] ? baseMap["reviewTime"].value : "",
+          value: baseMap["examineDate"] ? baseMap["examineDate"].value : "",
         },
         {
           name: "CompileExplain",
-          value: baseMap["preparationInstructions"] ? baseMap["preparationInstructions"].value : "",
+          value: baseMap["compileExplain"] ? baseMap["compileExplain"].value : "",
         },
         {
           name: "ExamineExplain",
-          value: baseMap["auditInstructions"] ? baseMap["auditInstructions"].value : "",
+          value: baseMap["examineExplain"] ? baseMap["examineExplain"].value : "",
         },
         {
           name: "ProjectExplain",
-          value: baseMap["auditInstructions"] ? baseMap["auditInstructions"].value : "",
+          value: baseMap["projectExplain"] ? baseMap["projectExplain"].value : "",
         },
       ];
       if (isControl || isBidInvitation) { //招标、招标控制价文件,则以下的8、12~18则不输出
@@ -1448,7 +1481,7 @@ INTERFACE_EXPORT = (() => {
       Element.call(this, "MakeInfo", attrs);
     }
 
-    let data = new CprjInfo(projectData.name);
+    let data = new CprjInfo(projectData.name); 
     data.children.push(new SystemInfo());
     data.children.push(new CostBasis());
     let seriNo = 1;

+ 66 - 28
web/building_saas/standard_interface/import/guangdong_zhongshan.js

@@ -13,6 +13,17 @@ INTERFACE_IMPORT = (() => {
    * @param {Object} xmlObj - xml经过x2js转换后的xml对象
    * @return {Object} - 返回的格式需要统一,具体参考函数内返回的内容。返回的内容会经过一系列的统一处理形成可入库的数据。
    */
+  const RoadGradeMap = {
+    "0": "高速公路",
+    "1": "一级公路",
+    "2": "二级公路",
+    "3": "三级公路",
+    "4": "四级公路",
+    "5": "等外公路",
+    "6": "独立桥梁",
+    "7":"独立隧道"
+  }
+  
   async function entry(areaKey, xmlObj) {
     const {
       UTIL: {
@@ -29,18 +40,37 @@ INTERFACE_IMPORT = (() => {
     if (EprjInfos.length > 0) { 
       let MakeInfo = EprjInfos[0].MakeInfo;
       let Params = EprjInfos[0].Params;
+      let BuildType = getValue(Params, ['_BuildType']);
+      let natureConstruction = "";
+      if (BuildType == "0") natureConstruction = "新建";
+      if (BuildType == "1") natureConstruction = "改扩建";
+
+      let terrainCategory = "";
+      let Terrain = getValue(Params, ['_Terrain']);
+      if (Terrain == "0") terrainCategory = "平原微丘";
+      if (Terrain == "1") terrainCategory = "山岭重丘";
+      let RoadGrade = getValue(Params, ['_RoadGrade']);
+      let roadGrade = "";
+      if (RoadGradeMap[RoadGrade]) roadGrade = RoadGradeMap[RoadGrade];
+
       info = [
-        { key: 'constructingUnits', value: getValue(MakeInfo, ['_Manage']) },
-        { key: 'designUnits', value: getValue(MakeInfo, ['_Designer']) },
-        { key: 'establishUnit', value: getValue(MakeInfo, ['_Compile']) },
-        { key: 'tenderCompiler', value: getValue(MakeInfo, ['_CompileApprover']) },
-        { key: 'authorNo', value: getValue(MakeInfo, ['_CompileCertNo']) },
-        { key: 'establishDate', value: getValue(MakeInfo, ['_CompileDate']) },
-        { key: 'tenderExaminer', value: getValue(MakeInfo, ['_ReviewApprover']) },
-        { key: 'certificateReviewer', value: getValue(MakeInfo, ['_ReviewCertNo']) },
-        { key: 'reviewTime', value: getValue(MakeInfo, ['_ReviewDate']) },
-        { key: 'startAndChainages', value: getValue(Params, ['_StartPileNo'])},
+        { key: 'constructingUnit', value: getValue(MakeInfo, ['_Manage']) },
+        { key: 'designUnit', value: getValue(MakeInfo, ['_Designer']) },
+        { key: 'compileUnit', value: getValue(MakeInfo, ['_Compile']) },
+        { key: 'compileApprover', value: getValue(MakeInfo, ['_CompileApprover']) },
+        { key: 'compileCertNo', value: getValue(MakeInfo, ['_CompileCertNo']) },
+        { key: 'compileDate', value: getValue(MakeInfo, ['_CompileDate']) },
+        { key: 'reviewUnit', value: getValue(MakeInfo, ['_Review']) },
+        { key: 'reviewApprover', value: getValue(MakeInfo, ['_ReviewApprover']) },
+        { key: 'reviewCertNo', value: getValue(MakeInfo, ['_ReviewCertNo']) },
+        { key: 'reviewDate', value: getValue(MakeInfo, ['_ReviewDate']) },
+        { key: 'startChainages', value: getValue(Params, ['_StartPileNo'])},
         { key: 'endChainages', value: getValue(Params, ['_EndPileNo']) },  
+        { key: 'location', value: getValue(Params, ['_PrjArea']) },  
+        { key: 'natureConstruction', value: natureConstruction },  
+        { key: 'terrainCategory', value: terrainCategory },  
+        { key: 'roadGrade', value: roadGrade },  
+
       ]
       for (let t of EprjInfos) { 
         tenders.push(setupTender(t))
@@ -52,32 +82,39 @@ INTERFACE_IMPORT = (() => {
     function setupTender(EprjInfo) { 
       let tender = {};
       let Params = EprjInfo.Params;
+      let SummaryOfCost = EprjInfo.SummaryOfCost;
       tender.name = EprjInfo._Name;
       tender.bills = [];
       tender.bidEvaluationList = [];
       tender.evaluationList = [];
-      let terrainCategory = "";
-      if (getValue(Params, ['_Terrain']) == '平原微丘陵区') terrainCategory = 0;
-      if (getValue(Params, ['_Terrain']) == '山岭重丘陵区') terrainCategory = 0;
+      let ProvisionalSums = getValue(SummaryOfCost, ['_ProvisionalSums']);
+      let Structure = getValue(Params, ['_Structure']);
+      let pavementStructure = "";
+      if (Structure == "0") pavementStructure = "沥青路面";
+      if (Structure == "1") pavementStructure = "水泥混凝土路面";
+      if (Structure == "2") pavementStructure = "其他类型路面";
       tender.feature = [
-        { key: 'projLocation', value: getValue(Params, ['_PrjArea']) },
-        { key: 'buildType', value: getValue(Params, ['_BuildType']) },// --todo
-        { key: 'terrainCategory', value: terrainCategory },
-        { key: 'establishDate', value: getValue(Params, ['_RoadGrade']) },// --todo
-        { key: 'tenderExaminer', value: getValue(Params, ['_DesignSpeed']) },// --todo
-        { key: 'pavementStructure', value: getValue(Params, ['_Structure']) },// --todo
+        { key: 'tenderSumLimit', value: getValue(SummaryOfCost, ['_TenderSumLimit'])},//招标控制价
+        { key: 'designSpeed', value: getValue(Params, ['_DesignSpeed']) },// --todo
+        { key: 'pavementStructure', value: pavementStructure},// --todo
         { key: 'subgradeWidth', value: getValue(Params, ['_SubgradeWidth']) },
-        { key: 'routeLength', value: getValue(Params, ['_RoadLength']) },// --todo
+        { key: 'roadLength', value: getValue(Params, ['_RoadLength']) },// --todo
         { key: 'bridgeLength', value: getValue(Params, ['_BridgeLength']) },
         { key: 'tunnelLength', value: getValue(Params, ['_TunnelLength']) },// --todo
-        { key: 'bridgeTunnelProportion', value: getValue(Params, ['_BriTunRate']) },// --todo
-        { key: 'interchangeNo', value: getValue(Params, ['_InterchangeNum']) },// --todo
-        { key: 'lineContactLineLength', value: getValue(Params, ['_StubLengths']) },// --todo
-        { key: 'auxiliaryContactLineLength', value: getValue(Params, ['_LaneLength']) },// --todo
+        { key: 'briTunRate', value: getValue(Params, ['_BriTunRate']) },// --todo
+        { key: 'interchangeNum', value: getValue(Params, ['_InterchangeNum']) },// --todo
+        { key: 'stubLengths', value: getValue(Params, ['_StubLengths']) },// --todo
+        { key: 'laneLength', value: getValue(Params, ['_LaneLength']) },// --todo
       ]
       const items = arrayValue(EprjInfo, ['Items', 'Item']);
-      for (let i of items) { 
-        tender.bills.push(setupBills(i));
+      for (let i of items) {
+        let bill = setupBills(i);
+        if (bill.name == "暂列金额(不含计日工总额)") { 
+          bill.fees = [{ fieldName: "common",tenderTotalFee:ProvisionalSums, tenderUnitFee: "0", totalFee: ProvisionalSums, unitFee: "0" }];
+          bill.calcBase = ProvisionalSums;
+          bill.calcFlag = 1;
+        } 
+        tender.bills.push(bill);
       }
       const BidEvaluationMainMaterial = arrayValue(EprjInfo, ['BidEvaluationMainMaterial']);
       for (let b of BidEvaluationMainMaterial) { 
@@ -102,8 +139,9 @@ INTERFACE_IMPORT = (() => {
       if (item._ProvisionalType == '0') bill.specialProvisional = '材料';
       if (item._ProvisionalType == '1') bill.specialProvisional = '工程设备';
       if (item._ProvisionalType == '2') bill.specialProvisional = '工程设备';
-      if (item.Item && item.Item.length > 0) { 
-        for (let i of item.Item) { 
+      let subItems = arrayValue(item, ['Item']);
+      if (subItems && subItems.length > 0) { 
+        for (let i of subItems) { 
           bill.children.push(setupBills(i))
         }
       }