Prechádzať zdrojové kódy

导入Excel,计量单元bug

MaiXinRong 3 rokov pred
rodič
commit
ceeb5686c3
2 zmenil súbory, kde vykonal 4 pridanie a 4 odobranie
  1. 1 1
      app/lib/analysis_excel.js
  2. 3 3
      app/service/stage_stash.js

+ 1 - 1
app/lib/analysis_excel.js

@@ -300,7 +300,7 @@ class ImportBaseTree {
         if (this.finalNode && this.finalNode.pos) {
             if (strict) {
                 const exist = this.finalNode.pos.find(x => { return x.name === pos.name; });
-                if (exist) return;
+                if (exist) return exist;
             }
             pos.id = this.ctx.app.uuid.v4();
             pos.lid = this.finalNode.id;

+ 3 - 3
app/service/stage_stash.js

@@ -94,10 +94,10 @@ class loadStageExcelTree {
             }
         } else {
             if (!node.contract_qty && !node.contract_tp) return;
-            const contract_qty = node.contract_qty;
+            const contract_qty = source.is_tp ? 0 : node.contract_qty;
             const contract_tp = contract_qty
                 ? this.ctx.helper.mul(contract_qty, source.unit_price, this.decimal.tp)
-                : this.ctx.helper.round(contract_tp, this.decimal.tp);
+                : this.ctx.helper.round(node.contract_tp, this.decimal.tp);
 
             if (curStageBills) {
                 this.updateBills.push({ id: curStageBills.id, contract_qty: contract_qty, contract_tp: contract_tp, postil: node.postil || curStageBills.postil || '' });
@@ -336,7 +336,7 @@ module.exports = app => {
                 });
                 const extraData = await this.ctx.service.ledgerExtra.getData(this.ctx.tender.id, ['is_tp']);
                 this.ctx.helper.assignRelaData(ledgerData, [
-                    { data: extraData, fields: ['is_import'], prefix: '', relaId: 'id' },
+                    { data: extraData, fields: ['is_tp'], prefix: '', relaId: 'id' },
                 ]);
                 const posData = await this.ctx.service.pos.getAllDataByCondition({
                     columns: ['id', 'lid', 'name', 'porder'],