From 2f4492ee18f90274582fcc2bb06f5e9bf64136e8 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 13 五月 2022 17:32:14 +0800
Subject: [PATCH] ProdBackup0513

---
 force-app/main/default/classes/OpportunityWebService.cls | 1004 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 634 insertions(+), 370 deletions(-)

diff --git a/force-app/main/default/classes/OpportunityWebService.cls b/force-app/main/default/classes/OpportunityWebService.cls
index 7aef092..3f26cf3 100644
--- a/force-app/main/default/classes/OpportunityWebService.cls
+++ b/force-app/main/default/classes/OpportunityWebService.cls
@@ -1,408 +1,672 @@
 global class OpportunityWebService {
-    
-    WebService static String changeTrade(String oppId){
 
-        List<Quote> quoList = [select id from Quote where OpportunityId = :oppId];
-        List<OpportunityLineItem> oppLI = [select id from OpportunityLineItem where Opportunity.id = :oppId];
+    WebService static String check(String oppId) {
+        String str = '1';
+        List<OpportunityLineItem> oliList = [select id, Product2.If_Exempt_Product__c, Product2.If_Radiation_Product__c, Opportunity.DealerId__c from OpportunityLineItem where opportunityId = :oppId];
+        Boolean hasA = false;
+        for (OpportunityLineItem oli : oliList) {
+            if (oli.Product2.If_Exempt_Product__c == false && oli.Product2.If_Radiation_Product__c == true) {
+                hasA = true;
+            }
+        }
+        if (hasA == true) {
+            str =  LicenseCheckUtil.LicenseCheck1(oliList[0].Opportunity.DealerId__c);
+        }
+        return str;
+    }
 
+    WebService static String checkOly() {
+        return LicenseCheckUtil.LicenseCheckOly();
+    }
+
+    WebService static String UpdateStageName(String opportunityId, String targetStageName) {
         Opportunity opp = new Opportunity();
-        opp.id = oppId;
-        opp.Estimation_Decision__c = false;
-        opp.Estimation_Id__c = null;
-        opp.Quote_Update_Sum__c = null;
-        opp.Estimation_No__c = null;
-        opp.Estimation_Proposal_Date__c = null;
-        opp.Estimation_Name__c = null;
-        // LHJ SWAG-C9QAAJ 鍘绘帀 Start
-        // opp.Authorized_Finish_Sales__c = null;
-        // opp.Authorized_DB_No__c = null;
-        // opp.Authorized_Date__c = null;
-        // opp.Autholization_Activated_Date__c = null;
-        // opp.Bidding_Content__c = null;
-        // opp.Bid_Date__c = null;
-        // opp.Bidding_No__c = null;
-        // opp.Bidding_Project_Name__c = null;
-        // LHJ End
-
-        Savepoint sp = Database.setSavepoint();
+        opp.Id = opportunityId;
+        opp.StageName = targetStageName;
         try {
-            delete quoList;
-            delete oppLI;
+            StaticParameter.StageProgressBarUpdate = true;
             update opp;
-            return '1';     
+        } catch (Exception ex) {
+            return ex.getMessage();
+        }
+
+        return '1';
+    }
+
+    WebService static String UpdateShare(String opportunityId, String userId) {
+        try {
+            List<OpportunityShare> osList = [select Id, OpportunityId, UserOrGroupId, OpportunityAccessLevel, RowCause from OpportunityShare where OpportunityId = :opportunityId and UserOrGroupId = :userId and RowCause = 'Team' and OpportunityAccessLevel = 'Read'];
+            for (OpportunityShare os : osList) {
+                os.OpportunityAccessLevel = 'Edit';
+            }
+            if (osList.size() > 0) {
+                update osList;
+            }
+        } catch (Exception ex) {
+            return ex.getMessage();
+        }
+
+        return '1';
+    }
+
+    WebService static String Upload2Sap(String opportunityId, String quoteNo, String quoteId) {
+        add();
+        Savepoint sp = Database.setSavepoint();
+        Opportunity oppor = [select id, AccountId, Dealer__r.DummyDealer__c, Dealer__r.ParentID, Account.MarketVerticals__c, Trade_Type_D__c from Opportunity where id = :opportunityId];
+        if (oppor.Account.MarketVerticals__c == 'Clinical' && oppor.Trade_Type_D__c == 'Taxation') {
+            if (oppor.Dealer__r.DummyDealer__c == true) {
+                String backStr = LicenseCheckUtil.LicenseCheck(oppor.AccountId);
+                if (backStr != '1') {
+                    return backStr + ',涓嶈兘涓婁紶鎶ヤ环';
+                }
+            } else {
+                String backStr = LicenseCheckUtil.LicenseCheck(oppor.Dealer__r.ParentID);
+                if (backStr != '1') {
+                    return backStr + ',涓嶈兘涓婁紶鎶ヤ环';
+                }
+            }
+        }
+        try {
+            Opportunity opp = new Opportunity();
+            opp.Id = opportunityId;
+            opp.the_Upload_of_quotation_number__c = quoteNo;
+            update opp;
+
+            Quote quo = new Quote();
+            quo.Id = quoteId;
+            quo.Is_upload__c = true;
+            update quo;
+
         } catch (Exception ex) {
             Database.rollback(sp);
-            return  ex.getMessage() + ' | Line:' + ex.getLineNumber();
+            return ex.getMessage();
         }
-    } 
 
-    // LHJ CBPR Start
-    webservice String parameter { get; set; }
-
-    public OpportunityWebService() {
-        this.parameter = 'value';
+        return '1';
     }
 
-    WebService static String oppCheck(String oppid, String saveFlg) {
 
-        Map<Id, String> proMap= new Map<Id, String>();
-        List<OpportunityLineItem> OppItemList = [select PricebookEntry.Product2Id, PricebookEntry.Product2.Name
-                                                   From OpportunityLineItem 
-                                                  Where OpportunityId = :oppid];
 
-        if (OppItemList.size() > 0) {
-            for (OpportunityLineItem opl : OppItemList) {
-                proMap.put(opl.PricebookEntry.Product2Id, opl.PricebookEntry.Product2.Name);
-            }
+    WebService static String checkUpperLimitOfSales(String oppId, String dealerId) {
+        String result = '';
+        String olympusAccountId = System.label.Olympus_Id;
+        Map<String, Integer> getModelQuantityMap = RadiationUtil.GetOpportunityLineMap(oppId);
+        String errorStr = RadiationUtil.GetCertificationDetail(dealerId, getModelQuantityMap);
+        if (errorStr != '') {
+            return '-1';
         }
-
-        List<Opportunity> oppList = [select Agency1__c from Opportunity where id = :oppid];
-        String angencyId = oppList[0].Agency1__c;
-        String strRet = '';
-
-        if (saveFlg == '1') {
-            strRet = checkProRegisterDecide(proMap, angencyId, oppid);
+        String accountDealerErrorMessage = RadiationUtil.updateCertificationDetails(dealerId, null, getModelQuantityMap, false);
+        //String olympusDealerErrorMessage = RadiationUtil.updateCertificationDetails(olympusAccountId, null, getModelQuantityMap, false);
+        result = accountDealerErrorMessage ;
+        //String flage = LicenseCheckUtil.LicenseCheckOly();
+        Boolean temp = result.startsWith('浣犱笉鑳�');
+        if (temp) {
+            return '-1';
         } else {
-            strRet = checkProRegisterDecide(proMap, angencyId, '');
-        }
-        return strRet;
-    }
-
-    // LHJ 闃胯タ璧涘妫�鏌� Start
-    WebService  static String checkDangerItem(String agency1) {
-        //娌℃湁鍗卞寲鍝佽瘉鐓х殑鎻愮ず淇℃伅
-        String licenseStr = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍗遍櫓鍖栧鍝佺粡钀ヨ鍙瘉銆�';
-        //娌℃湁闃胯タ璧涘缁忛攢鍟嗗崗璁殑鎻愮ず淇℃伅
-        String accStr = '绗竴缁忛攢鍟嗘病鏈夐樋瑗胯禌澶氱粡閿�鍟嗗崗璁��';
-
-        //妫�鏌ユ槸鍚︽湁璇佺収
-        List<License_Information__c> licenseList = [SELECT Id
-                                                      FROM License_Information__c
-                                                     WHERE LicenseAndAccount__c = :agency1
-                                                       AND LicenseType__c = '鍗遍櫓鍖栧鍝佺粡钀ヨ鍙瘉'
-                                                       AND Is_Active_Formula__c = true
-                                                       
-                                                    ];
-        //妫�鏌ユ槸鍚︽湁闃胯タ璧涘鍗忚
-        List<Account> accountList = [SELECT Id
-                                                      FROM Account
-                                                     WHERE Parent.id = :agency1
-                                                       //闃胯タ璧涘 澧炲姞妫�绱㈤樋瑗胯禌澶氬崗璁� 浠ュ強 鍙互鍋氭姤浠�(澶嶉�夋) 绮剧悽鎶�鏈� wql 2021/01/04 start
-                                                       AND Contract_Quote_Decide_Flag_checkbox__c =true
-                                                       AND Assiesedo_Dealer__c  = true
-                                                       //闃胯タ璧涘 澧炲姞妫�绱㈤樋瑗胯禌澶氬崗璁� 浠ュ強 鍙互鍋氭姤浠�(澶嶉�夋) 绮剧悽鎶�鏈� wql 2021/01/04 end
-                                                    ];
-
-        system.debug('licenseList:'+licenseList.size());
-        system.debug('agency1:'+agency1);
-        //鈶犳棦娌℃湁鍗卞寲鍝佽瘉涔熸病鏈夐樋瑗胯禌澶氬崗璁�
-        if(licenseList.size() == 0 && accountList.size() ==0){
-            return licenseStr+accStr;
-        }
-        //鈶℃病鏈夊嵄鍖栧搧璇�
-        else if(licenseList.size() ==0){
-            return licenseStr;
-        }
-        //鈶℃病鏈夐樋瑗胯禌澶氱粡閿�鍟嗗崗璁�
-        else if(accountList.size() ==0){
-            return accStr;
-        }
-        //鈶㈠叏閮芥湁
-        else{
-            return 'OK';
+            return result;
         }
     }
-    // LHJ 闃胯タ璧涘妫�鏌� End
 
-    public static Map<String, String> MapCheckProRegisterDecide(Map<Id, String> proMap, String agency1, String OppId) {
 
-        Map<String, String> retMap = new Map<String, String>();
-        String errormessage = '';
-        Boolean error = false;
-        Map<String,List<String>> proAllBSstrMap;
-        List<String> proNotNeedList = new List<String>();
-
-        Map<String,List<String>> old_newMap = new Map<String,List<String>>();
-        Map<String,List<String>> new_oldMap = new Map<String,List<String>>();
-
-        // 鍙栧緱 缁忚惀鑼冨洿瀵瑰簲浜у搧鍏崇郴
-        List<String> midStr = new List<String>();
-        List<String> midStrO = new List<String>();
-
-        // List<Product_Register_contrast__c> rrList = Product_Register_contrast__c.getall().values();
-
-        // for (Product_Register_contrast__c rr : rrList) {
-
-        //     midStr = new List<String>();
-        //     midStrO = new List<String>();
-
-        //     // 缁忚惀鑼冨洿瀵瑰簲浜у搧鍏崇郴 Map浣滄垚 鏃�-鏂板鐓�
-        //     if (old_newMap.containsKey(rr.Register_old__c)) {
-        //         old_newMap.get(rr.Register_old__c).add(rr.Register_new__c);
-        //     } else {
-        //         midStrO.add(rr.Register_new__c);
-        //         old_newMap.put(rr.Register_old__c, midStrO.clone());
-        //     }
-
-        //     // 缁忚惀鑼冨洿瀵瑰簲浜у搧鍏崇郴 Map浣滄垚 鏂�-鏃у鐓�
-        //     if (new_oldMap.containsKey(rr.Register_new__c)) {
-        //         new_oldMap.get(rr.Register_new__c).add(rr.Register_old__c);
-        //     } else {
-        //         midStr.add(rr.Register_old__c);
-        //         new_oldMap.put(rr.Register_new__c, midStr.clone());
-        //     }
-            
-        // }
-        // 鍙栧緱缁忛攢鍟� 鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�
-        List<License_Information__c> licenseList = [SELECT Id,
-                                                           ScopeKey__c, 
-                                                           LicenseType__c
-                                                      FROM License_Information__c
-                                                     WHERE LicenseAndAccount__c = :agency1
-                                                    AND (LicenseType__c = '鍖荤枟鍣ㄦ缁忚惀璁稿彲璇�'
-                                                        OR LicenseType__c = '绗簩绫诲尰鐤楀櫒姊扮粡钀ュ妗堝嚟璇�')
-                                                      AND Is_Active_Formula__c = true
-                                                    ];
-        // 鍒ゆ柇 鍖荤枟鍣ㄦ缁忚惀璁稿彲璇� 鏄惁瀛樺湪
-        if (licenseList.size() == 0) {
-            error = true;
-            errormessage = '绗竴缁忛攢鍟嗘病鏈夋湁鏁堢殑鍖荤枟鍣ㄦ缁忚惀璁稿彲璇併��';
-            retMap.put('agency', '0');
-
+    WebService static String checkUpperLimitOfSalesOly(String oppId, String dealerId) {
+        String result = '';
+        String olympusAccountId = System.label.Olympus_Id;
+        Map<String, Integer> getModelQuantityMap = RadiationUtil.GetOpportunityLineMap(oppId);
+        /*String errorStr = RadiationUtil.GetCertificationDetail(oppId,getModelQuantityMap);
+        if(errorStr != ''){
+           return '-1';
+        }
+        String accountDealerErrorMessage = RadiationUtil.updateCertificationDetails(dealerId, null, getModelQuantityMap, false);*/
+        String olympusDealerErrorMessage = RadiationUtil.updateCertificationDetails(olympusAccountId, null, getModelQuantityMap, false);
+        result = olympusDealerErrorMessage == '' ? '' : '濂ユ灄宸存柉鍙攢鍞暟閲忎笉瓒�' ;
+        //String flage = LicenseCheckUtil.LicenseCheckOly();
+        Boolean temp = result.startsWith('浣犱笉鑳�');
+        if (temp) {
+            return '-1';
         } else {
-            //缁忛攢鍟嗙粡钀ヨ寖鍥�
-            List<String> agListA = new List<String>();
-            List<String> agListTemp = new List<String>();
-            List<String> agList = new List<String>();
+            return result;
+        }
+    }
 
-            //鍙栫粡閿�鍟嗕笅 鎵�鏈夊尰鐤楀櫒姊扮粡钀ヨ鍙瘉銆佺浜岀被鍖荤枟鍣ㄦ缁忚惀澶囨鍑瘉
-            for (License_Information__c li : licenseList) {
-                if (li.ScopeKey__c != null) {
-                    agListA.addAll(li.ScopeKey__c.split(';'));
-                    agListTemp.addAll(li.ScopeKey__c.split(';'));
-                }
-            }
-            for (String a : agListTemp) {
-                if (a.length() >= 6) {
-                    agList.add(a.substring(0, a.length() - 1));
+    WebService static String checkOrderStatus(String oppId, String stageName, String creuser) {
+        String temp = '1';
+        Order ord = new Order();
+        List<Order> ordList = new List<Order>();
+        ordList = [select id, SAP_Order__c, ProductSegment__c, Is_TAX__c, SAP_Contract__c, ApproveStatus__c, CreatedById from Order where OpportunityId = : oppId and Status__c = 'Active'];
+         String userId = UserInfo.getUserId().substring(0, 15);
+         String roleId = UserInfo.getUserRoleId().substring(0, 15);
+        if (ordList.size() > 0) {
+            ord = ordList[0];
+           
+            if ( (ord.ApproveStatus__c == 'CancelPass' ||  ord.ApproveStatus__c == 'OrderDraft' || ord.ApproveStatus__c  == 'Draft' || ord.ApproveStatus__c == 'Reject') &&  creuser == userId ) {
+                StaticParameter.StageProgressBarUpdate = true;
+
+                
+
+                if (userId == '005280000037mrQ' || userId == '00528000002OAvH' || userId == '00528000000YSdB' ||
+                        roleId == '00E0K000001ywwz' || roleId == '00E0K000001jGiM' || roleId == '00E0K000001jGib' ||
+                        roleId == '00E0K000001ywgS' || roleId == '00E28000000knAm' || roleId == '00E28000000knAr' ||
+                        roleId == '00E28000000aKzn' || roleId == '00E0K000001jGhn' || roleId == '00E0K000001jGhs' ||
+                        roleId == '00E0K000001ywgN' || roleId == '00E0K000001PWuh' || roleId == '00E0K000001PWum' ||
+                        roleId == '00E0K000001PWur' || roleId == '00E280000015xus' || roleId == '00E280000015xux' ||
+                        roleId == '00E28000000aKzs' || roleId == '00E0K000001jGiC' || roleId == '00E0K000001jGiR' ||
+                        roleId == '00E0K000001ywgX' || roleId == '00E28000000knAc' || roleId == '00E28000000knAh' ||
+                        roleId == '00E28000000aKzx' || roleId == '00E28000000knAw' || roleId == '00E28000000knB1' ||
+                        roleId == '00E28000000aL02') {
+
+                    Opportunity opp = new Opportunity();
+                    opp.Id = oppId;
+                    opp.Cancel_Fail_Approve__c = 'Pass';
+                    opp.StageName = stageName;
+
+                    try {
+                        StaticParameter.StageProgressBarUpdate = true;
+                        update opp;
+                    } catch (Exception ex) {
+                        return ex.getMessage();
+                    }
                 } else {
-                    agList.add(a.trim());
-                }                
-            }
-
-            //浜у搧娉ㄥ唽璇�
-            Map<String,Map<String,String>> proBSMap = new Map<String,Map<String,String>>();
-            
-            Map<String,String> proMidMap = null;
-            //浜у搧鎵�鏈夋湁鏁堟敞鍐岃瘉锛堝彲浠ュ拰缁忛攢鍟嗗尮閰嶏級
-            proAllBSstrMap = new Map<String,List<String>>();
-            set<Id> proIdList = new set<Id>();
-
-            for (String qli : proMap.keySet()) {     
-                    proIdList.add(qli);
-                    proBSMap.put(qli, proMidMap);
-                    List<String> empList = new List<String>();
-                    proAllBSstrMap.put(qli, empList);
-                
-            }
-
-            List<Product_Register_Link__c> prls = [
-                                                 Select Product2__c,
-                                                        Product2__r.Asset_Model_No__c,
-                                                        Product2__r.SFDA_Approbated_Status__c,
-                                                        Product2__r.SFDA_Status_New__c, // 浜у搧鐨凜FDA鏈�缁堢姸鎬� 20181225
-                                                        Product_Register__r.Name,
-                                                        Product_Register__r.BusinessScopeKey__c, 
-                                                        Product_Register__r.RegisterNoStatus__c,
-                                                        Product_Register__r.MedPrdClass__c 
-                                                   From Product_Register_Link__c
-                                                  where Product2__c in :proIdList
-                                                  ];
-
-            // LHJ 20190102 澧炲姞璺宠繃閫昏緫 Start
-            List<Product2> productList = [select ID,SFDA_Status__c from Product2 where id in :proIdList];
-            for (Product2 pro : productList) {
-                if (pro.SFDA_Status__c == '涓嶈') {
-                    proNotNeedList.add(pro.ID);
+                    temp = '0';
                 }
+            } else {
+                temp = '0';
             }
-            // LHJ 20190102 澧炲姞璺宠繃閫昏緫 End
-
-            for (Product_Register_Link__c prl : prls) {
-                
-                // 璁剧疆浜у搧绫诲埆MAP
-                if (String.isNotBlank(prl.Product_Register__r.BusinessScopeKey__c)) {
-                    system.debug('Product2 +++++++' + prl.Product2__c);
-                    if (proBSMap.get(prl.Product2__c) != null) {
-                        proBSMap.get(prl.Product2__c).put(prl.Product_Register__r.Name, prl.Product_Register__r.BusinessScopeKey__c);
-                    
-                    } else {
-                        Map<String,String> toooMap = new Map<String,String>();
-                        toooMap.put(prl.Product_Register__r.Name, prl.Product_Register__r.BusinessScopeKey__c);
-                        proBSMap.put(prl.Product2__c, toooMap.clone());
-                    }
-                }
-
-                // 浜у搧鐨勪骇鍝佹敞鍐岃瘉鏄�"涓嶈"鐘舵�� 涓嶉渶瑕佸尮閰嶆敞鍐岃瘉 20181225
-                if (prl.Product2__r.SFDA_Approbated_Status__c == '涓嶈' 
-                        
-                        || prl.Product_Register__r.MedPrdClass__c == '1') {
-                     proNotNeedList.add(prl.Product2__c);
-                }
-            }
-            system.debug('proBSMap +++++++' + proBSMap);
-            for (String qli : proMap.keySet()) {
-
-                String proId = qli;
-                String proName = proMap.get(proId);
-
-                if (proId != null) {
-                    Boolean haveBS = false;
-
-                    // 浜у搧灞炰簬闈炲尰鐤楋紝涓嶇敤鍒ゆ柇缁忚惀鑼冨洿
-                    if (proNotNeedList.contains(proId)) {
-                        haveBS = true;
-                        continue;
-                    }
-
-                    if (proBSMap.get(proId) == null) {
-                        error = true;
-                        errormessage += '浜у搧"' + proName + '"娌℃湁鏈夋晥鐨勪骇鍝佹敞鍐岃瘉銆俓n';
-                        retMap.put(proId, '1');
-                        continue;
-                    }
-
-
-                    if (proBSMap.get(proId) != null) {
-                        system.debug('111 +++++++' + proBSMap);
-                        Map<String,String> midMap = new Map<String,String>();
-                        midMap = proBSMap.get(proId);
-
-                        for (String str : midMap.keySet()) {
-                            // LHJ 20200711 Start
-                            String strMidMap = midMap.get(str);
-                            List<String> proRegList = new List<String>();
-                            proRegList.addAll(strMidMap.split(';'));
-                            // LHJ 20200711 End
-                            for(String strReg:proRegList){
-                                // 琚畾涔変负"6815A"鐨勪骇鍝佺被鍒�,缁忚惀鑼冨洿涓繀椤绘湁6815鎴栬��6815A澶栨墠鍙互鍖归厤銆�
-                                if (strReg.length() == 6) {
-                                
-                                    for(String strAg:agListA){
-                                        if(strAg.length() >= 5 && midMap.get(str.substring(0, str.length() - 1)) == strAg.substring(0,5)){
-                                            proAllBSstrMap.get(proId).add(str.substring(0, str.length() - 1));
-                                            haveBS = true;
-                                            break;
-                                        }
-                                    }
-
-                                    /*if (agListA.contains(midMap.get(str.substring(0, str.length() - 1)))) {
-                                        proAllBSstrMap.get(proId).add(str.substring(0, str.length() - 1));
-                                        haveBS = true;
-                                    }*/
-                                } else {
-                                    system.debug('agList +++++++' + agList);
-                                    system.debug('midMap +++++++' + strReg);
-
-                                    if (agList.contains(strReg)) {
-
-                                        //浜у搧绫诲埆,鍖归厤鍒扮粡閿�鍟嗙被鍒�
-                                        proAllBSstrMap.get(proId).add(str);
-                                        haveBS = true;
-                                        break;
-                                    }
-                                }  
-                            }
-                            
-                                                      
-                        }
-                    }
-
-                    if (!haveBS) {
-                        error = true;
-                        errormessage += '绗竴缁忛攢鍟嗙殑缁忚惀鑼冨洿涓笉鍖呭惈浜у搧" ' + proName + '"銆俓n';
-                        retMap.put(proId, '2');
-                    }
-                }
-            }
-        }
-
-        if (retMap.isEmpty() == false) {
-            //return errormessage;
-            
         } else {
-            if (OppId != '') {
-                // 鏇存柊鎵�鏈夋敞鍐岃瘉淇℃伅
-                String strRegister_alleffective;
-                List<Product2> pro2List = new List<Product2>();
-                Map<String, Product2> pro2Map = new Map<String, Product2>();
-                List<OpportunityLineItem> updList = new List<OpportunityLineItem>();
-                List<OpportunityLineItem> OppItemList = [select id, Id__c, Register_alleffective__c,PricebookEntry.Product2Id
-                                                           From OpportunityLineItem 
-                                                          Where OpportunityId = :OppId];
-                // 闈炲尰鐤楁垨1绫讳骇鍝侊紝鍙栧緱
-                if (proNotNeedList != null && proNotNeedList.size() > 0) {
-                    pro2List = [select id, SFDA_Approbated_Status__c, RegisterNo_ALL__c from Product2 where Id in :proNotNeedList];
-                }
-                for (Product2 pro2 : pro2List) {
-                    pro2Map.put(pro2.Id, pro2);
-                }
+            if (userId == '005280000037mrQ' || userId == '00528000002OAvH' || userId == '00528000000YSdB' ||
+                    roleId == '00E0K000001ywwz' || roleId == '00E0K000001jGiM' || roleId == '00E0K000001jGib' ||
+                    roleId == '00E0K000001ywgS' || roleId == '00E28000000knAm' || roleId == '00E28000000knAr' ||
+                    roleId == '00E28000000aKzn' || roleId == '00E0K000001jGhn' || roleId == '00E0K000001jGhs' ||
+                    roleId == '00E0K000001ywgN' || roleId == '00E0K000001PWuh' || roleId == '00E0K000001PWum' ||
+                    roleId == '00E0K000001PWur' || roleId == '00E280000015xus' || roleId == '00E280000015xux' ||
+                    roleId == '00E28000000aKzs' || roleId == '00E0K000001jGiC' || roleId == '00E0K000001jGiR' ||
+                    roleId == '00E0K000001ywgX' || roleId == '00E28000000knAc' || roleId == '00E28000000knAh' ||
+                    roleId == '00E28000000aKzx' || roleId == '00E28000000knAw' || roleId == '00E28000000knB1' ||
+                    roleId == '00E28000000aL02') {
 
-                for (OpportunityLineItem ol : OppItemList) {
-                    if (proAllBSstrMap.containsKey(ol.PricebookEntry.Product2Id)) {
-                        ol.Register_alleffective__c = '';
-                        for(String str: proAllBSstrMap.get(ol.PricebookEntry.Product2Id)) {
+                Opportunity opp = new Opportunity();
+                opp.Id = oppId;
+                opp.Cancel_Fail_Approve__c = 'Pass';
+                opp.StageName = stageName;
 
-                            if (String.isNotBlank(ol.Register_alleffective__c)) {
-                                ol.Register_alleffective__c += ';' + str;
-                            } else {
-                                ol.Register_alleffective__c = str;
-                            }
-                        }
-                        // 闈炲尰鐤楁垨1绫讳骇鍝�
-                        if (pro2Map.containskey(ol.PricebookEntry.Product2Id)) {
-                            if (pro2Map.get(ol.PricebookEntry.Product2Id).SFDA_Approbated_Status__c == '涓嶈') {
-                                ol.Register_alleffective__c = 'FYL';
-                            } else {
-                                ol.Register_alleffective__c = pro2Map.get(ol.PricebookEntry.Product2Id).RegisterNo_ALL__c;
-                            }
-                        }
-                    }
-                    updList.add(ol);
+                try {
+                    StaticParameter.StageProgressBarUpdate = true;
+                    update opp;
+                } catch (Exception ex) {
+                    return ex.getMessage();
                 }
-                if (updList.size() > 0)  update updList;
+            } else {
+                temp = '0';
             }
         }
-        //濡傛灉涓嶆弧瓒抽樋瑗胯禌澶氱殑鏉′欢锛岃繘鍏ヨ繖涓彉閲� 20200821 ljh 
-        return retMap;
+        return temp;
+
     }
 
-    public static String checkProRegisterDecide(Map<Id, String> proMap, String agency1, String OppId) {
-    
-        String errormessage = '';
-        Boolean error = false;
 
-        Map<String, String> CheckMap = new Map<String, String>();
-        CheckMap = MapCheckProRegisterDecide(proMap, agency1, OppId);
-        if (CheckMap.isEmpty()) {
-            return 'OK';
-        } else {
-            return '鏈変笉鍙攢鍞骇鍝佹垨瓒呭嚭缁忛攢鍟嗙粡钀ヨ寖鍥达紝璇锋洿鏂版姤浠峰崟' + CheckMap;
-        }
 
-    }
-    WebService static String updReg(String  oppid) {
 
-        List<OpportunityLineItem> updList = new List<OpportunityLineItem>();
-        List<OpportunityLineItem> OppItemList = [select id, Id__c, Register_alleffective__c,
-                                                        PricebookEntry.Product2.RegisterNo_ALL__c 
-                                                           From OpportunityLineItem 
-                                                          Where OpportunityId = :oppid];
-        for (OpportunityLineItem ol : OppItemList) {
-            ol.Register_alleffective__c = ol.PricebookEntry.Product2.RegisterNo_ALL__c;
-            updList.add(ol);
-        }
-        if (updList.size() > 0)  update updList;
-        return 'OK';
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    private static void add() {
+        Integer i = 0;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
+        i++;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1