liuyn
2024-03-11 a87f1c3df03078814ee97ad0c8ac200a232419e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//author : kk 20240104
public with sharing class LexConsumableOrder {
    @AuraEnabled
    public static Consumable_order__c initConsumableOrder(String recordId){
        try{
            Consumable_order__c res = [SELECT Id,Order_status__c,OwnerId
                FROM Consumable_order__c 
                    WHERE Id = : recordId];
            return res;
        }
        catch(Exception e){
            System.debug('lexSubmitCampaign,method:initSubmit   error: '+e.getMessage());
            return null;
        }
 
    }
    @AuraEnabled
    public static String updateConsumableOrder(String Id , String recordTypeid){
        try {
            Consumable_order__c res = new Consumable_order__c();
            res.Id = Id;
            res.recordTypeid = recordTypeid;
            UPDATE res;
            return 'success';
        }
        catch (Exception e) {
            return '更新失败'+e.getMessage();
        }
        
 
    }
    @AuraEnabled
    public static List<Consumable_Orderdetails__c>  selectDeteails(String recordId){
        try {
            List<Consumable_Orderdetails__c> res = [select Id,Name,CreatedByid,Consumable_order__r.id,
                                                Consumable_order__c,Consumable_order__r.recordtypeid,Consumable_product__c,Consumable_count__c,
                                                Asset_Model_No__c,Intra_Trade_List_RMB__c 
                                                    from Consumable_Orderdetails__c 
                                                        where Consumable_order__r.id = :recordId];
            return res;
        }
        catch (Exception e) {
            return null;
        }
        
 
    }
    @AuraEnabled
    public static String create(Consumable_order_details2__c rac){
        Savepoint sp = Database.setSavepoint(); // 创建保存点
        try {
            INSERT rac;
            return 'success';
        }
        catch (Exception e) {
            Database.rollback(sp);
            return '新建失败'+e.getMessage();
        }
        
    }
 
    
}