|
|
@@ -1359,15 +1359,17 @@ module.exports = app => {
|
|
|
const updateList = [];
|
|
|
for (const cl of changeList) {
|
|
|
const audit_amount = cl.audit_amount.split(',');
|
|
|
- const last_amount = audit_amount.length - 1 !== -1 && audit_amount[audit_amount.length - 1] !== undefined ? audit_amount[audit_amount.length - 1] : (cl.camount ? cl.camount : 0);
|
|
|
- audit_amount.splice(-1, 1);
|
|
|
- const list_update = {
|
|
|
- id: cl.id,
|
|
|
- audit_amount: audit_amount.join(','),
|
|
|
- spamount: parseFloat(last_amount),
|
|
|
- };
|
|
|
- total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(cl.unit_price, parseFloat(last_amount), tp_decimal));
|
|
|
- updateList.push(list_update);
|
|
|
+ if (cl.audit_amount !== null && audit_amount.length > 0) {
|
|
|
+ const last_amount = audit_amount.length - 1 !== -1 && audit_amount[audit_amount.length - 1] !== undefined ? audit_amount[audit_amount.length - 1] : (cl.camount ? cl.camount : 0);
|
|
|
+ audit_amount.splice(-1, 1);
|
|
|
+ const list_update = {
|
|
|
+ id: cl.id,
|
|
|
+ audit_amount: audit_amount.join(','),
|
|
|
+ spamount: parseFloat(last_amount) || 0,
|
|
|
+ };
|
|
|
+ total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(cl.unit_price, parseFloat(last_amount), tp_decimal));
|
|
|
+ updateList.push(list_update);
|
|
|
+ }
|
|
|
}
|
|
|
if (updateList.length > 0) await this.transaction.updateRows(this.ctx.service.changeAuditList.tableName, updateList);
|
|
|
|
|
|
@@ -1837,16 +1839,18 @@ module.exports = app => {
|
|
|
}
|
|
|
}
|
|
|
const audit_amount = cl.audit_amount.split(',');
|
|
|
- const last_amount = audit_amount[audit_amount.length - 1] ? audit_amount[audit_amount.length - 1] : 0;
|
|
|
- audit_amount.splice(-1, 1);
|
|
|
- const list_update = {
|
|
|
- id: cl.id,
|
|
|
- audit_amount: audit_amount.join(','),
|
|
|
- samount: '',
|
|
|
- spamount: parseFloat(last_amount),
|
|
|
- };
|
|
|
- total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(cl.unit_price, parseFloat(last_amount), tp_decimal));
|
|
|
- updateChangeList.push(list_update);
|
|
|
+ if (cl.audit_amount !== null && audit_amount.length > 0) {
|
|
|
+ const last_amount = audit_amount[audit_amount.length - 1] ? audit_amount[audit_amount.length - 1] : 0;
|
|
|
+ audit_amount.splice(-1, 1);
|
|
|
+ const list_update = {
|
|
|
+ id: cl.id,
|
|
|
+ audit_amount: audit_amount.join(','),
|
|
|
+ samount: '',
|
|
|
+ spamount: parseFloat(last_amount) || 0,
|
|
|
+ };
|
|
|
+ total_price = this.ctx.helper.add(total_price, this.ctx.helper.mul(cl.unit_price, parseFloat(last_amount), tp_decimal));
|
|
|
+ updateChangeList.push(list_update);
|
|
|
+ }
|
|
|
}
|
|
|
if (updateChangeList.length > 0) await this.transaction.updateRows(this.ctx.service.changeAuditList.tableName, updateChangeList);
|
|
|
|