From 0c4796706fc9473d069b620321a54b20a119906c Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 11 七月 2023 14:16:44 +0800
Subject: [PATCH] Merge branch 'LEXUpgrade2023-Deloitte'

---
 force-app/main/default/classes/LexArriveGsDetailsController.cls |  114 ++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 72 insertions(+), 42 deletions(-)

diff --git a/force-app/main/default/classes/LexArriveGsDetailsController.cls b/force-app/main/default/classes/LexArriveGsDetailsController.cls
index 05b90bc..b434454 100644
--- a/force-app/main/default/classes/LexArriveGsDetailsController.cls
+++ b/force-app/main/default/classes/LexArriveGsDetailsController.cls
@@ -19,45 +19,72 @@
         try {
             //鍙栫粡閿�鍟嗕俊鎭�
             String userId = UserInfo.getUserId();
-            List<user> useracc = New List<user>();
-            useracc = [select accountid from user where id =:userId];
+            List<user> useracc = new List<user>();
+            useracc = [SELECT accountid FROM user WHERE id = :userId];
             accountid = useracc[0].accountid;
-            List<Consumable_order__c> rs = New List<Consumable_order__c>();
-            if(eSetId == NULL || eSetId == '') {
-
-            }else {
-                rs = [SELECT id,name,Order_reason__c,Arrive_Order__c,Arrive_Order__r.Total_num__c,Arrive_Order__r.IsShipment__c,Arrive_Order__r.Name,
-                            recordtypeid,Order_status__c,Deliver_date__c,Arrive_total_amount__c
-                        FROM Consumable_order__c
-                        WHERE id =:eSetId];
-                coc =  new Consumable_order__c();
-                if(rs.size()>0){
+            List<Consumable_order__c> rs = new List<Consumable_order__c>();
+            if (eSetId == null || eSetId == '') {
+            } else {
+                rs = [
+                    SELECT
+                        id,
+                        name,
+                        Order_reason__c,
+                        Arrive_Order__c,
+                        Arrive_Order__r.Total_num__c,
+                        Arrive_Order__r.IsShipment__c,
+                        Arrive_Order__r.Name,
+                        recordtypeid,
+                        Order_status__c,
+                        Deliver_date__c,
+                        Arrive_total_amount__c
+                    FROM Consumable_order__c
+                    WHERE id = :eSetId
+                ];
+                coc = new Consumable_order__c();
+                if (rs.size() > 0) {
                     coc = rs[0];
                     orderallcount = coc.Arrive_Order__r.Total_num__c;
                 }
-                if(coc.Arrive_Order__c == null){
+                if (coc.Arrive_Order__c == null) {
                     arrivetoorder = true;
                 }
-                List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = [SELECT Id,Dealer_Arrive__c,Bar_Code__c, RecordTypeid, Name,Consumable_Product__r.Name__c,
-                                                            Consumable_Product__c,Consumable_Product__r.Name,Dealer_Saled__c,
-                                                            Sterilization_limit__c,Deliver_date__c,
-                                                            Intra_Trade_List_RMB__c,Asset_Model_No__c,Arrive_Date__c,Send_Date__c,
-                                                            Consumable_Product__r.SFDA_Status__c,
-                                                            Consumable_Product__r.Product2__r.Packing_list_manual__c,
-                                                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
-                                                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
-                                                        FROM Consumable_order_details2__c
-                                                        WHERE Consumable_Arrived_order__c = :eSetId
-                                                        ORDER BY Name ];
+                List<Consumable_order_details2__c> consumablearriveproductdetailsSelected = [
+                    SELECT
+                        Id,
+                        Dealer_Arrive__c,
+                        Bar_Code__c,
+                        RecordTypeid,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        Consumable_Product__c,
+                        Consumable_Product__r.Name,
+                        Dealer_Saled__c,
+                        Sterilization_limit__c,
+                        Deliver_date__c,
+                        Intra_Trade_List_RMB__c,
+                        Asset_Model_No__c,
+                        Arrive_Date__c,
+                        Send_Date__c,
+                        Consumable_Product__r.SFDA_Status__c,
+                        Consumable_Product__r.Product2__r.Packing_list_manual__c,
+                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
+                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
+                    FROM Consumable_order_details2__c
+                    WHERE Consumable_Arrived_order__c = :eSetId
+                    ORDER BY Name
+                ];
                 for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
-                        consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
-                    }
+                    consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
+                }
             }
-            for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
+            for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
                 bss.packing_list = bss.Prod.Product2__r.Packing_list_manual__c;
                 bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                 //update by rentx 20210622 start CHAN-C3K4ZQ
-                bss.expiration_DateStr = bss.Prod.Product2__r.SFDA_Expiration_Date__c == null ? '' : bss.Prod.Product2__r.SFDA_Expiration_Date__c.format();
+                bss.expiration_DateStr = bss.Prod.Product2__r.SFDA_Expiration_Date__c == null
+                    ? ''
+                    : bss.Prod.Product2__r.SFDA_Expiration_Date__c.format();
                 bss.Sterilization_limitStr = bss.esd.Sterilization_limit__c == null ? '' : bss.esd.Sterilization_limit__c.format();
                 //update by rentx 20210622 end CHAN-C3K4ZQ
             }
@@ -65,7 +92,7 @@
             //add by rentx 20210622 CHAN-C3K4ZQ
             // makeRecordsView(consumableorderdetailsRecords);
             //add by rentx 20210622 CHAN-
-            for(ConsumableorderdetailsInfo con : consumableorderdetailsRecords){
+            for (ConsumableorderdetailsInfo con : consumableorderdetailsRecords) {
                 con.prodName = con.esd.Consumable_Product__r.Name__c;
             }
             results.coc = coc;
@@ -84,30 +111,34 @@
 
     //鍑哄簱
     @AuraEnabled
-    public static Results proSale(String cocStr, Decimal orderallcountParm, Integer consumableorderdetailsCountParm) {
+    public static Results proSale(String cocStr, Decimal orderallcountParm, Integer consumableorderdetailsCountParm, String eSetIdStr) {
         Results results = new Results();
+        eSetId = eSetIdStr;
         try {
             orderallcount = orderallcountParm;
             consumableorderdetailsCount = consumableorderdetailsCountParm;
-            coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class);
+            coc = (Consumable_order__c) JSON.deserialize(cocStr, Consumable_order__c.class);
             List<Consumable_order_details2__c> orderdetails = new List<Consumable_order_details2__c>();
             //鍙戣揣鏄庣粏2
-            orderdetails = [SELECT Id 
-                            FROM Consumable_order_details2__c
-                            WHERE Consumable_order_minor__c =:coc.Arrive_Order__c
-                            AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
-                            AND Dealer_Arrive__c = true ];
-            if(orderallcount!= consumableorderdetailsCount){
+            orderdetails = [
+                SELECT Id
+                FROM Consumable_order_details2__c
+                WHERE
+                    Consumable_order_minor__c = :coc.Arrive_Order__c
+                    AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                    AND Dealer_Arrive__c = TRUE
+            ];
+            if (orderallcount != consumableorderdetailsCount) {
                 results.result = 'Fail';
                 results.errorMsg = '璁㈠崟涓嶅畬鍏ㄥ埌璐э紝鏃犳硶鍑哄簱';
                 return results;
             }
-            if(coc.Arrive_Order__r.IsShipment__c == true){
+            if (coc.Arrive_Order__r.IsShipment__c == true) {
                 results.result = 'Fail';
                 results.errorMsg = '璁㈠崟宸茬粡鍑哄簱';
                 return results;
             }
-            results.url = '/lexsummonscreat?arriveorder=' + eSetId +'&KeyWords=Redirect';
+            results.url = '/lexsummonscreat?arriveorder=' + eSetId + '&KeyWords=Redirect';
             results.result = 'Success';
         } catch (Exception e) {
             results.result = 'Fail';
@@ -143,7 +174,7 @@
         @AuraEnabled
         public Consumable_order_details2__c esd;
         @AuraEnabled
-    	public Product2__c Prod;
+        public Product2__c Prod;
         @AuraEnabled
         public Decimal packing_list;
         @AuraEnabled
@@ -157,7 +188,6 @@
         @AuraEnabled
         public String prodName;
 
-
         // 宸插瓨鍦ㄦ秷鑰楀搧鏄庣粏鐢�
         public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
             esd = e;
@@ -168,4 +198,4 @@
             return null;
         }
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1