|
@@ -629,6 +629,7 @@ module.exports = app => {
|
|
|
change_update.status = audit.flow.status.checked;
|
|
|
change_update.p_code = postData.p_code;
|
|
|
change_update.sin_time = Date.parse(new Date()) / 1000;
|
|
|
+ change_update.is_revise = 0;
|
|
|
|
|
|
await this.ctx.service.tenderTag.saveTenderTag(changeData.tid, { bgl_time: new Date() }, this.transaction);
|
|
|
|
|
@@ -1225,13 +1226,29 @@ module.exports = app => {
|
|
|
});
|
|
|
await this.transaction.insert('zh_notice', records);
|
|
|
|
|
|
- // 新增新一次的审批人列表
|
|
|
// 获取当前次数审批人列表
|
|
|
const auditList = await this.ctx.service.changeAudit.getListGroupByTimes(changeData.cid, changeData.times);
|
|
|
const lastauditInfo = await this.ctx.service.changeAudit.getLastUser(changeData.cid, changeData.times, 1, 0);
|
|
|
let usort = lastauditInfo.usort + 1;
|
|
|
const newTimes = changeData.times + 1;
|
|
|
const insert_audit_array = [];
|
|
|
+ // 新增一个发起修订状态到审批流程中
|
|
|
+ const revise_audit = {
|
|
|
+ tid: auditList[0].tid,
|
|
|
+ cid: auditList[0].cid,
|
|
|
+ uid: auditList[0].uid,
|
|
|
+ name: auditList[0].name,
|
|
|
+ jobs: auditList[0].jobs,
|
|
|
+ company: auditList[0].company,
|
|
|
+ times: changeData.times,
|
|
|
+ usite: lastauditInfo.usite + 1,
|
|
|
+ usort,
|
|
|
+ status: audit.flow.auditStatus.revise,
|
|
|
+ sin_time: new Date(),
|
|
|
+ };
|
|
|
+ insert_audit_array.push(revise_audit);
|
|
|
+ usort++;
|
|
|
+ // 新增新一次的审批人列表
|
|
|
for (const al of auditList) {
|
|
|
const insert_audit = {
|
|
|
tid: al.tid,
|
|
@@ -1248,24 +1265,34 @@ module.exports = app => {
|
|
|
insert_audit_array.push(insert_audit);
|
|
|
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;
|
|
|
+ // 申请变更金额更新为上一次审批审批变更后数量,清空audit_amount值
|
|
|
+ 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));
|
|
|
+ updateTpList.push({ id: cl.id, camount: cl.spamount, audit_amount: null, samount: '' });
|
|
|
}
|
|
|
+ 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,
|
|
|
+ is_revise: 1,
|
|
|
};
|
|
|
const options = {
|
|
|
where: {
|