|
@@ -993,6 +993,7 @@ module.exports = app => {
|
|
|
const time = new Date();
|
|
|
try {
|
|
|
await this._updateTender(transaction);
|
|
|
+ let newTimes, newOrder, newSaid, oldTimes, oldOrder, oldSaid = '';
|
|
|
if (this.ctx.stage.cancancel === 1) {
|
|
|
// 原报撤回,判断是否为多次,多次则为退回状态
|
|
|
// 整理当前流程审核人状态更新
|
|
@@ -1037,15 +1038,12 @@ module.exports = app => {
|
|
|
await this.ctx.service.stagePay.deleteAuditStagePays(this.ctx.stage, this.ctx.stage.times, 0, transaction);
|
|
|
await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, 0, transaction, this.ctx.stage.times, 1);
|
|
|
await this.ctx.service.stagePay.deleteAuditStagePays(this.ctx.stage, this.ctx.stage.times, 1, transaction);
|
|
|
- await this.ctx.service.stageJgcl.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageBonus.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageSafeProd.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageTempLand.updateHistory(this.ctx.stage, transaction);
|
|
|
- // 先覆盖再删除
|
|
|
- await this.ctx.service.stageBills.updateAuditStageBills(stageId, this.ctx.stage.user_id, this.ctx.stage.times, 0, curAudit.aid, this.ctx.stage.times, 1, transaction);
|
|
|
- await this.ctx.service.stagePos.updateAuditStagePos(stageId, this.ctx.stage.user_id, this.ctx.stage.times, 0, curAudit.aid, this.ctx.stage.times, 1, transaction);
|
|
|
- await this.ctx.service.stageDetail.updateAuditStageDetail(stageId, this.ctx.stage.times, 0, this.ctx.stage.times, 1, transaction);
|
|
|
+ newTimes = this.ctx.stage.times;
|
|
|
+ newOrder = 0;
|
|
|
+ newSaid = this.ctx.stage.user_id;
|
|
|
+ oldTimes = this.ctx.stage.times;
|
|
|
+ oldOrder = 1;
|
|
|
+ oldSaid = curAudit.aid;
|
|
|
} else if (this.ctx.stage.cancancel === 2) {
|
|
|
const tpData = await this.ctx.service.stageBills.getSumTotalPrice(this.ctx.stage);
|
|
|
// 整理当前流程审核人状态更新
|
|
@@ -1116,16 +1114,12 @@ module.exports = app => {
|
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
|
// 复制一份最新数据给下一人
|
|
|
await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, curAudit.order + 1, transaction, this.ctx.stage.times, this.ctx.stage.curOrder + 1);
|
|
|
- await this.ctx.service.stageJgcl.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageBonus.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageSafeProd.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageTempLand.updateHistory(this.ctx.stage, transaction);
|
|
|
-
|
|
|
- // 先覆盖再删除
|
|
|
- await this.ctx.service.stageBills.updateAuditStageBills(stageId, preAudit.aid, this.ctx.stage.times, curAudit.order + 1, curAudit.aid, this.ctx.stage.times, curAudit.order, transaction);
|
|
|
- await this.ctx.service.stagePos.updateAuditStagePos(stageId, preAudit.aid, this.ctx.stage.times, curAudit.order + 1, curAudit.aid, this.ctx.stage.times, curAudit.order, transaction);
|
|
|
- await this.ctx.service.stageDetail.updateAuditStageDetail(stageId, this.ctx.stage.times, curAudit.order + 1, this.ctx.stage.times, curAudit.order, transaction);
|
|
|
+ newTimes = this.ctx.stage.times;
|
|
|
+ newOrder = curAudit.order + 1;
|
|
|
+ newSaid = preAudit.aid;
|
|
|
+ oldTimes = this.ctx.stage.times;
|
|
|
+ oldOrder = curAudit.order;
|
|
|
+ oldSaid = curAudit.aid;
|
|
|
// 锁定本人数据,保留锁定数据相关确认状态
|
|
|
// await this.ctx.service.stageAuditAss.lockConfirm4CheckNoPre(this.ctx.stage, curAudit.aid, preAudit.aid, transaction);
|
|
|
} else if (this.ctx.stage.cancancel === 3) {
|
|
@@ -1199,16 +1193,14 @@ module.exports = app => {
|
|
|
await this.ctx.service.stagePay.calcAllStagePays(this.ctx.stage, transaction);
|
|
|
// 复制一份最新数据给下一人
|
|
|
await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times, curAudit.order + 1, transaction, this.ctx.stage.times, this.ctx.stage.curOrder + 1);
|
|
|
- await this.ctx.service.stageJgcl.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageBonus.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageSafeProd.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageTempLand.updateHistory(this.ctx.stage, transaction);
|
|
|
|
|
|
- // 先覆盖再删除
|
|
|
- await this.ctx.service.stageBills.updateAuditStageBills(stageId, preAudit.aid, this.ctx.stage.times, curAudit.order + 1, curAudit.aid, this.ctx.stage.times, curAudit.order, transaction);
|
|
|
- await this.ctx.service.stagePos.updateAuditStagePos(stageId, preAudit.aid, this.ctx.stage.times, curAudit.order + 1, curAudit.aid, this.ctx.stage.times, curAudit.order, transaction);
|
|
|
- await this.ctx.service.stageDetail.updateAuditStageDetail(stageId, this.ctx.stage.times, curAudit.order + 1, this.ctx.stage.times, curAudit.order, transaction);
|
|
|
+ newTimes = this.ctx.stage.times;
|
|
|
+ newOrder = curAudit.order + 1;
|
|
|
+ newSaid = preAudit.aid;
|
|
|
+ oldTimes = this.ctx.stage.times;
|
|
|
+ oldOrder = curAudit.order;
|
|
|
+ oldSaid = curAudit.aid;
|
|
|
+
|
|
|
// 锁定本人数据,保留锁定数据相关确认状态
|
|
|
// await this.ctx.service.stageAuditAss.lockConfirm4CheckNoPre(this.ctx.stage, curAudit.aid, preAudit.aid, transaction);
|
|
|
} else if (this.ctx.stage.cancancel === 4) {
|
|
@@ -1279,17 +1271,25 @@ module.exports = app => {
|
|
|
await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times - 1, curAudit.order + 1, transaction, this.ctx.stage.times, 0);
|
|
|
await this.ctx.service.stagePay.copyAuditStagePays(this.ctx.stage, this.ctx.stage.times - 1, curAudit.order + 2, transaction, this.ctx.stage.times, 0);
|
|
|
await this.ctx.service.stagePay.deleteAuditStagePays(this.ctx.stage, this.ctx.stage.times, 0, transaction);
|
|
|
- await this.ctx.service.stageJgcl.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageBonus.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageOther.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageSafeProd.updateHistory(this.ctx.stage, transaction);
|
|
|
- await this.ctx.service.stageTempLand.updateHistory(this.ctx.stage, transaction);
|
|
|
|
|
|
- // 先覆盖再删除
|
|
|
- await this.ctx.service.stageBills.updateAuditStageBills(stageId, curAudit.aid, this.ctx.stage.times - 1, curAudit.order + 2, this.ctx.stage.user_id, this.ctx.stage.times, 0, transaction);
|
|
|
- await this.ctx.service.stagePos.updateAuditStagePos(stageId, curAudit.aid, this.ctx.stage.times - 1, curAudit.order + 2, this.ctx.stage.user_id, this.ctx.stage.times, 0, transaction);
|
|
|
- await this.ctx.service.stageDetail.updateAuditStageDetail(stageId, this.ctx.stage.times - 1, curAudit.order + 2, this.ctx.stage.times, 0, transaction);
|
|
|
+ newTimes = this.ctx.stage.times - 1;
|
|
|
+ newOrder = curAudit.order + 2;
|
|
|
+ newSaid = curAudit.aid;
|
|
|
+ oldTimes = this.ctx.stage.times;
|
|
|
+ oldOrder = 0;
|
|
|
+ oldSaid = this.ctx.stage.user_id;
|
|
|
}
|
|
|
+ // 先覆盖再删除
|
|
|
+ await this.ctx.service.stageBills.updateStageBills4CheckCancel(stageId, newSaid, newTimes, newOrder, oldSaid, oldTimes, oldOrder, transaction);
|
|
|
+ await this.ctx.service.stagePos.updateStagePos4CheckCancel(stageId, newSaid, newTimes, newOrder, oldSaid, oldTimes, oldOrder, transaction);
|
|
|
+ await this.ctx.service.stageDetail.updateStageDetail4CheckCancel(stageId, newTimes, newOrder, oldTimes, oldOrder, transaction);
|
|
|
+
|
|
|
+ await this.ctx.service.stageJgcl.updateHistory4CheckCancel(this.ctx.stage, newTimes, newOrder, transaction);
|
|
|
+ await this.ctx.service.stageBonus.updateHistory4CheckCancel(this.ctx.stage, newTimes, newOrder, transaction);
|
|
|
+ await this.ctx.service.stageOther.updateHistory4CheckCancel(this.ctx.stage, newTimes, newOrder, transaction);
|
|
|
+ await this.ctx.service.stageSafeProd.updateHistory4CheckCancel(this.ctx.stage, newTimes, newOrder, transaction);
|
|
|
+ await this.ctx.service.stageTempLand.updateHistory4CheckCancel(this.ctx.stage, newTimes, newOrder, transaction);
|
|
|
+
|
|
|
// 上报/审批 - 检查三方特殊推送
|
|
|
await this.ctx.service.specMsg.addStageMsg(transaction, this.ctx.session.sessionProject.id, this.ctx.stage, pushOperate.stage.flow);
|
|
|
await transaction.commit();
|