Pārlūkot izejas kodu

导入计量台账Excel,本期批注问题

MaiXinRong 2 gadi atpakaļ
vecāks
revīzija
40ebf5f8a4
1 mainītis faili ar 15 papildinājumiem un 6 dzēšanām
  1. 15 6
      app/service/stage_stash.js

+ 15 - 6
app/service/stage_stash.js

@@ -74,7 +74,10 @@ class loadStageExcelTree {
                 if (ssp) {
                     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, postil: p.postil || ssp.postil || '' });
+                    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 || ''
+                    });
                 }
             }
             for (const ssp of sourceStagePos) {
@@ -82,9 +85,12 @@ 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, postil: node.postil || source.postil || '' });
+                this.updateBills.push({ id: curStageBills.id, contract_qty, contract_tp, postil: node.postil || curStageBills.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, postil: node.postil || source.postil || '' });
+                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 || ''
+                });
             }
         } else {
             if (!node.contract_qty && !node.contract_tp) return;
@@ -94,9 +100,12 @@ 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, postil: node.postil || source.postil || '' });
+                this.updateBills.push({ id: curStageBills.id, contract_qty: contract_qty, contract_tp: contract_tp, postil: node.postil || curStageBills.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, postil: node.postil || source.postil || '' });
+                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 || ''
+                });
             }
         }
     }
@@ -322,7 +331,7 @@ module.exports = app => {
                 const cacheTree = analysisExcel.analysisData(excelData, tempData, { filterZeroGcl: false });
 
                 const ledgerData = await this.ctx.service.ledger.getAllDataByCondition({
-                    columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price', 'is_tp'],
+                    columns: ['id', 'ledger_id', 'ledger_pid', 'level', 'order', 'full_path', 'is_leaf', 'code', 'b_code', 'name', 'unit', 'unit_price'],
                     where: { tender_id: stage.tid},
                 });
                 const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp']);