From e14d6d0619330cad423f06493e3aa2371faa2a8f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期六, 09 九月 2023 14:02:23 +0800
Subject: [PATCH] Sit期间修改

---
 force-app/main/default/classes/lexPCLLostReportLwcController.cls |   82 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 76 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index fb16ace..4225066 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/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 鏀筰f鏉′欢
+		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
@@ -399,6 +445,27 @@
 					}
 				}
 			}
+			if (report.lostReport.Report_Status__c != '鑽夋') {
+				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 =:reportId order by CreatedDate DESC
+				];
+				List<ProcessInstanceHistory> items = new List<ProcessInstanceHistory>();
+				items.addall(pro.StepsAndWorkitems);
+				report.approvalHistorys = items;
+			}
 			// lostReportId = report.lostReport.id;
 			system.debug('save---end:');
 			messageMap.put('LostReport',JSON.serialize(report));
@@ -427,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');
@@ -438,11 +505,14 @@
 				SELECT 
 				ProcessDefinition.Name,
 				 (
-					SELECT StepStatus,
+					SELECT 
+					Id,
+					StepStatus, 
+					IsPending,
 					Comments,
 					CreatedDate,
 					Actor.Name,  
-					OriginalActor.Name, 
+					OriginalActor.Name,
 					ProcessNode.Name FROM StepsAndWorkitems order by IsPending DESC, CreatedDate DESC 
 				)
 				FROM ProcessInstance where TargetObjectId =:reportId order by CreatedDate DESC

--
Gitblit v1.9.1