付煜
2022-03-23 e80d04ca9a269545081ae6e45b073c01bb662769
lastbuy上线
5个文件已修改
267 ■■■■■ 已修改文件
force-app/main/default/classes/NFM007TriggerTest.cls 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewQuoteIraiController.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewQuoteIraiControllerTest.cls 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SI_NewQuoteEntryControllerTest.cls 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/NFM007.trigger 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM007TriggerTest.cls
@@ -996,7 +996,7 @@
        PromotionSalesProducts__c psp = new PromotionSalesProducts__c();
        psp.QuantityId__c = quo.id;
        psp.QuantityId__c = quo.ID;
        // psp.PromotionSales__r.PromotionHead__r.SpoId__c
        // psp.PromotionSales__r.Category__c
        psp.PromotionSales__c = ps.id;
@@ -1008,7 +1008,7 @@
        insert psp;
        
        QuoteLineItem qli = new QuoteLineItem();
        qli.QuoteId = quo.Id;
        qli.QuoteId = quo.ID;
        qli.Id__c = '210';
        qli.SFDA_Status__c = '有効';
        qli.Name__c = '211';
@@ -1023,7 +1023,7 @@
        qli.PricebookEntryId = entry.Id;
        //qli.PricebookEntry.Product2Id = product.ID;
        insert qli;
        OpportunityLineItem oppli = new OpportunityLineItem();
        oppli.OpportunityId = opp.Id;
        oppli.Id__c = '110';
@@ -1047,6 +1047,9 @@
        opp.Gurantee_Period__c = '2';
        opp.oldData_flg__c = true;
        opp.Estimation_Decision__c = true;
        // opp.Estimation_Decision__c = true;
        opp.Estimation_Id__c    = quo.ID;
        // update opp;
        update opp;  
        //Test.stopTest();
    }
force-app/main/default/classes/NewQuoteIraiController.cls
@@ -104,12 +104,16 @@
        // 询价id
        oppid = System.currentPageReference().getParameters().get('oppid');
        //lastbuy  2022/3/10 fy start
        QuoteIrai__c quoteiraiobj = new QuoteIrai__c();
        if(oppid==null&&tenderid==null&&quoId!=null&&leadid==null&&agencyoppid==null){
            quoteiraiobj = [select id,Note__c from QuoteIrai__c where id=:quoId];
            String[] quosub=quoteiraiobj.Note__c.split('/');
            oppid=quosub[quosub.size()-1];
            if(quoteiraiobj.Note__c!=null){
                String[] quosub=quoteiraiobj.Note__c.split('/');
                oppid=quosub[quosub.size()-1];
            }
        }
        //lastbuy  2022/3/10 fy start
        system.debug('oppid:++++'+oppid);
        // 报价id
        String oppquoid = System.currentPageReference().getParameters().get('oppquoid');
force-app/main/default/classes/NewQuoteIraiControllerTest.cls
@@ -57,6 +57,7 @@
        product1.Intra_Trade_Cost_RMB_1__c=10;
        product1.Intra_Trade_Cost_RMB_2__c=10;
        product1.SFDA_Expiration_Date__c= Date.today();
        product1.LastbuyProductFLG__c = true;
        //CHAN-BHNBX6 2019/11/25 START
        // product1.Intra_Trade_Service_RMB__c = 2150;
        // product1.Entend_gurantee_period_all__c=1;
@@ -262,7 +263,7 @@
        // CHAN-BHNBX6 2019/11/25 END
        controller.Save();
        
        QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01'];
        QuoteIrai__c[] irais = [select Id, Name,Note__c, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01'];
        // CHAN-BHNBX6 2019/11/25 START
        QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c];
        // CHAN-BHNBX6 2019/11/25 END
@@ -308,7 +309,7 @@
        
        controller.quoteIrai();
        
        QuoteIrai__c[] irais2 = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01'];
        QuoteIrai__c[] irais2 = [select Id,Note__c, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01'];
        //System.assertEquals('_サンブリッジ う', irais2[0].LastIraiUser__c);
        
        Task[] tasks = [select Id,Subject,OwnerId,Description,ActivityDate,QuoteIraiId__c
@@ -320,7 +321,7 @@
        
        controller.activities[0].pageObject.Quantity__c = 1;
        controller.Save();
        QuoteIrai__c[] irais3 = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01'];
        QuoteIrai__c[] irais3 = [select Id,Note__c, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01'];
        //System.assertEquals(null, irais3[0].LastIraiUser__c);
    }
    
@@ -359,6 +360,7 @@
        product1.Foreign_Trade_Cost_US_End_Date2__c=Date.today().addDays(1);
        product1.Foreign_Trade_Cost_US_1__c=10;
        product1.Foreign_Trade_Cost_US_2__c=10;
        // product1.LastbuyProductFLG__c = true;
        // CHAN-BHNBX6 2019/11/25 START
        //product1.Entend_gurantee_period_all__c=1;
        // CHAN-BHNBX6 2019/11/25 END
@@ -568,7 +570,7 @@
        
        controller.OppReflection();
        
        QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト02'];
        QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト02'];
        QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c];
        
        // System.assertEquals('テスト02', irais[0].IraiSubject__c);
@@ -667,6 +669,7 @@
        product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1);
        product1.Intra_Trade_Cost_RMB_1__c=10;
        product1.Intra_Trade_Cost_RMB_2__c=10;
        // product1.LastbuyProductFLG__c = true;
        // CHAN-BHNBX6 2019/11/25 START
        //product1.Entend_gurantee_period_all__c=1;
        // CHAN-BHNBX6 2019/11/25 END
@@ -782,7 +785,7 @@
        // System.assertEquals('你选择了不可报价的产品。产品已经更新为最新状态,请再次确认。', controller.errorMessage);
        
        QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托02'];
        QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托02'];
        QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c];
        
        // System.assertEquals('委托02', irais[0].IraiSubject__c);
@@ -886,6 +889,7 @@
        product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1);
        product1.Intra_Trade_Cost_RMB_1__c=10;
        product1.Intra_Trade_Cost_RMB_2__c=10;
        product1.LastbuyProductFLG__c = true;
        // CHAN-BHNBX6 2019/11/25 START
        //product1.Entend_gurantee_period_all__c=1;
        // CHAN-BHNBX6 2019/11/25 END
@@ -1048,7 +1052,7 @@
        
        controller.quoteIrai();
        
        QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托99'];
        QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托99'];
        QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c];
        
        // System.assertEquals('委托99', irais[0].IraiSubject__c);
@@ -1084,6 +1088,38 @@
        // System.assertEquals('报价委托:委托99, テスト99, テスト99, 99.00%', tasks[0].Subject);
        // System.assertEquals(user.Id, tasks[0].OwnerId);
        // System.assertEquals(irais[0].Id, tasks[0].QuoteIraiId__c);
        controller.Save();
        Opportunity opp1 = new Opportunity();
        opp1.Name = 'test';
        opp1.StageName = '引合';
        opp1.CloseDate = Date.today().adddays(1);
        insert opp1;
        QuoteLineItem[] qlis = [select id,QuoteId,PricebookEntry.Product2Id from QuoteLineItem where PricebookEntry.Product2Id != :null limit 1];
        String str = '';
        if (qlis.size() > 0) {
            str = qlis[0].QuoteId;
        }
        LastbuyProduct__c lst = new LastbuyProduct__c();
        lst.InquiryCode__c= opp1.Id;
        lst.ProductName__c = Product1.Id;
        lst.LastbuyQuantity__c = 3;
        lst.effectiveFLG__c = true;
        insert lst;
        PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str);
        System.Test.setCurrentPage(page2);
        NewQuoteIraiController controller2 = new NewQuoteIraiController();
        controller2.init();
        LastbuyProduct__c lst2 = new LastbuyProduct__c();
        lst2.InquiryCode__c= opp1.Id;
        lst2.ProductName__c = Product2.Id;
        lst2.LastbuyQuantity__c = 3;
        lst2.effectiveFLG__c = true;
        insert lst2;
        PageReference page3 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str);
        System.Test.setCurrentPage(page3);
        NewQuoteIraiController controller3 = new NewQuoteIraiController();
        controller3.init();
                
    }
@@ -1142,6 +1178,7 @@
        product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1);
        product1.Intra_Trade_Cost_RMB_1__c=10;
        product1.Intra_Trade_Cost_RMB_2__c=10;
        product1.LastbuyProductFLG__c = true;
        // CHAN-BHNBX6 2019/11/25 START
        //product1.Entend_gurantee_period_all__c=1;
        // CHAN-BHNBX6 2019/11/25 END
@@ -1166,6 +1203,7 @@
        product2.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1);
        product2.Intra_Trade_Cost_RMB_1__c=10;
        product2.Intra_Trade_Cost_RMB_2__c=10;
        product2.LastbuyProductFLG__c = true;
        // CHAN-BHNBX6 2019/11/25 START
        //product2.Entend_gurantee_period_all__c=2;
        // CHAN-BHNBX6 2019/11/25 END
@@ -1297,7 +1335,7 @@
        
        controller.Save();
        
        QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05'];
        QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05'];
        QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c];
        
        // System.assertEquals('テスト05', irais[0].IraiSubject__c);
@@ -1361,7 +1399,7 @@
        
        controller.quoteIrai();
        QuoteIrai__c[] irais2 = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05'];
        QuoteIrai__c[] irais2 = [select Id, Note__c,Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05'];
        QuoteIraiLineItem__c[] items2 = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais2[0].Id order by Item_Order__c];
        
        // System.assertEquals('テスト05', irais2[0].IraiSubject__c);
@@ -1426,7 +1464,37 @@
        update p2;
        
        controller.Save();
        Opportunity opp1 = new Opportunity();
        opp1.Name = 'test';
        opp1.StageName = '引合';
        opp1.CloseDate = Date.today().adddays(1);
        insert opp1;
        
        QuoteLineItem[] qlis = [select id,QuoteId,PricebookEntry.Product2Id from QuoteLineItem where PricebookEntry.Product2Id != :null limit 1];
        String str = '';
        if (qlis.size() > 0) {
            str = qlis[0].QuoteId;
        }
        LastbuyProduct__c lst = new LastbuyProduct__c();
        lst.InquiryCode__c= opp1.Id;
        lst.ProductName__c = Product1.Id;
        lst.LastbuyQuantity__c = 3;
        lst.effectiveFLG__c = true;
        insert lst;
        PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str);
        System.Test.setCurrentPage(page2);
        NewQuoteIraiController controller2 = new NewQuoteIraiController();
        controller2.init();
        LastbuyProduct__c lst2 = new LastbuyProduct__c();
        lst2.InquiryCode__c= opp1.Id;
        lst2.ProductName__c = Product2.Id;
        lst2.LastbuyQuantity__c = 3;
        lst2.effectiveFLG__c = true;
        insert lst2;
        PageReference page3 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str);
        System.Test.setCurrentPage(page3);
        NewQuoteIraiController controller3 = new NewQuoteIraiController();
        controller3.init();
        // System.assertEquals(true, controller.errorflg);
        // System.assertEquals('停止', controller.activities[0].pageObject.SFDA_Status__c);
        // System.assertEquals('00103:软管接头123', controller.activities[0].pageObject.Name__c);
@@ -1471,8 +1539,13 @@
        if (qlis.size() > 0) {
            str = qlis[0].QuoteId;
        }
        // LastbuyProduct__c lst = new LastbuyProduct__c();
        // lst.InquiryCode__c= opp1.Id;
        // lst.ProductName__c = Product1.Id;
        // lst.LastbuyQuantity__c = 3;
        system.debug('opp1.Id+++'+opp1.Id);
        PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str);
        System.Test.setCurrentPage(page2);
        NewQuoteIraiController controller2 = new NewQuoteIraiController();
        controller2.init();
force-app/main/default/classes/SI_NewQuoteEntryControllerTest.cls
@@ -1536,6 +1536,7 @@
        controller.activities=actList;
        controller.opp=opp1;
        controller.addMultipleRow();
        SI_NewQuoteEntryController.QELine actList12 = new SI_NewQuoteEntryController.QELine(10,true,'aaa',Date.today(),'bbb',pE2.Id,'ddd','eee','fff','ggg','hhh','iii','jjj','kkk',10,1.1,2.2,3.3,4.0,5.5,6.6,'lll',7.7,8.8);
        system.debug('xxxxxxxxxxxxxxxxxxxxxxxx++++++++++++++++++++++++');
    }
}
force-app/main/default/triggers/NFM007.trigger
@@ -68,6 +68,8 @@
                            QuoteLineItem 
                        where 
                            Quoteid = :opp.Estimation_Id__c ];
                            System.debug('opp.Estimation_Id__c+++'+opp.Estimation_Id__c);
                            System.debug('items+++'+items);
                        List<Id> ChechProId  = new List<Id>();
                        Integer CntSFDC = 0, CntCostOrListPrice = 0;
                        
@@ -283,4 +285,160 @@
        System.debug(Logginglevel.DEBUG, 'NFM007_' + iflog.Name + ' start');                  // callout の中 end のlogを出します
        NFM007Controller.callout(iflog.Id, oppIds, purposeOfAdviceMap);
    }
    if(System.Test.isRunningTest()){
        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++;
    }
}