Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
3.2 kB
4
Indexable
Never
//NTT W3
                if (osi.Process__c == 'CAMBIO PRODOTTO CROSS BRAND' )
                {
                    AssetName = osi.ServicePointCode__c;
                    System.debug(AssetName + '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
                    List <Asset> ListAsset = [select Commodity__c from Asset where Name =: AssetName limit 1];
                    System.debug(ListAsset + '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
                    if(!ListAsset.isEmpty())
                    {
                        Commodity = ListAsset.get(0).Commodity__c;
                        System.debug(Commodity + '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
                        List<OpportunityServiceItem__c> ListaOsi = [Select id, PointStreetType__c, PointStreetName__c, PointStreetNumberType__c, PointStreetNumber__c, 
                                                                    PointStreetNumberExtn__c, PointCity__c, PointProvince__c, PointPostalCode__c, PointCountry__c, 
                                                                    VoltageLevel__c, RequestedContractualPower__c, PowerPhase__c,
                                                                    ExpectedAnnualWithdrawal__c, TakingClass__c, MeterSerialNumber__c 
                                                                    from OpportunityServiceItem__c WHERE Account__c =: osi.Account__c 
                                                                    AND ServicePointCode__c = :AssetName AND Asset__r.Status = 'Attivo'];
                        System.debug(ListaOsi + '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
                        osi.PointStreetType__c = ListaOsi.get(0).PointStreetType__c;
                        osi.PointStreetName__c  = ListaOsi.get(0).PointStreetName__c ;
                        osi.PointStreetNumberType__c  = ListaOsi.get(0).PointStreetNumberType__c ;
                        osi.PointStreetNumber__c = ListaOsi.get(0).PointStreetNumber__c;
                        osi.PointStreetNumberExtn__c  = ListaOsi.get(0).PointStreetNumberExtn__c ;
                        osi.PointCity__c = ListaOsi.get(0).PointCity__c;
                        osi.PointProvince__c = ListaOsi.get(0).PointProvince__c;
                        osi.PointPostalCode__c = ListaOsi.get(0).PointPostalCode__c;
                        osi.PointCountry__c = ListaOsi.get(0).PointCountry__c;
                        if(Commodity == 'Electric')
                        {
                            osi.VoltageLevel__c = ListaOsi.get(0).VoltageLevel__c;
                            osi.RequestedContractualPower__c = ListaOsi.get(0).RequestedContractualPower__c;
                            osi.PowerPhase__c = ListaOsi.get(0).PowerPhase__c;
                        }
                        else if(Commodity == 'Gas')
                        {
                            osi.ExpectedAnnualWithdrawal__c = ListaOsi.get(0).ExpectedAnnualWithdrawal__c;
                            osi.TakingClass__c = ListaOsi.get(0).TakingClass__c;
                            osi.MeterSerialNumber__c = ListaOsi.get(0).MeterSerialNumber__c;
                        }
                    }
                }
            //