From 25f056535350a0b80bad50d2cc45311998e5d1cd Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期一, 09 十月 2023 18:28:00 +0800
Subject: [PATCH] 近期修改

---
 force-app/main/default/classes/lexPCLLostReportLwcController.cls |   62 +++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 20 deletions(-)

diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index a55853f..9e33408 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -163,6 +163,7 @@
 			 Lost_Reason_Sub__c,Lost_By_Company__c,
 			 LostTotalAmount__c,LostType__c,
 			 Report_Status__c,Sales_assistant__c,
+			 TotalAmountLost__c,
 			 InclusionUltrasound__c, //20230506 lt DB202304618804  鍖呭惈瓒呭0
 			 ModifyAfterApproval__c,Approved_Day__c,//20230814 lt DB202308068183 澶卞崟鎶ュ憡瀹℃壒鑺傜偣澧炲姞鍔╃悊瀹℃壒鑺傜偣 add
 			 Opportunity__c, Opportunity__r.Sales_assistant_ID__c,
@@ -307,9 +308,17 @@
 			FROM ProcessInstance where TargetObjectId =:LostReport.lostReport.id order by CreatedDate DESC
 			];
 			if(pros.size() > 0){
+				
 				List<ProcessInstanceHistory> items = new List<ProcessInstanceHistory>();
+				maps.put('allowUserId',pros[0].StepsAndWorkitems[0].OriginalActor.Id);
+				maps.put('userProfileId',UserInfo.getProfileId());
 				for(ProcessInstance pro: pros){
 					items.addAll(pro.StepsAndWorkitems);
+				}
+				for(ProcessInstanceHistory pro: pros[0].StepsAndWorkitems){
+					if(pro.StepStatus == 'Started'){
+						maps.put('submitUserId',pro.OriginalActorId);
+					}
 				}
 				LostReport.approvalHistorys = items;
 			}else{
@@ -331,6 +340,7 @@
 		// Map<String,String> ele = new Map<String,String>();
 		// LostReport.LostBrands[0].columns.add();
 		maps.put('LostReport', LostReport);
+		maps.put('userId',UserInfo.getUserId());
 		return maps;
 	}
 	@AuraEnabled
@@ -389,6 +399,7 @@
 			report.lostReport.recordTypeID  =  report.lostReport.LostType__c== '澶卞崟'?Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByDeveloperName().get('PCL_Lost_report').getRecordTypeId() : Schema.SObjectType.Lost_cancel_report__c.getRecordTypeInfosByDeveloperName().get('PCL_PartLost_report').getRecordTypeId();
 			report.lostReport.LostTotalAmount__c    = 0;
 			report.lostReport.of_lost_system_processor__c   = 0;
+			report.lostReport.TotalAmountLost__c    = 0;
 			report.lostReport.Lost_reason_main__c = null;
 			report.lostReport.Lost_Reason_Sub__c  = null;
 			report.lostReport.Lost_By_Company__c = null;
@@ -399,6 +410,11 @@
 			for(LostBrand tempLostBrand : report.LostBrands) {
 				if(string.isNotBlank(tempLostBrand.lostBrand.Lost_By_Company__c)) {
 					report.lostReport.LostTotalAmount__c += tempLostBrand.lostBrand.LostPrice__c;
+					Decimal med = tempLostBrand.lostBrand.LostPrice__c/1.13/1000;
+					Decimal med1 = med.setScale(2);
+					// System.debug('---lt123涓嶅惈绋庢暟鍊�(浜哄伐)Decimal---'+med);
+					// System.debug('---lt123涓嶅惈绋庢暟鍊�(浜哄伐)Decimal涓や綅灏忔暟---'+med1);
+					report.lostReport.TotalAmountLost__c += med1;
 					report.lostReport.Lost_reason_main__c =
 					report.lostReport.Lost_reason_main__c == null
 						? tempLostBrand.lostBrand.Lost_reason_main__c
@@ -511,7 +527,7 @@
 					}
 				}
 			}
-			if (report.lostReport.Report_Status__c != '鑽夋') {
+			
 				List<ProcessInstance> pros = [
 				SELECT 
 				ProcessDefinition.Name,
@@ -532,30 +548,36 @@
 				for(ProcessInstance pro: pros){
 					items.addAll(pro.StepsAndWorkitems);
 				}
-				report.approvalHistorys = items;
-			}else{
-				List<ProcessInstanceHistory> items = new List<ProcessInstanceHistory>();
-				report.approvalHistorys = items;
-			}
+				if(items.size() > 0){
+					report.approvalHistorys = items;
+				}else{
+					List<ProcessInstanceHistory> items1 = new List<ProcessInstanceHistory>();
+					report.approvalHistorys = items1;
+				}
+				
+			
+				
+			
 			// lostReportId = report.lostReport.id;
 			system.debug('save---end:');
 			messageMap.put('LostReport',JSON.serialize(report));
 		}catch (Exception e) {
 			Database.rollback(sp);
 			// 杩欓噷闇�瑕佸啓涓�浜涙姤閿欎俊鎭�
-			if (e.getMessage().contains(',')) {
-                System.debug(LoggingLevel.INFO, '*** e: ' + e);
-                String exc = '' + e.getMessage();
-                Integer left = exc.indexOf(':') + 1;
-                Integer right = exc.lastIndexOf(':');
-                String str = exc.substring(left,right);
-                left = str.indexOf(',') +  1;
-                String newStr = str.substring(left);
-                messageMap.put('error', ''+ newStr);
-            }else {
-                messageMap.put('error', ''+ e.getMessage());
-            }
-			
+			// if (e.getMessage().contains(',')) {
+            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
+            //     String exc = '' + e.getMessage();
+            //     Integer left = exc.indexOf(':') + 1;
+            //     Integer right = exc.lastIndexOf(':');
+            //     String str = exc.substring(left,right);
+            //     left = str.indexOf(',') +  1;
+            //     String newStr = str.substring(left);
+            //     messageMap.put('error', ''+ newStr);
+            // }else {
+            //     messageMap.put('error', ''+ e.getMessage());
+            // }
+
+			messageMap.put('error', ''+ e.getMessage());
 			return messageMap;
 		}
 		return messageMap;
@@ -623,7 +645,7 @@
             }else {
                 objs.put('error', ''+ e.getMessage());
             }
-			return messages;
+			return objs;
 		}
 	}
 	// +++++++++++++++++++++++++++++++++++++++++++++++++++++++

--
Gitblit v1.9.1