瀏覽代碼

上报检查,超计调整

MaiXinRong 1 年之前
父節點
當前提交
8b897280b2
共有 2 個文件被更改,包括 9 次插入34 次删除
  1. 9 33
      app/lib/ledger.js
  2. 0 1
      app/service/stage_change.js

+ 9 - 33
app/lib/ledger.js

@@ -976,40 +976,13 @@ class checkData {
         }
     }
     _checkBillsOverRange(bills, posRange, isTz) {
-        // if (isTz && posRange.length > 0) {
-        //     for (const p of posRange) {
-        //         const end_contract_qty = this.add(p.pre_contract_qty, p.contract_qty);
-        //         if (end_contract_qty > p.quantity) return true;
-        //     }
-        //     return false;
-        // } else {
-        //     const end_qc_qty = this.add(bills.qc_qty, bills.pre_qc_qty);
-        //     const end_qc_tp = this.add(bills.qc_tp, bills.pre_qc_tp);
-        //     const end_gather_qty = this.sum([bills.contract_qty, bills.pre_contract_qty, end_qc_qty]);
-        //     const end_gather_tp = this.sum([bills.contract_tp, bills.pre_contract_tp, end_qc_tp]);
-        //     if (isTz) {
-        //         if (end_gather_qty) {
-        //             return !bills.quantity || Math.abs(end_gather_qty) > Math.abs(this.add(bills.quantity, end_qc_qty));
-        //         } else if (end_gather_tp) {
-        //             return !bills.total_price || Math.abs(end_gather_tp) > Math.abs(this.add(bills.total_price, end_qc_tp));
-        //         }
-        //     } else {
-        //         if (end_gather_qty) {
-        //             return !bills.deal_qty || Math.abs(end_gather_qty) > Math.abs(this.add(bills.deal_qty, end_qc_qty));
-        //         } else if (end_gather_tp) {
-        //             return !bills.deal_tp || Math.abs(end_gather_tp) > Math.abs(this.add(bills.deal_tp, end_qc_tp));
-        //         }
-        //     }
-        // }
         if (isTz && posRange.length > 0) {
             for (const p of posRange) {
                 const end_contract_qty = this.ctx.helper.add(p.pre_contract_qty, p.contract_qty);
                 if (!p.quantity && !!end_contract_qty) return true;
-                if (p.quantity > 0) {
-                    if (end_contract_qty > p.final_1_qty) return true;
-                } else {
-                    if (end_contract_qty < p.final_1_qty || end_contract_qty > 0) return true;
-                }
+                return p.quantity > 0
+                    ? end_contract_qty > p.quantity
+                    : (p.final_1_qty ? end_contract_qty > p.final_1_qty : end_contract_qty < p.final_1_qty || p.final_1_qty > 0);
             }
         }
         const end_contract_qty = this.ctx.helper.add(bills.contract_qty, bills.pre_contract_qty);
@@ -1019,9 +992,12 @@ class checkData {
             if (!compare_tp) return !!end_contract_tp;
             return compare_tp >= 0 ? end_contract_tp > compare_tp : end_contract_tp < compare_tp || end_contract_tp > 0;
         } else {
-            const compare_qty = isTz ? bills.final_1_qty : bills.deal_final_1_qty;
-            if (!compare_qty) return !!end_contract_qty;
-            return compare_qty >= 0 ? end_contract_qty > compare_qty : end_contract_qty < compare_qty || end_contract_qty > 0;
+            const compare_qty1 = isTz ? bills.quantity : bills.deal_qty;
+            const compare_qty2 = isTz ? bills.final_1_qty : bills.deal_final_1_qty;
+            if (!compare_qty1) return !!end_contract_qty;
+            return compare_qty1 > 0
+                ? end_contract_qty > compare_qty2
+                : (compare_qty2 > 0 ? end_contract_qty > compare_qty2 : end_contract_qty < compare_qty2 || end_contract_qty > 0);
         }
     }
     checkOverRange() {

+ 0 - 1
app/service/stage_change.js

@@ -789,7 +789,6 @@ module.exports = app => {
                 cbid.push(x.cbid);
             });
             const validChangeBills = await this.ctx.service.stageChangeFinal.getListChangeBillsValidQty(tender.id, cbid);
-            console.log(cbid, validChangeBills);
             validChangeBills.forEach(x => {
                 x.billsPos = data.find(y => { return x.id === y.cbid; });
             });