Browse Source

变更令相关原报时间调整

Tony Kang 1 year ago
parent
commit
0dc1fd38f3
1 changed files with 11 additions and 2 deletions
  1. 11 2
      app/controller/report_controller.js

+ 11 - 2
app/controller/report_controller.js

@@ -756,7 +756,7 @@ module.exports = app => {
                     default:
                         break;
                 }
-                otherChangeList = otherChangeList.filter(x => { return x.id != bglObj.BUSINESS_ID });
+                otherChangeList = otherChangeList.filter(x => { return x.id != bglObj.BUSINESS_ID; });
                 let archiveList = [];
                 const archives = await ctx.service.rptArchive.getArchiveByBzId(pid, stage_id, bglObj.BUSINESS_ID);
                 if (archives.length > 0) {
@@ -991,6 +991,9 @@ module.exports = app => {
                     if ([1, 9].includes(change_plan.status)) orgChangePlanStatus = 1; // 原报只要已上报(非1、9),status都是3
                     stgAudit.push({ aid: change_plan.uid, status: orgChangePlanStatus, opinion: '', end_time: change_plan.in_time, order: 0 }); // 加上原报
                     changePlanAudit.forEach(audit => {
+                        if (audit.order === 1) {
+                            stgAudit[0].end_time = audit.begin_time || stgAudit[0].end_time; // 如果没有begin_time,则保留时间
+                        }
                         stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
                     });
                     break;
@@ -1001,6 +1004,9 @@ module.exports = app => {
                     if ([1, 9].includes(change_project.status)) orgChangePrjStatus = 1; // 原报只要已上报(非1、9),status都是3
                     stgAudit.push({ aid: change_project.uid, status: orgChangePrjStatus, opinion: '', end_time: change_project.in_time, order: 0 }); // 加上原报
                     changeProjectAudit.forEach(audit => {
+                        if (audit.order === 1) {
+                            stgAudit[0].end_time = audit.begin_time || stgAudit[0].end_time; // 如果没有begin_time,则保留时间
+                        }
                         stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
                     });
                     break;
@@ -1011,6 +1017,9 @@ module.exports = app => {
                     if ([1, 9].includes(change_apply.status)) orgChangeApplyStatus = 1; // 原报只要已上报(非1、9),status都是3
                     stgAudit.push({ aid: change_apply.uid, status: orgChangeApplyStatus, opinion: '', end_time: change_apply.in_time, order: 0 }); // 加上原报
                     changeApplyAudit.forEach(audit => {
+                        if (audit.order === 1) {
+                            stgAudit[0].end_time = audit.begin_time || stgAudit[0].end_time; // 如果没有begin_time,则保留时间
+                        }
                         stgAudit.push({ aid: audit.aid, status: audit.status, opinion: audit.opinion, end_time: audit.end_time, times: audit.times, order: audit.order });
                     });
                     break;
@@ -1123,7 +1132,7 @@ module.exports = app => {
                     stageList.push({ id: params.stage_id, user_id: payment.uid, status: payment.status });
                 }
             } else if ([-300, -301, -302, -303, -400, -500].includes(params.stage_id)) {
-                // 变更令相关的
+                // 变更令、预付款、材差相关的
                 stgAudit = [];
                 stgAuditForOrg = [];
                 stageFlow = [];