Browse Source

导入计量台账,导入计量数据时,导入本期批注

MaiXinRong 2 years ago
parent
commit
4fcf1ae7d9
2 changed files with 12 additions and 8 deletions
  1. 6 2
      app/lib/analysis_excel.js
  2. 6 6
      app/service/stage_stash.js

+ 6 - 2
app/lib/analysis_excel.js

@@ -901,8 +901,9 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
             contract_tp: {value: ['本期合同计量|金额'], type: colDefineType.match},
             deal_dgn_qty1: {value: ['合同|项目节数量1'], type: colDefineType.match},
             deal_dgn_qty2: {value: ['合同|项目节数量2'], type: colDefineType.match},
-            qc_dgn_qty1: {value: ['变更|项目节数量1'], type: colDefineType.match},
-            qc_dgn_qty2: {value: ['变更|项目节数量2'], type: colDefineType.match},
+            c_dgn_qty1: {value: ['变更|项目节数量1'], type: colDefineType.match},
+            c_dgn_qty2: {value: ['变更|项目节数量2'], type: colDefineType.match},
+            postil: {value: ['本期批注'], type: colDefineType.match}
         };
         this.needCols = ['code', 'b_code', 'pos', 'name', 'unit', 'unit_price', 'contract_qty', 'contract_tp'];
     }
@@ -942,6 +943,7 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
             xmj.deal_dgn_qty2 = aeUtils.toNumber(row[this.colsDef.deal_dgn_qty2]);
             xmj.c_dgn_qty1 = aeUtils.toNumber(row[this.colsDef.c_dgn_qty1]);
             xmj.c_dgn_qty2 = aeUtils.toNumber(row[this.colsDef.c_dgn_qty2]);
+            xmj.postil = this.ctx.helper.replaceReturn(row[this.colsDef.postil]);
             this.ctx.helper.checkDgnQtyPrecision(xmj);
             return xmj;
         } catch (error) {
@@ -978,6 +980,7 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
         } else {
             node.contract_tp = null;
         }
+        node.postil = this.ctx.helper.replaceReturn(row[this.colsDef.postil]);
         if (this.filter.filterZeroGcl && !node.contract_qty && !node.contract_tp) return true;
         return this.cacheTree.addGclNode(node);
     }
@@ -994,6 +997,7 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
         pos.quantity = aeUtils.toNumber(row[this.colsDef.contract_qty]);
         pos = this.cacheTree.addPos(pos, true);
         pos.contract_qty = pos.quantity;
+        pos.postil = this.ctx.helper.replaceReturn(row[this.colsDef.postil]);
         return pos;
     }
 

+ 6 - 6
app/service/stage_stash.js

@@ -72,9 +72,9 @@ class loadStageExcelTree {
                 let ssp = sourceStagePos.find(x => { return x.pid === sp.id; });
                 sourceStagePos.splice(sourceStagePos.indexOf(ssp), 1);
                 if (ssp) {
-                    this.updatePos.push({ id: ssp.id, contract_qty: p.contract_qty });
+                    this.updatePos.push({ id: ssp.id, contract_qty: p.contract_qty, postil: p.postil || ssp.postil || '' });
                 } else {
-                    this.insertPos.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, pid:sp.id, contract_qty: p.contract_qty });
+                    this.insertPos.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, pid:sp.id, contract_qty: p.contract_qty, postil: p.postil || ssp.postil || '' });
                 }
             }
             for (const ssp of sourceStagePos) {
@@ -82,9 +82,9 @@ class loadStageExcelTree {
             }
             const contract_tp = this.ctx.helper.mul(contract_qty, source.unit_price, this.decimal.tp);
             if (curStageBills) {
-                this.updateBills.push({ id: curStageBills.id, contract_qty, contract_tp });
+                this.updateBills.push({ id: curStageBills.id, contract_qty, contract_tp, postil: node.postil || source.postil || '' });
             } else {
-                if (contract_qty) this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty, contract_tp });
+                if (contract_qty) this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty, contract_tp, postil: node.postil || source.postil || '' });
             }
         } else {
             if (!node.contract_qty && !node.contract_tp) return;
@@ -94,9 +94,9 @@ class loadStageExcelTree {
                 : this.ctx.helper.round(contract_tp, this.decimal.tp);
 
             if (curStageBills) {
-                this.updateBills.push({ id: curStageBills.id, contract_qty: contract_qty, contract_tp: contract_tp });
+                this.updateBills.push({ id: curStageBills.id, contract_qty: contract_qty, contract_tp: contract_tp, postil: node.postil || source.postil || '' });
             } else {
-                this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty: contract_qty, contract_tp: contract_tp });
+                this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty: contract_qty, contract_tp: contract_tp, postil: node.postil || source.postil || '' });
             }
         }
     }