|
@@ -1167,6 +1167,14 @@ module.exports = app => {
|
|
|
level: selectData.level - 1,
|
|
|
full_path: newFullPath,
|
|
|
};
|
|
|
+ const nexts = await this.getNextsData(tenderId, parentData.ledger_id, selectData.order);
|
|
|
+ if (nexts.length > 0) {
|
|
|
+ updateData.unit_price = null;
|
|
|
+ updateData.quantity = null;
|
|
|
+ updateData.total_price = null;
|
|
|
+ updateData.deal_qty = null;
|
|
|
+ updateData.deal_tp = null;
|
|
|
+ }
|
|
|
await this.transaction.update(this.tableName, updateData);
|
|
|
// 选中节点--全部子节点(含孙) level-1, full_path变更
|
|
|
await this._syncUplevelChildren(selectData);
|
|
@@ -1257,11 +1265,16 @@ module.exports = app => {
|
|
|
await this.transaction.update(this.tableName, updateData);
|
|
|
// 选中节点--全部子节点(含孙) level++, full_path
|
|
|
await this._syncDownlevelChildren(selectData, preData);
|
|
|
- // 选中节点--前兄弟节点 is_leaf应为false
|
|
|
- if (preData.is_leaf) {
|
|
|
+ // 选中节点--前兄弟节点 is_leaf应为false, 清空计算相关字段
|
|
|
+ if (preData.is_leaf || preData.unit_price || preData.quantity || preData.total_price || preData.deal_qty || preData.deal_tp) {
|
|
|
const updateData2 = {
|
|
|
id: preData.id,
|
|
|
is_leaf: false,
|
|
|
+ unit_price: null,
|
|
|
+ quantity: null,
|
|
|
+ total_price: null,
|
|
|
+ deal_qty: null,
|
|
|
+ deal_tp: null,
|
|
|
};
|
|
|
await this.transaction.update(this.tableName, updateData2);
|
|
|
}
|
|
@@ -1723,8 +1736,10 @@ module.exports = app => {
|
|
|
const insertResult = await this.transaction.insert(this.tableName, qd);
|
|
|
qd.id = insertResult.insertId;
|
|
|
newIds.push(insertResult.insertId);
|
|
|
- await this.ctx.service.pos.insertLedgerPosData(this.transaction, tenderId, qd, data[i].pos);
|
|
|
- await this.calc(tenderId, insertResult.insertId, this.transaction);
|
|
|
+ if (data[i].pos.length > 0) {
|
|
|
+ await this.ctx.service.pos.insertLedgerPosData(this.transaction, tenderId, qd, data[i].pos);
|
|
|
+ await this.calc(tenderId, insertResult.insertId, this.transaction);
|
|
|
+ }
|
|
|
}
|
|
|
this.cache.set(cacheKey, maxId + data.length + 1, 'EX', this.ctx.app.config.cacheTime);
|
|
|
await this.transaction.commit();
|
|
@@ -1793,8 +1808,10 @@ module.exports = app => {
|
|
|
const insertResult = await this.transaction.insert(this.tableName, qd);
|
|
|
qd.id = insertResult.insertId;
|
|
|
newIds.push(insertResult.insertId);
|
|
|
- await this.ctx.service.pos.insertLedgerPosData(this.transaction, tenderId, qd, data[i].pos);
|
|
|
- await this.calc(tenderId, insertResult.insertId, this.transaction);
|
|
|
+ if (data[i].pos.length > 0) {
|
|
|
+ await this.ctx.service.pos.insertLedgerPosData(this.transaction, tenderId, qd, data[i].pos);
|
|
|
+ await this.calc(tenderId, insertResult.insertId, this.transaction);
|
|
|
+ }
|
|
|
}
|
|
|
this.cache.set(cacheKey, maxId + data.length + 1, 'EX', this.ctx.app.config.cacheTime);
|
|
|
await this.transaction.commit();
|