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 |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index 9ec6918..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,13 +494,32 @@
 			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');
 			objs.put('submitFlag', '1');
+			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);
+			objs.put('approvalHistorys',items);
 			return objs;
 		}catch(exception ex) {
 			Database.rollback(sp);
@@ -454,6 +540,17 @@
 		return lostBrand;
 	}
 
+	@AuraEnabled
+	public static PCLLostProducts getNewLostProduct(Integer lineNo2){
+		PCLLostProducts pro = null;
+		try {
+			pro = new PCLLostProducts(lineNo2);
+		} catch (Exception e) {
+			System.debug(e.getMessage());
+		}
+		return pro;
+	}
+
 	// update tcm 20211125 娣诲姞鍨嬪彿鏃惰嚜鍔ㄥ甫鍑哄搧鐗� end
 	// 椤甸潰鐨勬暟鎹粨鏋�
 	public class LostReport {
@@ -461,17 +558,22 @@
 		public Lost_cancel_report__c lostReport { get; set; }
 		@AuraEnabled
 		public list<LostBrand> LostBrands { get; set; }
+		@AuraEnabled
+		public list<ProcessInstanceHistory> approvalHistorys { get; set; }
 		public LostReport(){
 			lostReport = new Lost_cancel_report__c();
 			LostBrands = new list<LostBrand> {new LostBrand(0)};
+			approvalHistorys = new list<ProcessInstanceHistory>();
 		}
 		public LostReport(Lost_cancel_report__c lostReport){
 			this.lostReport = lostReport;
 			LostBrands = new list<LostBrand> {new LostBrand(0)};
+			approvalHistorys = new list<ProcessInstanceHistory>();
 		}
 		public LostReport(Lost_cancel_report__c lostReport,  list<LostBrand> LostBrands){
 			this.lostReport = lostReport;
 			this.LostBrands = LostBrands;
+			approvalHistorys = new list<ProcessInstanceHistory>();
 		}
 	}
 

--
Gitblit v1.9.1