From 7078a9c09c584b4f126568703baf39b6ef6f30af Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 20 七月 2023 15:42:46 +0800
Subject: [PATCH] button-lexReturnDeliverySlipConsumApply

---
 force-app/main/default/classes/lexReturnDeliveryController.cls-meta.xml                         |    5 +++++
 force-app/main/default/classes/lexReturnDeliveryController.cls                                  |   31 +++++++++++++++++++++++++++++++
 force-app/main/default/lwc/lexReturnDeliverySlipConsumApply/lexReturnDeliverySlipConsumApply.js |   12 ++++++++----
 3 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/force-app/main/default/classes/lexReturnDeliveryController.cls b/force-app/main/default/classes/lexReturnDeliveryController.cls
new file mode 100644
index 0000000..04dc82f
--- /dev/null
+++ b/force-app/main/default/classes/lexReturnDeliveryController.cls
@@ -0,0 +1,31 @@
+public with sharing class lexReturnDeliveryController {
+    @AuraEnabled
+    public static InitData init(String recordId){
+        InitData res = new InitData();
+        try {
+            res.flag = true;
+            List<Consum_Apply_Equipment_Set_Detail__c> caeList = [SELECT Asset_Center_Confirm_F__c FROM Consum_Apply_Equipment_Set_Detail__c WHERE Cancel_Select__c = false AND Consum_Apply__c = :recordId];
+            if(caeList.size()>0){
+                res.size = caeList.size();
+                for(Consum_Apply_Equipment_Set_Detail__c cae : caeList){
+                    if(cae.Asset_Center_Confirm_F__c  != 'OK'){
+                        res.flag = false;
+                    }
+                } 
+            }
+            
+        }   
+        catch (Exception e) {
+            System.debug('********lexReturnDeliveryController*****'+e.getMessage());
+        }
+        
+        return res;
+    }
+
+    public class InitData{
+        @AuraEnabled
+        public Boolean flag;
+        @AuraEnabled
+        public Integer size;
+    }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/lexReturnDeliveryController.cls-meta.xml b/force-app/main/default/classes/lexReturnDeliveryController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/lexReturnDeliveryController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>50.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexReturnDeliverySlipConsumApply/lexReturnDeliverySlipConsumApply.js b/force-app/main/default/lwc/lexReturnDeliverySlipConsumApply/lexReturnDeliverySlipConsumApply.js
index e2bf008..a749001 100644
--- a/force-app/main/default/lwc/lexReturnDeliverySlipConsumApply/lexReturnDeliverySlipConsumApply.js
+++ b/force-app/main/default/lwc/lexReturnDeliverySlipConsumApply/lexReturnDeliverySlipConsumApply.js
@@ -22,12 +22,16 @@
 		init({
 			recordId: this.recordId
 		}).then(res=>{
-			if(!res.flag){
+			if(res){
+				if(!res.flag){
 				this.showToast('鏈畬鎴愬埌璐х‘璁ゆ垨澶囧搧涓績鏈‘璁や笉鑳戒笂浼犺瘯鐢ㄨ〃','warning');
 				return;
-			}
-			if(res.size > 0){
-				window.open("/apex/consumTrialConfirm?id=" + this.recordId); 
+				}
+				if(res.size > 0){
+					this.dispatchEvent(new CloseActionScreenEvent());
+					window.open("/apex/consumTrialConfirm?id=" + this.recordId); 
+					return;
+				}
 			}
 		})
 	}

--
Gitblit v1.9.1