From 196df4d4bf1941546d349cadbf343655578ec280 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期三, 13 九月 2023 15:05:56 +0800
Subject: [PATCH] sit期间修改

---
 force-app/main/default/classes/lexPCLLostReportLwcController.cls |   61 ++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index aa1edac..58c3650 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -150,6 +150,7 @@
 			 LostTotalAmount__c,LostType__c,
 			 Report_Status__c,Sales_assistant__c,
 			 InclusionUltrasound__c, //20230506 lt DB202304618804  鍖呭惈瓒呭0
+			 ModifyAfterApproval__c,Approved_Day__c,//20230814 lt DB202308068183 澶卞崟鎶ュ憡瀹℃壒鑺傜偣澧炲姞鍔╃悊瀹℃壒鑺傜偣 add
 			 Opportunity__c, Opportunity__r.Sales_assistant_ID__c,
 			 Opportunity__r.Sales_manager_departmentID__c,
 			 Manager_sales__c,recordtypeid,recordtype.DeveloperName
@@ -172,7 +173,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 +244,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);
@@ -267,6 +301,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
 	public static Map<String,String> dataEntry(String report1,List<Id> deleteBrandIdList,List<Id> deleteProductIdList){
@@ -284,6 +331,10 @@
 			report.lostReport.Lost_reason_main__c = null;
 			report.lostReport.Lost_Reason_Sub__c  = null;
 			report.lostReport.Lost_By_Company__c = null;
+				//鎵瑰噯鏃ヤ笉涓虹┖鏃剁粰淇敼鍚庡啀鎵瑰噯璧嬪��
+			if(LostReport.lostReport.Approved_Day__c != null){
+				LostReport.lostReport.ModifyAfterApproval__c = true;
+			}
 			for(LostBrand tempLostBrand : report.LostBrands) {
 				if(string.isNotBlank(tempLostBrand.lostBrand.Lost_By_Company__c)) {
 					report.lostReport.LostTotalAmount__c += tempLostBrand.lostBrand.LostPrice__c;
@@ -438,7 +489,7 @@
 	public static Map<string,Object> submit(String report1,String reportId){
 		LostReport report = (LostReport)JSON.deserialize(report1, LostReport.class);
 		Map<string,string> messages = new Map<string,string>();
-		if(!'鑽夋'.equals(report.lostReport.Report_Status__c) ) {
+		if(!'鑽夋'.equals(report.lostReport.Report_Status__c) && LostReport.LostReport.ModifyAfterApproval__c == false) {
 			messages.put('error', '鍙湁鍦ㄨ崏妗堜腑鎵嶈兘鎻愪氦鐢宠锛�');
 			return messages;
 		}
@@ -448,9 +499,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');

--
Gitblit v1.9.1