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
// by ljh
public class ReantalApplySeriesNoController{
    private String raqId{get;set;}
    public Rental_Apply_Sequence__c  raq{get;set;}
    // public List<Raqinfo> raqInfoList { get; set; }
    public List<Rental_Apply_Sequence__c> raqList { get; set; }
    public Boolean Isadmix { get; set; }
    public ReantalApplySeriesNoController(){
        raqId = ApexPages.currentPage().getParameters().get('raqId');
        raq = new Rental_Apply_Sequence__c();
        raqList = new List<Rental_Apply_Sequence__c>();
        Isadmix = false;
    }
    public void init() {
        // raqInfoList = new List<Raqinfo>();
        raq = [Select Fixture_Model_No__c,Internal_asset_location__c,Salesdepartment__c,Equipment_Type__c,Product_category__c,Invalid_Flag__c From Rental_Apply_Sequence__c where Id =:raqId and Invalid_Flag__c = false limit 1];
        // List<Rental_Apply_Sequence__c> 
        raqList = [Select Id,Series_No__c,Invalid_Flag__c,Apply_Set_Detail_ExternalKey__c,
                Apply_Set_Detail__r.Queue_Time_F__c,Apply_Set_Detail__r.Queue_Number__c,Apply_Set_Detail__r.Queue_User__c,
                Rental_Apply__r.Name,Rental_Apply__r.WorkPlace__c,Rental_Apply__r.Person_In_Charge__c,
                Rental_Apply__r.Request_shipping_day__c,Rental_Apply__r.demo_purpose2__c,
                Rental_Apply__r.Request_approval_time__c,Rental_Apply__r.Hospital__c,
                Rental_Apply__r.Campaign__c
                From Rental_Apply_Sequence__c
                where Invalid_Flag__c = false
                and  Fixture_Model_No__c =:raq.Fixture_Model_No__c 
                and  Internal_asset_location__c =:raq.Internal_asset_location__c 
                and  Salesdepartment__c =:raq.Salesdepartment__c 
                and  Equipment_Type__c =:raq.Equipment_Type__c 
                and  Product_category__c =:raq.Product_category__c 
                order by Series_No__c ASC nulls last];
        // LineNo
        // for (Integer i = 0; i < raqList.size(); i++) {
        //     // 作成明细行
        //     Raqinfo raqinfod = new Raqinfo(raqList[i]);
        //     raqinfod.LineNo = i+1;
        //     raqInfoList.add(raqinfod);
        // }
        String IsadmixStr = '';
        for (Rental_Apply_Sequence__c raq:raqList) {
            if(String.isBlank(IsadmixStr)){
                IsadmixStr = raq.Apply_Set_Detail_ExternalKey__c;
            }else{
                if(String.isBlank(raq.Apply_Set_Detail_ExternalKey__c) || (!String.isBlank(raq.Apply_Set_Detail_ExternalKey__c) && IsadmixStr != raq.Apply_Set_Detail_ExternalKey__c)){
                    //混合
                    Isadmix = true; break;
                }
            } 
        }
    }
 
    // class Raqinfo  {
    //     public Integer LineNo {get; set;}
    //     public Rental_Apply_Sequence__c raq {get; set;}
    //     public Raqinfo(Rental_Apply_Sequence__c q) {
    //         raq = q;
    //     }
    // }
}