Просмотр исходного кода

导入标段数据,更新数据调整

MaiXinRong 3 лет назад
Родитель
Сommit
0037af3ba5
1 измененных файлов с 8 добавлено и 8 удалено
  1. 8 8
      app/lib/sum_load.js

+ 8 - 8
app/lib/sum_load.js

@@ -330,6 +330,7 @@ class gatherStageGclTree extends loadGclBaseTree {
             const relaPos = pos.filter(x => {return x.lid === d.id});
             const baseNode = {
                 id: d.id,
+                is_import: d.is_import,
                 ledger_id: d.ledger_id,
                 ledger_pid: d.ledger_pid,
                 level: d.level,
@@ -339,10 +340,10 @@ class gatherStageGclTree extends loadGclBaseTree {
                 name: d.name,
                 unit: d.unit,
                 unit_price: d.unit_price,
-                org_contract_qty: this.cover ? d.contract_qty || 0 : 0,
-                org_contract_tp: this.cover ? d.contract_tp || 0 : 0,
-                org_qc_qty: d.is_import ? 0 : d.qc_qty || 0,
-                org_qc_tp: d.is_import ? 0 : d.qc_tp || 0,
+                org_contract_qty: d.contract_qty || 0,
+                org_contract_tp: d.contract_tp || 0,
+                org_qc_qty: d.qc_qty || 0,
+                org_qc_tp: d.qc_tp || 0,
                 org_order: d.order,
                 contract_qty: 0,
                 contract_tp: 0,
@@ -386,14 +387,13 @@ class gatherStageGclTree extends loadGclBaseTree {
     getUpdateData() {
         const result = { update: [], errors: [], qc_detail: [] };
         for (const bn of this.baseNodes) {
+            if (!this.cover && !this.contract_qty && !this.qc_qty && !this.contract_tp) continue;
+
             if (!bn.is_import && bn.org_qc_qty !== 0 && bn.qc_qty !== 0) {
                 result.errors.push({ b_code: bn.b_code, name: bn.name, unit: bn.unit, qc_qty: bn.qc_qty, ledger_id: bn.ledger_id, type: 'qc-conflict'});
-                if (bn.contract_qty !== bn.org_contract_qty || bn.contract_tp !== bn.org_contract_tp) {
-                    result.update.push({ lid: bn.id, contract_qty: bn.contract_qty, contract_tp: bn.contract_tp, qc_qty: bn.org_qc_qty, qc_tp: bn.org_qc_tp });
-                }
                 continue;
             }
-            if (bn.contract_qty !== bn.org_contract_qty || bn.contract_tp !== bn.org_contract_tp || bn.qc_qty !== bn.org_qc_qty) {
+            if (bn.is_import || this.cover || bn.contract_qty !== bn.org_contract_qty || bn.contract_tp !== bn.org_contract_tp || bn.qc_qty !== bn.org_qc_qty) {
                 let data = { lid: bn.id, contract_qty: bn.contract_qty, contract_tp: bn.contract_tp };
                 if (!bn.is_import && bn.org_qc_qty) {
                     data.qc_qty = bn.org_qc_qty;