GWY
2022-05-30 4420517bbbffea48cabe7a7dcdf2e1c4b440fc85
force-app/main/default/classes/OrderTriggerHandler.cls
@@ -1925,6 +1925,12 @@
            if (newOrder.SP_33__c == true && oldOrder.SP_33__c == false) {
                newOrder.Description += sObjectFieldMaps.get('SP_33__c').getDescribe().getLabel() + ' \r\n ';
            }
            if (newOrder.SP_32__c == true && oldOrder.SP_32__c == false) {
                newOrder.Description += sObjectFieldMaps.get('SP_32__c').getDescribe().getLabel() + ' \r\n ';
            }
            if (newOrder.SP_31__c == true && oldOrder.SP_31__c == false) {
                newOrder.Description += sObjectFieldMaps.get('SP_31__c').getDescribe().getLabel() + ' \r\n ';
            }
            if (newOrder.SP_11__c == true && oldOrder.SP_11__c == false) {
                newOrder.Description += sObjectFieldMaps.get('SP_11__c').getDescribe().getLabel() + ' \r\n ';
            }
@@ -1990,6 +1996,12 @@
            }
            if (newOrder.SP_33__c == false && oldOrder.SP_33__c == true) {
                newOrder.Description =  newOrder.Description.remove(sObjectFieldMaps.get('SP_33__c').getDescribe().getLabel() + ' \r\n ');
            }
            if (newOrder.SP_32__c == false && oldOrder.SP_32__c == true) {
                newOrder.Description =  newOrder.Description.remove(sObjectFieldMaps.get('SP_32__c').getDescribe().getLabel() + ' \r\n ');
            }
            if (newOrder.SP_31__c == false && oldOrder.SP_31__c == true) {
                newOrder.Description =  newOrder.Description.remove(sObjectFieldMaps.get('SP_31__c').getDescribe().getLabel() + ' \r\n ');
            }
            if (newOrder.SP_11__c == false && oldOrder.SP_11__c == true) {
                newOrder.Description = newOrder.Description.remove(sObjectFieldMaps.get('SP_11__c').getDescribe().getLabel() + ' \r\n ');
@@ -2090,15 +2102,15 @@
                        newOrder.BS_AsistBGenManger_BS__c = u.BS_AsistBGenManger__c == null ? u.Id : u.BS_AsistBGenManger__c;
                        newOrder.BS_AsistGenManger_BS__c  = u.BS_AsistGenManger__c  == null ? u.Id : u.BS_AsistGenManger__c;
                        newOrder.BS_MandAGM__c  = u.BS_Manager__c         == u.BS_AsistGenManger__c ? true : false;
                        newOrder.BS_AGMandD__c  = u.BS_AsistGenManger__c  == u.BS_Department__c ? true : false;
                        newOrder.BS_DandAB__c   = u.BS_Department__c      == u.BS_AsistBGenManger__c ? true : false;
                        newOrder.BS_MandAGM__c  = u.BS_Manager__c         == u.BS_AsistBGenManger__c ? true : false;
                        //newOrder.BS_MandAGM__c  = u.BS_Manager__c         == u.BS_AsistGenManger__c ? true : false;
                        //newOrder.BS_AGMandD__c  = u.BS_AsistGenManger__c  == u.BS_Department__c ? true : false;
                        //newOrder.BS_DandAB__c   = u.BS_Department__c      == u.BS_AsistBGenManger__c ? true : false;
                        newOrder.BS_ABGandBD__c = u.BS_AsistBGenManger__c == u.BS_BDepartment__c ? true : false;
                        newOrder.BS_BDandIND__c = u.BS_BDepartment__c     == u.BS_INDepartment__c ? true : false;
                        newOrder.BS_INDandGM__c = u.BS_INDepartment__c    == u.BS_GeneralManager__c ? true : false;
                    }
                }
                if (newOrder.ProductSegment__c != 'BS') {
                    newOrder.SalesOwner_BS__c = newOrder.OpportunityOwnerId__c;
@@ -2119,6 +2131,14 @@
            }    
            //}
        }
        for (Order newOrder : newList) {
            if (newOrder.ProductSegment__c == 'BS') {
                newOrder.BS_AGMandD__c  = newOrder.BS_Manager_BS__c    == newOrder.SalesOwner_BS__c ? true : false;
                newOrder.BS_DandAB__c   = newOrder.BS_Department_BS__c == newOrder.SalesOwner_BS__c ? true : false;
            }
        }
    }
@@ -2655,13 +2675,13 @@
                        // 合同-变更申请-原合同无效或者手动修改导致合同无效
                        if (!approveStatus && status) {
                            if(newOrd.oldOrder__c){
                            /*if(newOrd.oldOrder__c){
                                RadiationUtil.oldOrder = true;
                                if (updateFlag) {
                                    newOrd.oldOrder__c = false;
                                }
                                
                            }
                            }*/
                            RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'无效或变更无效',newOrd.LastModifiedById );
                        }
@@ -2678,12 +2698,12 @@
                            if (RadiationUtil.EscapeOrderTriggerHandler) {
                                RadiationUtil.EscapeOrderTriggerHandler = false;
                                if(newOrd.oldOrder__c){
                                /*if(newOrd.oldOrder__c){
                                    RadiationUtil.oldOrder = true;
                                    if (updateFlag) {
                                        newOrd.oldOrder__c = false;
                                    }
                                }
                                }*/
                                RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同变更草案中',newOrd.LastModifiedById );
                            }
@@ -2697,43 +2717,43 @@
                        Boolean status = newOrd.Status__c != oldOrd.Status__c && newOrd.Status__c == 'Inactive';
                        // 合同提交状态变成无效
                        if ( status ) {
                            if(newOrd.oldOrder__c){
                            /*if(newOrd.oldOrder__c){
                                RadiationUtil.oldOrder = true;
                                if (updateFlag) {
                                    newOrd.oldOrder__c = false;
                                }
                            }
                            }*/
                            RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同提交变无效',newOrd.LastModifiedById );
                        }
                    } else if (newOrd.ApproveStatus__c == 'CancelPass' && newOrd.Status__c == 'Active') {
                        // 合同-合同批准→→→合同取消
                        if ( approveStatus && newOrd.BeforeSubmitStatus__c == 'OrderPass') {
                            if(newOrd.oldOrder__c){
                            /*if(newOrd.oldOrder__c){
                                RadiationUtil.oldOrder = true;
                                if (updateFlag) {
                                    newOrd.oldOrder__c = false;
                                }
                            }
                            }*/
                            RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同取消',newOrd.LastModifiedById );
                        }
                    } else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderReject' && newOrd.Status__c == 'Active') {
                        // 合同提交→→→合同驳回
                        if(newOrd.oldOrder__c){
                        /*if(newOrd.oldOrder__c){
                            RadiationUtil.oldOrder = true;
                            if (updateFlag) {
                                newOrd.oldOrder__c = false;
                            }
                        }
                        }*/
                        RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同驳回',newOrd.LastModifiedById );
                    } else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderDraft' && newOrd.Status__c == 'Active') {
                        // 合同提交→→→合同调回
                        if(newOrd.oldOrder__c){
                        /*if(newOrd.oldOrder__c){
                            RadiationUtil.oldOrder = true;
                            if (updateFlag) {
                                newOrd.oldOrder__c = false;
                            }
                        }
                        }*/
                        RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同调回',newOrd.LastModifiedById );
                    }
                   
@@ -3434,6 +3454,451 @@
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
    }
    
}