19626
2023-09-09 e14d6d0619330cad423f06493e3aa2371faa2a8f
force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -172,7 +172,18 @@
            lostReportList[0].LostType__c ='部分失单';
         }
         // 权限,如果当前状态不是草案中,那么需要跳转到只读页面
         if(!'草案'.equals(lostReportList[0].Report_Status__c) && userinfo.getProfileId() != (ID) '00e10000000Y3o5AAC') {
      //原:!'草案'.equals(lostReportList[0].Report_Status__c) && userinfo.getProfileId() != (ID) '00e10000000Y3o5AAC'
      // 20230814 lt DB202308068183 失单报告审批节点增加助理审批节点 end 改if条件
      if(
         !('草案'.equals(lostReportList[0].Report_Status__c)
         || userinfo.getProfileId() == (ID) '00e10000000Y3o5AAC'
         ||('批准'.equals(lostReportList[0].Report_Status__c) &&
            (userinfo.getProfileId() == (ID) '00e10000000xnp2AAA' ||
            userinfo.getProfileId() == (ID) '00e10000000xnpRAAQ' ||
            userinfo.getProfileId() == (ID) '00e10000000xnpHAAQ'))
         )
        ){
            pageStatus = 'View';
         }
         oppId = lostReportList[0].Opportunity__c;
@@ -232,6 +243,28 @@
      brandNo = 0;
      // 读取竞争对手品牌
      // BrandmapSet();
      if (LostReport.lostReport.Report_Status__c != '草案' && lostReportId != null) {
         ProcessInstance pro = [
         SELECT
         ProcessDefinition.Name,
            (
            SELECT
            Id,
            StepStatus,
            IsPending,
            Comments,
            CreatedDate,
            Actor.Name,
            OriginalActor.Name,
            ProcessNode.Name FROM StepsAndWorkitems order by IsPending DESC, CreatedDate DESC
         )
         FROM ProcessInstance where TargetObjectId =:LostReport.lostReport.id order by CreatedDate DESC
         ];
         List<ProcessInstanceHistory> items = new List<ProcessInstanceHistory>();
         items.addall(pro.StepsAndWorkitems);
         LostReport.approvalHistorys = items;
      }
      if(string.isNotEmpty(submitFlag)) {
         maps.put('message', '提交成功!');
         maps.put('LostReport', LostReport);
@@ -266,6 +299,19 @@
        }
      String jsonStr = JSON.serialize(lstPickvals);
        return jsonStr;
   }
   @AuraEnabled
   public static string searchBatchIfForProduct(String productName){
      try {
         List<BatchIF_Transfer__c> transfer = [select
                                  Internal_value__c
                                  from BatchIF_Transfer__c
                                  where Dropped_Flag__c = false
                                          and Table__c = 'PCLLostBrand__c' and Column__c = 'Lost_By_Company__c' and External_value__c =: productName];
         return transfer[0].Internal_value__c;
      } catch (Exception e) {
         throw new AuraHandledException(e.getMessage());
      }
   }
   // 数据录入
   @AuraEnabled
@@ -448,9 +494,9 @@
         report.lostReport.Id = reportId;
         report.lostReport.Report_Status__c = '提交';
         update report.lostReport;
         Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
         psr.setObjectId(reportId);
         Approval.ProcessResult submitResult = Approval.process(psr);
         // Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest();
         // psr.setObjectId(reportId);
         // Approval.ProcessResult submitResult = Approval.process(psr);
         objs.put('uri', '/apex/PCLLostReportPage');
         objs.put('Id', reportId);
         objs.put('pageStatus', 'View');