高章伟
2022-02-24 2aa8da8af66aa8ae00f25831aed6bb0364176e7b
force-app/main/default/triggers/NFM007.trigger
@@ -106,7 +106,8 @@
                        //lastbuy  2022/2/9 fy start
                        List<LastbuyProduct__c> upLastbuyObjList = new List<LastbuyProduct__c>();
                        if(lastProductFLGList!=null){
                            List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c from LastbuyProduct__c where InquiryCode__c= : opp.Id and ProductName__c in :lastProductFLGList];
                            List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : opp.Id and ProductName__c in :lastProductFLGList and    effectiveFLG__c = true];
                            System.debug('bbbbbbbbbbbbbbb==='+lastProductFLGList);
                            if(LastbuyObjList!=null){
                                for(LastbuyProduct__c lastbuypr :LastbuyObjList){
                                    Decimal quoteLItemNum=0;
@@ -119,9 +120,13 @@
                                        opp.addError('产品数量不可超过产品预留数量');
                                    }else{
                                        lastbuypr.ActualQuantity__c=quoteLItemNum;
                                        lastbuypr.effectiveFLG__c=false;
                                        upLastbuyObjList.add(lastbuypr);
                                    }
                                    System.debug('cccccccccccccc==='+lastbuypr);
                                }
                                System.debug('aaaaaaaaaaaaaa==='+LastbuyObjList);
                            }else{
                                opp.addError('预留表中还没有数据');
                            }