From fd9df05c48c09b4d7f39a3b401882bda226dedea Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 31 十月 2023 20:38:18 +0800
Subject: [PATCH] 近期修改
---
force-app/main/default/classes/lexPCLLostReportLwcController.cls | 113 +++++++++++++++++++-------------------------------------
1 files changed, 39 insertions(+), 74 deletions(-)
diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index a55853f..0f381d3 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -1,6 +1,6 @@
public with sharing class lexPCLLostReportLwcController {
- public static Product2 pro2 { get; set; }
+
public static string oppId { get; set; }
@@ -19,16 +19,10 @@
public static integer brandNo {get; set;}
- public static integer RemoveBrandNo {get; set;}
-
- public static integer setBrandNo {get; set;}
-
public static integer brandCount {get; set;}
// add tcm 20211122 start
- public static integer topNum {get; set;}
- public static integer secondNum {get; set;}
// add tcm 20211122 end
@AuraEnabled(cacheable=true)
@@ -92,6 +86,7 @@
pickList.put('娲楁秷鏈�', xixiaoji);
pickList.put('鍏夋簮', guangyuan);
pickList.put('鍏朵粬', qita);
+ pickList.put('鍏ㄩ儴',lstPickvals);
return JSON.serialize(pickList);
}
@AuraEnabled
@@ -104,7 +99,7 @@
submitFlag = submitFlag1;
return init1();
} catch (Exception e) {
- throw new AuraHandledException(e.getMessage());
+ return new Map<string,object>();
}
}
// 鍒濆鍖�
@@ -163,6 +158,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,
@@ -209,6 +205,7 @@
Lost_reason_main__c,Lost_Reason_Sub__c,Name,Agency__c, AgencyMannual__c,
Lost_cancel_report__c,Lost_By_Company_Mannual__c,ChannelSpecificReasons__c,
( select id,PCLLostBrand__c,LostProduct__c,
+ isSpec__c,
LostProduct__r.Name,
LostProductMannual__c, //SWAG-C6P9PX lt 20210913 add
ProductCategory__c,
@@ -307,9 +304,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].Actor.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.ActorId);
+ }
}
LostReport.approvalHistorys = items;
}else{
@@ -331,6 +336,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
@@ -371,7 +377,7 @@
}
} catch (Exception e) {
- throw new AuraHandledException(e.getMessage());
+ return e.getMessage();
}
}
// 鏁版嵁褰曞叆
@@ -382,13 +388,14 @@
Map<String,String> messageMap = new Map <String,String>();
system.debug('save---start:');
Savepoint sp = Database.setSavepoint();
- try{
+
// 寰呭畬鎴愶紝杩欓噷闇�瑕佹妸绗竴涓搧鐗岀殑淇℃伅璧嬪�煎埌杩欎釜澶卞崟鎶ュ憡涓婂幓锛岃繕鏈夐渶瑕佹妸鍚勪釜鍝佺墝閲戦姹囨�诲姞璧锋潵锛�
//system.debug('LostReport.LostBrands:'+LostReport.LostBrands);
// 璁剧疆璁板綍绫诲瀷
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 +406,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 +523,7 @@
}
}
}
- if (report.lostReport.Report_Status__c != '鑽夋') {
+
List<ProcessInstance> pros = [
SELECT
ProcessDefinition.Name,
@@ -532,35 +544,22 @@
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());
- }
-
- return messageMap;
- }
+
return messageMap;
}
-
// 鎻愪氦
@AuraEnabled
@@ -611,19 +610,8 @@
return objs;
}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);
- objs.put('error', ''+ newStr);
- }else {
- objs.put('error', ''+ e.getMessage());
- }
- return messages;
+ objs.put('error',e.getMessage());
+ return objs;
}
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -742,30 +730,7 @@
}
}
}
- // add tcm 20211119 end
-
- // add tcm 20211118 start
- public static void search() {
- if (LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.LostProduct__c==null) {
- LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductClass__c=null;
- LostReport.LostBrands[topNum].LostProducts[secondNum].bool=false;
-
- }else {
- Product2 prd = [select Id,ProductClass__c
- , ProductCategory__c
- from Product2 where Id =:LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.LostProduct__c];
- if (prd.ProductCategory__c!=null) {
- LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductClass__c=prd.ProductClass__c;
- LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductCategory__c=prd.ProductCategory__c;
- LostReport.LostBrands[topNum].LostProducts[secondNum].bool=true;
- }else {
- LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductClass__c=null;
- LostReport.LostBrands[topNum].LostProducts[secondNum].LostProductss.ProductCategory__c=null;
- LostReport.LostBrands[topNum].LostProducts[secondNum].bool=false;
-
- }
- }
- }
+
@AuraEnabled
public static string searchProduct(String lostProduct){
Product2 prd = null;
@@ -775,7 +740,7 @@
, ProductCategory__c
from Product2 where Id =:lostProduct];
} catch (Exception e) {
- throw new AuraHandledException(e.getMessage());
+ return e.getMessage();
}
return JSON.serialize(prd);
}
@@ -799,7 +764,7 @@
Approval.ProcessResult result = Approval.process(req);
return null;
} catch (Exception e) {
- return e.getMessage();
+ return e.getMessage();
}
}
--
Gitblit v1.9.1