Browse Source

量价的调价方案调整

chenshilong 5 years ago
parent
commit
b0cc288c17

+ 3 - 26
web/building_saas/main/html/tender_price.html

@@ -1,44 +1,21 @@
 
 <div class="toolsbar px-1">
     <div class="btn-toolbar py-1">
-        <!--<div class="input-group input-group-sm mr-2" style="margin-left:10px; margin-top:4px;">-->
         <div class="input-group input-group-sm mr-2">
             <select class="form-control form-control-sm" style="width: auto; font-size: .875rem" id="calcPriceOption">
                 <option value="coeBase">按调价系数计算</option>
                 <option value="priceBase_RCJ" >按目标价调整人材机消耗</option>
                 <option value="priceBase_ZM" >按目标价调整子目工程量</option>
             </select>
-<!--            <div class="form-check">
-                <label class="form-check-label">
-                    <input class="form-check-input" name="tenderCalcType" id="tenderCalcByXS" value="0" type="radio">
-                    按调价系数正算 
-                </label>
-            </div>
-            <div class="form-check">
-                <label class="form-check-label">
-                    <input class="form-check-input" name="tenderCalcType" id="tenderCalcByTargetRCJ" value="1" type="radio">
-                    按目标价反算人材机消耗 
-                </label>
-            </div>
-            <div class="form-check">
-                <label class="form-check-label">
-                    <input class="form-check-input" name="tenderCalcType" id="tenderCalcByTargetZM" value="2" type="radio">
-                    按目标价反算子目工程量 
-                </label>
-            </div>-->
         </div>
-        <div class="input-group input-group-sm mr-2" style="width:200px">
+
+        <div class="input-group input-group-sm mr-2" style="width:230px">
             <div class="input-group-prepend">
                 <span class="input-group-text" id="inputGroup-sizing-sm">人材机单价调整系数</span>
             </div>
             <input id = 'gljPriceTenderCoe' type="number" step="0.1" class="form-control" placeholder="请输入系数" value="1">
         </div>
-        <!--<div class="btn-group mr-2">-->
-            <!--<button type="button" class="btn btn-outline-primary btn-sm" id = "tenderGLJQuantity">调整人材机消耗</button>-->
-            <!--<button type="button" class="btn btn-outline-primary btn-sm" id = "tenderRationQuantity">调整子目工程量</button>-->
-           <!--&lt;!&ndash; <button type="button" class="btn btn-outline-primary btn-sm">反调单价</button>&ndash;&gt;-->
-            <!--<button type="button" class="btn btn-outline-primary btn-sm" id = "tenderPrice">调价计算2</button>-->
-        <!--</div>-->
+
         <button type="button" class="btn btn-outline-primary btn-sm" id = "tenderPrice">调价计算</button>
         <span>&nbsp</span>
         <button type="button" class="btn btn-outline-danger btn-sm" id = "cleanTender">清空调价</button>

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

@@ -949,17 +949,21 @@ let calcTools = {
             let qCoe = 1;
             /* 量价、工料机类型的定额,在反向调价之调整人材机消耗量系数时,因为他们没有工料机可调,调价结果没变,影响汇总后的父结点金额。
             所以要特殊处理:此种情况下仍然要调量价的消耗量,即还是要像"子目工程量调整系数"方式那样调,但系数又不能在"子目工程量调整系数"
-            中显示出来,所以可以改变tenderQuantity达到同样的效果以瞒天过海。所以在取系数时,无论什么系数,只要能取到就算正确。 */
-            if (treeNode.data.type == rationType.volumePrice || treeNode.data.type == rationType.gljRation){
-                if (treeNode.data.rationQuantityCoe)
-                    qCoe = treeNode.data.rationQuantityCoe
-                else if (treeNode.data.quantityCoe && treeNode.data.quantityCoe.labour)
-                    qCoe = treeNode.data.quantityCoe.labour;
-            }
-            else {
+            中显示出来(明明是调工料机,你却调到树结点上,这比较搞笑啊),所以可以改变tenderQuantity达到同样的效果以瞒天过海。所以在取系数时,
+            无论什么系数,只要能取到就算正确。
+            2020-04-05 注: 以上是老黄历。新思路是量价只作为定额调整,不作为工料机调整。两种反调模式下,统一都只调子目消耗量系数。
+            为避免歧义,量价的工料机调整系数不允许输入。
+            */
+            // if (treeNode.data.type == rationType.volumePrice || treeNode.data.type == rationType.gljRation){
+            //     if (treeNode.data.rationQuantityCoe)
+            //         qCoe = treeNode.data.rationQuantityCoe
+            //     else if (treeNode.data.quantityCoe && treeNode.data.quantityCoe.labour)
+            //         qCoe = treeNode.data.quantityCoe.labour;
+            // }
+            // else {
                 if (treeNode.data.rationQuantityCoe)
                     qCoe = treeNode.data.rationQuantityCoe;
-            };
+            // };
             if (qCoe == '0' || qCoe == 0) qCoe = 1;
             treeNode.data.tenderQuantity = (this.uiNodeQty(treeNode) * qCoe).toDecimal(decimalObj.decimal("quantity", treeNode));
             return treeNode.data.tenderQuantity;
@@ -2330,20 +2334,27 @@ class CalcProgram {
         if (treeNode.data.feesIndex.common.totalFee != 0)
             coe = (treeNode.data.targetUnitFee / treeNode.data.feesIndex.common.unitFee).toDecimal(decimalObj.process);
 
-        if (tender == tenderTypes.ttReverseRation){
+        // 调价情况之————量价反调工料机(量价无工料机可调,还是按定额来调,即直接调树结点的消耗量)
+        let isVP_RevGLJ =(tender == tenderTypes.ttReverseGLJ) && (treeNode.data.type == rationType.volumePrice || treeNode.data.type == rationType.gljRation);
+
+        if ((tender == tenderTypes.ttReverseRation) || isVP_RevGLJ){
             treeNode.data.tenderQuantity = (treeNode.data.quantity * coe).toDecimal(decimalObj.decimal("quantity", treeNode));
             if (treeNode.data.rationQuantityCoe != coe){
                 treeNode.data.rationQuantityCoe = coe;
                 treeNode.changed = true;
             };
 
+            if (isVP_RevGLJ){
+                treeNode.data.quantityCoe = {labour: 0, material: 0, machine: 0, main: 0, equipment: 0};
+                treeNode.changed = true;
+            };
+
             let ttf = (treeNode.data.tenderQuantity * treeNode.data.feesIndex.common.tenderUnitFee).toDecimal(decimalObj.decimal('totalPrice', treeNode));
             if (treeNode.data.feesIndex.common.tenderTotalFee != ttf){
                 treeNode.data.feesIndex.common.tenderTotalFee = ttf;
                 treeNode.changed = true;
             };
         }else if (tender == tenderTypes.ttReverseGLJ){
-            //     treeNode.data.tenderQuantity = treeNode.data.quantity;   // 这句好像多余,因为调用calculate()时里面会重新计算tenderQuantity,有问题再放开AAAAA
             let qcObj = treeNode.data.quantityCoe;
             if (!qcObj || calcTools.isEmptyObject(qcObj)){
                 treeNode.data.quantityCoe = {labour: coe, material: coe, machine: coe, main: coe, equipment: coe};

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

@@ -224,6 +224,8 @@ let tender_obj={
     updateChildrenValue:function (node,dataCode,value,datas,nodes) {
          if(node.children.length > 0){
             for(let c of node.children){
+                if ((dataCode.indexOf("quantityCoe.") != -1) && (c.data.type == rationType.volumePrice || c.data.type == rationType.gljRation))
+                    value = 0;
                 this.updateChildrenValue(c,dataCode,value,datas,nodes);
                 let updateData = {type:c.sourceType,data:{'ID' : c.data.ID}};
                 updateData.data[dataCode] = value;