buli
2022-05-13 2f4492ee18f90274582fcc2bb06f5e9bf64136e8
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
public without sharing class OrderSplitRatioController {
    public String UsId { get; set; }
    public String BsAgm { get; set; }
    public String AppSta { get; set; }
    public String new_profileId { get; set; }
    String oldResponse;
    //订单
    public Order ord { get; set; }
    public Order ra1 { get; set; }
    public Order cc { get; set; }
    public Boolean hasError { get; private set; }
    // 订单ID
    public Id raid { get; private set; }
    public String baseUrl { get; private set; }
 
    public OrderSplitRatioController() {
        baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        raid = ApexPages.currentPage().getParameters().get('raid');
    }
    public OrderSplitRatioController(ApexPages.StandardController stdController) {
        //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
        baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        raid = stdController.getId();
    }
 
    // 画面初始化
    public void init() {
        //新的获取人员简档ID
        new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15));
        new_profileId = new_profileId.substring(0,15);
        AppSta = '';
        hasError = false;
        ord = new Order();
        cc = new Order();
        List<Order> raList = [select Id, Name, Dealer__c,SplitRatio__c,CrossCooperativeDealerText__c,SplitRatioFormule__c,BS_AsistGenManger_BS__c,ApproveStatus__c from Order where Id = :raid];
        UsId = UserInfo.getUserId().subString(0, 15);
        if (raList.size() > 0) {
            ord = raList[0];
            BsAgm = raList[0].BS_AsistGenManger_BS__c;
            if(BsAgm != null){
                BsAgm = BsAgm.substring(0, 15);
            }
 
            if(raList[0].ApproveStatus__c == 'Submit' || raList[0].ApproveStatus__c == 'OrderSubmit'){
                AppSta = '1';
            }
        }
        /*System.debug('AppSta='+AppSta);
        System.debug('new_profileId='+new_profileId);
        System.debug('BsAgm='+BsAgm);*/
    }
    
     // 画面初始化 UP
    public void init1() {
        AppSta = '';
        hasError = false;
        ra1 = new Order();
        List<Order> ra1List = [select Id, Name, Dealer__c,SplitRatio__c,CrossCooperativeDealerText__c,SplitRatioFormule__c,BS_AsistGenManger_BS__c from Order where Id = :raid];
        UsId = UserInfo.getUserId().subString(0, 15);
        if (ra1List.size() > 0) {
            ra1 = ra1List[0];
        }
    }
 
 
 
    // 保存按钮
    public PageReference saveBtn() {
        hasError = false;
        String response = ra1.SplitRatio__c;
        if (String.isBlank(ra1.SplitRatio__c)) {
        /*String SplitRatiotext = ra1.Dealer__c +' '+ ra1.SplitRatio__c +' '+ ra1.CrossCooperativeDealerText__c;
        ra1.SplitRatiotext__c = SplitRatiotext;*/
        update ra1;
        }else {
            update ra1;
        }
        
        return null;
    }
}