|
@@ -380,11 +380,20 @@ module.exports = app => {
|
|
|
this.ctx.material.decimal.up = newUp;
|
|
|
this.ctx.material.decimal.tp = newTp;
|
|
|
const m_tp = await this.ctx.service.materialBills.calcMaterialMTp(transaction);
|
|
|
+ let update_calc = false;
|
|
|
+ if (this.ctx.material.ex_calc) {
|
|
|
+ const ex_calc = JSON.parse(this.ctx.material.ex_calc);
|
|
|
+ const zdy = this._.find(ex_calc, { code: 'zdy' });
|
|
|
+ zdy.value = this.ctx.helper.round(zdy.value, newTp);
|
|
|
+ this.ctx.material.ex_calc = JSON.stringify(ex_calc);
|
|
|
+ update_calc = true;
|
|
|
+ }
|
|
|
const [ex_tp, ex_expr] = await this.ctx.service.materialExponent.calcMaterialExTp(transaction);
|
|
|
const updateData = {
|
|
|
id: this.ctx.material.id,
|
|
|
decimal: JSON.stringify(this.ctx.material.decimal),
|
|
|
};
|
|
|
+ if (update_calc) updateData.ex_calc = this.ctx.material.ex_calc;
|
|
|
await transaction.update(this.tableName, updateData);
|
|
|
await transaction.commit();
|
|
|
return true;
|