Преглед изворни кода

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

TonyKang пре 4 година
родитељ
комит
c5f487a262

+ 7 - 2
public/web/gljUtil.js

@@ -10,6 +10,7 @@ let gljUtil = {
       com_electrovalence = projectGLJDatas.com_electrovalence;
     let rations = rationDatas;
     let rationMap = _.indexBy(rations, 'ID');
+    let billsMap = _.indexBy(billsDatas,'ID');
     let quantityMap = {};
     let rationGljGroup = _.groupBy(rationGLJDatas, 'projectGLJID');
     let IDarray = this.getSubdivisionAndTechBillsLeavesID(billsDatas); //分别取分部分项和技术措施项目的所有叶子清单ID
@@ -29,7 +30,7 @@ let gljUtil = {
       pglj[qField] = 0;
       pglj[mField] = 0;
       let gljGroup = rationGljGroup[pglj.id] ? rationGljGroup[pglj.id] : []; //定额工料机没有,有可能是定额类型的工料机
-      let result = this.getQuantityPerGLJ(gljGroup, rations, rationMap, pglj, billIDs, tech_billIDS, q_decimal, _, scMathUtil);
+      let result = this.getQuantityPerGLJ(gljGroup, rations, rationMap, pglj, billIDs, tech_billIDS,billsMap, q_decimal, _, scMathUtil);
       pglj[qField] = result.quantity;
       pglj.tenderQuantity = result.tenderQuantity;
       quantityMap[pg_index] = pglj;
@@ -169,12 +170,15 @@ let gljUtil = {
     // 场外运输损耗率%+(装卸总次数-1)*每增加一次装卸损耗率%
     return (offSiteTransportLossRate + (totalLoadingTimes - 1) * handlingLossRate);
   },
-  getQuantityPerGLJ: function (ration_glj_list, rations, rationMap, pglj, billIDs, tech_billIDS, q_decimal, _, scMathUtil) {
+  getQuantityPerGLJ: function (ration_glj_list, rations, rationMap, pglj, billIDs, tech_billIDS,billsMap, q_decimal, _, scMathUtil) {
     let result = {};
     let quantity_sum = 0; //工料机汇总消耗量
     let tender_qantity_sum = 0;
     for (let rg of ration_glj_list) {
       let tem_ration = rationMap[rg.rationID];
+      if(tem_ration){
+        if(!billsMap[tem_ration.billsItemID]) continue;//如果定额工料的父项没有找到,则忽略
+      }
       let r_quantity = tem_ration ? scMathUtil.roundForObj(tem_ration.quantity, q_decimal) : 0;
       let glj_quantity = scMathUtil.roundForObj(rg.quantity, q_decimal);
       let tender_r_quantity = r_quantity;
@@ -192,6 +196,7 @@ let gljUtil = {
       tender_qantity_sum = scMathUtil.roundForObj(tender_qantity_sum + tender_total, q_decimal);
     }
     for (let ra of rations) { //计算定额类型工料机的消耗量
+      if(!billsMap[ra.billsItemID]) continue;//如果定额工料的父项没有找到,则忽略
       if (ra.type == this.rationType.gljRation && ra.projectGLJID === pglj.id) {
         let r_quantity = scMathUtil.roundForObj(ra.quantity, q_decimal);
         r_quantity = r_quantity ? r_quantity : 0;

+ 8 - 8
web/building_saas/main/html/main.html

@@ -750,32 +750,32 @@
                                 <!--关于计算-->
                                 <div class="tab-pane fade" id="poj-settings-4" role="tabpanel">
                                     <div class="modal-auto-height">
-                                        <fieldset class="form-group" style="display:none">
-                                            <h5>取费方式</h5>
-                                            <div class="form-check">
+                                        <fieldset class="form-group" >
+                                            <h5>计算方式</h5>
+                                         <!--    <div class="form-check">
                                                 <label class="form-check-label">
                                                     <input class="form-check-input" name="calcFlag" id="rationContent" value="0" type="radio">
                                                     子目含量取费
                                                 </label>
-                                            </div>
+                                            </div> -->
                                             <div class="form-check">
                                                 <label class="form-check-label">
                                                     <input class="form-check-input" name="calcFlag" id="rationPriceConverse" value="1" type="radio">
-                                                    子目单价取费(反算:清单综合合价=清单综合单价*清单工程量
+                                                    反算:清单综合合价=清单综合单价*清单工程量
                                                 </label>
                                             </div>
                                             <div class="form-check">
                                                 <label class="form-check-label" >
                                                     <input class="form-check-input" name="calcFlag" id="rationPrice" value="2" type="radio">
-                                                    子目单价取费(正算:清单综合合价=∑子目综合合价
+                                                   正算:清单综合合价=∑子目综合合价
                                                 </label>
                                             </div>
-                                            <div class="form-check">
+                                           <!--  <div class="form-check">
                                                 <label class="form-check-label">
                                                     <input class="form-check-input" name="calcFlag" id="billsPrice" value="3" type="radio">
                                                     清单单价取费
                                                 </label>
-                                            </div>
+                                            </div> -->
                                         </fieldset>
                                         <fieldset class="form-group" style="display:none">
                                             <h5>暂估合价计算方式</h5>

+ 11 - 7
web/building_saas/main/js/models/calc_program.js

@@ -972,10 +972,9 @@ let calcTools = {
     } else if (this.isLeafBill(treeNode)) {
       if (treeNode.children && treeNode.children.length > 0) {
         // 清单单价计算模式下的叶子清单:取自己的计算程序ID,找到自己的计算程序计算。(汇总清单所有定额的工料机)
-        // if (projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
-        //     return treeNodeCalcType.ctBillCalcProgram;
-        // else                                        // 前三种计算模式下的叶子清单:汇总定额的计算程序的费用类别
-        return treeNodeCalcType.ctGatherRationsFees;
+         if (projectObj.project.property.billsCalcMode === leafBillGetFeeType.billsPrice)
+             return treeNodeCalcType.ctBillCalcProgram;
+         else return treeNodeCalcType.ctGatherRationsFees;// 前三种计算模式下的叶子清单:汇总定额的计算程序的费用类别
       } else {
         // 公式计算
         return treeNodeCalcType.ctCalcBaseValue;
@@ -2284,15 +2283,20 @@ class CalcProgram {
           bttf = sum_rttf;
         }
 
-        if (
+       /*  if (
           calcTools.isBillProject() &&
           (ft.type == "common" || ft.type == "rationCommon")
+        )  */
+        if (
+          me.project.property.billsCalcMode == leafBillGetFeeType.rationPriceConverse &&
+          (ft.type == "common" || ft.type == "rationCommon")
         ) {
-          // 招投标项目, 还要反算
+          // 招投标项目, 还要反算 
+          // 9-24 新需求 开放正算反算选项,按选项判断
           buf = buf.toDecimal(decimalObj.bills.unitPrice);
           btuf = btuf.toDecimal(decimalObj.bills.unitPrice);
           btf = (buf * nQ).toDecimal(decimalObj.bills.totalPrice);
-          bttf = (btuf * nQ).toDecimal(decimalObj.bills.totalPrice);
+          bttf = (btuf * nQ).toDecimal(decimalObj.bills.totalPrice); 
         }
       }
 

+ 3 - 0
web/building_saas/main/js/views/importBills.js

@@ -308,6 +308,9 @@ const importBills = (function () {
         let curSheetType = null;
         for (let sheetName in sheets) {
             let sheetData = sheets[sheetName];
+            if (!sheetData.data.dataTable) {
+                continue;
+            }
             let sheetType = getFileType(sheetData);
             if (curSheetType !== null && sheetType !== curSheetType) {
                 throw 'excel文件中存在不同格式的表格。';

+ 2 - 0
web/building_saas/main/js/views/project_glj_view.js

@@ -317,6 +317,8 @@ projectGljObject={
          } 
          for(let r of projectObj.project.Ration.datas){
             if(rationIDMap[r.ID] || (r.type == rationType.gljRation && r.projectGLJID== projectGLJData.id)){
+              let billNode =  projectObj.project.mainTree.findNode(r.billsItemID);////如果定额工料的父项没有找到,则忽略
+              if(!billNode) continue;
               rations.push(r);
             } 
          } 

+ 9 - 1
web/building_saas/standard_interface/config.js

@@ -118,6 +118,14 @@ const INTERFACE_CONFIG = (() => {
         [BID_SUBMISSION]: '.zjgltb',
         [CONTROL]: '.zjglzbkzj',
       },
-    }
+    },
+    '浙江@海曙区': {
+      scriptName: 'zhejiang_ninghai.js',
+      fileSuffix: {
+        [BID_INVITATION]: '.zjglzb',
+        [BID_SUBMISSION]: '.zjgltb',
+        [CONTROL]: '.zjglzbkzj',
+      },
+    },
   };
 })()

+ 1 - 1
web/building_saas/standard_interface/export/guangdong_zhongshan.js

@@ -310,7 +310,7 @@ INTERFACE_EXPORT = (() => {
         },
         {
           name: "Key1",
-          value: window.btoa(VERSION),
+          value: window.btoa(userID),
         },
         {
           name: "Key2",

+ 5 - 4
web/building_saas/standard_interface/import/anhui_maanshan.js

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

+ 33 - 5
web/building_saas/standard_interface/import/base.js

@@ -330,7 +330,7 @@ const INTERFACE_EXPORT_BASE = (() => {
           const regStr = /{[^{}]+}/.test(child.rowCode) ? child.rowCode : `\\b${child.rowCode}\\b`;
           rowCodeData.push({ reg: new RegExp(regStr, 'g'), ID: child.ID, rowCode: child.rowCode });
         }
-        if (child.calcBase) {
+        if (child.tempCalcBase) {
           toBeTransformBills.push(child);
         }
         if (child.children && child.children.length) {
@@ -339,16 +339,44 @@ const INTERFACE_EXPORT_BASE = (() => {
       });
     }
     setBills(billsTarget, -1);
-    // 转换计算基数,将行引用转换为ID引用
+    // 转换计算基数
     toBeTransformBills.forEach(bills => {
       rowCodeData.forEach(({ reg, ID, rowCode }) => {
         const rowCodeReg = new RegExp(`{${rowCode}}`);
-        if (rowCodeReg.test(bills.calcBase)) {
-          bills.calcBase = bills.calcBase.replace(rowCodeReg, `@${ID}`);
+        // 替换行号
+        if (rowCodeReg.test(bills.tempCalcBase)) {
+          bills.tempCalcBase = bills.tempCalcBase.replace(rowCodeReg, `@${ID}`);
         } else {
-          bills.calcBase = bills.calcBase.replace(reg, `@${ID}`);
+          bills.tempCalcBase = bills.tempCalcBase.replace(reg, `@${ID}`);
         }
+        // 替换基数,防止其他公司的软件导出没有{}
+        bills.tempCalcBase = bills.tempCalcBase.replace(/.?专项暂定合计.?/g, '{专项暂定合计}');
+        bills.tempCalcBase = bills.tempCalcBase.replace(/.?各章清单合计.?/g, '{各章清单合计}');
       });
+
+      /* 检查基数有效性,无效则使用模板的基数 */
+      // 消除ID引用对基数分割的影响
+      const IDs = bills.tempCalcBase.match(/@[\da-zA-Z-]{36}/g) || [];
+      const bases = [...IDs];
+      const str = bills.tempCalcBase.replace(/@[\da-zA-Z-]{36}/g, '');
+      const otherBases = str.split(/[+-/*]/).filter(item => !!item);
+      bases.push(...otherBases);
+      // 判定基数有效性
+      const isValid = bases.every(base => {
+        if (base === '{专项暂定合计}' || base === '{各章清单合计}') {
+          return true;
+        }
+        if (/^(\d+(\.\d+)?)%?$/.test(base)) { // 数值+%(可有可无)
+          return true;
+        }
+        if (/[\da-zA-Z-]{36}/.test(base)) { // ID引用
+          return true;
+        }
+        return false;
+      });
+      if (isValid) {
+        bills.calcBase = bills.tempCalcBase;
+      }
     });
     rst.forEach(bills => delete bills.children);
     return rst;