|
@@ -896,11 +896,12 @@ module.exports = app => {
|
|
* @return {Promise<void>}
|
|
* @return {Promise<void>}
|
|
*/
|
|
*/
|
|
async checkAgain(stageId, times = 1) {
|
|
async checkAgain(stageId, times = 1) {
|
|
|
|
+ const accountId = this.ctx.session.sessionUser.accountId;
|
|
const time = new Date();
|
|
const time = new Date();
|
|
// 整理当前流程审核人状态更新
|
|
// 整理当前流程审核人状态更新
|
|
const auditors = await this.getAllDataByCondition({
|
|
const auditors = await this.getAllDataByCondition({
|
|
where: { sid: stageId, times },
|
|
where: { sid: stageId, times },
|
|
- orders: [['order', 'desc']],
|
|
|
|
|
|
+ orders: [['order', 'asc']],
|
|
});
|
|
});
|
|
const maxOrder = auditors[auditors.length - 1].order;
|
|
const maxOrder = auditors[auditors.length - 1].order;
|
|
const audits = auditors.filter(x => { return x.order === maxOrder});
|
|
const audits = auditors.filter(x => { return x.order === maxOrder});
|
|
@@ -913,7 +914,7 @@ module.exports = app => {
|
|
try {
|
|
try {
|
|
// 当前审批人2次添加至流程中
|
|
// 当前审批人2次添加至流程中
|
|
const checkAgainAuditors = [], checkingAuditors = [];
|
|
const checkAgainAuditors = [], checkingAuditors = [];
|
|
- audit.forEach(x => {
|
|
|
|
|
|
+ audits.forEach(x => {
|
|
checkAgainAuditors.push({
|
|
checkAgainAuditors.push({
|
|
tid: x.tid, sid: x.sid, aid: x.aid,
|
|
tid: x.tid, sid: x.sid, aid: x.aid,
|
|
times: x.times, order: x.order + 1,
|
|
times: x.times, order: x.order + 1,
|
|
@@ -922,7 +923,7 @@ module.exports = app => {
|
|
audit_type: x.audit_type, audit_order: x.audit_order,
|
|
audit_type: x.audit_type, audit_order: x.audit_order,
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- audit.forEach(x => {
|
|
|
|
|
|
+ audits.forEach(x => {
|
|
checkingAuditors.push({
|
|
checkingAuditors.push({
|
|
tid: x.tid, sid: x.sid, aid: x.aid,
|
|
tid: x.tid, sid: x.sid, aid: x.aid,
|
|
times: x.times, order: x.order + 2,
|
|
times: x.times, order: x.order + 2,
|
|
@@ -935,8 +936,8 @@ module.exports = app => {
|
|
await transaction.insert(this.tableName, checkingAuditors);
|
|
await transaction.insert(this.tableName, checkingAuditors);
|
|
|
|
|
|
// 复制一份最新数据给下一人
|
|
// 复制一份最新数据给下一人
|
|
- await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, audit.order + 1, transaction);
|
|
|
|
- await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, audit.order + 2, transaction);
|
|
|
|
|
|
+ await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, selfAudit.order + 1, transaction);
|
|
|
|
+ await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, selfAudit.order + 2, transaction);
|
|
await this.ctx.service.stageJgcl.updateHistory4CheckAgain(this.ctx.stage, transaction);
|
|
await this.ctx.service.stageJgcl.updateHistory4CheckAgain(this.ctx.stage, transaction);
|
|
await this.ctx.service.stageBonus.updateHistory4CheckAgain(this.ctx.stage, transaction);
|
|
await this.ctx.service.stageBonus.updateHistory4CheckAgain(this.ctx.stage, transaction);
|
|
await this.ctx.service.stageOther.updateHistory4CheckAgain(this.ctx.stage, transaction);
|
|
await this.ctx.service.stageOther.updateHistory4CheckAgain(this.ctx.stage, transaction);
|
|
@@ -964,7 +965,7 @@ module.exports = app => {
|
|
await this.ctx.service.revisePrice.cancelPriceUsed(this.ctx.stage, transaction);
|
|
await this.ctx.service.revisePrice.cancelPriceUsed(this.ctx.stage, transaction);
|
|
// 重算所有单价变更
|
|
// 重算所有单价变更
|
|
const priceCalc = new RevisePrice(this.ctx);
|
|
const priceCalc = new RevisePrice(this.ctx);
|
|
- const pcTp = await priceCalc.stageCheckAgainPriceChange(this.ctx.stage, audit.order + 2, transaction);
|
|
|
|
|
|
+ const pcTp = await priceCalc.stageCheckAgainPriceChange(this.ctx.stage, selfAudit.order + 2, transaction);
|
|
await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, auditConst.status.checking, checkingAuditors, checkAgainAuditors, null, stageTp, pcTp);
|
|
await this.ctx.service.tenderCache.updateStageCache4Flow(transaction, this.ctx.stage, auditConst.status.checking, checkingAuditors, checkAgainAuditors, null, stageTp, pcTp);
|
|
|
|
|
|
// 添加短信通知-需要审批提醒功能
|
|
// 添加短信通知-需要审批提醒功能
|