|
@@ -32,6 +32,7 @@ class revisePriceCalc {
|
|
|
x.rela_cid = x.rela_cid.split(',');
|
|
|
this.rela_price_c.push(x);
|
|
|
} else {
|
|
|
+ x.his_rela_cid = [];
|
|
|
this.common_price_c.push(x);
|
|
|
}
|
|
|
});
|
|
@@ -209,6 +210,7 @@ class revisePriceCalc {
|
|
|
if (p) {
|
|
|
updateBills.push({ id: b.id, unit_price: p.new_price });
|
|
|
bills_tp = this.ctx.helper.mul(p.new_price, b.spamount, change.tp_decimal || decimal.tp);
|
|
|
+ if (!p.rela_cid) p.his_rela_cid.push(change.cid);
|
|
|
} else {
|
|
|
bills_tp = this.ctx.helper.mul(b.unit_price, b.spamount, change.tp_decimal || decimal.tp);
|
|
|
}
|
|
@@ -235,6 +237,11 @@ class revisePriceCalc {
|
|
|
for (const c of change) {
|
|
|
await this.calcChange(c, transaction);
|
|
|
}
|
|
|
+ const revisePriceUpdate = [];
|
|
|
+ for (const p of this.common_price_c) {
|
|
|
+ if (p.his_rela_cid.length > 0) revisePriceUpdate.push({id: p.id, his_rela_cid: p.his_rela_cid.join(',')});
|
|
|
+ }
|
|
|
+ await transaction.updateRows(this.ctx.service.revisePrice.tableName, revisePriceUpdate);
|
|
|
}
|
|
|
async _calcStage(stage, bills, transaction) {
|
|
|
// 无单价变更不执行
|