From 4661adc43f549036f4e6e44debe92521c5793083 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 06 六月 2023 11:06:36 +0800
Subject: [PATCH] 修改页面以及按钮
---
force-app/main/default/classes/lexPCLLostReportLwcController.cls | 49 +++++++++++++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/force-app/main/default/classes/lexPCLLostReportLwcController.cls b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
index 1c42b9f..3a4b157 100644
--- a/force-app/main/default/classes/lexPCLLostReportLwcController.cls
+++ b/force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -494,7 +494,7 @@
}
// 鏁版嵁褰曞叆
@AuraEnabled
- public static Map<String,String> dataEntry(String report1){
+ public static Map<String,String> dataEntry(String report1,List<Id> deleteBrandIdList,List<Id> deleteProductIdList){
LostReport report = (LostReport)JSON.deserialize(report1, LostReport.class);
Map<String,String> messageMap = new Map <String,String>();
system.debug('save---start:');
@@ -543,30 +543,32 @@
map<string,PCLLostProduct__c> upsertLostProductMap = new map<string,PCLLostProduct__c>();
// 闇�瑕佸垹鎺夌殑澶卞崟鍝佺墝
list<PCLLostProduct__c> deleteLostProductList = new list<PCLLostProduct__c>();
+ Integer lineNo = 0;
for(LostBrand tempLostBrand : report.LostBrands ) {
// 濡傛灉鏈夊け鍗曞搧鐗岋紝閭d箞灏辫鎻掑叆鏇存柊锛�
system.debug('tempLostBrand.lostBrand.Lost_By_Company__c:'+tempLostBrand.lostBrand.Lost_By_Company__c);
if(string.isNotBlank(tempLostBrand.lostBrand.Lost_By_Company__c)) {
- upsertLostBrandMap.put(tempLostBrand.lineNo,tempLostBrand.lostBrand);
- tempLostBrand.lostBrand.Lost_cancel_report__c = report.lostReport.id;
+ upsertLostBrandMap.put(lineNo,tempLostBrand.lostBrand);
+ tempLostBrand.lostBrand.Lost_cancel_report__c = report.lostReport.Id;
tempLostBrand.lostBrand.Name = tempLostBrand.lostBrand.Lost_By_Company__c;
integer tempNo = 0;
for( PCLLostProducts tempLostProduct : tempLostBrand.LostProducts) {
system.debug('Name:'+ tempLostProduct.LostProductss.Name );
if(tempLostProduct.LostProductss.Quantity__c !=null && tempLostProduct.LostProductss.Quantity__c >0) {
tempLostProduct.LostProductss.Name = tempLostBrand.lostBrand.Name + tempLostProduct.LostProductss.Quantity__c;
- upsertLostProductMap.put(tempLostBrand.lineNo +':'+ tempNo,tempLostProduct.LostProductss);
- }else if(string.isNotBlank(tempLostProduct.LostProductss.id)) {
+ upsertLostProductMap.put(lineNo +':'+ tempNo,tempLostProduct.LostProductss);
+ }else if(string.isNotBlank(tempLostProduct.LostProductss.Id)) {
deleteLostProductList.add(tempLostProduct.LostProductss);
}
tempNo++;
}
}
// 濡傛灉娌℃湁鍝佺墝锛屼絾鏄湁id锛� 杩欐牱鏁版嵁闇�瑕佸垹闄�
- else if(string.isNotBlank(tempLostBrand.lostBrand.id)) {
- deleteLostBrandMap.put(tempLostBrand.lineNo,tempLostBrand.lostBrand);
+ else if(string.isNotBlank(tempLostBrand.lostBrand.Id )) {
+ deleteLostBrandMap.put(lineNo,tempLostBrand.lostBrand);
// 杩欓噷鍙兘闇�瑕佷篃鍒ゆ柇涓�涓嬪け鍗曞瀷鍙锋湁娌℃湁闇�瑕佸垹鎺�
}
+ lineNo++;
}
if(upsertLostBrandMap.size()>0) {
upsert upsertLostBrandMap.values();
@@ -574,7 +576,7 @@
for( string productNo :upsertLostProductMap.keyset()) {
PCLLostProduct__c tempLostProduct = upsertLostProductMap.get(productNo);
integer brandNo = integer.valueof(productNo.split(':')[0]);
- tempLostProduct.PCLLostBrand__c = upsertLostBrandMap.get(brandNo).id;
+ tempLostProduct.PCLLostBrand__c = upsertLostBrandMap.get(brandNo).Id;
}
if(upsertLostProductMap.size()>0) {
upsert upsertLostProductMap.values();
@@ -582,13 +584,20 @@
if(deleteLostBrandMap.size()>0) {
delete deleteLostBrandMap.values();
for(PCLLostBrand__c pcl: deleteLostBrandMap.values()) {
- pcl.id = null;
+ pcl.Id = null;
}
+ }
+ if (deleteProductIdList.size()>0) {
+ database.delete(deleteProductIdList);
+
+ }
+ if (deleteBrandIdList.size()>0) {
+ database.delete(deleteBrandIdList);
}
if(deleteLostProductList.size()>0) {
delete deleteLostProductList;
for(PCLLostProduct__c pclp: deleteLostProductList) {
- pclp.id = null;
+ pclp.Id = null;
}
}
if(deleteBrandIDSet.size() > 0) {
@@ -617,6 +626,7 @@
}
// lostReportId = report.lostReport.id;
system.debug('save---end:');
+ messageMap.put('LostReport',JSON.serialize(report));
}catch (Exception ex) {
Database.rollback(sp);
// 杩欓噷闇�瑕佸啓涓�浜涙姤閿欎俊鎭�
@@ -773,6 +783,8 @@
@AuraEnabled
public Boolean bool;
@AuraEnabled
+ public String productName;
+ @AuraEnabled
public List<Map<String, String>> productOptions = new List<Map<String, String>>();
public PCLLostProducts() {
this.lineNo2 = 0;
@@ -815,20 +827,17 @@
}
}
}
- // add tcm 20211118 end
-
@AuraEnabled
- public static List<Product2> searchProduct(){
+ public static string searchProduct(String lostProduct){
+ Product2 prd = null;
try {
- List<Product2> products = [
- select
- Id,name
- from Product2
- where Brand_Name__c = 'STORZ' limit 10
- ];
- return products;
+ prd = [select Id,ProductClass__c, ProductCategory__c from Product2 where Id =:lostProduct];
} catch (Exception e) {
throw new AuraHandledException(e.getMessage());
}
+ return JSON.serialize(prd);
}
+
+ // add tcm 20211118 end
+
}
\ No newline at end of file
--
Gitblit v1.9.1