Browse Source

导入大司空计算调整

MaiXinRong 3 tháng trước cách đây
mục cha
commit
c1ae6c5a8a
2 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 3 2
      app/lib/ybp_tree.js
  2. 2 2
      app/service/ledger.js

+ 3 - 2
app/lib/ybp_tree.js

@@ -166,6 +166,7 @@ class YbpImportTree {
         const setting = this.setting;
         const compareData = { kind: node.kind };
         const hasUp = (!node.children || node.children.length === 0) && defaultMerge.indexOf(compareData.kind) < 0;
+        // const hasUp = (!node.children || node.children.length === 0) &&(defaultMerge.indexOf(compareData.kind) < 0 ||  (this.importType === YbpImportType.flow));
         const isXmj = defaultMerge.indexOf(compareData.kind) >= 0;
         compareData.code = isXmj ? node.code || '' : '';
         compareData.b_code = isXmj ? '' : node.code || '';
@@ -192,7 +193,7 @@ class YbpImportTree {
                 this.children.push(cur);
             }
             this.datas.push(cur);
-            cur.dgn_qty1 = isXmj ? node.quantity || 1 : 0;
+            cur.dgn_qty1 = isXmj ? node.quantity || 0 : 0;
             cur.dgn_qty2 = isXmj ? node.quantity2 || 0 : 0;
             cur.quantity = isXmj ? 0 : node.quantity || 0;
             cur.total_fee = node.fees ? node.fees.marketCommon.totalFee : 0;
@@ -201,7 +202,7 @@ class YbpImportTree {
             cur.features = node.itemCharacterText || '';
         } else {
             if (isXmj) {
-                cur.dgn_qty1 = this.helper.add(cur.dgn_qty1, node.quantity || 1);
+                cur.dgn_qty1 = this.helper.add(cur.dgn_qty1, node.quantity || 0);
                 cur.dgn_qty2 = this.helper.add(cur.dgn_qty2, node.quantity2 || 0);
             } else {
                 cur.quantity = this.helper.add(cur.quantity, node.quantity || 0);

+ 2 - 2
app/service/ledger.js

@@ -729,8 +729,8 @@ module.exports = app => {
                     const precision = helper.findPrecision(tender.info.precision, node.unit);
                     node.quantity = helper.round(node.quantity, precision.value);
                     node.unit_price = helper.round(node.unit_price, decimal.up);
-                    if (!node.children || node.children.length === 0) {
-                        node.total_price = helper.mul(node.quantity, node.unit_price, decimal.tp);
+                    if ((!node.children || node.children.length === 0)) {
+                        node.total_price = node.b_code ? helper.mul(node.quantity, node.unit_price, decimal.tp) : helper.round(node.total_fee, decimal.tp);
                     }
                 },
             };