KKbes
2023-06-06 2291a36fcb66026690656554143dcdc8b0e72ea0
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// author:kkbes
 
public with sharing class LexSearchSetProductController {
  
  // public class  InitData{
 
  //   @AuraEnabled
  //   public Boolean isSelected;
  //   @AuraEnabled
  //   public String Name;
  //   @AuraEnabled
  //   public String Product_Set_CD;
  //   @AuraEnabled
  //   public Decimal Quantity;
  //   @AuraEnabled
  //   public String Quote_Select_Info;
  //   @AuraEnabled
  //   public Boolean Valid;
 
 
 
  //   public InitData()
 
  // }
 
 
 
    public class SSPLine {
        @AuraEnabled
        public Boolean isSelected;
        @AuraEnabled
        public String setProductid ;
        @AuraEnabled
        public String setProductidFull;
        @AuraEnabled
        public Decimal Quantity;
        @AuraEnabled
        public Product_Set__c theObject;
        @AuraEnabled
        public String Name;      
        @AuraEnabled
        public String Product_Set_CD;
        @AuraEnabled
        public String Quote_Select_Info;
        @AuraEnabled
        public Boolean Valid;
        @AuraEnabled
        public String Report;
 
 
        public SSPLine(Product_Set__c psl) {
          isSelected = false;
          setProductid = psl.id;
            setProductid = setProductid.substring(0,15);
            setProductidFull = psl.id;
            Name = psl.Name;
            Product_Set_CD= psl.Product_Set_CD__c;
            Quantity = psl.Quantity__c;
            Quote_Select_Info = psl.Quote_Select_Info__c;
            Valid = psl.Valid_Status__c;
            Report='◆';
        }
    }
 
 
  //   @AuraEnabled
  //   public static void SelectDone(List<SSPLine>  activities){
  //       setPFString = '';
  //       setProductidFullList = New List<String>();
  //       if(activities.size()==1){
  //         setPFString = activities[0].setProductidFull;
  //       }else{
  //         for(SSPLine arc : activities){
  //           if(arc.isSelected==true){
  //             if(String.isblank(setPFString)||setPFString==null){
  //               setPFString = arc.setProductidFull;
  //             }else{
  //               setPFString = setPFString+','+arc.setProductidFull;
  //             }
              
  //           }
  //         }
  //       }
  //       DataStatus = 'Fin';
  // }
 
 
 
    @AuraEnabled
    public static String getNeedParm1(){
        String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        return baseUrl;
    }
 
    @AuraEnabled
    public static String init(){
        String reportid;
        Report r = new Report();
        List<Report> rs = new List<Report>();
        rs=[Select id,DeveloperName,Name,NamespacePrefix from Report Where DeveloperName='Set_Product_Detail'];
        if (rs.size()>0){
            //system.debug('DeveloperName=' + rs[0].DeveloperName);
            //system.debug('Name=' + rs[0].Name);
            //system.debug('NamespacePrefix=' + rs[0].NamespacePrefix);
            reportid = rs[0].id;
            reportid = reportid.substring(0,15);
        }
        return reportid;
  }
 
  @AuraEnabled
  public static List<SSPLine> getData(String SearchName , String filterName , String SearchCode){
    String searchSql = 'Select id, name, Price__c, Product_Set_CD__c, Quantity__c,Valid_Status__c,Quote_Select_Info__c From Product_Set__c ';
    String whereStr = 'Where Valid_Status__c = true ';
    String whereSql = '';
 
    if(SearchName != null && SearchName != ''){
      whereSql += 'and name Like ' + '\'%' + SearchName + '%\' ';
    }
 
    if(filterName != null && filterName != ''){
      whereSql += 'and Applicable_Department__c =\'' + filterName + '\'';
    }
 
    if(SearchCode != null && SearchCode != ''){
      whereSql += 'and Product_Set_CD__c like ' + '\'%' + SearchCode + '%\' ';
    }
    searchSql = searchSql + whereStr + whereSql;
 
    searchSql += ' order by Product_Set_CD__c limit 500';
 
    List<Product_Set__c> cl = new List<Product_Set__c>();
 
    cl = Database.query(searchSql);
    List<SSPLine> activities = New List<SSPLine>();
 
    for(Product_Set__c psl : cl){
        SSPLine a = new SSPLine(psl);
        activities.add(a);
        
    }
    return activities;
  }
 
 
 
 
 
}