|
@@ -1249,22 +1249,32 @@ module.exports = app => {
|
|
|
usort++;
|
|
|
}
|
|
|
await this.transaction.insert(this.ctx.service.changeAudit.tableName, insert_audit_array);
|
|
|
- // 变更金额也退回
|
|
|
const changeList = await this.ctx.service.changeAuditList.getAllDataByCondition({
|
|
|
where: { cid: changeData.cid },
|
|
|
});
|
|
|
- let total_price = 0;
|
|
|
- const tp_decimal = changeData.tp_decimal ? changeData.tp_decimal : this.ctx.tender.info.decimal.tp;
|
|
|
+ // 申请变更金额更新为上一次审批审批变更后数量
|
|
|
+ const updateTpList = [];
|
|
|
for (const cl of changeList) {
|
|
|
- total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(cl.unit_price, cl.camount, tp_decimal));
|
|
|
+ if (cl.camount !== cl.spamount) {
|
|
|
+ updateTpList.push({ id: cl.id, camount: cl.spamount });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (updateTpList.length > 0) {
|
|
|
+ await this.transaction.updateRows(this.ctx.service.changeAuditList.tableName, updateTpList);
|
|
|
}
|
|
|
+
|
|
|
+ // let total_price = 0;
|
|
|
+ // const tp_decimal = changeData.tp_decimal ? changeData.tp_decimal : this.ctx.tender.info.decimal.tp;
|
|
|
+ // for (const cl of changeList) {
|
|
|
+ // total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(cl.unit_price, cl.camount, tp_decimal));
|
|
|
+ // }
|
|
|
// 设置变更令修订状态
|
|
|
const change_update = {
|
|
|
w_code: changeData.w_code,
|
|
|
status: audit.flow.status.revise,
|
|
|
times: newTimes,
|
|
|
cin_time: Date.parse(new Date()) / 1000,
|
|
|
- total_price,
|
|
|
+ // total_price,
|
|
|
tp_decimal: null,
|
|
|
};
|
|
|
const options = {
|