From 0f44cb1a0b7b36860e9ce81c1eac9e395d87f0b4 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 05 六月 2023 13:53:18 +0800
Subject: [PATCH] mergecode into lex dtt

---
 force-app/main/default/classes/LexSaleAndDeliveryController.cls |   55 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/force-app/main/default/classes/LexSaleAndDeliveryController.cls b/force-app/main/default/classes/LexSaleAndDeliveryController.cls
index 9a385f2..6f07385 100644
--- a/force-app/main/default/classes/LexSaleAndDeliveryController.cls
+++ b/force-app/main/default/classes/LexSaleAndDeliveryController.cls
@@ -21,11 +21,7 @@
             res.entity = data;
             userinfoId = UserInfo.getUserId();
             List<user> Useracc = new List<user>();
-            Useracc = [
-                SELECT accountid, Work_Location__c, UserPro_Type__c
-                FROM user
-                WHERE id = :userinfoId
-            ];
+            Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId];
             accountid = Useracc[0].accountid;
             agencyProType = Useracc[0].UserPro_Type__c;
             if (String.isBlank(Useracc[0].UserPro_Type__c)) {
@@ -38,13 +34,13 @@
             data.put('userWorkLocation', userWorkLocation);
             System.debug(
                 'userinfoId = ' +
-                    userinfoId +
-                    ' accountid = ' +
-                    accountid +
-                    ' agencyProType = ' +
-                    agencyProType +
-                    ' userWorkLocation = ' +
-                    userWorkLocation
+                userinfoId +
+                ' accountid = ' +
+                accountid +
+                ' agencyProType = ' +
+                agencyProType +
+                ' userWorkLocation = ' +
+                userWorkLocation
             );
             //榛樿妫�绱㈡樉绀烘湭瀹屾垚鐨勬寚绀哄崟
             List<Consumable_order__c> raesList = new List<Consumable_order__c>();
@@ -141,6 +137,8 @@
             res.entity = data;
             Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-'));
             Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-'));
+            System.debug('cate2 = ' + cate2);
+            System.debug('cate3 = ' + cate3);
             // 鑾峰緱璁㈠崟涓�瑙�
             List<Consumable_order__c> raesList = new List<Consumable_order__c>();
             String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
@@ -230,4 +228,35 @@
             return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
         }
     }
-}
+
+    @AuraEnabled
+    public static ResponseBodyLWC cleanUp(String accountid, String agencyProType, String userWorkLocation) {
+        try {
+            ResponseBodyLWC res = new ResponseBodyLWC();
+            Map<String, object> data = new Map<String, object>();
+            res.entity = data;
+
+            // 鑾峰緱鏄剧ず鏁版嵁
+            List<Consumable_order__c> raesList = new List<Consumable_order__c>();
+            String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
+            soql += '  WHERE Order_type__c = \'' + '浼犵エ' + '\'  ';
+            soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+            soql += 'and SummonsStatus_c__c != \'' + '宸插畬鎴�' + '\' and Dealer_Info__c =\'' + accountid + '\' ';
+            soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+            soql += 'order by SummonsStatus_c__c';
+            System.debug('soql = ' + soql);
+            raesList = Database.query(soql);
+            data.put('raesList', raesList);
+            if (raesList.size() > 0) {
+                res.msg = '鍏辨湁' + raesList.size() + '涓嚭搴撳崟';
+            } else {
+                res.msg = '娌℃湁鎼滅储鍒扮浉鍏冲嚭搴撳崟銆�';
+            }
+            res.status = 'Success';
+            res.code = 200;
+            return res;
+        } catch (Exception e) {
+            return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1