|
@@ -104,6 +104,7 @@ class YbpImportTree {
|
|
|
this.importType = type;
|
|
|
this.helper = helper;
|
|
|
this.decimal = decimal;
|
|
|
+ this.default = { dgn_qty1: 1, dgn_qty2: 0, qty: 0 };
|
|
|
this.clearDatas();
|
|
|
}
|
|
|
set newId(num) {
|
|
@@ -174,7 +175,7 @@ class YbpImportTree {
|
|
|
? (node.fees && node.fees.marketCommon ? node.fees.marketCommon.unitPrice : 0)
|
|
|
: 0;
|
|
|
|
|
|
- let cur = (this.importType === YbpImportType.merge || defaultMerge.indexOf(compareData.kind) >= 0)
|
|
|
+ let cur = (this.importType === YbpImportType.merge && defaultMerge.indexOf(compareData.kind) >= 0)
|
|
|
? this._findNode(compareData, parent)
|
|
|
: null;
|
|
|
if (!cur) {
|
|
@@ -191,15 +192,16 @@ class YbpImportTree {
|
|
|
this.children.push(cur);
|
|
|
}
|
|
|
this.datas.push(cur);
|
|
|
- cur.dgn_qty1 = isXmj ? node.quantity || 0 : 0;
|
|
|
+ cur.dgn_qty1 = isXmj ? node.quantity || 1 : 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;
|
|
|
cur.labour_fee = node.fees && node.fees.marketLabour ? node.fees.marketLabour.totalFee : 0;
|
|
|
cur.remark = node.remark;
|
|
|
+ cur.features = node.itemCharacterText || '';
|
|
|
} else {
|
|
|
if (isXmj) {
|
|
|
- cur.dgn_qty1 = this.helper.add(cur.dgn_qty1, node.quantity || 0);
|
|
|
+ cur.dgn_qty1 = this.helper.add(cur.dgn_qty1, node.quantity || 1);
|
|
|
cur.dgn_qty2 = this.helper.add(cur.dgn_qty2, node.quantity2 || 0);
|
|
|
} else {
|
|
|
cur.quantity = this.helper.add(cur.quantity, node.quantity || 0);
|
|
@@ -209,14 +211,18 @@ class YbpImportTree {
|
|
|
}
|
|
|
if (loadRelaFun) loadRelaFun(cur, node);
|
|
|
cur.source.push(this.unitName);
|
|
|
- for (const c of node.children) {
|
|
|
- this._importNode(c, cur, loadRelaFun);
|
|
|
+ if (node.children) {
|
|
|
+ for (const c of node.children) {
|
|
|
+ this._importNode(c, cur, loadRelaFun,);
|
|
|
+ }
|
|
|
}
|
|
|
+ return cur;
|
|
|
}
|
|
|
importTree(tree, unitName, loadRelaFun) {
|
|
|
+ const parent = this.importType === YbpImportType.flow ? this._importNode({name: unitName}) : null;
|
|
|
this.unitName = unitName;
|
|
|
for (const n of tree.children) {
|
|
|
- this._importNode(n, null, loadRelaFun);
|
|
|
+ this._importNode(n, parent, loadRelaFun);
|
|
|
}
|
|
|
}
|
|
|
|