From da42e2995c00293af89c71fe5ba6e16cbb77e1b3 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期五, 16 六月 2023 17:24:31 +0800
Subject: [PATCH] backup code

---
 force-app/main/default/classes/LexConsumableController.cls |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/force-app/main/default/classes/LexConsumableController.cls b/force-app/main/default/classes/LexConsumableController.cls
index ae8b99b..c6f9846 100644
--- a/force-app/main/default/classes/LexConsumableController.cls
+++ b/force-app/main/default/classes/LexConsumableController.cls
@@ -1651,6 +1651,7 @@
         OSHFLG = OSHFLGStr;
         coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class);
         contactDealer = (List<String>)JSON.deserialize(contactDealerStr, List<String>.class);
+        System.debug('consumableorderdetailsRecordsviewStr:'+consumableorderdetailsRecordsviewStr);
         consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class);
         if(coc.Offers_Price__c != null){
             String offerStr = String.valueOf(coc.Offers_Price__c);
@@ -2018,13 +2019,19 @@
 
     //鍒犻櫎闄勪欢
     @AuraEnabled
-    public static Results deleteAtt(String contentVersionId){
+    public static Results deleteAtt(String contentVersionId, String cocId){
         Results results = new Results();
         try {
+            List<ContentVersion> cvInfo = [SELECT Id FROM ContentVersion WHERE FirstPublishLocationId = :cocId];
             ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
             String contentDocumentId = conVersion.ContentDocumentId;
             ContentDocument conDocument =  [SELECT Id FROM ContentDocument where Id = :contentDocumentId];
             delete conDocument;
+            if(cvInfo.size() <= 1){
+                Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id =:cocId];
+                c.Consumable_pdf_insert_day__c =null;
+                update c;
+            }
             results.result = 'Success';
         } catch (Exception e) {
             results.result = 'Fail';
@@ -2056,7 +2063,7 @@
         }
     }
 
-    class ConsumableorderdetailsInfo implements Comparable {
+    public class ConsumableorderdetailsInfo implements Comparable {
         @AuraEnabled
         public Boolean check { get; set; }
         @AuraEnabled

--
Gitblit v1.9.1