Browse Source

导入调整

MaiXinRong 4 years ago
parent
commit
de416e0ecc
1 changed files with 4 additions and 3 deletions
  1. 4 3
      app/lib/analysis_excel.js

+ 4 - 3
app/lib/analysis_excel.js

@@ -446,6 +446,7 @@ class AnalysisExcelTree {
      */
     constructor(ctx) {
         this.ctx = ctx;
+        this.decimal = ctx.tender.info.decimal;
         this.colsDef = null;
         this.colHeaderMatch = {
             code: {value: ['项目节编号', '预算项目节'], type: colDefineType.match},
@@ -501,7 +502,7 @@ class AnalysisExcelTree {
             node.quantity = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.quantity]), precision.value);
             node.dgn_qty1 = aeUtils.toNumber(row[this.colsDef.dgn_qty1]);
             node.dgn_qty2 = aeUtils.toNumber(row[this.colsDef.dgn_qty2]);
-            node.unit_price = aeUtils.toNumber(row[this.colsDef.unit_price]);
+            node.unit_price = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.unit_price]), this.decimal.up);
             node.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
             node.memo = this.ctx.helper.replaceReturn(row[this.colsDef.memo]);
             if (node.quantity && node.unit_price) {
@@ -539,7 +540,7 @@ class AnalysisExcelTree {
         const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, node.unit);
         node.quantity = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.quantity]), precision.value);
         node.sgfh_qty = node.quantity;
-        node.unit_price = aeUtils.toNumber(row[this.colsDef.unit_price]);
+        node.unit_price = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.unit_price]), this.decimal.up);
         node.drawing_code = this.ctx.helper.replaceReturn(row[this.colsDef.drawing_code]);
         node.memo = this.ctx.helper.replaceReturn(row[this.colsDef.memo]);
         if (node.quantity && node.unit_price) {
@@ -751,7 +752,7 @@ class AnalysisGclExcelTree {
         node.unit = this.ctx.helper.replaceReturn(row[this.colsDef.unit]);
         const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, node.unit);
         node.quantity = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.quantity]), precision.value);
-        node.unit_price = aeUtils.toNumber(row[this.colsDef.unit_price]);
+        node.unit_price = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.unit_price]), this.ctx.tender.info.decimal.up);
         if (node.quantity && node.unit_price) {
             node.total_price = this.ctx.helper.mul(node.quantity, node.unit_price, this.ctx.tender.info.decimal.tp);
         } else {