| New file |
| | |
| | | // Author: Fu,Yu |
| | | // Created Date: 2023/08/07 |
| | | // Purpose: get page layout and record data |
| | | // Test Class: lexNewQuoteEntryControllerTest |
| | | public class lexNewQuoteEntryController{ |
| | | public static Integer quoteEntryMaxLine; |
| | | public static List<QELine> activities; |
| | | public static List<QELine> tmpactivities; |
| | | public static List<QuoteLineItem> CheckItem; |
| | | public static Boolean WinOrDecideAlert; |
| | | public static Boolean errorflg; |
| | | public static String errormessage; |
| | | public static String errormessagewarn; |
| | | public static Map<Id, Product2> prd2LatestValMap; |
| | | public static Boolean productStatusUpdated; |
| | | public static Opportunity opp; |
| | | public static Quote quo; |
| | | public static Boolean enableSales; |
| | | public static String quoId; |
| | | public static String oppId; |
| | | public static Boolean newQuoteFlag; |
| | | public static Boolean changedAfterPrint; |
| | | public static string quoteGurantee_Period; |
| | | public static string quotemultiYearWarranty; |
| | | public static Pricebook2 standardPricebook; |
| | | public static Boolean detail; |
| | | public static String selection_hp; |
| | | public static String quoIdreturn; |
| | | public static String trade; |
| | | public static String searchMode; |
| | | public static Boolean filg; |
| | | public static Integer flglastbuy; |
| | | public static String errorProductmodel; |
| | | public static Boolean SkipQuotefilg; |
| | | public static Boolean QuoteDecision; |
| | | //字段报错标识 start |
| | | public static Boolean dfpp = false; |
| | | public static Boolean qname = false; |
| | | public static Boolean qacc = false; |
| | | public static Boolean qaapc = false; |
| | | public static Boolean Agency1 = false; |
| | | public static Boolean nAgency1 = false; |
| | | public static Boolean oapp = false; |
| | | public static Boolean noapp = false; |
| | | public static Boolean Agency2 = false; |
| | | public static Boolean nAgency2 = false; |
| | | public static Boolean aapp = false; |
| | | public static Boolean naapp = false; |
| | | //字段报错标识 end |
| | | public static Boolean hongzi = false; |
| | | @AuraEnabled |
| | | //根据报价Id检索报价 |
| | | public static Quote selectQuoteById(String quoId){ |
| | | Quote quo = new Quote(); |
| | | |
| | | if(String.isNotBlank(quoId)){ |
| | | List<Quote> quoList = |
| | | [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | Dealer_Final_Price__c, TotalPrice__c, Estimation_List_Price__c, QuoteNumber, |
| | | QuoteToName, Quote_Expiration_Date__c, Quote_Comment__c, Stocking_Price__c, Unit_Price__c, |
| | | Offer_Amount__c, TOTAL__c, Discount__c, Pricing__c, Preferential_Trading_Price__c, Contract__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Print_HP_Name__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_No__c, |
| | | Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c, Discount_Amount__c, Discount_Amount_Calculate__c, Installation_location__c, |
| | | QuoteTotal_Page__c, Dealer_Final_Price_Page__c, Quote_Adjust_Amount_Page__c, OCM_Agent1_Price_Page__c, Agent1_Agent2_Price_Page__c |
| | | , AgencyDiscount__c,OCM_Sales_Forecast__c//预测金额修改 fy |
| | | , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c, |
| | | Preferential_Gurantee_Period__c,LineItemCount |
| | | ,IsQuoteTrial__c,OpportunityId,Opportunity.RecordType.DeveloperName |
| | | FROM Quote Where Id = :quoId]; |
| | | quo = quoList[0]; |
| | | } |
| | | |
| | | return quo; |
| | | } |
| | | //检索报价行项目行数 |
| | | @AuraEnabled |
| | | public static List<Quote> selectQuoteListLineItemCount(String quoId,String oppId,String copyid){ |
| | | List<Quote> quoList = new List<Quote>(); |
| | | if(String.isBlank(oppId)){ |
| | | if(String.isNotBlank(quoId)){ |
| | | quoList = [select Id, OpportunityId, Opportunity.RecordType.DeveloperName,LineItemCount From Quote Where Id = :quoId]; |
| | | } |
| | | }else{ |
| | | if(String.isBlank(copyid)){ |
| | | quoList =[select Id, OpportunityId,LineItemCount From Quote Where OpportunityId = :oppId]; |
| | | } |
| | | } |
| | | return quoList; |
| | | } |
| | | //检索报价行项目 |
| | | @AuraEnabled |
| | | public static String selectQuoteLineItem(String quoId,String copyid){ |
| | | List<QuoteLineItem> items = |
| | | [Select Id, Asset_Model_No__c, SFDA_Status__c, Product_Sales_Possibility__c, |
| | | Name__c, BSS_Category__c, Quote.Quote_Print_Date__c,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c, |
| | | Qty_Unit__c, Cost__c, UnitPrice__c, ListPrice__c, Quantity, TotalPrice__c, |
| | | PricebookEntry.Product2.SFDA_Status__c, ProductCode__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name, |
| | | PricebookEntryId, PricebookEntry.Product2Id, UnitPrice_Page__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.StorageStatus__c |
| | | , AgencyUnitPrice__c, AgencySubtotal__c, Present__c |
| | | , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c, |
| | | ServicePrice__c , GuranteePrice__c, ProductEntend_gurantee_period_all__c, |
| | | ProductGuranteePrice__c, GuranteeType__c, |
| | | warrantyType__c, productServicePrice__c, NoDiscountTotal__c |
| | | , provistonPeriod__c |
| | | , PricebookEntry.Product2.Entend_gurantee_period_all__c |
| | | , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c |
| | | , PricebookEntry.Product2.Intra_Trade_Service_RMB__c |
| | | , PricebookEntry.Product2.GuranteeType__c |
| | | , PricebookEntry.Product2.Maintenance_Price_Year__c |
| | | , Maintenance_Price_Year__c |
| | | ,PricebookEntry.Product2.Repair_Contract_USD__c |
| | | ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c |
| | | ,PricebookEntry.Product2.NoDiscount_Foreign__c |
| | | ,PricebookEntry.Product2.LastbuyProductFLG__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,PricebookEntry.Product2.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ,Quote.Opportunity.Trade__c |
| | | ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c |
| | | From QuoteLineItem where Quoteid = :quoId Order by Item_Order__c, Id]; |
| | | activities = new List<QELine>(); |
| | | QELine cle = new QELine(); |
| | | Integer i = 0; |
| | | if (items.size() > 0) { |
| | | for (QuoteLineItem olt : items) { |
| | | i++; |
| | | cle = new QELine(olt,i, copyid); |
| | | activities.add(cle); |
| | | } |
| | | } |
| | | return JSON.serialize(activities)+'---'+JSON.serialize(items); |
| | | } |
| | | //检索登录人信息 |
| | | @AuraEnabled |
| | | public static User selecUser(){ |
| | | User usobj =new User(); |
| | | List<User> us = new List<User>(); |
| | | String userid = UserInfo.getUserId(); |
| | | if (userid != null) { |
| | | us = [Select Quote_Correct__c, Quote_Special_Operation__c, Cost_Referable__c, ViewSpecialAgencyAmout__c From User Where Id = :userid]; |
| | | if (us.size() > 0) { |
| | | usobj = us[0]; |
| | | } |
| | | } |
| | | return usobj; |
| | | } |
| | | @AuraEnabled |
| | | public static Boolean getquoDes() { |
| | | Schema.DescribeSObjectResult quoteDesc = Quote.SObjectType.getDescribe(); |
| | | return quoteDesc.isUpdateable(); |
| | | } |
| | | @AuraEnabled |
| | | public static Boolean QuotCalfagAss(){ |
| | | String ProfileId= UserInfo.getProfileId().subString(0,15); |
| | | String QuotationCalculationPermission = System.Label.QuotationCalculationPermission; |
| | | return QuotationCalculationPermission.contains(ProfileId); |
| | | } |
| | | //根据询价Id检索询价 |
| | | @AuraEnabled |
| | | public static Opportunity selectOpportunityById(String oppId){ |
| | | Opportunity opp = new Opportunity(); |
| | | List<Opportunity> oppList =[SELECT Account.Name, Account.RecordType.DeveloperName, |
| | | CLBIC_Category__c, HP_Name__c, Name, CurrencyIsoCode, Wholesale_Price__c, Department_Name__c, |
| | | Direct_Separate__c, Trade__c, AccountId, New_Opportunity__c, Estimation_Decision__c, SAP_Send_OK__c, Sales_Root__c, |
| | | Agency1__c, Agency2__c, Stocking_Price__c, Purchasing_Cost__c, Opportunity_No__c, StageName, |
| | | Agency1__r.Special__c, Agency2__r.Special__c, Account.Parent.Special__c |
| | | , Authorized_DB_No__c, Authorized_Finish_Sales__c, If_Need_Authorize__c |
| | | , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c |
| | | , Hospital__c, Department_Class__c |
| | | ,Is_Corrosion__c, |
| | | If_Need_PriceApply__c |
| | | ,CelonOpportunity__c |
| | | , If_Account_Change__c |
| | | , Salesdepartment_Owner__c |
| | | ,Opportunity_Category__c |
| | | FROM Opportunity Where Id = :oppId]; |
| | | if (oppList.size() > 0) { |
| | | opp = oppList[0]; |
| | | } |
| | | return opp; |
| | | } |
| | | //检索询价行项目 |
| | | // @AuraEnabled |
| | | // public static String selectOpportunityLineItem(String oppId){ |
| | | // List<OpportunityLineItem> items = New List<OpportunityLineItem>(); |
| | | // items = [Select Id, Asset_Model_No__c, SFDA_Status__c, Name__c, ProductCode__c, PricebookEntry.Product2.StorageStatus__c, |
| | | // Qty_Unit__c, Cost__c, UnitPrice, ListPrice__c, Quantity, BSS_Category__c, TotalPrice,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c, |
| | | // PricebookEntry.Product2.SFDA_Status__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name, |
| | | // PricebookEntryId, PricebookEntry.Product2Id, Opportunity.Trade__c, PricebookEntry.Product2.Intra_Trade_List_RMB__c, PricebookEntry.Product2.Intra_Trade_Cost_RMB__c, |
| | | // PricebookEntry.Product2.Foreign_Trade_List_US__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.Foreign_Trade_Cost_US__c, UnitPrice__c, TotalPrice__c |
| | | // , AgencyUnitPrice__c, AgencySubtotal__c, Present__c |
| | | // , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c, |
| | | // ServicePrice__c , GuranteePrice__c, |
| | | // ProductEntend_gurantee_period_all__c, |
| | | // ProductGuranteePrice__c, GuranteeType__c, |
| | | // warrantyType__c, productServicePrice__c, |
| | | // NoDiscountTotal__c |
| | | // , provistonPeriod__c |
| | | // , PricebookEntry.Product2.Entend_gurantee_period_all__c |
| | | // , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c |
| | | // , PricebookEntry.Product2.Intra_Trade_Service_RMB__c |
| | | // , PricebookEntry.Product2.GuranteeType__c |
| | | // , PricebookEntry.Product2.Maintenance_Price_Year__c |
| | | // , Maintenance_Price_Year__c |
| | | // ,PricebookEntry.Product2.Repair_Contract_USD__c |
| | | // ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c |
| | | // ,PricebookEntry.Product2.NoDiscount_Foreign__c |
| | | // ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c |
| | | // From OpportunityLineItem |
| | | // Where OpportunityId = :oppId Order by Item_Order__c, Id]; |
| | | |
| | | // activities = new List<QELine>(); |
| | | // QELine cle = new QELine(); |
| | | // if (items.size() > 0) { |
| | | // for(OpportunityLineItem otlt : items) { |
| | | // cle = new QELine(otlt); |
| | | // activities.add(cle); |
| | | // } |
| | | // } |
| | | // return JSON.serialize(activities); |
| | | // } |
| | | //检索客户 |
| | | @AuraEnabled |
| | | public static List<Account> selectAccountById(String accountid){ |
| | | List<Account> accs2 = [Select Id, RecordType.DeveloperName, Hospital__c, Agent_Ref__c From Account Where Id = :accountid]; |
| | | List<Account> accs = new List<Account>(); |
| | | if (accs2.size() > 0) { |
| | | if (accs2[0].RecordType.DeveloperName != 'AgencyContract') { |
| | | accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Hospital__c]; |
| | | } else { |
| | | accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Agent_Ref__c]; |
| | | } |
| | | } |
| | | return accs; |
| | | } |
| | | //检索下拉列表值 |
| | | @AuraEnabled |
| | | public static List<Map<String,String>> getPicklistValues(String objstr, String fld ,Boolean ifempty){ |
| | | List<Map<String,String>> options = new List<Map<String,String>>(); |
| | | Map<String,String> space = new Map<String,String>(); |
| | | if(ifempty){ |
| | | space.put('label', '--无--'); |
| | | space.put('value', ''); |
| | | options.add(space); |
| | | } |
| | | |
| | | Schema.sObjectType objType = Schema.getGlobalDescribe().get(objstr); |
| | | Schema.DescribeSObjectResult objDescribe = objType.getDescribe(); |
| | | map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap(); |
| | | list<Schema.PicklistEntry> values = fieldMap.get(fld).getDescribe().getPickListValues(); |
| | | system.debug(objstr + '=' + values); |
| | | for (Schema.PicklistEntry a : values) |
| | | { |
| | | if (!a.isActive()) continue; |
| | | Map<String,String> ses = new Map<String,String>(); |
| | | ses.put('label', a.getLabel()); |
| | | ses.put('value', a.getValue()); |
| | | options.add(ses); |
| | | } |
| | | return options; |
| | | } |
| | | //保存报价 |
| | | @AuraEnabled |
| | | public static Map<String,String> SaveQuote(String activitiesCan, |
| | | String CheckItemCan , |
| | | boolean WinOrDecideAlertc, |
| | | boolean productStatusUpdatedc, |
| | | String oppInfoc, |
| | | boolean enableSalesc, |
| | | String quoc, |
| | | String oppIdc, |
| | | String quoIdc, |
| | | boolean newQuoteFlagc, |
| | | Boolean changedAfterPrintc, |
| | | String quoteGurantee_Periodc, |
| | | String quotemultiYearWarrantyc, |
| | | String selection_hpc, |
| | | Boolean SkipQuotefilgc, |
| | | Boolean quoteflg){ |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | oppId = oppIdc; |
| | | quoId = quoIdc; |
| | | System.debug('quoId+'+quoId); |
| | | System.debug('quoteflg+'+quoteflg); |
| | | System.debug('quoc:' + quoc); |
| | | WinOrDecideAlert = WinOrDecideAlertc; |
| | | productStatusUpdated = productStatusUpdatedc; |
| | | newQuoteFlag = newQuoteFlagc; |
| | | changedAfterPrint = changedAfterPrintc; |
| | | quoteGurantee_Period = quoteGurantee_Periodc; |
| | | quotemultiYearWarranty = quotemultiYearWarrantyc; |
| | | selection_hp = selection_hpc; |
| | | SkipQuotefilg = SkipQuotefilgc; |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | if(String.isNotBlank(CheckItemCan)){ |
| | | CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class); |
| | | }else { |
| | | CheckItem = null; |
| | | } |
| | | enableSales = enableSalesc; |
| | | // errorMessagechack = null; |
| | | setOppFromOppInfo(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Map<String,String> result = new Map<String,String>(); |
| | | try { |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | if(quoteflg){ |
| | | if(checkVirtual('包含虚拟产品,无法报价计算')){ |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | if (!dataCheck()) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | return result; |
| | | } |
| | | if (dataEntry() == false) { |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } else { |
| | | result.put('success', System.Label.Message_002); |
| | | if(String.isBlank(quoId)){ |
| | | result.put('quoId',quoIdreturn); |
| | | } |
| | | if(String.isNotBlank(quo.Quote_No__c)){ |
| | | result.put('QuoteNo',quo.Quote_No__c); |
| | | } |
| | | if(errormessagewarn != null){ |
| | | result.put('warn', errormessagewarn); |
| | | String act = JSON.serialize(activities); |
| | | result.put('act', act); |
| | | } |
| | | return result; |
| | | } |
| | | } catch (DmlException de) { |
| | | Database.rollback(sp); |
| | | // errormessage = de.getLineNumber()+'行'+de.getDmlMessage(0); |
| | | errormessage = de.getDmlMessage(0); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, de.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, de.getStackTraceString()); |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | // errormessage = e.getLineNumber()+'行'+e.getMessage(); |
| | | errormessage = e.getMessage(); |
| | | result.put('errormessage',errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, e.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, e.getStackTraceString()); |
| | | } |
| | | } |
| | | public static Map<String,String> resultFlag(Map<String,String> result){ |
| | | if(dfpp){ |
| | | result.put('dfpp', 'dfpp'); |
| | | } |
| | | if(qname){ |
| | | result.put('qname', 'qname'); |
| | | } |
| | | if(qacc){ |
| | | result.put('qacc', 'qacc'); |
| | | } |
| | | if(qaapc){ |
| | | result.put('qaapc', 'qaapc'); |
| | | } |
| | | if(Agency1){ |
| | | result.put('Agency1', 'Agency1'); |
| | | } |
| | | if(nAgency1){ |
| | | result.put('nAgency1', 'nAgency1'); |
| | | } |
| | | if(oapp){ |
| | | result.put('oapp', 'oapp'); |
| | | } |
| | | if(noapp){ |
| | | result.put('noapp', 'noapp'); |
| | | } |
| | | if(Agency2){ |
| | | result.put('Agency2', 'Agency2'); |
| | | } |
| | | if(nAgency2){ |
| | | result.put('nAgency2', 'nAgency2'); |
| | | } |
| | | if(aapp){ |
| | | result.put('aapp', 'aapp'); |
| | | } |
| | | if(naapp){ |
| | | result.put('naapp', 'naapp'); |
| | | } |
| | | return result; |
| | | } |
| | | //打印按钮保存报价 |
| | | @AuraEnabled |
| | | public static Map<String,String> Print(String activitiesCan, |
| | | String CheckItemCan , |
| | | boolean WinOrDecideAlertc, |
| | | boolean productStatusUpdatedc, |
| | | String oppInfoc, |
| | | boolean enableSalesc, |
| | | String quoc, |
| | | String oppIdc, |
| | | String quoIdc, |
| | | boolean newQuoteFlagc, |
| | | Boolean changedAfterPrintc, |
| | | String quoteGurantee_Periodc, |
| | | String quotemultiYearWarrantyc, |
| | | String selection_hpc, |
| | | Boolean SkipQuotefilgc, |
| | | Boolean QuoteDecisionc) { |
| | | oppId = oppIdc; |
| | | quoId = quoIdc; |
| | | System.debug('quoId+'+quoId); |
| | | WinOrDecideAlert = WinOrDecideAlertc; |
| | | productStatusUpdated = productStatusUpdatedc; |
| | | newQuoteFlag = newQuoteFlagc; |
| | | changedAfterPrint = changedAfterPrintc; |
| | | quoteGurantee_Period = quoteGurantee_Periodc; |
| | | quotemultiYearWarranty = quotemultiYearWarrantyc; |
| | | selection_hp = selection_hpc; |
| | | SkipQuotefilg = SkipQuotefilgc; |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | if(String.isNotBlank(CheckItemCan)){ |
| | | CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class); |
| | | }else { |
| | | CheckItem = null; |
| | | } |
| | | enableSales = enableSalesc; |
| | | QuoteDecision = QuoteDecisionc; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Map<String,String> result = new Map<String,String>(); |
| | | try { |
| | | if(checkVirtual('包含虚拟产品,无法打印')){ |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | setOppFromOppInfo(); |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | //Decide前or後 |
| | | if (QuoteDecision == true) { |
| | | //NoSave |
| | | } else { |
| | | if (dataCheck() == false ) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | return result; |
| | | } |
| | | |
| | | if (dataEntry() == false) { |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | } |
| | | List<Opportunity> opps = new List<Opportunity>(); |
| | | if (String.isBlank(oppId)) { |
| | | } else { |
| | | opps = [Select Id |
| | | From Opportunity Where Id = : oppId]; |
| | | if (opps.size() > 0) { |
| | | List<Quote> quos = New List<Quote>(); |
| | | //ligthing bug 修改 fy start |
| | | // if (String.isBlank(quoId)) { |
| | | // } else { |
| | | // quos = [Select Id, |
| | | // Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoId]; |
| | | if(String.isNotBlank(quoId)||(String.isBlank(quoId) && String.isNotBlank(quoIdreturn))){ |
| | | String quoIds = String.isNotBlank(quoId) ? quoId : quoIdreturn; |
| | | quos = [Select Id, |
| | | Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoIds]; |
| | | //ligthing bug 修改 fy end |
| | | if (quos.size() > 0) { |
| | | //优惠成交价 |
| | | quos[0].Preferential_Trading_Price__c = quo.Preferential_Trading_Price__c; |
| | | //优惠折扣 |
| | | quos[0].Discount__c = quo.Discount__c; |
| | | //优惠价格 |
| | | quos[0].Pricing__c = quo.Pricing__c; |
| | | //单价 |
| | | quos[0].Unit_Price__c = quo.Unit_Price__c; |
| | | //报价金额 |
| | | quos[0].Offer_Amount__c = quo.Offer_Amount__c; |
| | | //Total |
| | | quos[0].TOTAL__c = quo.TOTAL__c; |
| | | //契約内容 |
| | | quos[0].Contract__c = quo.Contract__c; |
| | | //多年保修 start |
| | | quos[0].Preferential_Gurantee_Period__c = quo.Preferential_Gurantee_Period__c; |
| | | //多年保修 end |
| | | if (quos[0].Quote_Date__c == null) { |
| | | quos[0].Quote_Date__c = date.Today(); |
| | | opps[0].Estimation_Proposal_Date__c = date.Today(); |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | update opps[0]; |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | quos[0].Quote_Print_Date__c = date.Today(); |
| | | ControllerUtil.updQuote(quos[0]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // pageArrange(); |
| | | result.put('success', System.Label.Message_002); |
| | | if(String.isBlank(quoId)){ |
| | | result.put('quoId',quoIdreturn); |
| | | } |
| | | if(errormessagewarn != null){ |
| | | result.put('warn', errormessagewarn); |
| | | } |
| | | return result; |
| | | } catch (DmlException de) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = de.getDmlMessage(0); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, de.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, de.getStackTraceString()); |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = e.getMessage(); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, e.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, e.getStackTraceString()); |
| | | } |
| | | } |
| | | // oppに画面の値を設定 |
| | | public static void setOppFromOppInfo() { |
| | | opp.Agency1__c = quo.Agency1__c; |
| | | opp.Agency2__c = quo.Agency2__c; |
| | | } |
| | | //保存chaeck |
| | | public static Boolean dataCheck() { |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | Boolean error = false; |
| | | Boolean error1 = false; |
| | | integer Gcnt = 0; |
| | | if (activities == null || activities.size() <= 0) { |
| | | errorflg = true; |
| | | errorMessage = '不允许保存空的报价单,请选择产品'; |
| | | return false; |
| | | } |
| | | if (WinOrDecideAlert && (!productStatusUpdated)) { |
| | | errorflg = true; |
| | | errorMessage = '产品状态发生变化,请更新'; |
| | | return false; |
| | | } |
| | | if (!checkSFDAStatus1(false)) { |
| | | errorflg = true; |
| | | errormessage = '请更新不可销售的产品。'; |
| | | return false; |
| | | } |
| | | List<String> product2Ids = new List<String>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine a : activities) { |
| | | if (!String.isBlank(a.pageObject.Id__c)) { |
| | | product2Ids.add(a.pageObject.Id__c); |
| | | } |
| | | } |
| | | Map<String, String> loopMap = new Map<String, String>(); |
| | | if (CheckItem != null) { |
| | | Gcnt = CheckItem.size(); |
| | | if (CheckItem.size() > 0) { |
| | | for (QuoteLineItem qli : CheckItem) { |
| | | loopMap.put(qli.PricebookEntry.Product2Id, qli.SFDA_Status__c); |
| | | } |
| | | } |
| | | } |
| | | prd2LatestValMap = new Map<Id, Product2>(); |
| | | integer cntPrd2 = 0; |
| | | for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c,LastbuyProductFLG__c |
| | | From Product2 Where Id IN :product2Ids]) { |
| | | cntPrd2 = cntPrd2 + 1; |
| | | if (prd2.Estimation_Entry_Possibility__c != '○') { |
| | | error1 = true; |
| | | } |
| | | if (prd2.Estimation_Entry_Possibility__c == 'M') { |
| | | error1 = false; |
| | | } |
| | | if (prd2.SFDA_Status__c != loopMap.get(prd2.Id)) { |
| | | WinOrDecideAlert = true; |
| | | } |
| | | |
| | | prd2LatestValMap.put(prd2.Id, prd2); |
| | | } |
| | | if (cntPrd2 != Gcnt) { |
| | | WinOrDecideAlert = false; |
| | | } |
| | | |
| | | } |
| | | if(ContractAmountLimitJudge()){ |
| | | return false; |
| | | } |
| | | if (error1 == true && WinOrDecideAlert == false) { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Error_Message37; |
| | | return false; |
| | | } |
| | | |
| | | if (checkAgentsDeleteFlag() == false) { |
| | | return false; |
| | | } |
| | | if (enableSales == true && opp.Trade__c == '内貿') { |
| | | Map<Id, String> proMap = new Map<Id, String>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine qli : activities) { |
| | | if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | proMap.put(qli.pageObject.Id__c, qli.pageObject.Name__c); |
| | | } |
| | | } |
| | | } |
| | | Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, ''); |
| | | if (chkMap.size() > 0) { |
| | | errorflg = true; |
| | | if (chkMap.containsKey('agency')&&!opp.Is_Corrosion__c) { |
| | | errorflg = true; |
| | | errormessage = '第一经销商没有有效的医疗器械经营许可证。'; |
| | | // return false; |
| | | } |
| | | Integer inerr = 0; |
| | | if (activities.size() > 0) { |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | s.haveno_Register = false; |
| | | s.wrong_Register = false; |
| | | if (chkMap.containsKey(s.pageObject.Id__c)) { |
| | | if (chkMap.get(s.pageObject.Id__c) == '1') { |
| | | s.haveno_Register = true; |
| | | inerr ++; |
| | | } else if (chkMap.get(s.pageObject.Id__c) == '2') { |
| | | s.wrong_Register = true; |
| | | inerr ++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (inerr > 0) { |
| | | errorflg = true; |
| | | errormessagewarn = '请检查红字内容(NMPA状态红字,不可销售产品;产品名称红字,超过经销商经营范围)。'; |
| | | // errorMessagechack = '请检查红字内容(NMPA状态红字,不可销售产品;产品名称红字,超过经销商经营范围)。'; |
| | | } |
| | | } |
| | | Boolean isDangerError = false; |
| | | Boolean isNotDangerError = false; |
| | | if (activities.size() > 0) { |
| | | for (QELine qli : activities) { |
| | | if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | if (opp.Is_Corrosion__c) { |
| | | if(!qli.Is_DangerousChemicals){ |
| | | isNotDangerError =true; |
| | | qli.wrong_Register = true; |
| | | } |
| | | }else{ |
| | | if(qli.Is_DangerousChemicals){ |
| | | isDangerError =true; |
| | | qli.wrong_Register = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (opp.Is_Corrosion__c) { |
| | | String str = OpportunityWebService.checkDangerItem(opp.agency1__c); |
| | | if (str != 'OK') { |
| | | errorflg = true; |
| | | errorMessage = str; |
| | | return false; |
| | | } |
| | | if(isNotDangerError){ |
| | | errorflg = true; |
| | | errormessage = '当阿西塞多时,行项目的产品必须全选择危化品。'; |
| | | return false; |
| | | } |
| | | }else{ |
| | | if(isDangerError){ |
| | | errorflg = true; |
| | | errormessage = '当询价不是阿西塞多时,行项目的产品不能选择危化品。'; |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | detail = false; |
| | | if ((quo.QuoteName__c == null) || (quo.QuoteName__c == '')) { |
| | | // quo.QuoteName__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.QuoteName__c.label; |
| | | error = true; |
| | | qname = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.Quote_Adjust_Calculate__c == null) { |
| | | // quo.Quote_Adjust_Calculate__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Calculate__c.label; |
| | | error = true; |
| | | qacc = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.Quote_Adjust_Amount_Page__c == null) { |
| | | // quo.Quote_Adjust_Amount__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Amount__c.label; |
| | | error = true; |
| | | qaapc = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.Quote_Expiration_Date__c == null) { |
| | | // quo.Quote_Expiration_Date__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Quote_Expiration_Date__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | //decimal temSalesAmount1 = 0; // 2018/09/28 CHAN-B4YAB8 经销商小计合计 end |
| | | system.debug('activities++++----****2'+activities); |
| | | for (QELine a : activities) { |
| | | if ((a.Asset_Model != null) && (a.Asset_Model != '')) { |
| | | if (a.pageObject.Quantity__c == null || a.pageObject.Quantity__c == 0) { |
| | | // a.pageObject.Quantity__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.QuoteLineItem.fields.Quantity__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (a.pageObject.UnitPrice_Page__c == null) { |
| | | // a.pageObject.UnitPrice__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.QuoteLineItem.fields.UnitPrice__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (a.pageObject.AgencyUnitPrice__c == null) { |
| | | // a.pageObject.AgencyUnitPrice__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.QuoteLineItem.fields.AgencyUnitPrice__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (a.pageObject.PricebookEntryId == null) { |
| | | error = true; |
| | | errormessage = System.Label.Error_Message27; |
| | | } |
| | | detail = true; |
| | | } |
| | | } |
| | | if (enableSales == true) { |
| | | // LHJ Start |
| | | system.debug('errormessage==='+errormessage); |
| | | if (quo.Agency1__c == null) { |
| | | // quo.Agency1__c.addError(System.Label.Error_Message3); |
| | | Agency1 = true; |
| | | String label = Schema.SObjectType.Quote.fields.Agency1__c.label; |
| | | error = true; |
| | | if(String.isNotBlank(errormessage)){ |
| | | errormessage +='\n'+ label+':'+System.Label.Error_Message3; |
| | | }else { |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | } |
| | | system.debug('errormessage==='+errormessage); |
| | | // LHJ End |
| | | if (quo.OCM_Agent1_Price_Page__c == null) { |
| | | // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3); |
| | | oapp = true; |
| | | String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label; |
| | | error = true; |
| | | errormessage =label+':'+System.Label.Error_Message3; |
| | | } else { |
| | | |
| | | } |
| | | } else { |
| | | |
| | | if (opp.Agency1__c != null) { |
| | | // opp.Agency1__c.addError(System.Label.Error_Message30); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label; |
| | | error = true; |
| | | nAgency1 = true; |
| | | if(String.isNotBlank(errormessage)){ |
| | | errormessage +='\n'+ label+':'+System.Label.Error_Message30; |
| | | }else { |
| | | errormessage = label+':'+System.Label.Error_Message30; |
| | | } |
| | | } |
| | | system.debug('errormessage==='+errormessage); |
| | | if (quo.OCM_Agent1_Price_Page__c != null) { |
| | | // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message30); |
| | | noapp = true; |
| | | String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label; |
| | | error = true; |
| | | errormessage =label+':'+System.Label.Error_Message30; |
| | | } |
| | | if (opp.Agency2__c != null) { |
| | | // opp.Agency2__c.addError(System.Label.Error_Message30); |
| | | nAgency2 = true; |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message30; |
| | | } |
| | | if (quo.Agent1_Agent2_Price_Page__c != null) { |
| | | // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message30); |
| | | naapp = true; |
| | | String label = Schema.SObjectType.Quote.fields.Agent1_Agent2_Price__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message30; |
| | | } |
| | | |
| | | } |
| | | if (quo.Agency1_Profit_Rate__c >= 1000 || quo.Agency1_Profit_Rate__c <= -1000) { |
| | | error = true; |
| | | errormessage = System.Label.Error_Message38; |
| | | } |
| | | if (quo.Agency2_Profit_Rate__c >= 1000 || quo.Agency2_Profit_Rate__c <= -1000) { |
| | | error = true; |
| | | errormessage = System.Label.Error_Message38; |
| | | } |
| | | if (error == true) { |
| | | errorflg = true; |
| | | return false; |
| | | } |
| | | // PageArrange(); |
| | | errorflg = false; |
| | | errorMessage = null; |
| | | return true; |
| | | } |
| | | // 产品状态判断 |
| | | public static boolean checkSFDAStatus1(boolean dodecide) { |
| | | for (QELine a : activities) { |
| | | if ((a.Asset_Model != null) && (a.Asset_Model != '')) { |
| | | if (a.pageObject.SFDA_Status__c != '有効' && |
| | | a.pageObject.SFDA_Status__c != '有効(再申請中)' && |
| | | a.pageObject.SFDA_Status__c != '不要' && |
| | | a.pageObject.SFDA_Status__c != '失効(期限内生産済在庫対応)' && |
| | | // LHJ CBPR 20181221 Start |
| | | (a.pageObject.SFDA_Status__c != '暂停出库(长期)') && |
| | | (a.pageObject.SFDA_Status__c != '暂停出库(短期)') && |
| | | // LHJ CBPR 20181221 End |
| | | (a.pageObject.SFDA_Status__c != '失効(再申請中)' || dodecide != false) |
| | | ) { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | //报价合同金额增加限制 |
| | | public static boolean ContractAmountLimitJudge(){ |
| | | if(opp.Sales_Root__c =='OCM直接销售'){ |
| | | return false; |
| | | } |
| | | Boolean error = false; |
| | | Double AccrualTotal=0; |
| | | Double sumContractAmount =0; |
| | | for(QELine aaa :activities){ |
| | | // 2022-06-14 紧急修复 ssm |
| | | if (String.isBlank(aaa.Asset_Model)) { |
| | | continue; |
| | | } |
| | | if(aaa.pageObject.PricebookEntry.Product2Id!=null){ |
| | | if(aaa.GuranteePrice==null){ |
| | | aaa.GuranteePrice=0; |
| | | } |
| | | AccrualTotal += aaa.pageObject.Quantity__c*aaa.GuranteePrice; |
| | | } |
| | | } |
| | | if(quo.MultiYearWarrantyTotalPrice__c==null){ |
| | | quo.MultiYearWarrantyTotalPrice__c=0; |
| | | } |
| | | sumContractAmount = AccrualTotal+quo.MultiYearWarrantyTotalPrice__c; |
| | | if(quo.OCM_Agent1_Price_Page__c<=sumContractAmount){ |
| | | error = true; |
| | | errorflg = true; |
| | | errormessage = '预测金额为负数,请正确填写合同金额。'; |
| | | } |
| | | if(quo.multiYearWarranty__c){ |
| | | if(quo.OCM_Agent1_Price_Page__c<=0){ |
| | | error = true; |
| | | errorflg = true; |
| | | errormessage = '预测金额为负数,请正确填写合同金额。'; |
| | | } |
| | | } |
| | | return error; |
| | | } |
| | | // |
| | | public static Boolean checkAgentsDeleteFlag() { |
| | | // Check Agents |
| | | List<Id> accIds = new List<Id>(); |
| | | if (opp.Agency1__c != null) { |
| | | accIds.add(opp.Agency1__c); |
| | | } |
| | | if (opp.Agency2__c != null) { |
| | | accIds.add(opp.Agency2__c); |
| | | } |
| | | if (accIds.size() > 0) { |
| | | List<Account> agentAccs = [SELECT Id, Delete_Flag__c, Is_Active_Formula__c, Sales_Shop_Class__c FROM Account WHERE Id IN :accIds]; |
| | | String activeFormula1 = null, activeFormula2 = null; |
| | | for (Account local : agentAccs) { |
| | | if (local.Sales_Shop_Class__c == '医疗修理经销商') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | if (local.Id == opp.Agency1__c) { |
| | | errorMessage = '请确认第一经销商的经销商资质'; |
| | | return false; |
| | | } |
| | | } |
| | | if (local.Id == opp.Agency1__c) { |
| | | activeFormula1 = local.Is_Active_Formula__c; |
| | | } |
| | | } |
| | | for (Account local : agentAccs) { |
| | | if (local.Id == opp.Agency2__c) { |
| | | activeFormula2 = local.Is_Active_Formula__c; |
| | | } |
| | | } |
| | | if (activeFormula1 == '无效' && activeFormula2 == '无效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Agent1_and_Agent2_were_Deleted; |
| | | return false; |
| | | } else if (activeFormula1 == '无效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Agent1_was_Deleted; |
| | | return false; |
| | | } else if (activeFormula2 == '无效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Agent2_was_Deleted; |
| | | return false; |
| | | } |
| | | } |
| | | // 内貿の場合Check Agency1 |
| | | if (opp.Agency1__c != null && opp.Trade__c == '内貿') { |
| | | Account acc = [select Sales_Shop_Class__c, Business_Authorization_No__c, Business_Paper_Expiration_Date__c, |
| | | Tax_Practice_No__c, Tax_Practice_Expiration_Date__c, Medical_Equipment_Num__c, Is_Active_Formula__c, |
| | | Medical_Equipment_Expiration_Date__c from Account where Id = :opp.Agency1__c]; |
| | | //经销商分类只有特约、一级或者集中采购才可以进行报价 |
| | | List<String> salesClazz = new List<String> {'特約販売店(区域)', '特約販売店(製品)', '特約販売店(製品+区域)', '一級販売店', '集采经销商'}; |
| | | // 有效/无效(公式)!= 有效 |
| | | if (acc.Is_Active_Formula__c != '有效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = '请选择有效的经销商'; |
| | | return false; |
| | | } |
| | | else if(!salesClazz.contains(acc.Sales_Shop_Class__c)){ |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = '经销商1的经销商分类为:特约,一级,集中采购才可以报价'; |
| | | return false; |
| | | }else if (!(String.isBlank(acc.Tax_Practice_No__c) == false |
| | | && (acc.Tax_Practice_Expiration_Date__c == null || acc.Tax_Practice_Expiration_Date__c >= Date.today()) |
| | | |
| | | && String.isBlank(acc.Business_Authorization_No__c) == false |
| | | && acc.Business_Paper_Expiration_Date__c != null && acc.Business_Paper_Expiration_Date__c >= Date.today()) |
| | | ) { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = '请确认第一经销商的经销商资质'; |
| | | return false; |
| | | }else {} |
| | | } |
| | | return true; |
| | | } |
| | | //保存逻辑 |
| | | public static boolean dataEntry() { |
| | | system.debug('activities++++----****3'+activities); |
| | | Boolean ifdecide=checkIsDecide(); |
| | | standardPricebook = ControllerUtil.getStandardPricebook(); |
| | | if(!ifdecide){ |
| | | |
| | | List<Quote> maxQuote_No = [select Quote_No__c From Quote Where OpportunityId = :oppid and (not Quote_No__c like '%Old') order by Quote_No_last2__c desc NULLS LAST limit 1]; |
| | | String oppNo; |
| | | Integer l = 1; |
| | | if (maxQuote_No.size() > 0) { |
| | | try { |
| | | oppNo = maxQuote_No[0].Quote_No__c; |
| | | l = Integer.valueOf(oppNo.substring(oppNo.length() - 2)) + 1; |
| | | } catch (System.TypeException e) { |
| | | system.debug('maxQuote_No Error: quote.id=' + maxQuote_No[0].id); |
| | | } |
| | | } else { |
| | | system.debug('first Quote'); |
| | | } |
| | | oppNo = '00' + String.valueof(l); |
| | | oppNo = oppNo.substring(oppNo.length() - 2); |
| | | |
| | | Quote q = New Quote(); |
| | | if (changedAfterPrint) { |
| | | system.debug('id空1:'); |
| | | quoId = null; |
| | | SkipQuotefilg = true; |
| | | } |
| | | // CHAN-AVG3PW 询价报价画面规则变更 |
| | | if (newQuoteFlag) { |
| | | system.debug('id空3:'); |
| | | quoId = null; |
| | | SkipQuotefilg = true; |
| | | } |
| | | System.debug('quoteGurantee_Period: ' + quoteGurantee_Period); |
| | | System.debug('quo.Gurantee_Period__c: ' + quo.Gurantee_Period__c); |
| | | System.debug('quotemultiYearWarranty: ' + quotemultiYearWarranty); |
| | | System.debug('quo.multiYearWarranty__c: ' + quo.multiYearWarranty__c); |
| | | if ((quoteGurantee_Period != null && |
| | | !quoteGurantee_Period.equals(quo.Gurantee_Period__c)) |
| | | || |
| | | (quotemultiYearWarranty != null && |
| | | !quotemultiYearWarranty.equals('' + quo.multiYearWarranty__c)) |
| | | ) { |
| | | system.debug('id空5:'); |
| | | quoId = null; |
| | | SkipQuotefilg = true; |
| | | } |
| | | if (String.isBlank(quoId)) { |
| | | q = New Quote(); |
| | | q.OpportunityId = oppId; |
| | | if (detail == true) { |
| | | if (standardPricebook == null) { |
| | | errormessage = System.Label.Error_Message27; |
| | | errorflg = true; |
| | | return false; |
| | | } else { |
| | | q.Pricebook2Id = standardPricebook.Id; |
| | | } |
| | | } |
| | | } else { |
| | | List<Quote> qs = New List<Quote>(); |
| | | qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | Stocking_Price__c, Discount_Amount__c, Discount_Amount_Calculate__c, Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Quote_No__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, |
| | | Preferential_Trading_Price__c, Discount__c, Pricing__c, Unit_Price__c, Offer_Amount__c, TOTAL__c, |
| | | Contract__c, Print_HP_Name__c, Quote_Expiration_Date__c, Quote_Comment__c, OCM_Sales_Forecast__c, Installation_location__c, HasType3Machine__c |
| | | , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c |
| | | , Preferential_Gurantee_Period__c |
| | | ,IsQuoteTrial__c |
| | | From Quote Where Id = :quoId]; |
| | | if (qs.size() > 0) { |
| | | q = qs[0]; |
| | | } |
| | | if (q.Pricebook2Id == null) { |
| | | if (detail == true) { |
| | | if (standardPricebook == null) { |
| | | errormessage = System.Label.Error_Message27; |
| | | errorflg = true; |
| | | return false; |
| | | } else { |
| | | q.Pricebook2Id = standardPricebook.Id; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (String.isBlank(quoId)) { |
| | | q.Quote_No__c = opp.Opportunity_No__c + '-' + oppNo; |
| | | q.PriceRefreshDate__c = Date.today(); |
| | | } |
| | | if (productStatusUpdated) { |
| | | q.PriceRefreshDate__c = Date.today(); |
| | | } |
| | | List<String> pIds = new List<String>(); |
| | | system.debug('activities++++----****1'+activities); |
| | | for (QELine s : activities) { |
| | | if (String.isBlank(s.pageObject.Id__c) == false) { |
| | | pIds.add(s.pageObject.Id__c); |
| | | } |
| | | } |
| | | List<Product2> pList = [select Id from Product2 where Id in :pids and Category3__c = '主机']; |
| | | if (pList.size() > 0) q.HasType3Machine__c = true; |
| | | q.Name = quo.QuoteName__c; |
| | | q.Estimation_List_Price__c = quo.Estimation_List_Price__c; |
| | | q.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c; |
| | | q.OCM_Sales_Forecast__c = quo.OCM_Sales_Forecast__c;//预测金额修改 fy |
| | | q.Stocking_Price__c = quo.Stocking_Price__c; |
| | | q.Quote_Adjust_Amount__c = quo.Quote_Adjust_Amount_Page__c; |
| | | q.Quote_Adjust_Calculate__c = quo.Quote_Adjust_Calculate__c; |
| | | q.Discount_Amount__c = quo.Discount_Amount__c; |
| | | q.Discount_Amount_Calculate__c = quo.Discount_Amount_Calculate__c; |
| | | q.Agency1__c = opp.Agency1__c; |
| | | q.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c; |
| | | q.Agency1_Profit__c = quo.Agency1_Profit__c; |
| | | q.AgencyDiscount__c = quo.AgencyDiscount__c; |
| | | q.Gurantee_Period__c = quo.Gurantee_Period__c; |
| | | q.multiYearWarranty__c = quo.multiYearWarranty__c; |
| | | q.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c; |
| | | q.quoteSavedDate__c = Date.today(); |
| | | q.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c; |
| | | q.Agency2__c = opp.Agency2__c; |
| | | q.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c; |
| | | q.Agency2_Profit__c = quo.Agency2_Profit__c; |
| | | q.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c; |
| | | q.Print_HP_Name__c = selection_hp; |
| | | q.Quote_Expiration_Date__c = quo.Quote_Expiration_Date__c; |
| | | q.Quote_Comment__c = quo.Quote_Comment__c; |
| | | q.Installation_location__c = quo.Installation_location__c; |
| | | q.QuotationChange__c = quo.QuotationChange__c; |
| | | q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c; |
| | | q.Interdepartmental__c = quo.Interdepartmental__c; |
| | | if(!quo.IsQuoteTrial__c){ |
| | | q.IsQuoteTrial__c = quo.IsQuoteTrial__c; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | List<Id> idList = new List<Id>(); |
| | | for (QELine s : activities) { |
| | | if (String.isNotBlank(s.pageObject.PricebookEntryId)) { |
| | | idList.add(s.pageObject.PricebookEntryId); |
| | | } |
| | | } |
| | | List<PricebookEntry> pb = [select Id from PricebookEntry where Product2.Category5__c = '虚拟' and Id in: idList]; |
| | | q.Have_Virtual__c = false; |
| | | if(pb.size() > 0){ |
| | | q.Have_Virtual__c = true; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | if (String.isBlank(quoId)) { |
| | | insert q; |
| | | quo.Quote_No__c = q.Quote_No__c; |
| | | // quo.IsQuoteTrial__c = q.IsQuoteTrial__c; |
| | | // isQuoteTrialOnInit = q.IsQuoteTrial__c; |
| | | } else { |
| | | update q; |
| | | } |
| | | List<QuoteLineItem> qlist = New List<QuoteLineItem>(); |
| | | qlist = [Select Id From QuoteLineItem Where QuoteId = :quoId]; |
| | | if (qlist.size() > 0) { |
| | | delete qlist; |
| | | } |
| | | qlist = New List<QuoteLineItem>(); |
| | | List<String> product_lines = new List<String>(); |
| | | Boolean Is_Eng2_Opp = false; |
| | | Integer i = 1; |
| | | if (activities.size() > 0) { |
| | | system.debug('activities++++----****'+activities); |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | if (s.pageObject.PricebookEntryId != null) { |
| | | QuoteLineItem ql = s.pageObject.clone(); |
| | | ql.Quantity = ql.Quantity__c; |
| | | ql.UnitPrice = 0; |
| | | ql.QuoteId = q.Id; |
| | | ql.Name__c = s.pageObject.Name__c; |
| | | ql.Cost__c = s.Cost_c; |
| | | ql.Cost_Subtotal__c = s.Cost_Subtotal_c; |
| | | // s.pageObject.Cost__c = s.Cost_c; |
| | | // s.pageObject.Cost_Subtotal__c = s.Cost_Subtotal_c; |
| | | ql.UnitPrice__c = ql.UnitPrice_Page__c; |
| | | ql.UnitPrice_Page__c = 0; |
| | | ql.ListPrice__c = s.ListPrice_Page; |
| | | ql.GuranteePrice__c = s.GuranteePrice; |
| | | ql.ProductGuranteePrice__c = s.ProductGuranteePrice; |
| | | ql.Maintenance_Price_Year__c = s.Maintenance_Price_Year; |
| | | ql.CanNotCancelFlag__c = s.CanNotCancelledGurantee; |
| | | ql.Item_Order__c = i;//预测金额修改 fy |
| | | if (s.pageObject.Subtotal__c != null && quo.OCM_Agent1_Price_Page__c != null && quo.QuoteTotal_Page__c != null) { |
| | | if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//预测金额修改 fy |
| | | ql.OCM_Sales_Forecast__c = quo.OCM_Agent1_Price_Page__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c); |
| | | } |
| | | } |
| | | qlist.add(ql); |
| | | product_lines.add(s.pageObject.PricebookEntryId); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | system.debug('qlist+++---+++'+qlist); |
| | | insert qlist; |
| | | } |
| | | system.debug('○○○○○Save2○○○○○'); |
| | | List<PricebookEntry> entrys = product_lines!= null && product_lines.size() > 0 ? [select Id from PricebookEntry where Id in :product_lines and Product2.ENG_New__c = 'ENG2'] : null; |
| | | Is_Eng2_Opp = entrys != null && entrys.size() > 0 ? true : false; |
| | | Opportunity o = New Opportunity(); |
| | | List<Opportunity> os = New List<Opportunity>(); |
| | | os = [select Id, Estimation_List_Price__c, Dealer_Final_Price__c, Estimation_List_Price_Without_Tax__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Stocking_Price__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_Update_Sum__c , Hospital__c,Is_Corrosion__c |
| | | ,StageName ,OlyNumberHosts__c |
| | | From Opportunity Where Id = :oppid]; |
| | | if (os.size() > 0) { |
| | | o = os[0]; |
| | | o.Estimation_List_Price__c = quo.Estimation_List_Price__c; |
| | | o.Wholesale_Price__c = q.OCM_Sales_Forecast__c;//预测金额修改 fy |
| | | o.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c; |
| | | o.Agency1__c = opp.Agency1__c; |
| | | o.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c; |
| | | o.Agency1_Profit__c = quo.Agency1_Profit__c; |
| | | o.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c; |
| | | o.Agency2__c = opp.Agency2__c; |
| | | o.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c; |
| | | o.Agency2_Profit__c = quo.Agency2_Profit__c; |
| | | o.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c; |
| | | o.Stocking_Price__c = quo.Stocking_Price__c; |
| | | o.Estimation_No__c = q.Quote_No__c; |
| | | o.Estimation_Name__c = q.Name; |
| | | o.Estimation_Id__c = q.Id; |
| | | o.Installation_location__c = q.Installation_location__c; |
| | | o.HasType3Machine__c = q.HasType3Machine__c; |
| | | o.AgencyDiscount__c = quo.AgencyDiscount__c; |
| | | o.Gurantee_Period__c = quo.Gurantee_Period__c ; |
| | | o.multiYearWarranty__c = quo.multiYearWarranty__c ; |
| | | o.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c ; |
| | | o.quoteSavedDate__c = Date.today(); |
| | | o.OlyNumberHosts__c = 0; |
| | | List<String> oppIds = New List<String>(); |
| | | List<String> product2Ids = New List<String>(); |
| | | Map<String,Decimal> product2IdsMap = new Map<String,Decimal>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine a : activities) { |
| | | if(String.isBlank(a.pageObject.Id__c) == false) { |
| | | product2Ids.add(a.pageObject.Id__c); |
| | | product2IdsMap.put(a.pageObject.Id__c,a.pageObject.Quantity__c); |
| | | } |
| | | } |
| | | for (Product2 prod : [Select Id,ProductClass__c From Product2 Where Id IN :product2Ids]) { |
| | | if(o.StageName == '引合' || o.StageName == '注残' || o.StageName == '出荷' || o.StageName == '完了'){ |
| | | if(prod.ProductClass__c == '主机'){ |
| | | if(product2IdsMap.containsKey(prod.Id)){ |
| | | o.OlyNumberHosts__c += product2IdsMap.get(prod.Id); |
| | | oppIds.add(o.Id); |
| | | ControllerUtil.UpdateBiddingFlag(oppIds); |
| | | } |
| | | }else{ |
| | | o.OlyNumberHosts__c += 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (o.Quote_Update_Sum__c == null) { |
| | | o.Quote_Update_Sum__c = 1; |
| | | } else { |
| | | o.Quote_Update_Sum__c = o.Quote_Update_Sum__c + 1; |
| | | } |
| | | o.ENG2_Opp__c = Is_Eng2_Opp; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | update o; |
| | | |
| | | |
| | | //OpportunityLineItem-------------------------------------------- |
| | | List<OpportunityLineItem> ols = New List<OpportunityLineItem>(); |
| | | OpportunityLineItem ol = New OpportunityLineItem(); |
| | | ols = [select Id, Quantity from OpportunityLineItem Where OpportunityId = :oppid]; |
| | | if (ols.size() > 0) { |
| | | ControllerUtil.delOppLine(ols); |
| | | } |
| | | i = 1; |
| | | ols = New List<OpportunityLineItem>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | if (s.pageObject.PricebookEntryId != null) { |
| | | ol = New OpportunityLineItem(); |
| | | ol.OpportunityId = oppid; |
| | | ol.Id__c = s.pageObject.Id__c; |
| | | ol.SFDA_Status__c = s.pageObject.SFDA_Status__c; |
| | | ol.Name__c = s.pageObject.Name__c; |
| | | ol.ListPrice__c = s.ListPrice_Page; |
| | | ol.Quantity = s.pageObject.Quantity__c; |
| | | ol.UnitPrice = 0; |
| | | ol.UnitPrice__c = s.pageObject.UnitPrice_Page__c; |
| | | ol.AgencyUnitPrice__c = s.pageObject.AgencyUnitPrice__c; |
| | | ol.Present__c = s.pageObject.Present__c; |
| | | ol.AgencySubtotal__c = s.pageObject.AgencySubtotal__c; |
| | | ol.GuaranteePeriod__c = s.pageObject.GuaranteePeriod__c; |
| | | if (opp.CurrencyIsoCode != null ) { |
| | | ol.multiYearWarranty__c = s.pageObject.multiYearWarranty__c; |
| | | ol.ServicePrice__c = s.pageObject.ServicePrice__c; |
| | | ol.If_Cancel_Guarantee__c = s.pageObject.If_Cancel_Guarantee__c; |
| | | ol.ProductEntend_gurantee_period_all__c |
| | | = s.pageObject.ProductEntend_gurantee_period_all__c; |
| | | ol.GuranteeType__c = s.pageObject.GuranteeType__c; |
| | | ol.NoDiscountTotal__c = s.pageObject.NoDiscountTotal__c; |
| | | ol.warrantyType__c = s.pageObject.warrantyType__c; |
| | | ol.productServicePrice__c = s.pageObject.productServicePrice__c; |
| | | ol.GuranteePrice__c = s.GuranteePrice; |
| | | ol.ProductGuranteePrice__c = s.ProductGuranteePrice; |
| | | ol.Maintenance_Price_Year__c = s.Maintenance_Price_Year; |
| | | ol.provistonPeriod__c = s.pageObject.provistonPeriod__c; |
| | | } |
| | | ol.Qty_Unit__c = s.pageObject.Qty_Unit__c; |
| | | ol.Cost__c = s.pageObject.Cost__c; |
| | | ol.BSS_Category__c = s.pageObject.BSS_Category__c; |
| | | ol.CanNotCancelFlag__c = s.CanNotCancelledGurantee;//预测金额修改 fy |
| | | if (s.pageObject.Subtotal__c != null && o.Wholesale_Price__c != null && quo.QuoteTotal_Page__c != null) { |
| | | if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//预测金额修改 fy |
| | | ol.OCM_Sales_Forecast__c = o.Wholesale_Price__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c); |
| | | } |
| | | } |
| | | ol.PricebookEntryId = s.pageObject.PricebookEntryId; |
| | | ol.Item_Order__c = i; |
| | | ols.add(ol); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | ControllerUtil.insOppLine(ols); |
| | | } |
| | | |
| | | } else { |
| | | system.debug('*****SystemError OpportunityId is Null*****'); |
| | | } |
| | | if (String.isBlank(quoId)) { |
| | | quoIdreturn = q.Id; |
| | | // newQuoteFlag = false; |
| | | } |
| | | }else{ |
| | | errorflg = true; |
| | | errormessage = '该询价已经decide,不可再修改'; |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | //防止多开页面加验证查询 |
| | | private static boolean checkIsDecide() { |
| | | List<Opportunity> oppsde = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId]; |
| | | if (oppsde.size() > 0) { |
| | | if(oppsde[0].Estimation_Decision__c){ |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | //检索新建报价产品 |
| | | @AuraEnabled |
| | | public static List<PricebookEntry> serContact(String tradec,String SearchName,String celon){ |
| | | trade = tradec; |
| | | String x = '×'; |
| | | String searchSql = 'select Id,Product2Id,Product2.Name,Product2.ProductCode,Product2.StorageStatus__c,Product2.OT_CODE_no_link__c, Product2.Alternative_Products__c, ' |
| | | + 'Product2.Foreign_Trade_Cost_US__c, Product2.Foreign_Trade_List_US__c, Product2.Intra_Trade_Cost_RMB__c, Product2.Intra_Trade_List_RMB__c, ' |
| | | + 'Product2.Asset_Model_No__c, Product2.Serial_Lot_No__c, Product2.Sales_Possibility__c, Product2.Estimation_Entry_Possibility__c, ' |
| | | + 'Product2.SFDA_Status__c, Product2.Qty_Unit__c, Product2.BSSCategory__c, Product2.Asset_loaner_category__c, Product2.Packing_list_manual__c ' |
| | | + ' ,Product2.Extend_new_product_gurantee_MD__c , Product2.Extend_new_product_gurantee__c , Product2.Entend_gurantee_period_all__c , ' |
| | | + ' Product2.Intra_Trade_Gurantee_RMB__c ' |
| | | + ',Product2.Intra_Trade_Foreign_RMB__c,Product2.NoDiscount_Foreign__c,Product2.Repair_Contract_USD__c ' |
| | | + ' , Product2.Intra_Trade_Service_RMB__c,Product2.CanNotCancelledGurantee__c,Product2.Is_DangerousChemicals__c ' |
| | | + ' , Product2.GuranteeType__c , product2.VenderName__c , product2.Maintenance_Price_Year__c ' |
| | | + ' , Product2.suitDepartment__c ' |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | + ' , Product2.Category5__c ' |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | + ' , Product2.Estimated_ConsumptionDueDate__c ' |
| | | + 'FROM PricebookEntry '; |
| | | String whereStr = 'Where Product2.Asset_Model_No__c != null And Product2.Manual_Entry__c = false And Product2.Estimation_Entry_Possibility__c !=' + '\'' + x + '\' ' |
| | | + 'AND CurrencyIsoCode =' + '\'' + String.escapeSingleQuotes(trade) + '\' ' |
| | | + 'AND IsActive = true '; |
| | | String whereSql = ''; |
| | | if (searchMode == 'CS') { |
| | | whereSql += 'and Product2.Asset_loaner_category__c = \'为耗材管理\' '; |
| | | } |
| | | if (SearchName != null && SearchName != '') { |
| | | String likename = String.escapeSingleQuotes(SearchName); |
| | | String prdcd = String.escapeSingleQuotes(SearchName); |
| | | if (likename.indexOf('*') >= 0) { |
| | | likename = likename.replace('*', '%'); |
| | | } else { |
| | | likename = '%' + likename + '%'; |
| | | } |
| | | whereSql += 'and (Product2.Name Like ' + '\'' + likename + '\' or Product2.ProductCode = ' + '\'' + prdcd + '\' or Product2.Asset_Model_No__c Like ' + '\'' + likename + '\') '; |
| | | } |
| | | celon = String.isNotBlank(celon) ? celon : null; |
| | | whereSql += ' and Product2.Celon_Product__c = :celon '; |
| | | searchSql = searchSql + whereStr + whereSql; |
| | | searchSql += ' order by Product2.Asset_Model_No__c Limit 450'; |
| | | List<PricebookEntry> pbes = Database.query(searchSql); |
| | | return pbes; |
| | | } |
| | | //检索产品配套 |
| | | @AuraEnabled |
| | | public static List<Product_Set__c> serSetContact(String SearchName,String SearchCode,String filterName){ |
| | | String searchSql = 'Select id, name, Price__c, Product_Set_CD__c, Quantity__c,Valid_Status__c,Quote_Select_Info__c From Product_Set__c '; |
| | | String whereStr = 'Where Valid_Status__c = true '; |
| | | String whereSql = ''; |
| | | if(SearchName != null && SearchName != ''){ |
| | | whereSql += 'and name Like ' + '\'%' + SearchName + '%\' '; |
| | | } |
| | | if(filterName != null && filterName != ''){ |
| | | whereSql += 'and Applicable_Department__c =\'' + filterName + '\''; |
| | | } |
| | | if(SearchCode != null && SearchCode != ''){ |
| | | whereSql += 'and Product_Set_CD__c like ' + '\'%' + SearchCode + '%\' '; |
| | | } |
| | | searchSql = searchSql + whereStr + whereSql; |
| | | searchSql += ' order by Product_Set_CD__c limit 500'; |
| | | List<Product_Set__c> cl = Database.query(searchSql); |
| | | return cl; |
| | | } |
| | | //产品检索配套赋值 |
| | | @AuraEnabled |
| | | public static String setProductEntry(String setProduct_text, |
| | | String activitiesCan, |
| | | String oppInfoc, |
| | | String quoc) { |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | setOppFromOppInfo(); |
| | | List<String> productIDLIST = new List<String>(); |
| | | if (setProduct_text == null) { |
| | | // PageArrange(); |
| | | return JSON.serialize(activities); |
| | | } else { |
| | | productIDLIST = setProduct_text.split(','); |
| | | } |
| | | System.debug('productIDLIST-c++'+productIDLIST); |
| | | List<Id> productIds = null; |
| | | List<Product_Set_Detail__c> productSetDetails = [SELECT Id, Product__c, Quantity__c, Product_Set__r.Name,Product__r.VenderName__c,Product__r.CanNotCancelledGurantee__c,Product__r.Is_DangerousChemicals__c FROM Product_Set_Detail__c Where Product_Set__c in :productIDLIST]; |
| | | if (productSetDetails.size() == 0) { |
| | | // PageArrange(); |
| | | return JSON.serialize(activities); |
| | | } else { |
| | | productIds = new List<Id>(); |
| | | for (Product_Set_Detail__c local : productSetDetails) { |
| | | productIds.add(local.Product__c); |
| | | } |
| | | } |
| | | System.debug('productIds++'+productIds); |
| | | System.debug('activities++'+activities); |
| | | tmpactivities = activities; |
| | | activities = new List<QELine>(); |
| | | boolean lineflg = false; |
| | | Map<Id, Product2> items = new Map<Id, Product2>(); |
| | | List<Product2> products = [select Id, Name, ProductCode, |
| | | Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c, |
| | | SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c |
| | | , Entend_gurantee_period_all__c |
| | | , Intra_Trade_Gurantee_RMB__c |
| | | , Intra_Trade_Service_RMB__c |
| | | , GuranteeType__c |
| | | , Maintenance_Price_Year__c |
| | | ,CanNotCancelledGurantee__c |
| | | ,Is_DangerousChemicals__c |
| | | ,Repair_Contract_USD__c |
| | | ,LastbuyProductFLG__c |
| | | ,Intra_Trade_Foreign_RMB__c |
| | | ,NoDiscount_Foreign__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ,Estimated_ConsumptionDueDate__c |
| | | FROM Product2 Where Id IN :productIds |
| | | And Manual_Entry__c = false]; |
| | | for (Product2 product : products) { |
| | | items.put(product.Id, product); |
| | | } |
| | | System.debug('items++'+items); |
| | | Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>(); |
| | | List<PricebookEntry> workEntries = [ |
| | | SELECT Id, Product2Id |
| | | FROM PricebookEntry Where Product2Id IN :productIds |
| | | AND CurrencyIsoCode = :(opp.Trade__c == '外貿' ? 'USD' : 'CNY') |
| | | AND IsActive = true |
| | | ]; |
| | | for (PricebookEntry workEntry : workEntries) { |
| | | entries.put(workEntry.Product2Id, workEntry); |
| | | } |
| | | System.debug('entries-c++'+entries); |
| | | Integer i = 1; |
| | | Integer rightcnt = 0; |
| | | for (QELine t : tmpactivities) { |
| | | QELine a = New QELine(); |
| | | a.lineNo = i; |
| | | System.debug('i-c++'+i); |
| | | a = t; |
| | | a.lineNo = i; |
| | | activities.add(a); |
| | | |
| | | i++; |
| | | } |
| | | if (items.size() > 0) { |
| | | System.debug('productSetDetails-c++'+productSetDetails); |
| | | for (Integer l = 0; l < productSetDetails.size(); l++) { |
| | | Product_Set_Detail__c nowDetail = productSetDetails[l]; |
| | | Product2 prd = items.get(nowDetail.product__c); |
| | | PricebookEntry pbe = entries.get(nowDetail.product__c); |
| | | if (pbe == null) { |
| | | } else { |
| | | QELine c = null; |
| | | Integer Quantity_c = nowDetail.Quantity__c > 0 ? Integer.valueOf(nowDetail.Quantity__c) : 1; |
| | | if (opp.Trade__c == '外貿') { |
| | | if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) { |
| | | c = new QELine(i, prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c, |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, |
| | | prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c, |
| | | prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantity_c, prd.Foreign_Trade_List_US__c, |
| | | prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c, |
| | | prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Foreign_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.NoDiscount_Foreign__c, prd.Repair_Contract_USD__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | } else { |
| | | continue; |
| | | } |
| | | } else if (opp.Trade__c == '内貿') { |
| | | if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) { |
| | | c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c, |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, |
| | | prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c, |
| | | prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantity_c, prd.Intra_Trade_List_RMB__c, |
| | | prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c, |
| | | prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Gurantee_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.Intra_Trade_Service_RMB__c |
| | | , prd.Maintenance_Price_Year__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | } else { |
| | | continue; |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | activities.add(c); |
| | | i++; |
| | | rightcnt++; |
| | | lineflg = true; |
| | | } |
| | | } |
| | | } |
| | | // PageArrange(); |
| | | if (productSetDetails.size() > 0) { |
| | | errorflg = true; |
| | | errormessage = productSetDetails[0].Product_Set__r.Name + ' 导入结束,导入 ' + productSetDetails.size() + ' 件,成功' + rightcnt + ' 件'; |
| | | } |
| | | System.debug('activities-to++'+activities); |
| | | return errormessage + '---' + JSON.serialize(activities); |
| | | } |
| | | //excelImport |
| | | @AuraEnabled |
| | | public static String excelImport(String excel_text, |
| | | String activitiesCan, |
| | | String oppInfoc, |
| | | String quoc) { |
| | | |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | setOppFromOppInfo(); |
| | | errorflg = false; |
| | | errormessage = ''; |
| | | Integer j = 0; |
| | | tmpactivities = activities; |
| | | activities = new List<QELine>(); |
| | | Integer i = 0; |
| | | Integer xlscnt = 0; |
| | | Integer rightcnt = 0; |
| | | |
| | | string[] xlslists = excel_text.split('\n', -1); |
| | | List<string> xlslist = New list<string>(); |
| | | List<string> codelist = New List<string>(); |
| | | List<Integer> Quantitylist = New List<Integer>(); |
| | | //String str ; |
| | | |
| | | Map<String, Integer> mp = new Map<String, Integer>(); |
| | | string xlscode; |
| | | Integer xlsQuantity; |
| | | |
| | | try { |
| | | for (string xls : xlslists) { |
| | | if (xls == null || xls == '') { |
| | | } else { |
| | | xlscode = null; |
| | | xlsQuantity = null; |
| | | xlslist = xls.split('\t', -1); |
| | | system.debug('xlslist+++'+xlslist); |
| | | for (String s : xlslist) { |
| | | //odd number or even number |
| | | if (math.mod(i, 2) != 0) { |
| | | system.debug('xlslist1+++'+s); |
| | | //odd number |
| | | if (s == '' || s == null) { |
| | | errorflg = true; |
| | | errormessage = System.Label.Error_Message31; |
| | | activities = tmpactivities; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } else { |
| | | s = s.trim(); |
| | | xlsQuantity = Integer.valueOf(s); |
| | | Quantitylist.add(xlsQuantity); |
| | | } |
| | | } else { |
| | | system.debug('xlslist2+++'+s); |
| | | //even number |
| | | if (s == '' || s == null) { |
| | | errorflg = true; |
| | | errormessage = System.Label.Error_Message31; |
| | | activities = tmpactivities; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } else { |
| | | s = s.trim(); |
| | | codelist.add(s); |
| | | xlscode = s; |
| | | } |
| | | } |
| | | i++; |
| | | } |
| | | //mp.put(xlscode, xlsQuantity); |
| | | xlscnt++; |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | system.debug('xlslist3+++'+xlscnt); |
| | | activities = tmpactivities; |
| | | errorflg = true; |
| | | errormessage = System.Label.Error_Message31; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } |
| | | |
| | | system.debug(j); |
| | | system.debug('xlscnt:::::' + xlscnt); |
| | | |
| | | if (codelist.size() == 0 || Quantitylist.size() == 0) { |
| | | activities = tmpactivities; |
| | | errorflg = true; |
| | | system.debug('codelist+++'+codelist); |
| | | system.debug('Quantitylist+++'+Quantitylist); |
| | | errormessage = System.Label.Error_Message31; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } |
| | | |
| | | |
| | | i = 1; |
| | | boolean lineflg = false; |
| | | for (QELine t : tmpactivities) { |
| | | QELine a = New QELine(); |
| | | a = t; |
| | | a.lineNo = i; |
| | | activities.add(a); |
| | | i++; |
| | | } |
| | | Map<String, Product2> mpProduct2 = new Map<String, Product2>(); |
| | | String celon_type = String.isNotBlank(opp.CelonOpportunity__c) ? opp.CelonOpportunity__c : null; |
| | | List<Product2> items = [select Id, Name, ProductCode, |
| | | Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c, |
| | | SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c |
| | | , Entend_gurantee_period_all__c |
| | | , Intra_Trade_Gurantee_RMB__c |
| | | , Intra_Trade_Service_RMB__c |
| | | , GuranteeType__c |
| | | , Maintenance_Price_Year__c |
| | | ,CanNotCancelledGurantee__c |
| | | ,Is_DangerousChemicals__c |
| | | ,Repair_Contract_USD__c |
| | | ,Intra_Trade_Foreign_RMB__c |
| | | ,NoDiscount_Foreign__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ,Estimated_ConsumptionDueDate__c |
| | | FROM Product2 Where ProductCode In :codelist |
| | | And Celon_Product__c = :celon_type |
| | | And Manual_Entry__c = false]; |
| | | for (Product2 prd : items) { |
| | | system.debug('prd.ProductCode:::::' + prd.ProductCode); |
| | | mpProduct2.put(prd.ProductCode, prd); |
| | | } |
| | | Map<String, PricebookEntry> entries = new Map<String, PricebookEntry>(); // keyがProductCodeです。 |
| | | List<PricebookEntry> pbes = [ |
| | | select Id, PricebookEntry.Product2.ProductCode |
| | | FROM PricebookEntry Where PricebookEntry.Product2.ProductCode IN :codelist |
| | | AND CurrencyIsoCode = :(opp.Trade__c == '外貿' ? 'USD' : 'CNY') |
| | | AND IsActive = true]; |
| | | for (PricebookEntry pbe : pbes) { |
| | | system.debug('pbe.Product2.ProductCode:::::' + pbe.Product2.ProductCode); |
| | | entries.put(pbe.Product2.ProductCode, pbe); |
| | | } |
| | | |
| | | for (Integer l = 0; l < codelist.size(); l++) { |
| | | system.debug('codelist[l]:::::' + codelist[l]); |
| | | Product2 prd = mpProduct2.get(codelist[l]); |
| | | if (prd != null) { |
| | | PricebookEntry pbe = entries.get(codelist[l]); |
| | | QELine c = null; |
| | | if (pbe != null && (opp.Trade__c == '外貿' || opp.Trade__c == '内貿')) { |
| | | if (opp.Trade__c == '外貿') { |
| | | if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) { |
| | | c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c, prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c, |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantitylist[l], prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c, prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Foreign_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.NoDiscount_Foreign__c, |
| | | prd.Repair_Contract_USD__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | |
| | | } else { |
| | | continue; |
| | | } |
| | | } else { |
| | | if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) { |
| | | c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c, |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantitylist[l], prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c, prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Gurantee_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.Intra_Trade_Service_RMB__c |
| | | , prd.Maintenance_Price_Year__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | activities.add(c); |
| | | i++; |
| | | rightcnt++; |
| | | } |
| | | } |
| | | // messageを出す |
| | | errorflg = true; |
| | | errormessage = '数据导入结束,导入 ' + codelist.size() + ' 件,成功' + rightcnt + ' 件'; |
| | | // pageArrange(); |
| | | |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | |
| | | } |
| | | //decide按钮 |
| | | @AuraEnabled |
| | | public static Map<String,String> QuoteDecision(String activitiesCan, |
| | | String CheckItemCan , |
| | | boolean WinOrDecideAlertc, |
| | | boolean productStatusUpdatedc, |
| | | String oppInfoc, |
| | | boolean enableSalesc, |
| | | String quoc, |
| | | String oppIdc, |
| | | String quoIdc, |
| | | boolean newQuoteFlagc, |
| | | Boolean changedAfterPrintc, |
| | | String quoteGurantee_Periodc, |
| | | String quotemultiYearWarrantyc, |
| | | String selection_hpc, |
| | | Boolean SkipQuotefilgc) { |
| | | oppId = oppIdc; |
| | | quoId = quoIdc; |
| | | System.debug('quoId+'+quoId); |
| | | WinOrDecideAlert = WinOrDecideAlertc; |
| | | productStatusUpdated = productStatusUpdatedc; |
| | | newQuoteFlag = newQuoteFlagc; |
| | | changedAfterPrint = changedAfterPrintc; |
| | | quoteGurantee_Period = quoteGurantee_Periodc; |
| | | quotemultiYearWarranty = quotemultiYearWarrantyc; |
| | | selection_hp = selection_hpc; |
| | | SkipQuotefilg = SkipQuotefilgc; |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | if(String.isNotBlank(CheckItemCan)){ |
| | | CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class); |
| | | }else { |
| | | CheckItem = null; |
| | | } |
| | | enableSales = enableSalesc; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Map<String,String> result = new Map<String,String>(); |
| | | try { |
| | | setOppFromOppInfo(); |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | if (!(opp.If_Account_Change__c != null ? opp.If_Account_Change__c : false)) { |
| | | if(!ReservedProductVerification()){ |
| | | if(flglastbuy==1){ |
| | | errorflg = true; |
| | | errormessage = '预留产品表中没有该询价,请通过本部窗口联系营业管理课' ; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | }else if(flglastbuy==2){ |
| | | errorflg = true; |
| | | errormessage = errorProductmodel+'产品数量不可超过产品预留数量' ; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | }else if(flglastbuy==3){ |
| | | errorflg = true; |
| | | errormessage = '预留产品'+errorProductmodel+'未录入预留产品表'; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | if(checkVirtual('包含虚拟产品,无法进行decide')){ |
| | | errorflg = true; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | if (checkIsQuoteTrial()) { |
| | | errorflg = true; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | if (enableSales == true) { |
| | | if (dataCheckDecide() == false) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | if(hongzi){ |
| | | String act = JSON.serialize(activities); |
| | | result.put('act', act); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | | if (checkSFDAStatus2(true) == false) { |
| | | errorflg = true; |
| | | errormessage = '请更新不可销售的产品。'; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | if (dataCheck() == false) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | return result; |
| | | } |
| | | System.debug('oppId++'+oppId); |
| | | if (dataEntry() == false) { |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | if(SkipQuotefilg){ |
| | | errorflg = true; |
| | | errormessage = '产品配置或者经销商信息发生变化,已经生成新的报价单,请重新操作报价计算'; |
| | | quo.IsQuoteTrial__c = false; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | if (String.isBlank(oppId)) { |
| | | } else { |
| | | List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId]; |
| | | |
| | | if (opps.size() > 0) { |
| | | opps[0].Estimation_Decision__c = true; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | update opps[0]; |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | |
| | | Quote q = new Quote(); |
| | | if(String.isBlank(quoId)){ |
| | | q = [select Id from Quote where Id = :quoIdreturn]; |
| | | }else{ |
| | | q = [select Id from Quote where Id = :quoId]; |
| | | } |
| | | q.Quote_Decision_Date__c = date.Today(); |
| | | update q; |
| | | result.put('success', System.Label.Message_002); |
| | | if(String.isBlank(quoId)){ |
| | | result.put('quoId',quoIdreturn); |
| | | } |
| | | if(errormessagewarn != null){ |
| | | result.put('warn', errormessagewarn); |
| | | String act = JSON.serialize(activities); |
| | | result.put('act', act); |
| | | } |
| | | return result; |
| | | |
| | | // pageArrange(); |
| | | } |
| | | } catch (DmlException de) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = de.getDmlMessage(0); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = e.getLineNumber()+':'+e.getMessage(); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | //decide检查 |
| | | private static boolean dataCheckDecide() { |
| | | Boolean error = false; |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | if (quo.Dealer_Final_Price_Page__c == null) { |
| | | // quo.Dealer_Final_Price__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Dealer_Final_Price__c.label; |
| | | dfpp = true; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (checkAgentsDeleteFlag() == false) { |
| | | return false; |
| | | } |
| | | if (WinOrDecideAlert && (!productStatusUpdated)) { |
| | | // PriceStatusUpdate(); |
| | | } |
| | | if (opp.Agency1__c == null) { |
| | | // opp.Agency1__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label; |
| | | error = true; |
| | | Agency1 = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.OCM_Agent1_Price_Page__c == null || quo.OCM_Agent1_Price_Page__c == 0) { |
| | | // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label; |
| | | error = true; |
| | | oapp = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (opp.Agency2__c == null && quo.Agent1_Agent2_Price_Page__c != null) { |
| | | // opp.Agency2__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label; |
| | | error = true; |
| | | Agency2 = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (opp.Agency2__c != null && quo.Agent1_Agent2_Price_Page__c == null) { |
| | | // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agent1_Agent2_Price__c.label; |
| | | error = true; |
| | | aapp = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | |
| | | if (opp.If_Need_Authorize__c == true) { |
| | | ID tmpid = opp.Agency2__c == null ? opp.Agency1__c : opp.Agency2__c; |
| | | List<Account> accName = [select name from Account where id = : tmpid]; |
| | | if (accName[0].name != opp.Authorized_Finish_Sales__c) { |
| | | error = true; |
| | | errormessage = '经销商未授权或授权未完成,请先授权。' ; |
| | | } |
| | | } |
| | | if (opp.Trade__c == '内貿') { |
| | | Map<Id, String> proMap = new Map<Id, String>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine qli : activities) { |
| | | if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | proMap.put(qli.pageObject.Id__c, qli.PageObject.Name__c); |
| | | } |
| | | } |
| | | } |
| | | Map<String, String> chkMap = new Map<String, String>(); |
| | | if(!opp.Is_Corrosion__c){ |
| | | chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, ''); |
| | | } |
| | | System.debug('chkMap++'+chkMap); |
| | | if (chkMap.size() > 0) { |
| | | errorflg = true; |
| | | error = true; |
| | | if (chkMap.containsKey('agency')) { |
| | | errormessage = '第一经销商没有有效的医疗器械经营许可证。'; |
| | | } |
| | | Integer inerr = 0; |
| | | if (activities.size() > 0) { |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | if (chkMap.containsKey(s.PageObject.Id__c)) { |
| | | if (chkMap.get(s.PageObject.Id__c) == '1') { |
| | | s.haveno_Register = true; |
| | | inerr ++; |
| | | } else if (chkMap.get(s.PageObject.Id__c) == '2') { |
| | | s.wrong_Register = true; |
| | | inerr ++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (inerr > 0) { |
| | | errormessage = '请检查红字内容(NMPA状态红字,不可销售产品;产品名称红字,超过经销商经营范围)。'; |
| | | hongzi = true; |
| | | } |
| | | return false; |
| | | } |
| | | Boolean isDangerError = false; |
| | | Boolean isNotDangerError = false; |
| | | if (activities.size() > 0) { |
| | | for (QELine qli : activities) { |
| | | if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | if (opp.Is_Corrosion__c) { |
| | | if(!qli.Is_DangerousChemicals){ |
| | | isNotDangerError =true; |
| | | qli.wrong_Register = true; |
| | | } |
| | | |
| | | }else{ |
| | | if(qli.Is_DangerousChemicals){ |
| | | isDangerError =true; |
| | | qli.wrong_Register = true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (enableSales == true&&opp.Is_Corrosion__c&&opp.Trade__c == '内貿') { |
| | | String str = OpportunityWebService.checkDangerItem(opp.agency1__c); |
| | | if (str != 'OK') { |
| | | error = true; |
| | | errormessage = str; |
| | | } |
| | | if(isNotDangerError){ |
| | | error = true; |
| | | errormessage = '当阿西塞多时,行项目的产品必须全选择危化品。'; |
| | | } |
| | | }else if(!opp.Is_Corrosion__c){ |
| | | if(isDangerError){ |
| | | error = true; |
| | | errormessage = '当询价不是阿西塞多时,行项目的产品不能选择危化品。'; |
| | | } |
| | | } |
| | | } |
| | | if (error == true) { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | //检查是否报价计算 |
| | | private static boolean checkIsQuoteTrial() { |
| | | Boolean error = false; |
| | | errorflg = false; |
| | | errormessage = null; |
| | | if(opp.If_Need_PriceApply__c){ |
| | | if(!quo.IsQuoteTrial__c){ |
| | | error = true; |
| | | errormessage = 'decide报价还没进行报价试算,请先报价试算!' ; |
| | | } |
| | | if(quoId !=null){ |
| | | boolean IsActivePsp = true; |
| | | String errorPsp =''; |
| | | List<PromotionSalesProducts__c> promotionSalesProductsList =[select id,PromotionSales__c,QuantityId__c,PromotionSales__r.name,PromotionSales__r.IsPolicyEffective__c,recordTypeName__c from PromotionSalesProducts__c where QuantityId__c=: quoId]; |
| | | if(promotionSalesProductsList.size()>0){ |
| | | for(PromotionSalesProducts__c psp :promotionSalesProductsList){ |
| | | if(psp.PromotionSales__r.IsPolicyEffective__c == '无效'&&psp.recordTypeName__c!='NormalProduct'){ |
| | | IsActivePsp =false; |
| | | errorPsp = psp.PromotionSales__r.name; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(!IsActivePsp){ |
| | | error = true; |
| | | errormessage = '报价试算中,选择的促销政策:'+errorPsp+',不在有效期内,请检查!' ; |
| | | } |
| | | } |
| | | } |
| | | return error; |
| | | } |
| | | //lastbuy检查 |
| | | public static boolean ReservedProductVerification() { |
| | | filg=true; |
| | | Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>(); |
| | | List<Id> lastProductFLGListId = new List<Id>(); |
| | | List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>(); |
| | | List<QuoteLineItem> act = new List<QuoteLineItem>(); |
| | | List<QuoteLineItem> act2 = new List<QuoteLineItem>(); |
| | | for(QELine aaa :activities){ |
| | | if(aaa.pageObject.PricebookEntry.Product2Id!=null){ |
| | | act.add(aaa.pageObject); |
| | | } |
| | | } |
| | | act2=act.deepClone(); |
| | | Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>(); |
| | | System.debug('activities1111111111112为所当为多多!!!'+activities); |
| | | integer i =0; |
| | | for(QuoteLineItem pspsc :act2){ |
| | | if(pspsc.PricebookEntry.Product2Id!=null){ |
| | | if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){ |
| | | QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id); |
| | | quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c; |
| | | map1.put(pspsc.PricebookEntry.Product2Id,quoteLine); |
| | | }else{ |
| | | map1.put(pspsc.PricebookEntry.Product2Id,pspsc); |
| | | } |
| | | System.debug('34499879!!!'+activities); |
| | | } |
| | | } |
| | | System.debug('3434343!!!'+activities); |
| | | System.debug('5656565!!!'+map1); |
| | | for (QuoteLineItem value : map1.values()) { |
| | | if(value.PricebookEntry.Product2.LastbuyProductFLG__c){ |
| | | lastProductFLGListId.add(value.PricebookEntry.Product2Id); |
| | | quotlinitMap.put(value.PricebookEntry.Product2Id,value); |
| | | lastProductFLGList.add(value); |
| | | } |
| | | } |
| | | System.debug('activities++++!!!'+activities); |
| | | System.debug('activities!!!'+map1.values()); |
| | | System.debug('oppId!!!'+oppId); |
| | | System.debug('lastProductFLGList!!!'+lastProductFLGListId); |
| | | if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){ |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true]; |
| | | Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>(); |
| | | System.debug('LastbuyObjList+++++!!!'+LastbuyObjList); |
| | | if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){ |
| | | for(LastbuyProduct__c lastbuypr :LastbuyObjList){ |
| | | LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr); |
| | | } |
| | | }else{ |
| | | flglastbuy=1; |
| | | filg=false; |
| | | return filg; |
| | | } |
| | | System.debug('LastbuyObjMap!!!'+LastbuyObjMap); |
| | | System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList); |
| | | if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){ |
| | | for(QuoteLineItem lastbuypr :lastProductFLGList){ |
| | | Decimal quoteLItemNum=0; |
| | | if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){ |
| | | quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c; |
| | | System.debug('quoteLItemNum!!!'+quoteLItemNum); |
| | | System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c); |
| | | if(lastbuypr.Quantity__c>quoteLItemNum){ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | flglastbuy=2; |
| | | filg=false; |
| | | break; |
| | | } |
| | | }else{ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | flglastbuy=3; |
| | | filg=false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | system.debug('filg====='+filg); |
| | | return filg; |
| | | } |
| | | // CHAN-AVG3PW 询价报价画面规则变更 |
| | | // 报价创建日超过三个月时,如产品停产或CFDA失效,不可以保存,提示“请更新停止销售的产品” |
| | | // 做DECIDE时,如产品停产或CFDA失效,不可以保存,提示“请更新停止销售的产品” |
| | | private static boolean checkSFDAStatus2(boolean dodecide) { |
| | | for (QELine a : activities) { |
| | | if ((a.Asset_Model != null) && (a.Asset_Model != '')) { |
| | | if (a.PageObject.SFDA_Status__c != '有効' && |
| | | a.PageObject.SFDA_Status__c != '有効(再申請中)' && |
| | | a.PageObject.SFDA_Status__c != '不要' && |
| | | a.PageObject.SFDA_Status__c != '暂停出库(短期)' && |
| | | a.PageObject.SFDA_Status__c != '失効(期限内生産済在庫対応)' |
| | | ) { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | // DB202307431108 报价单】经销商1合同金额默认值规则修改 fy start |
| | | public static String getValueFromJSONStringPlus(String jsonstring,String key,String key1) { |
| | | if (String.isNotBlank(jsonstring)) { |
| | | Map<String, Object> map1 = (Map<String, Object>) JSON.deserializeUntyped(jsonstring); |
| | | Map<String, Map<String,Object>> mapping = new Map<String, Map<String,Object>>(); |
| | | for (String str : map1.keySet()) { |
| | | Map<String,Object> mapvalue = (Map<String,Object>) map1.get(str); |
| | | mapping.put(str, mapvalue); |
| | | } |
| | | return mapping.get(key) != null ? (mapping.get(key).get(key1) !=null ? String.valueOf(mapping.get(key).get(key1)) :( mapping.get(key).get('Other') !=null ? String.valueOf(mapping.get(key).get('Other')):null)) : (mapping.get('Default') != null ? (mapping.get('Default').get(key1) !=null ? String.valueOf(mapping.get('Default').get(key1)) : (mapping.get('Default').get('Other') != null ? String.valueOf(mapping.get('Default').get('Other')):null)): null); |
| | | } |
| | | return null; |
| | | } |
| | | //下拉列表值获取共通 |
| | | @AuraEnabled |
| | | public static InitData getModulus(String oppInfoc){ |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | InitData res = new InitData(); |
| | | String str_rate_hospital = ControllerUtil.getValueFromJSONString(System.Label.Quote_HospitalAmount_Rate, opp.Salesdepartment_Owner__c); |
| | | String str_rate_agency1 = lexNewQuoteEntryController.getValueFromJSONStringPlus(System.Label.Quote_Agency1Amount_Rate, opp.Salesdepartment_Owner__c,opp.Opportunity_Category__c); |
| | | res.rate_hospital = String.isNotBlank(str_rate_hospital) ? Decimal.valueOf(str_rate_hospital) : 1.0; |
| | | res.rate_agency1 = String.isNotBlank(str_rate_agency1) ? Decimal.valueOf(str_rate_agency1) : 1.0; |
| | | return res; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | public static Boolean checkVirtual(String message){ |
| | | |
| | | List<String> idList = new List<String>(); |
| | | for (QELine s : activities) { |
| | | if (String.isNotBlank(s.Category5) && s.Category5 == '虚拟') { |
| | | idList.add(s.Category5); |
| | | } |
| | | System.debug('Category5+'+s.Category5); |
| | | } |
| | | if(idList.size() > 0){ |
| | | errorMessage = message; |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | public class InitData{ |
| | | @AuraEnabled |
| | | public Decimal rate_hospital; |
| | | @AuraEnabled |
| | | public Decimal rate_agency1; |
| | | } |
| | | //行项目自定义结构 |
| | | //行项目原值 |
| | | public class QELinelatestInfo { |
| | | public String ProductCode { get; set; } |
| | | public String ProductName { get; set; } |
| | | public String SFDA_Status { get; set; } |
| | | public String Sales_Possibility { get; set; } |
| | | public Decimal ListPrice { get; set; } |
| | | public Decimal Cost { get; set; } |
| | | public Integer Specifications {get; set;} |
| | | public string GuranteeType {get; set;} |
| | | public Decimal Intra_Trade_Gurantee {get; set;} |
| | | public Decimal ProductEntend_gurantee_period_all {get; set;} |
| | | public Decimal Intra_Trade_Service {get; set;} |
| | | public Decimal Maintenance_Price_Year {get; set;} |
| | | public Boolean CanNotCancelledGurantee {get; set;} |
| | | public Boolean Is_DangerousChemicals {get; set;} |
| | | } |
| | | //行项目新值 |
| | | public class QELine { |
| | | public Integer lineNo; |
| | | public String Asset_Model; |
| | | public String Sales_Possibility; |
| | | public QuoteLineItem pageObject; |
| | | public Decimal Cost_c; |
| | | public Decimal Cost_Subtotal_c; |
| | | public Decimal ListPrice_Page; |
| | | public String StorageStatus; |
| | | public Integer Specifications; |
| | | public String VenderName; |
| | | public Boolean CanNotCancelledGurantee; |
| | | public Boolean Is_DangerousChemicals; |
| | | public QELinelatestInfo latestInfo; |
| | | public boolean changed_name; |
| | | public boolean changed_sfda; |
| | | public boolean changed_list; |
| | | public boolean changed_cost; |
| | | public boolean haveno_Register; |
| | | public boolean wrong_Register; |
| | | public String Estimated_ConsumptionDueDate; |
| | | public Decimal GuranteePrice; |
| | | public Decimal ProductGuranteePrice; |
| | | public decimal Maintenance_Price_Year; |
| | | public String Category5; |
| | | public QELine(){} |
| | | public QELine(QuoteLineItem qli, Integer i, String copyQuoId) { |
| | | this.lineNo = i; |
| | | pageObject = qli.clone(); |
| | | pageObject.Id__c = qli.PricebookEntry.Product2Id; |
| | | pageObject.Quantity__c = qli.Quantity; |
| | | if (String.isNotBlank(copyQuoId)) { |
| | | pageObject.SFDA_Status__c = qli.PricebookEntry.Product2.SFDA_Status__c; |
| | | pageObject.Name__c = qli.PricebookEntry.Product2.Name; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | Category5 = qli.PricebookEntry.Product2.Category5__c; |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | this.Asset_Model = qli.Asset_Model_No__c; |
| | | if (qli.Cost__c > 0 && qli.Quantity > 0) { |
| | | this.Cost_Subtotal_c = qli.Cost__c * qli.Quantity; |
| | | } |
| | | this.VenderName = qli.PricebookEntry.Product2.VenderName__c; |
| | | if(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c != null){ |
| | | this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c).replaceAll('-','/'); |
| | | }else{ |
| | | this.Estimated_ConsumptionDueDate = ''; |
| | | } |
| | | if(VenderName==null||VenderName==''){ |
| | | this.VenderName =' 无 '; |
| | | } |
| | | this.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c; |
| | | this.Is_DangerousChemicals = qli.PricebookEntry.Product2.Is_DangerousChemicals__c; |
| | | this.StorageStatus = qli.PricebookEntry.Product2.StorageStatus__c; |
| | | this.ListPrice_Page = qli.ListPrice__c; |
| | | this.Cost_c = qli.Cost__c; |
| | | pageObject.Subtotal__c = qli.TotalPrice__c; |
| | | pageObject.UnitPrice_Page__c = qli.UnitPrice__c; |
| | | latestInfo = new QELinelatestInfo(); |
| | | latestInfo.ProductCode = qli.ProductCode__c; |
| | | latestInfo.ProductName = qli.PricebookEntry.Product2.Name; |
| | | latestInfo.SFDA_Status = qli.PricebookEntry.Product2.SFDA_Status__c; |
| | | latestInfo.ProductEntend_gurantee_period_all = qli.PricebookEntry.Product2.Entend_gurantee_period_all__c; |
| | | if(qli.Quote.Opportunity.Trade__c == '内貿'){ |
| | | latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c; |
| | | latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.Intra_Trade_Service_RMB__c; |
| | | if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){ |
| | | latestInfo.Maintenance_Price_Year = 0; |
| | | }else{ |
| | | latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Maintenance_Price_Year__c; |
| | | } |
| | | }else if(qli.Quote.Opportunity.Trade__c == '外貿'){ |
| | | latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c; |
| | | latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.NoDiscount_Foreign__c; |
| | | if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){ |
| | | latestInfo.Maintenance_Price_Year = 0; |
| | | }else{ |
| | | latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Repair_Contract_USD__c; |
| | | } |
| | | } |
| | | latestInfo.GuranteeType = qli.PricebookEntry.Product2.GuranteeType__c; |
| | | latestInfo.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c; |
| | | this.Maintenance_Price_Year = qli.Maintenance_Price_Year__c; |
| | | this.GuranteePrice = qli.GuranteePrice__c; |
| | | this.ProductGuranteePrice = qli.ProductGuranteePrice__c; |
| | | latestInfo.Sales_Possibility = qli.PricebookEntry.Product2.Sales_Possibility__c; |
| | | if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) { |
| | | latestInfo.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + ''); |
| | | } |
| | | latestInfo.ListPrice = qli.Product_ListPrice__c; |
| | | latestInfo.Cost = qli.Product_Cost__c; |
| | | if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) { |
| | | this.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + ''); |
| | | } |
| | | this.changed_name = false; |
| | | this.changed_sfda = false; |
| | | this.changed_list = false; |
| | | this.changed_cost = false; |
| | | this.haveno_Register = false; |
| | | this.wrong_Register = false; |
| | | } |
| | | public QELine(Integer i,Boolean Is_DangerousChemicals,Boolean CanNotCancelledGurantee,String VenderName, |
| | | Date Estimated_ConsumptionDueDate, |
| | | String PricebookEntryId, |
| | | String Asset_Model, String StorageStatus, |
| | | String ProductCode, String Id_c, |
| | | String SFDA_Status_c, String Sales_Possibility_c, |
| | | String Name_c, String BSS_Category_c, |
| | | Integer Quantity, Decimal ListPrice_c, |
| | | Decimal UnitPrice_c, Decimal Cost_c, |
| | | Decimal Packing_list_manual |
| | | , Decimal Entend_gurantee_period_all |
| | | , decimal ProductGuranteePrice |
| | | , string GuranteeType |
| | | , Decimal productServicePrice |
| | | , Decimal productMaintenance_Price_Year |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,String Category5 |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ) { |
| | | pageObject = New QuoteLineItem(); |
| | | pageObject.Quantity__c = Quantity; |
| | | this.lineNo = i; |
| | | this.Asset_Model = Asset_Model; |
| | | this.Sales_Possibility = Sales_Possibility_c; |
| | | if(Estimated_ConsumptionDueDate != null){ |
| | | this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(Estimated_ConsumptionDueDate).replaceAll('-','/'); |
| | | }else{ |
| | | this.Estimated_ConsumptionDueDate = ''; |
| | | } |
| | | this.StorageStatus = StorageStatus; |
| | | pageObject.Id__c = Id_c; |
| | | pageObject.SFDA_Status__c = SFDA_Status_c; |
| | | pageObject.Name__c = Name_c; |
| | | pageObject.BSS_Category__c = BSS_Category_c; |
| | | this.ListPrice_Page = ListPrice_c; |
| | | pageObject.UnitPrice_Page__c = UnitPrice_c; |
| | | pageObject.Subtotal__c = UnitPrice_c * Quantity; |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | Category5 = Category5; |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | if(VenderName==null||VenderName==''){ |
| | | this.VenderName =' 无 '; |
| | | }else{ |
| | | this.VenderName = VenderName; |
| | | } |
| | | this.CanNotCancelledGurantee = CanNotCancelledGurantee; |
| | | this.Is_DangerousChemicals = Is_DangerousChemicals; |
| | | pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all; |
| | | pageObject.productServicePrice__c = productServicePrice; |
| | | pageObject.GuranteeType__c = GuranteeType; |
| | | this.ProductGuranteePrice = ProductGuranteePrice; |
| | | this.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | this.Cost_c = Cost_c; |
| | | this.Cost_Subtotal_c = Cost_c * Quantity; |
| | | pageObject.PricebookEntryId = PricebookEntryId; |
| | | latestInfo = New QELinelatestInfo(); |
| | | latestInfo.ProductCode = ProductCode; |
| | | latestInfo.ProductName = Name_c; |
| | | latestInfo.SFDA_Status = SFDA_Status_c; |
| | | latestInfo.Sales_Possibility = Sales_Possibility_c; |
| | | latestInfo.ListPrice = this.ListPrice_Page; |
| | | latestInfo.Cost = pageObject.Cost__c; |
| | | latestInfo.ProductEntend_gurantee_period_all = Entend_gurantee_period_all; |
| | | latestInfo.Intra_Trade_Gurantee = ProductGuranteePrice; |
| | | latestInfo.Intra_Trade_Service = productServicePrice; |
| | | latestInfo.GuranteeType = GuranteeType; |
| | | latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | latestInfo.CanNotCancelledGurantee = CanNotCancelledGurantee; |
| | | latestInfo.Is_DangerousChemicals = Is_DangerousChemicals; |
| | | if (Packing_list_manual != null) { |
| | | latestInfo.Specifications = integer.valueof('' + Packing_list_manual); |
| | | } |
| | | if (Packing_list_manual != null) { |
| | | this.Specifications = integer.valueof('' + Packing_list_manual); |
| | | } |
| | | this.changed_name = false; |
| | | this.changed_sfda = false; |
| | | this.changed_list = false; |
| | | this.changed_cost = false; |
| | | this.haveno_Register = false; |
| | | this.wrong_Register = false; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | @isTest |
| | | public class lexNewQuoteEntryControllerTest { |
| | | static final String RC_BYOUIN = '病院'; |
| | | static final String RC_HANBAOITEN = '販売店'; |
| | | static final String RC_KEIYAKU = '契約'; |
| | | private static String quoteNo = 'textQutote01'; |
| | | public static String CurrencyIso = 'CNY'; |
| | | private static Boolean isUnitPrice = true; |
| | | private static Boolean isOfferAmount = true; |
| | | private static Boolean isTotalPrice = true; |
| | | private static Boolean isDiscountRate = true; |
| | | private static Boolean isDiscountAmount = true; |
| | | private static Boolean isTradingPrice = true; |
| | | private static Boolean isContractDetail = true; |
| | | |
| | | private static Date offerExpireDate = Date.today(); |
| | | private static String clientName = 'test client'; |
| | | private static String offerComment = 'test comment'; |
| | | private static Date offerPrintDate = Date.today(); |
| | | private static String agentName = 'test agent name'; |
| | | @isTest |
| | | static void Test1(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','',''); |
| | | PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | quoteflg = true; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | lexNewQuoteEntryController.setOppFromOppInfo(); |
| | | } |
| | | @isTest |
| | | static void Test2(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | |
| | | Product_Set_Detail__c psd1 = new Product_Set_Detail__c(); |
| | | psd1.Product_Set__c = ps1.id; |
| | | psd1.Price__c = 100; |
| | | psd1.Quantity__c = 10; |
| | | psd1.Product__c = product1.id; |
| | | |
| | | insert psd1; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122'); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1',''); |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String setProduct_text = ps1.Id; |
| | | String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc); |
| | | String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1'; |
| | | String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | private static Id pricebookId = ControllerUtil.getStandardPricebook().Id; |
| | | |
| | | static testMethod void Test3(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | // 产品 |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'Prd1'; |
| | | prd1.ProductCode = 'Prd1'; |
| | | prd1.Repair_Product_Code__c = 'Prd1_RP'; |
| | | prd1.Name = 'Prd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Category2__c = '本体'; |
| | | prd1.Category3__c = '纤维镜'; |
| | | prd1.Category4__c = 'CV'; |
| | | prd1.Category5__c = '260SL系列'; |
| | | prd1.Asset_Model_No__c = '1001'; |
| | | prd1.Important_product__c = true; |
| | | prd1.Important_Rroduct_1GI__c = true; |
| | | insert prd1; |
| | | |
| | | PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id); |
| | | entry.UnitPrice = 0; |
| | | entry.IsActive = true; |
| | | entry.UseStandardPrice = false; |
| | | entry.CurrencyIsoCode = 'CNY'; |
| | | insert entry; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | lexNewQuoteEntryController.selectAccountById(contractA.Id); |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | insert opp; |
| | | |
| | | |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":true,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quos.OpportunityId = opp.Id; |
| | | quos.Pricebook2Id = pricebookId; |
| | | quos.Opportunity.RecordType.Id=recKeiyaku.Id; |
| | | // 删除ID属性 |
| | | // 执行插入操作 |
| | | insert quos; |
| | | |
| | | Map<String,String> result = new Map<String,String>(); |
| | | lexNewQuoteEntryController.changedAfterPrint=true; |
| | | lexNewQuoteEntryController.newQuoteFlag=true; |
| | | // lexNewQuoteEntryController.dataEntry(); |
| | | lexNewQuoteEntryController.qname=true; |
| | | lexNewQuoteEntryController.dfpp=true; |
| | | lexNewQuoteEntryController.qacc=true; |
| | | lexNewQuoteEntryController.qaapc=true; |
| | | lexNewQuoteEntryController.Agency1=true; |
| | | lexNewQuoteEntryController.nAgency1=true; |
| | | lexNewQuoteEntryController.oapp=true; |
| | | lexNewQuoteEntryController.noapp=true; |
| | | lexNewQuoteEntryController.Agency2=true; |
| | | lexNewQuoteEntryController.nAgency2=true; |
| | | lexNewQuoteEntryController.aapp=true; |
| | | lexNewQuoteEntryController.naapp=true; |
| | | lexNewQuoteEntryController.resultFlag(result); |
| | | lexNewQuoteEntryController.selectQuoteById(quos.Id); |
| | | |
| | | // 报价行项目 |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quos.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = prd1.id; |
| | | target.PricebookEntryId = entry.Id; |
| | | insert target; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | lexNewQuoteEntryController.selectQuoteLineItem(quos.Id,opp.Id); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),''); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'',''); |
| | | lexNewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',true); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = true; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoteGurantee_Periodc = null; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | Boolean quoteflg = true; |
| | | prd1.Category5__c = '虚拟'; |
| | | update prd1; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,'',quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false); |
| | | quoIdc = quos.Id; |
| | | oppIdc = null; |
| | | oppInfoc = JSON.serialize(opp); |
| | | lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false); |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | String setProduct_text = ps1.Id; |
| | | String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc); |
| | | } |
| | | @isTest |
| | | static void Test4(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'USD'; |
| | | opp.Is_Corrosion__c = false; |
| | | opp.Purchase_Type__c = 'ET24時間販売'; |
| | | opp.SAP_Province__c='上海市'; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','',''); |
| | | PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | quoteflg = true; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | newQuoteFlagc = false; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | lexNewQuoteEntryController.setOppFromOppInfo(); |
| | | } |
| | | |
| | | static testMethod void Test5(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | // 产品 |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'Prd1'; |
| | | prd1.ProductCode = 'Prd1'; |
| | | prd1.Repair_Product_Code__c = 'Prd1_RP'; |
| | | prd1.Name = 'Prd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Category2__c = '本体'; |
| | | prd1.Category3__c = '纤维镜'; |
| | | prd1.Category4__c = 'CV'; |
| | | prd1.Category5__c = '260SL系列'; |
| | | prd1.Asset_Model_No__c = '1001'; |
| | | prd1.Important_product__c = true; |
| | | prd1.Important_Rroduct_1GI__c = true; |
| | | insert prd1; |
| | | |
| | | |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | lexNewQuoteEntryController.selectAccountById(contractA.Id); |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = 'ET24時間販売'; |
| | | opp.Promise_Class__c = '内貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | opp.Is_Corrosion__c=true; |
| | | opp.SAP_Province__c='上海市'; |
| | | insert opp; |
| | | List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1',''); |
| | | PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id); |
| | | entry.UnitPrice = 0; |
| | | entry.IsActive = true; |
| | | entry.UseStandardPrice = false; |
| | | entry.CurrencyIsoCode = 'CNY'; |
| | | insert entry; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | // 删除ID属性 |
| | | quos.Id = null; |
| | | quos.OpportunityId = opp.Id; |
| | | quos.Opportunity.RecordType.Id=recKeiyaku.Id; |
| | | quos.Pricebook2Id = pricebookId; |
| | | // 执行插入操作 |
| | | insert quos; |
| | | |
| | | lexNewQuoteEntryController.selectQuoteById(quos.Id); |
| | | // 报价行项目 |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quos.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | // target.TotalPrice = 100; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = prd1.id; |
| | | target.PricebookEntryId = entry.Id; |
| | | target.Item_Order__c = 3; |
| | | insert target; |
| | | |
| | | |
| | | |
| | | lexNewQuoteEntryController.selectQuoteLineItem(target.Id,opp.Id); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),''); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'',''); |
| | | lexNewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',false); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = quos.Id; |
| | | quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | // 删除ID属性 |
| | | quos.Id = null; |
| | | quos.OpportunityId = opp.Id; |
| | | quos.Pricebook2Id = pricebookId; |
| | | // 执行插入操作 |
| | | String quoteGurantee_Periodc = null; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,true); |
| | | lexNewQuoteEntryController.WinOrDecideAlert=true; |
| | | lexNewQuoteEntryController.productStatusUpdated=false; |
| | | |
| | | } |
| | | |
| | | @isTest |
| | | static void Test6(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | |
| | | Product_Set_Detail__c psd1 = new Product_Set_Detail__c(); |
| | | psd1.Product_Set__c = ps1.id; |
| | | psd1.Price__c = 100; |
| | | psd1.Quantity__c = 10; |
| | | psd1.Product__c = product1.id; |
| | | |
| | | insert psd1; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122'); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1',''); |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String setProduct_text = ps1.Id; |
| | | String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc); |
| | | String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1'; |
| | | String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | @isTest |
| | | static void Test7(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | lexNewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"暂停出库(短期)","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"暂停出库(短期)","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"Id__c":null,"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[1].pageObject.Id__c = product2.Id; |
| | | for(lexNewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | } |
| | | @isTest |
| | | static void Test8(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'USD'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | lexNewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | product1.LastbuyProductFLG__c = true; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | LastbuyProduct__c lbp = new LastbuyProduct__c(); |
| | | lbp.Name = 'Test0215'; |
| | | lbp.ProductName__c = product1.Id; |
| | | lbp.InquiryCode__c = opp.Id; |
| | | lbp.effectiveFLG__c = true; |
| | | lbp.LastbuyQuantity__c = 1; |
| | | insert lbp; |
| | | Quote quote = new Quote( Name = 'テスト見積'); |
| | | quote.OpportunityId = opp.Id; |
| | | quote.Pricebook2Id = pricebook.id; |
| | | quote.Quote_No__c = 'textQutote01'; |
| | | quote.Unit_Price__c = isUnitPrice; |
| | | quote.Offer_Amount__c = isOfferAmount; |
| | | quote.TOTAL__c = isTotalPrice; |
| | | quote.Discount__c = isDiscountRate; |
| | | quote.Pricing__c = isDiscountAmount; |
| | | quote.Preferential_Trading_Price__c = isTradingPrice; |
| | | quote.Contract__c = isContractDetail; |
| | | quote.Quote_Comment__c = offerComment; |
| | | insert quote; |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quote.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = product1.id; |
| | | target.PricebookEntryId = pE.Id; |
| | | insert target; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id); |
| | | List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[0].pageObject.Quantity__c = 2; |
| | | activities[0].pageObject.PricebookEntryId = pE.Id; |
| | | for(lexNewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | } |
| | | @isTest |
| | | static void Test9(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'USD'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | lexNewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | product1.LastbuyProductFLG__c = false; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | LastbuyProduct__c lbp = new LastbuyProduct__c(); |
| | | lbp.Name = 'Test0215'; |
| | | lbp.ProductName__c = product1.Id; |
| | | lbp.InquiryCode__c = opp.Id; |
| | | lbp.effectiveFLG__c = true; |
| | | lbp.LastbuyQuantity__c = 1; |
| | | // insert lbp; |
| | | Quote quote = new Quote( Name = 'テスト見積'); |
| | | quote.OpportunityId = opp.Id; |
| | | quote.Pricebook2Id = pricebook.id; |
| | | quote.Quote_No__c = 'textQutote01'; |
| | | quote.Unit_Price__c = isUnitPrice; |
| | | quote.Offer_Amount__c = isOfferAmount; |
| | | quote.TOTAL__c = isTotalPrice; |
| | | quote.Discount__c = isDiscountRate; |
| | | quote.Pricing__c = isDiscountAmount; |
| | | quote.Preferential_Trading_Price__c = isTradingPrice; |
| | | quote.Contract__c = isContractDetail; |
| | | quote.Quote_Comment__c = offerComment; |
| | | insert quote; |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quote.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = product1.id; |
| | | target.PricebookEntryId = pE.Id; |
| | | insert target; |
| | | License_Information__c linc = new License_Information__c( name='Test20181204', |
| | | LicenseType__c = '医疗器械经营许可证', |
| | | BusinessLicense__c = '20180522', |
| | | ValidFrom__c = date.newinstance(2018, 05, 22), |
| | | ValidTo__c = date.newinstance(2088, 05, 22), |
| | | Scope3__c = '6815;6822;6823;6825', |
| | | LicenseAndAccount__c = sellerA.id |
| | | ); |
| | | insert linc; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id); |
| | | List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[0].pageObject.Quantity__c = 2; |
| | | activities[0].pageObject.PricebookEntryId = pE.Id; |
| | | activities[0].pageObject.SFDA_Status__c = '暂停出库(短期)'; |
| | | for(lexNewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quos.IsQuoteTrial__c = true; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | } |
| | | @isTest |
| | | static void Test10(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'USD'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | lexNewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | product1.LastbuyProductFLG__c = false; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | LastbuyProduct__c lbp = new LastbuyProduct__c(); |
| | | lbp.Name = 'Test0215'; |
| | | lbp.ProductName__c = product1.Id; |
| | | lbp.InquiryCode__c = opp.Id; |
| | | lbp.effectiveFLG__c = true; |
| | | lbp.LastbuyQuantity__c = 1; |
| | | // insert lbp; |
| | | Quote quote = new Quote( Name = 'テスト見積'); |
| | | quote.OpportunityId = opp.Id; |
| | | quote.Pricebook2Id = pricebook.id; |
| | | quote.Quote_No__c = 'textQutote01'; |
| | | quote.Unit_Price__c = isUnitPrice; |
| | | quote.Offer_Amount__c = isOfferAmount; |
| | | quote.TOTAL__c = isTotalPrice; |
| | | quote.Discount__c = isDiscountRate; |
| | | quote.Pricing__c = isDiscountAmount; |
| | | quote.Preferential_Trading_Price__c = isTradingPrice; |
| | | quote.Contract__c = isContractDetail; |
| | | quote.Quote_Comment__c = offerComment; |
| | | insert quote; |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quote.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = product1.id; |
| | | target.PricebookEntryId = pE.Id; |
| | | insert target; |
| | | License_Information__c linc = new License_Information__c( name='Test20181204', |
| | | LicenseType__c = '医疗器械经营许可证', |
| | | BusinessLicense__c = '20180522', |
| | | ValidFrom__c = date.newinstance(2018, 05, 22), |
| | | ValidTo__c = date.newinstance(2088, 05, 22), |
| | | Scope3__c = '6815;6822;6823;6825', |
| | | LicenseAndAccount__c = sellerA.id |
| | | ); |
| | | insert linc; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = lexNewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id); |
| | | List<lexNewQuoteEntryController.QELine> activities = (List<lexNewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexNewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[0].pageObject.Quantity__c = 2; |
| | | activities[0].pageObject.PricebookEntryId = pE.Id; |
| | | activities[0].pageObject.SFDA_Status__c = '暂停出库(短期)'; |
| | | for(lexNewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = false; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quos.IsQuoteTrial__c = true; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | } |
| | | @isTest |
| | | static void Test11(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | |
| | | Product_Set_Detail__c psd1 = new Product_Set_Detail__c(); |
| | | psd1.Product_Set__c = ps1.id; |
| | | psd1.Price__c = 100; |
| | | psd1.Quantity__c = 10; |
| | | psd1.Product__c = product1.id; |
| | | |
| | | insert psd1; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('12','121','122'); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<Product_Set__c> pstc = lexNewQuoteEntryController.serSetContact('品','1',''); |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String setProduct_text = ps1.Id; |
| | | String setprd = lexNewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc); |
| | | String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1'; |
| | | String eximt = lexNewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | |
| | | @isTest |
| | | static void Test12(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = 'ET24時間販売'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | opp.Is_Corrosion__c=true; |
| | | opp.SAP_Province__c='上海市'; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexNewQuoteEntryController.QuotCalfagAss(); |
| | | lexNewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexNewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexNewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexNewQuoteEntryController.InitData ind = lexNewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | List<PricebookEntry> pri = lexNewQuoteEntryController.serContact('','',''); |
| | | PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | quoteflg = true; |
| | | lexNewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | lexNewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | lexNewQuoteEntryController.setOppFromOppInfo(); |
| | | |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | // Author: Fu,Yu |
| | | // Created Date: 2023/08/07 |
| | | // Purpose: get page layout and record data |
| | | // Test Class: lexSINewQuoteEntryControllerTest |
| | | public class lexSINewQuoteEntryController { |
| | | public static Integer quoteEntryMaxLine; |
| | | public static List<QELine> activities; |
| | | public static List<QELine> tmpactivities; |
| | | public static List<QuoteLineItem> CheckItem; |
| | | public static Boolean WinOrDecideAlert; |
| | | public static Boolean errorflg; |
| | | public static String errormessage; |
| | | public static String errormessagewarn; |
| | | public static Map<Id, Product2> prd2LatestValMap; |
| | | public static Boolean productStatusUpdated; |
| | | public static Opportunity opp; |
| | | public static Quote quo; |
| | | public static Boolean enableSales; |
| | | public static String quoId; |
| | | public static String oppId; |
| | | public static Boolean newQuoteFlag; |
| | | public static Boolean changedAfterPrint; |
| | | public static string quoteGurantee_Period; |
| | | public static string quotemultiYearWarranty; |
| | | public static Pricebook2 standardPricebook; |
| | | public static Boolean detail; |
| | | public static String selection_hp; |
| | | public static String quoIdreturn; |
| | | public static String trade; |
| | | public static String searchMode; |
| | | public static Boolean filg; |
| | | public static Integer flglastbuy; |
| | | public static String errorProductmodel; |
| | | public static Boolean SkipQuotefilg; |
| | | public static Boolean QuoteDecision; |
| | | //字段报错标识 start |
| | | public static Boolean dfpp = false; |
| | | public static Boolean qname = false; |
| | | public static Boolean qacc = false; |
| | | public static Boolean qaapc = false; |
| | | public static Boolean Agency1 = false; |
| | | public static Boolean nAgency1 = false; |
| | | public static Boolean oapp = false; |
| | | public static Boolean noapp = false; |
| | | public static Boolean Agency2 = false; |
| | | public static Boolean nAgency2 = false; |
| | | public static Boolean aapp = false; |
| | | public static Boolean naapp = false; |
| | | //字段报错标识 end |
| | | public static Boolean hongzi = false; |
| | | @AuraEnabled |
| | | //根据报价Id检索报价 |
| | | public static Quote selectQuoteById(String quoId){ |
| | | Quote quo = new Quote(); |
| | | |
| | | if(String.isNotBlank(quoId)){ |
| | | List<Quote> quoList = |
| | | [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | Dealer_Final_Price__c, TotalPrice__c, Estimation_List_Price__c, QuoteNumber, |
| | | CreatedByid,Queto_Confirm_Date__c, |
| | | QuoteToName, Quote_Expiration_Date__c, Quote_Comment__c, Stocking_Price__c, Unit_Price__c, |
| | | Offer_Amount__c, TOTAL__c, Discount__c, Pricing__c, Preferential_Trading_Price__c, Contract__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Print_HP_Name__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_No__c, |
| | | Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c, Discount_Amount__c, Discount_Amount_Calculate__c, Installation_location__c, |
| | | QuoteTotal_Page__c, Dealer_Final_Price_Page__c, Quote_Adjust_Amount_Page__c, OCM_Agent1_Price_Page__c, Agent1_Agent2_Price_Page__c |
| | | , AgencyDiscount__c,OCM_Sales_Forecast__c//预测金额修改 fy |
| | | , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c, |
| | | Preferential_Gurantee_Period__c,LineItemCount |
| | | ,IsQuoteTrial__c,OpportunityId,Opportunity.RecordType.DeveloperName |
| | | FROM Quote Where Id = :quoId]; |
| | | quo = quoList[0]; |
| | | } |
| | | |
| | | return quo; |
| | | } |
| | | //检索报价行项目行数 |
| | | @AuraEnabled |
| | | public static List<Quote> selectQuoteListLineItemCount(String quoId,String oppId,String copyid){ |
| | | List<Quote> quoList = new List<Quote>(); |
| | | if(String.isBlank(oppId)){ |
| | | if(String.isNotBlank(quoId)){ |
| | | quoList = [select Id, OpportunityId, Opportunity.RecordType.DeveloperName,LineItemCount From Quote Where Id = :quoId]; |
| | | } |
| | | }else{ |
| | | if(String.isBlank(copyid)){ |
| | | quoList =[select Id, OpportunityId,LineItemCount From Quote Where OpportunityId = :oppId]; |
| | | } |
| | | } |
| | | return quoList; |
| | | } |
| | | //检索报价行项目 |
| | | @AuraEnabled |
| | | public static String selectQuoteLineItem(String quoId,String copyid){ |
| | | List<QuoteLineItem> items = |
| | | [Select Id, Asset_Model_No__c, SFDA_Status__c, Product_Sales_Possibility__c,ProductSetName__c, |
| | | Name__c, BSS_Category__c, Quote.Quote_Print_Date__c,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c, |
| | | Qty_Unit__c, Cost__c, UnitPrice__c, ListPrice__c, Quantity, TotalPrice__c, |
| | | PricebookEntry.Product2.SFDA_Status__c, ProductCode__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name, |
| | | PricebookEntryId, PricebookEntry.Product2Id, UnitPrice_Page__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.StorageStatus__c |
| | | , AgencyUnitPrice__c, AgencySubtotal__c, Present__c |
| | | , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c, |
| | | ServicePrice__c , GuranteePrice__c, ProductEntend_gurantee_period_all__c, |
| | | ProductGuranteePrice__c, GuranteeType__c, |
| | | warrantyType__c, productServicePrice__c, NoDiscountTotal__c |
| | | , provistonPeriod__c |
| | | , PricebookEntry.Product2.Entend_gurantee_period_all__c |
| | | , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c |
| | | , PricebookEntry.Product2.Intra_Trade_Service_RMB__c |
| | | , PricebookEntry.Product2.GuranteeType__c |
| | | , PricebookEntry.Product2.Maintenance_Price_Year__c |
| | | , Maintenance_Price_Year__c |
| | | ,PricebookEntry.Product2.Repair_Contract_USD__c |
| | | ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c |
| | | ,PricebookEntry.Product2.NoDiscount_Foreign__c |
| | | ,PricebookEntry.Product2.LastbuyProductFLG__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,PricebookEntry.Product2.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ,Quote.Opportunity.Trade__c |
| | | ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c |
| | | From QuoteLineItem where Quoteid = :quoId Order by Item_Order__c, Id]; |
| | | activities = new List<QELine>(); |
| | | QELine cle = new QELine(); |
| | | Integer i = 0; |
| | | if (items.size() > 0) { |
| | | for (QuoteLineItem olt : items) { |
| | | i++; |
| | | cle = new QELine(olt,i, copyid); |
| | | activities.add(cle); |
| | | } |
| | | } |
| | | return JSON.serialize(activities)+'---'+JSON.serialize(items); |
| | | } |
| | | //检索登录人信息 |
| | | @AuraEnabled |
| | | public static User selecUser(){ |
| | | User usobj =new User(); |
| | | List<User> us = new List<User>(); |
| | | String userid = UserInfo.getUserId(); |
| | | if (userid != null) { |
| | | us = [Select Id,Quote_Correct__c, Quote_Special_Operation__c, Cost_Referable__c, ViewSpecialAgencyAmout__c,ProfileId From User Where Id = :userid]; |
| | | if (us.size() > 0) { |
| | | usobj = us[0]; |
| | | } |
| | | } |
| | | return usobj; |
| | | } |
| | | @AuraEnabled |
| | | public static Boolean getquoDes() { |
| | | Schema.DescribeSObjectResult quoteDesc = Quote.SObjectType.getDescribe(); |
| | | return quoteDesc.isUpdateable(); |
| | | } |
| | | @AuraEnabled |
| | | public static Boolean QuotCalfagAss(){ |
| | | String ProfileId= UserInfo.getProfileId().subString(0,15); |
| | | String QuotationCalculationPermission = System.Label.QuotationCalculationPermission; |
| | | return QuotationCalculationPermission.contains(ProfileId); |
| | | } |
| | | //根据询价Id检索询价 |
| | | @AuraEnabled |
| | | public static Opportunity selectOpportunityById(String oppId){ |
| | | Opportunity opp = new Opportunity(); |
| | | List<Opportunity> oppList =[SELECT Account.Name,BusinessFileArchived__c, Account.RecordType.DeveloperName,Opportunity_sub_owner__c, |
| | | CLBIC_Category__c, HP_Name__c, Name, CurrencyIsoCode, Wholesale_Price__c, Department_Name__c, |
| | | Direct_Separate__c, Trade__c, AccountId, New_Opportunity__c, Estimation_Decision__c, SAP_Send_OK__c, Sales_Root__c, |
| | | Agency1__c, Agency2__c, Stocking_Price__c, Purchasing_Cost__c, Opportunity_No__c, StageName, |
| | | Agency1__r.Special__c, Agency2__r.Special__c, Account.Parent.Special__c |
| | | , Authorized_DB_No__c, Authorized_Finish_Sales__c, If_Need_Authorize__c |
| | | , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c |
| | | , Hospital__c, Department_Class__c |
| | | ,Is_Corrosion__c, |
| | | If_Need_PriceApply__c |
| | | ,CelonOpportunity__c |
| | | , If_Account_Change__c |
| | | ,Configuration_Suggestion__c , Configuration_Suggestion_Feedback__c |
| | | , Salesdepartment_Owner__c |
| | | ,Opportunity_Category__c |
| | | FROM Opportunity Where Id = :oppId]; |
| | | if (oppList.size() > 0) { |
| | | opp = oppList[0]; |
| | | } |
| | | return opp; |
| | | } |
| | | //检索询价行项目 |
| | | // @AuraEnabled |
| | | // public static String selectOpportunityLineItem(String oppId){ |
| | | // List<OpportunityLineItem> items = New List<OpportunityLineItem>(); |
| | | // items = [Select Id, Asset_Model_No__c, SFDA_Status__c, Name__c, ProductCode__c, PricebookEntry.Product2.StorageStatus__c, |
| | | // Qty_Unit__c, Cost__c, UnitPrice, ListPrice__c, Quantity, BSS_Category__c, TotalPrice,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c, |
| | | // PricebookEntry.Product2.SFDA_Status__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name, |
| | | // PricebookEntryId, PricebookEntry.Product2Id, Opportunity.Trade__c, PricebookEntry.Product2.Intra_Trade_List_RMB__c, PricebookEntry.Product2.Intra_Trade_Cost_RMB__c, |
| | | // PricebookEntry.Product2.Foreign_Trade_List_US__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.Foreign_Trade_Cost_US__c, UnitPrice__c, TotalPrice__c |
| | | // , AgencyUnitPrice__c, AgencySubtotal__c, Present__c |
| | | // , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c, |
| | | // ServicePrice__c , GuranteePrice__c, |
| | | // ProductEntend_gurantee_period_all__c, |
| | | // ProductGuranteePrice__c, GuranteeType__c, |
| | | // warrantyType__c, productServicePrice__c, |
| | | // NoDiscountTotal__c |
| | | // , provistonPeriod__c |
| | | // , PricebookEntry.Product2.Entend_gurantee_period_all__c |
| | | // , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c |
| | | // , PricebookEntry.Product2.Intra_Trade_Service_RMB__c |
| | | // , PricebookEntry.Product2.GuranteeType__c |
| | | // , PricebookEntry.Product2.Maintenance_Price_Year__c |
| | | // , Maintenance_Price_Year__c |
| | | // ,PricebookEntry.Product2.Repair_Contract_USD__c |
| | | // ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c |
| | | // ,PricebookEntry.Product2.NoDiscount_Foreign__c |
| | | // ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c |
| | | // From OpportunityLineItem |
| | | // Where OpportunityId = :oppId Order by Item_Order__c, Id]; |
| | | |
| | | // activities = new List<QELine>(); |
| | | // QELine cle = new QELine(); |
| | | // if (items.size() > 0) { |
| | | // for(OpportunityLineItem otlt : items) { |
| | | // cle = new QELine(otlt); |
| | | // activities.add(cle); |
| | | // } |
| | | // } |
| | | // return JSON.serialize(activities); |
| | | // } |
| | | //检索产品 |
| | | @AuraEnabled |
| | | public static List<Product2> selectProById(String proList){ |
| | | List<String> product2Ids = (List<String>)JSON.deserialize(proList,List<String>.class); |
| | | List<Product2> plo = |
| | | [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c,Packing_list_manual__c |
| | | , Intra_Trade_Gurantee_RMB__c, |
| | | Intra_Trade_Service_RMB__c |
| | | From Product2 Where Id IN :product2Ids]; |
| | | return plo; |
| | | } |
| | | //检索客户 |
| | | @AuraEnabled |
| | | public static List<Account> selectAccountById(String accountid){ |
| | | List<Account> accs2 = [Select Id, RecordType.DeveloperName, Hospital__c, Agent_Ref__c From Account Where Id = :accountid]; |
| | | List<Account> accs = new List<Account>(); |
| | | if (accs2.size() > 0) { |
| | | if (accs2[0].RecordType.DeveloperName != 'AgencyContract') { |
| | | accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Hospital__c]; |
| | | } else { |
| | | accs = [Select Id, Name, Site, Alias_Name2__c From Account Where Id = :accs2[0].Agent_Ref__c]; |
| | | } |
| | | } |
| | | return accs; |
| | | } |
| | | //检索下拉列表值 |
| | | @AuraEnabled |
| | | public static List<Map<String,String>> getPicklistValues(String objstr, String fld ,Boolean ifempty){ |
| | | List<Map<String,String>> options = new List<Map<String,String>>(); |
| | | Map<String,String> space = new Map<String,String>(); |
| | | if(ifempty){ |
| | | space.put('label', '--无--'); |
| | | space.put('value', ''); |
| | | options.add(space); |
| | | } |
| | | |
| | | Schema.sObjectType objType = Schema.getGlobalDescribe().get(objstr); |
| | | Schema.DescribeSObjectResult objDescribe = objType.getDescribe(); |
| | | map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap(); |
| | | list<Schema.PicklistEntry> values = fieldMap.get(fld).getDescribe().getPickListValues(); |
| | | system.debug(objstr + '=' + values); |
| | | for (Schema.PicklistEntry a : values) |
| | | { |
| | | if (!a.isActive()) continue; |
| | | Map<String,String> ses = new Map<String,String>(); |
| | | ses.put('label', a.getLabel()); |
| | | ses.put('value', a.getValue()); |
| | | options.add(ses); |
| | | } |
| | | return options; |
| | | } |
| | | @AuraEnabled |
| | | public static Map<String,String> SaveQuote(String activitiesCan, |
| | | String CheckItemCan , |
| | | boolean WinOrDecideAlertc, |
| | | boolean productStatusUpdatedc, |
| | | String oppInfoc, |
| | | boolean enableSalesc, |
| | | String quoc, |
| | | String oppIdc, |
| | | String quoIdc, |
| | | boolean newQuoteFlagc, |
| | | Boolean changedAfterPrintc, |
| | | String quoteGurantee_Periodc, |
| | | String quotemultiYearWarrantyc, |
| | | String selection_hpc, |
| | | Boolean SkipQuotefilgc, |
| | | Boolean quoteflg){ |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | oppId = oppIdc; |
| | | quoId = quoIdc; |
| | | System.debug('quoId+'+quoId); |
| | | WinOrDecideAlert = WinOrDecideAlertc; |
| | | productStatusUpdated = productStatusUpdatedc; |
| | | newQuoteFlag = newQuoteFlagc; |
| | | changedAfterPrint = changedAfterPrintc; |
| | | quoteGurantee_Period = quoteGurantee_Periodc; |
| | | quotemultiYearWarranty = quotemultiYearWarrantyc; |
| | | selection_hp = selection_hpc; |
| | | SkipQuotefilg = SkipQuotefilgc; |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | if(String.isNotBlank(CheckItemCan)){ |
| | | CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class); |
| | | }else { |
| | | CheckItem = null; |
| | | } |
| | | enableSales = enableSalesc; |
| | | // errorMessagechack = null; |
| | | setOppFromOppInfo(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Map<String,String> result = new Map<String,String>(); |
| | | try { |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | if(quoteflg){ |
| | | // if (opp.If_Need_Authorize__c == true) { |
| | | // ID tmpid = opp.Agency2__c == null ? opp.Agency1__c : opp.Agency2__c; |
| | | // List<Account> accName = [select name from Account where id = : tmpid]; |
| | | // if(accName.size()>0){ |
| | | // if (accName[0].name != opp.Authorized_Finish_Sales__c) { |
| | | // errormessage = '请先授权后,再进行报价计算。'; |
| | | // result.put('errormessage', errormessage); |
| | | // return result; |
| | | // } |
| | | // } |
| | | // } |
| | | if(checkVirtual('包含虚拟产品,无法报价计算')){ |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | } |
| | | System.debug('suoding1'); |
| | | if (!dataCheck()) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | return result; |
| | | } |
| | | System.debug('suoding2'); |
| | | QuoteConfirm(quoId); |
| | | System.debug('suoding3'); |
| | | if (dataEntry() == false) { |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } else { |
| | | result.put('success', System.Label.Message_002); |
| | | if(String.isBlank(quoId)){ |
| | | result.put('quoId',quoIdreturn); |
| | | } |
| | | if(String.isNotBlank(quo.Quote_No__c)){ |
| | | result.put('QuoteNo',quo.Quote_No__c); |
| | | } |
| | | if(errormessagewarn != null){ |
| | | result.put('warn', errormessagewarn); |
| | | String act = JSON.serialize(activities); |
| | | result.put('act', act); |
| | | } |
| | | return result; |
| | | } |
| | | } catch (DmlException de) { |
| | | Database.rollback(sp); |
| | | // errormessage = de.getLineNumber()+'行'+de.getDmlMessage(0); |
| | | errormessage = de.getDmlMessage(0); |
| | | result.put('errormessage',errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, de.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, de.getStackTraceString()); |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | // errormessage = e.getLineNumber()+'行'+e.getMessage(); |
| | | errormessage = e.getMessage(); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, e.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, e.getStackTraceString()); |
| | | } |
| | | } |
| | | public static Map<String,String> resultFlag(Map<String,String> result){ |
| | | if(dfpp){ |
| | | result.put('dfpp', 'dfpp'); |
| | | } |
| | | if(qname){ |
| | | result.put('qname', 'qname'); |
| | | } |
| | | if(qacc){ |
| | | result.put('qacc', 'qacc'); |
| | | } |
| | | if(qaapc){ |
| | | result.put('qaapc', 'qaapc'); |
| | | } |
| | | if(Agency1){ |
| | | result.put('Agency1', 'Agency1'); |
| | | } |
| | | if(nAgency1){ |
| | | result.put('nAgency1', 'nAgency1'); |
| | | } |
| | | if(oapp){ |
| | | result.put('oapp', 'oapp'); |
| | | } |
| | | if(noapp){ |
| | | result.put('noapp', 'noapp'); |
| | | } |
| | | if(Agency2){ |
| | | result.put('Agency2', 'Agency2'); |
| | | } |
| | | if(nAgency2){ |
| | | result.put('nAgency2', 'nAgency2'); |
| | | } |
| | | if(aapp){ |
| | | result.put('aapp', 'aapp'); |
| | | } |
| | | if(naapp){ |
| | | result.put('naapp', 'naapp'); |
| | | } |
| | | return result; |
| | | } |
| | | @AuraEnabled |
| | | public static Map<String,String> Print(String activitiesCan, |
| | | String CheckItemCan , |
| | | boolean WinOrDecideAlertc, |
| | | boolean productStatusUpdatedc, |
| | | String oppInfoc, |
| | | boolean enableSalesc, |
| | | String quoc, |
| | | String oppIdc, |
| | | String quoIdc, |
| | | boolean newQuoteFlagc, |
| | | Boolean changedAfterPrintc, |
| | | String quoteGurantee_Periodc, |
| | | String quotemultiYearWarrantyc, |
| | | String selection_hpc, |
| | | Boolean SkipQuotefilgc, |
| | | Boolean QuoteDecisionc) { |
| | | oppId = oppIdc; |
| | | quoId = quoIdc; |
| | | System.debug('quoId+'+quoId); |
| | | WinOrDecideAlert = WinOrDecideAlertc; |
| | | productStatusUpdated = productStatusUpdatedc; |
| | | newQuoteFlag = newQuoteFlagc; |
| | | changedAfterPrint = changedAfterPrintc; |
| | | quoteGurantee_Period = quoteGurantee_Periodc; |
| | | quotemultiYearWarranty = quotemultiYearWarrantyc; |
| | | selection_hp = selection_hpc; |
| | | SkipQuotefilg = SkipQuotefilgc; |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | if(String.isNotBlank(CheckItemCan)){ |
| | | CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class); |
| | | }else { |
| | | CheckItem = null; |
| | | } |
| | | enableSales = enableSalesc; |
| | | QuoteDecision = QuoteDecisionc; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Map<String,String> result = new Map<String,String>(); |
| | | try { |
| | | if(checkVirtual('包含虚拟产品,无法打印')){ |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | setOppFromOppInfo(); |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | //Decide前or後 |
| | | if (QuoteDecision == true) { |
| | | //NoSave |
| | | } else { |
| | | if (dataCheck() == false ) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | return result; |
| | | } |
| | | |
| | | if (dataEntry() == false) { |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | } |
| | | List<Opportunity> opps = new List<Opportunity>(); |
| | | if (String.isBlank(oppId)) { |
| | | } else { |
| | | opps = [Select Id |
| | | From Opportunity Where Id = : oppId]; |
| | | if (opps.size() > 0) { |
| | | List<Quote> quos = New List<Quote>(); |
| | | //ligthing bug 修改 fy start |
| | | // if (String.isBlank(quoId)) { |
| | | // } else { |
| | | // quos = [Select Id, |
| | | // Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoId]; |
| | | if(String.isNotBlank(quoId)||(String.isBlank(quoId) && String.isNotBlank(quoIdreturn))){ |
| | | String quoIds = String.isNotBlank(quoId) ? quoId : quoIdreturn; |
| | | quos = [Select Id, |
| | | Quote_Print_Date__c, Quote_Date__c From Quote Where Id = : quoIds]; |
| | | //ligthing bug 修改 fy end |
| | | if (quos.size() > 0) { |
| | | //优惠成交价 |
| | | quos[0].Preferential_Trading_Price__c = quo.Preferential_Trading_Price__c; |
| | | //优惠折扣 |
| | | quos[0].Discount__c = quo.Discount__c; |
| | | //优惠价格 |
| | | quos[0].Pricing__c = quo.Pricing__c; |
| | | //单价 |
| | | quos[0].Unit_Price__c = quo.Unit_Price__c; |
| | | //报价金额 |
| | | quos[0].Offer_Amount__c = quo.Offer_Amount__c; |
| | | //Total |
| | | quos[0].TOTAL__c = quo.TOTAL__c; |
| | | //契約内容 |
| | | quos[0].Contract__c = quo.Contract__c; |
| | | //多年保修 start |
| | | quos[0].Preferential_Gurantee_Period__c = quo.Preferential_Gurantee_Period__c; |
| | | //多年保修 end |
| | | if (quos[0].Quote_Date__c == null) { |
| | | quos[0].Quote_Date__c = date.Today(); |
| | | opps[0].Estimation_Proposal_Date__c = date.Today(); |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | update opps[0]; |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | quos[0].Quote_Print_Date__c = date.Today(); |
| | | ControllerUtil.updQuote(quos[0]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // pageArrange(); |
| | | result.put('success', System.Label.Message_002); |
| | | if(String.isBlank(quoId)){ |
| | | result.put('quoId',quoIdreturn); |
| | | } |
| | | if(errormessagewarn != null){ |
| | | result.put('warn', errormessagewarn); |
| | | } |
| | | return result; |
| | | } catch (DmlException de) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = de.getDmlMessage(0); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, de.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, de.getStackTraceString()); |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = e.getMessage(); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | // system.debug(Logginglevel.ERROR, e.getMessage()); |
| | | // system.debug(Logginglevel.ERROR, e.getStackTraceString()); |
| | | } |
| | | } |
| | | // oppに画面の値を設定 |
| | | public static void setOppFromOppInfo() { |
| | | opp.Agency1__c = quo.Agency1__c; |
| | | opp.Agency2__c = quo.Agency2__c; |
| | | } |
| | | //保存chaeck |
| | | public static Boolean dataCheck() { |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | Boolean error = false; |
| | | Boolean error1 = false; |
| | | integer Gcnt = 0; |
| | | String lines = ''; |
| | | system.debug(oppId+'^^^^^^^'+lines); |
| | | if(oppId != null){ |
| | | lines = ControllerUtil.setQuote(oppId); |
| | | } |
| | | system.debug(oppId+'^^^^^^^'+lines); |
| | | if(lines!='Fin'){ |
| | | errorMessage = lines; |
| | | } |
| | | if (activities == null || activities.size() <= 0) { |
| | | errorflg = true; |
| | | errorMessage = '不允许保存空的报价单,请选择产品'; |
| | | return false; |
| | | } |
| | | if (WinOrDecideAlert && (!productStatusUpdated)) { |
| | | errorflg = true; |
| | | errorMessage = '产品状态发生变化,请更新'; |
| | | return false; |
| | | } |
| | | if (!checkSFDAStatus1(false)) { |
| | | errorflg = true; |
| | | errormessage = '请更新不可销售的产品。'; |
| | | return false; |
| | | } |
| | | List<String> product2Ids = new List<String>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine a : activities) { |
| | | if (!String.isBlank(a.pageObject.Id__c)) { |
| | | product2Ids.add(a.pageObject.Id__c); |
| | | } |
| | | } |
| | | Map<String, String> loopMap = new Map<String, String>(); |
| | | if (CheckItem != null) { |
| | | Gcnt = CheckItem.size(); |
| | | if (CheckItem.size() > 0) { |
| | | for (QuoteLineItem qli : CheckItem) { |
| | | loopMap.put(qli.PricebookEntry.Product2Id, qli.SFDA_Status__c); |
| | | } |
| | | } |
| | | } |
| | | prd2LatestValMap = new Map<Id, Product2>(); |
| | | integer cntPrd2 = 0; |
| | | for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c,LastbuyProductFLG__c |
| | | From Product2 Where Id IN :product2Ids]) { |
| | | cntPrd2 = cntPrd2 + 1; |
| | | System.debug('prd2.Estimation_Entry_Possibility__c'+prd2.Estimation_Entry_Possibility__c); |
| | | if (prd2.Estimation_Entry_Possibility__c != '○') { |
| | | error1 = true; |
| | | } |
| | | if (prd2.Estimation_Entry_Possibility__c == 'M') { |
| | | error1 = false; |
| | | } |
| | | if (prd2.SFDA_Status__c != loopMap.get(prd2.Id)) { |
| | | WinOrDecideAlert = true; |
| | | } |
| | | |
| | | prd2LatestValMap.put(prd2.Id, prd2); |
| | | } |
| | | if (cntPrd2 != Gcnt) { |
| | | WinOrDecideAlert = false; |
| | | } |
| | | |
| | | } |
| | | if(ContractAmountLimitJudge()){ |
| | | return false; |
| | | } |
| | | if (error1 == true && WinOrDecideAlert == false) { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Error_Message37; |
| | | return false; |
| | | } |
| | | |
| | | if (checkAgentsDeleteFlag() == false) { |
| | | return false; |
| | | } |
| | | if (enableSales == true && opp.Trade__c == '内貿') { |
| | | Map<Id, String> proMap = new Map<Id, String>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine qli : activities) { |
| | | if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | proMap.put(qli.pageObject.Id__c, qli.pageObject.Name__c); |
| | | } |
| | | } |
| | | } |
| | | Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, ''); |
| | | if (chkMap.size() > 0) { |
| | | errorflg = true; |
| | | if (chkMap.containsKey('agency')) { |
| | | errorflg = true; |
| | | errormessage = '第一经销商没有有效的医疗器械经营许可证。'; |
| | | // return false; |
| | | } |
| | | Integer inerr = 0; |
| | | if (activities.size() > 0) { |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | s.haveno_Register = false; |
| | | s.wrong_Register = false; |
| | | if (chkMap.containsKey(s.pageObject.Id__c)) { |
| | | if (chkMap.get(s.pageObject.Id__c) == '1') { |
| | | s.haveno_Register = true; |
| | | inerr ++; |
| | | } else if (chkMap.get(s.pageObject.Id__c) == '2') { |
| | | s.wrong_Register = true; |
| | | inerr ++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (inerr > 0) { |
| | | errorflg = true; |
| | | errormessagewarn = '请检查红字内容(NMPA状态红字,不可销售产品;产品名称红字,超过经销商经营范围)。'; |
| | | // errorMessagechack = '请检查红字内容(NMPA状态红字,不可销售产品;产品名称红字,超过经销商经营范围)。'; |
| | | } |
| | | } |
| | | // Boolean isDangerError = false; |
| | | // Boolean isNotDangerError = false; |
| | | // if (activities.size() > 0) { |
| | | // for (QELine qli : activities) { |
| | | // if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | // if (opp.Is_Corrosion__c) { |
| | | // if(!qli.Is_DangerousChemicals){ |
| | | // isNotDangerError =true; |
| | | // qli.wrong_Register = true; |
| | | // } |
| | | // }else{ |
| | | // if(qli.Is_DangerousChemicals){ |
| | | // isDangerError =true; |
| | | // qli.wrong_Register = true; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // if (opp.Is_Corrosion__c) { |
| | | // String str = OpportunityWebService.checkDangerItem(opp.agency1__c); |
| | | // if (str != 'OK') { |
| | | // errorflg = true; |
| | | // errorMessage = str; |
| | | // return false; |
| | | // } |
| | | // if(isNotDangerError){ |
| | | // errorflg = true; |
| | | // errormessage = '当阿西塞多时,行项目的产品必须全选择危化品。'; |
| | | // return false; |
| | | // } |
| | | // }else{ |
| | | // if(isDangerError){ |
| | | // errorflg = true; |
| | | // errormessage = '当询价不是阿西塞多时,行项目的产品不能选择危化品。'; |
| | | // return false; |
| | | // } |
| | | // } |
| | | } |
| | | detail = false; |
| | | if ((quo.QuoteName__c == null) || (quo.QuoteName__c == '')) { |
| | | // quo.QuoteName__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.QuoteName__c.label; |
| | | error = true; |
| | | qname = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.Quote_Adjust_Calculate__c == null) { |
| | | // quo.Quote_Adjust_Calculate__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Calculate__c.label; |
| | | error = true; |
| | | qacc = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.Quote_Adjust_Amount_Page__c == null) { |
| | | // quo.Quote_Adjust_Amount__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Quote_Adjust_Amount__c.label; |
| | | error = true; |
| | | qaapc = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.Quote_Expiration_Date__c == null) { |
| | | // quo.Quote_Expiration_Date__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Quote_Expiration_Date__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | //decimal temSalesAmount1 = 0; // 2018/09/28 CHAN-B4YAB8 经销商小计合计 end |
| | | system.debug('activities++++----****2'+activities); |
| | | Decimal initPrice = 0; |
| | | for (QELine a : activities) { |
| | | if ((a.Asset_Model != null) && (a.Asset_Model != '')) { |
| | | if (a.pageObject.Quantity__c == null || a.pageObject.Quantity__c == 0) { |
| | | // a.pageObject.Quantity__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.QuoteLineItem.fields.Quantity__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (a.pageObject.UnitPrice_Page__c == null) { |
| | | // a.pageObject.UnitPrice__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.QuoteLineItem.fields.UnitPrice__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (a.pageObject.AgencyUnitPrice__c == null) { |
| | | // a.pageObject.AgencyUnitPrice__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.QuoteLineItem.fields.AgencyUnitPrice__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (a.pageObject.PricebookEntryId == null) { |
| | | error = true; |
| | | errormessage = System.Label.Error_Message27; |
| | | } |
| | | detail = true; |
| | | } |
| | | if(a.PageObject.UnitPrice_Page__c!=null){ |
| | | initPrice += (a.VenderName=='OSH'?(a.PageObject.UnitPrice_Page__c*0.45):a.PageObject.UnitPrice_Page__c)*(a.PageObject.Quantity__c==null?0:a.PageObject.Quantity__c); |
| | | } |
| | | } |
| | | System.debug('initPrice'+initPrice); |
| | | if (enableSales == true) { |
| | | // LHJ Start |
| | | String profileId = UserInfo.getProfileId(); |
| | | String SI_2M3_ID = System.Label.SI_2M3_ID_15; |
| | | String SI_2M3_Id_Bulleti = System.Label.SI_2M3_Id_Bulletin; |
| | | if(!profileId.left(15).equals(SI_2M3_ID) |
| | | && !profileId.left(15).equals(SI_2M3_Id_Bulleti)) { |
| | | if (quo.Agency1__c == null) { |
| | | // quo.Agency1__c.addError(System.Label.Error_Message3); |
| | | Agency1 = true; |
| | | String label = Schema.SObjectType.Quote.fields.Agency1__c.label; |
| | | error = true; |
| | | if(String.isNotBlank(errormessage)){ |
| | | errormessage +='\n'+ label+':'+System.Label.Error_Message3; |
| | | }else { |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | } |
| | | } |
| | | System.debug('SI_2M3_ID'+SI_2M3_ID); |
| | | System.debug('SI_2M3_Id_Bulleti'+SI_2M3_Id_Bulleti); |
| | | System.debug('profileId'+profileId); |
| | | // LHJ End |
| | | if (quo.OCM_Agent1_Price_Page__c == null) { |
| | | // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3); |
| | | quo.OCM_Agent1_Price_Page__c = initPrice; |
| | | // String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label; |
| | | // error = true; |
| | | // errormessage = label+':'+System.Label.Error_Message3; |
| | | } else { |
| | | |
| | | } |
| | | System.debug('error'+error); |
| | | System.debug('errormessage1'+errormessage); |
| | | } else { |
| | | |
| | | if (opp.Agency1__c != null) { |
| | | // opp.Agency1__c.addError(System.Label.Error_Message30); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label; |
| | | error = true; |
| | | nAgency1 = true; |
| | | if(String.isNotBlank(errormessage)){ |
| | | errormessage +='\n'+ label+':'+System.Label.Error_Message30; |
| | | }else { |
| | | errormessage = label+':'+System.Label.Error_Message30; |
| | | } |
| | | } |
| | | if (quo.OCM_Agent1_Price_Page__c != null) { |
| | | // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message30); |
| | | noapp = true; |
| | | String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message30; |
| | | } |
| | | if (opp.Agency2__c != null) { |
| | | // opp.Agency2__c.addError(System.Label.Error_Message30); |
| | | nAgency2 = true; |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message30; |
| | | } |
| | | if (quo.Agent1_Agent2_Price_Page__c != null) { |
| | | // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message30); |
| | | naapp = true; |
| | | String label = Schema.SObjectType.Quote.fields.Agent1_Agent2_Price__c.label; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message30; |
| | | } |
| | | |
| | | } |
| | | if (quo.Agency1_Profit_Rate__c >= 1000 || quo.Agency1_Profit_Rate__c <= -1000) { |
| | | error = true; |
| | | errormessage = System.Label.Error_Message38; |
| | | } |
| | | if (quo.Agency2_Profit_Rate__c >= 1000 || quo.Agency2_Profit_Rate__c <= -1000) { |
| | | error = true; |
| | | errormessage = System.Label.Error_Message38; |
| | | } |
| | | |
| | | if (error == true) { |
| | | errorflg = true; |
| | | return false; |
| | | } |
| | | // PageArrange(); |
| | | errorflg = false; |
| | | errorMessage = null; |
| | | return true; |
| | | } |
| | | // 产品状态判断 |
| | | public static boolean checkSFDAStatus1(boolean dodecide) { |
| | | for (QELine a : activities) { |
| | | if ((a.Asset_Model != null) && (a.Asset_Model != '')) { |
| | | if (a.pageObject.SFDA_Status__c != '有効' && |
| | | a.pageObject.SFDA_Status__c != '有効(再申請中)' && |
| | | a.pageObject.SFDA_Status__c != '不要' && |
| | | a.pageObject.SFDA_Status__c != '失効(期限内生産済在庫対応)' && |
| | | // LHJ CBPR 20181221 Start |
| | | (a.pageObject.SFDA_Status__c != '暂停出库(长期)') && |
| | | (a.pageObject.SFDA_Status__c != '暂停出库(短期)') && |
| | | // LHJ CBPR 20181221 End |
| | | (a.pageObject.SFDA_Status__c != '失効(再申請中)' || dodecide != false) |
| | | ) { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | public static boolean ContractAmountLimitJudge(){ |
| | | if(opp.Sales_Root__c =='OCM直接销售'){ |
| | | return false; |
| | | } |
| | | Boolean error = false; |
| | | Double AccrualTotal=0; |
| | | Double sumContractAmount =0; |
| | | for(QELine aaa :activities){ |
| | | // 2022-06-14 紧急修复 ssm |
| | | if (String.isBlank(aaa.Asset_Model)) { |
| | | continue; |
| | | } |
| | | if(aaa.pageObject.PricebookEntry.Product2Id!=null){ |
| | | if(aaa.GuranteePrice==null){ |
| | | aaa.GuranteePrice=0; |
| | | } |
| | | AccrualTotal += aaa.pageObject.Quantity__c*aaa.GuranteePrice; |
| | | } |
| | | } |
| | | if(quo.MultiYearWarrantyTotalPrice__c==null){ |
| | | quo.MultiYearWarrantyTotalPrice__c=0; |
| | | } |
| | | sumContractAmount = AccrualTotal+quo.MultiYearWarrantyTotalPrice__c; |
| | | if(quo.OCM_Agent1_Price_Page__c<=sumContractAmount){ |
| | | error = true; |
| | | errorflg = true; |
| | | errormessage = '预测金额为负数,请正确填写合同金额。'; |
| | | } |
| | | if(quo.multiYearWarranty__c){ |
| | | if(quo.OCM_Agent1_Price_Page__c<=0){ |
| | | error = true; |
| | | errorflg = true; |
| | | errormessage = '预测金额为负数,请正确填写合同金额。'; |
| | | } |
| | | } |
| | | return error; |
| | | } |
| | | public static Boolean checkAgentsDeleteFlag() { |
| | | // Check Agents |
| | | List<Id> accIds = new List<Id>(); |
| | | if (opp.Agency1__c != null) { |
| | | accIds.add(opp.Agency1__c); |
| | | } |
| | | if (opp.Agency2__c != null) { |
| | | accIds.add(opp.Agency2__c); |
| | | } |
| | | if (accIds.size() > 0) { |
| | | List<Account> agentAccs = [SELECT Id, Delete_Flag__c, Is_Active_Formula__c, Sales_Shop_Class__c FROM Account WHERE Id IN :accIds]; |
| | | String activeFormula1 = null, activeFormula2 = null; |
| | | for (Account local : agentAccs) { |
| | | if (local.Sales_Shop_Class__c == '医疗修理经销商') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | if (local.Id == opp.Agency1__c) { |
| | | errorMessage = '请确认第一经销商的经销商资质'; |
| | | return false; |
| | | } |
| | | } |
| | | if (local.Id == opp.Agency1__c) { |
| | | activeFormula1 = local.Is_Active_Formula__c; |
| | | } |
| | | } |
| | | for (Account local : agentAccs) { |
| | | if (local.Id == opp.Agency2__c) { |
| | | activeFormula2 = local.Is_Active_Formula__c; |
| | | } |
| | | } |
| | | if (activeFormula1 == '无效' && activeFormula2 == '无效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Agent1_and_Agent2_were_Deleted; |
| | | return false; |
| | | } else if (activeFormula1 == '无效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Agent1_was_Deleted; |
| | | return false; |
| | | } else if (activeFormula2 == '无效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = System.Label.Agent2_was_Deleted; |
| | | return false; |
| | | } |
| | | } |
| | | // 内貿の場合Check Agency1 |
| | | if (opp.Agency1__c != null && opp.Trade__c == '内貿') { |
| | | Account acc = [select Sales_Shop_Class__c, Business_Authorization_No__c, Business_Paper_Expiration_Date__c, |
| | | Tax_Practice_No__c, Tax_Practice_Expiration_Date__c, Medical_Equipment_Num__c, Is_Active_Formula__c, |
| | | Medical_Equipment_Expiration_Date__c from Account where Id = :opp.Agency1__c]; |
| | | //经销商分类只有特约、一级或者集中采购才可以进行报价 |
| | | List<String> salesClazz = new List<String> {'特約販売店(区域)', '特約販売店(製品)', '特約販売店(製品+区域)', '一級販売店', '集采经销商'}; |
| | | // 有效/无效(公式)!= 有效 |
| | | if (acc.Is_Active_Formula__c != '有效') { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = '请选择有效的经销商'; |
| | | return false; |
| | | } |
| | | else if(!salesClazz.contains(acc.Sales_Shop_Class__c)){ |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = '经销商1的经销商分类为:特约,一级,集中采购才可以报价'; |
| | | return false; |
| | | }else if (!(String.isBlank(acc.Tax_Practice_No__c) == false |
| | | && (acc.Tax_Practice_Expiration_Date__c == null || acc.Tax_Practice_Expiration_Date__c >= Date.today()) |
| | | && String.isBlank(acc.Medical_Equipment_Num__c) == false |
| | | && acc.Medical_Equipment_Expiration_Date__c != null && acc.Medical_Equipment_Expiration_Date__c >= Date.today() |
| | | && String.isBlank(acc.Business_Authorization_No__c) == false |
| | | && acc.Business_Paper_Expiration_Date__c != null && acc.Business_Paper_Expiration_Date__c >= Date.today()) |
| | | ) { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | errorMessage = '请确认第一经销商的经销商资质'; |
| | | return false; |
| | | }else {} |
| | | } |
| | | return true; |
| | | } |
| | | //保存逻辑 |
| | | public static boolean dataEntry() { |
| | | system.debug('activities++++----****3'+activities); |
| | | Boolean ifdecide=checkIsDecide(); |
| | | standardPricebook = ControllerUtil.getStandardPricebook(); |
| | | if(!ifdecide){ |
| | | |
| | | List<Quote> maxQuote_No = [select Quote_No__c From Quote Where OpportunityId = :oppid and (not Quote_No__c like '%Old') order by Quote_No_last2__c desc NULLS LAST limit 1]; |
| | | String oppNo; |
| | | Integer l = 1; |
| | | if (maxQuote_No.size() > 0) { |
| | | try { |
| | | oppNo = maxQuote_No[0].Quote_No__c; |
| | | l = Integer.valueOf(oppNo.substring(oppNo.length() - 2)) + 1; |
| | | } catch (System.TypeException e) { |
| | | system.debug('maxQuote_No Error: quote.id=' + maxQuote_No[0].id); |
| | | } |
| | | } else { |
| | | system.debug('first Quote'); |
| | | } |
| | | oppNo = '00' + String.valueof(l); |
| | | oppNo = oppNo.substring(oppNo.length() - 2); |
| | | |
| | | Quote q = New Quote(); |
| | | if (changedAfterPrint) { |
| | | system.debug('id空1:'); |
| | | quoId = null; |
| | | SkipQuotefilg = true; |
| | | } |
| | | // if (changedAfterBid) { |
| | | // system.debug('id空1:'); |
| | | // quoId = null; |
| | | // SkipQuotefilg = true; |
| | | // } |
| | | // CHAN-AVG3PW 询价报价画面规则变更 |
| | | // if (quo.CreatedByid !=null && quo.CreatedByid != UserInfo.getUserId() ){ |
| | | // system.debug('id空3:'); |
| | | // quoId = null; |
| | | // SkipQuotefilg = true; |
| | | // } |
| | | if ((quoteGurantee_Period != null && |
| | | !quoteGurantee_Period.equals(quo.Gurantee_Period__c)) |
| | | || |
| | | (quotemultiYearWarranty != null && |
| | | !quotemultiYearWarranty.equals('' + quo.multiYearWarranty__c)) |
| | | ) { |
| | | system.debug('id空8:'); |
| | | quoId = null; |
| | | SkipQuotefilg = true; |
| | | } |
| | | if (String.isBlank(quoId)) { |
| | | system.debug('standardPricebook:'+standardPricebook); |
| | | q = New Quote(); |
| | | q.OpportunityId = oppId; |
| | | if (detail == true) { |
| | | if (standardPricebook == null) { |
| | | errormessage = System.Label.Error_Message27; |
| | | errorflg = true; |
| | | return false; |
| | | } else { |
| | | q.Pricebook2Id = standardPricebook.Id; |
| | | } |
| | | } |
| | | } else { |
| | | List<Quote> qs = New List<Quote>(); |
| | | qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | Stocking_Price__c, Discount_Amount__c, Discount_Amount_Calculate__c, Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Quote_No__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, |
| | | Preferential_Trading_Price__c, Discount__c, Pricing__c, Unit_Price__c, Offer_Amount__c, TOTAL__c, |
| | | Contract__c, Print_HP_Name__c, Quote_Expiration_Date__c, Quote_Comment__c, OCM_Sales_Forecast__c, Installation_location__c, HasType3Machine__c |
| | | , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c |
| | | , Preferential_Gurantee_Period__c |
| | | ,IsQuoteTrial__c |
| | | From Quote Where Id = :quoId]; |
| | | if (qs.size() > 0) { |
| | | q = qs[0]; |
| | | } |
| | | if (q.Pricebook2Id == null) { |
| | | if (detail == true) { |
| | | if (standardPricebook == null) { |
| | | errormessage = System.Label.Error_Message27; |
| | | errorflg = true; |
| | | return false; |
| | | } else { |
| | | q.Pricebook2Id = standardPricebook.Id; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (String.isBlank(quoId)) { |
| | | q.Quote_No__c = opp.Opportunity_No__c + '-' + oppNo; |
| | | q.PriceRefreshDate__c = Date.today(); |
| | | } |
| | | if (productStatusUpdated) { |
| | | q.PriceRefreshDate__c = Date.today(); |
| | | } |
| | | List<String> pIds = new List<String>(); |
| | | system.debug('activities++++----****1'+activities); |
| | | for (QELine s : activities) { |
| | | if (String.isBlank(s.pageObject.Id__c) == false) { |
| | | pIds.add(s.pageObject.Id__c); |
| | | } |
| | | } |
| | | List<Product2> pList = [select Id from Product2 where Id in :pids and Category3__c = '主机']; |
| | | if (pList.size() > 0) q.HasType3Machine__c = true; |
| | | q.Name = quo.QuoteName__c; |
| | | q.Estimation_List_Price__c = quo.Estimation_List_Price__c; |
| | | q.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c; |
| | | q.OCM_Sales_Forecast__c = quo.OCM_Sales_Forecast__c;//预测金额修改 fy |
| | | q.Stocking_Price__c = quo.Stocking_Price__c; |
| | | q.Quote_Adjust_Amount__c = quo.Quote_Adjust_Amount_Page__c; |
| | | q.Quote_Adjust_Calculate__c = quo.Quote_Adjust_Calculate__c; |
| | | q.Discount_Amount__c = quo.Discount_Amount__c; |
| | | q.Discount_Amount_Calculate__c = quo.Discount_Amount_Calculate__c; |
| | | q.Agency1__c = opp.Agency1__c; |
| | | q.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c; |
| | | q.Agency1_Profit__c = quo.Agency1_Profit__c; |
| | | q.AgencyDiscount__c = quo.AgencyDiscount__c; |
| | | q.Gurantee_Period__c = quo.Gurantee_Period__c; |
| | | q.multiYearWarranty__c = quo.multiYearWarranty__c; |
| | | q.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c; |
| | | q.quoteSavedDate__c = Date.today(); |
| | | q.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c; |
| | | q.Agency2__c = opp.Agency2__c; |
| | | q.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c; |
| | | q.Agency2_Profit__c = quo.Agency2_Profit__c; |
| | | q.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c; |
| | | q.Opportunity_sub_owner__c = opp.Opportunity_sub_owner__c; |
| | | q.Print_HP_Name__c = selection_hp; |
| | | q.Quote_Expiration_Date__c = quo.Quote_Expiration_Date__c; |
| | | q.Quote_Comment__c = quo.Quote_Comment__c; |
| | | q.Installation_location__c = quo.Installation_location__c; |
| | | q.QuotationChange__c = quo.QuotationChange__c; |
| | | q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c; |
| | | q.Interdepartmental__c = quo.Interdepartmental__c; |
| | | if(!quo.IsQuoteTrial__c){ |
| | | q.IsQuoteTrial__c = quo.IsQuoteTrial__c; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | List<Id> idList = new List<Id>(); |
| | | for (QELine s : activities) { |
| | | if (String.isNotBlank(s.pageObject.PricebookEntryId)) { |
| | | idList.add(s.pageObject.PricebookEntryId); |
| | | } |
| | | } |
| | | List<PricebookEntry> pb = [select Id from PricebookEntry where Product2.Category5__c = '虚拟' and Id in: idList]; |
| | | q.Have_Virtual__c = false; |
| | | if(pb.size() > 0){ |
| | | q.Have_Virtual__c = true; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | if (String.isBlank(quoId)) { |
| | | insert q; |
| | | quo.Quote_No__c = q.Quote_No__c; |
| | | // quo.IsQuoteTrial__c = q.IsQuoteTrial__c; |
| | | // isQuoteTrialOnInit = q.IsQuoteTrial__c; |
| | | } else { |
| | | update q; |
| | | } |
| | | List<QuoteLineItem> qlist = New List<QuoteLineItem>(); |
| | | qlist = [Select Id From QuoteLineItem Where QuoteId = :quoId]; |
| | | if (qlist.size() > 0) { |
| | | delete qlist; |
| | | } |
| | | qlist = New List<QuoteLineItem>(); |
| | | List<String> product_lines = new List<String>(); |
| | | Boolean Is_Eng2_Opp = false; |
| | | Integer i = 1; |
| | | if (activities.size() > 0) { |
| | | system.debug('activities++++----****'+activities); |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | if (s.pageObject.PricebookEntryId != null) { |
| | | QuoteLineItem ql = s.pageObject.clone(); |
| | | ql.Quantity = ql.Quantity__c; |
| | | ql.UnitPrice = 0; |
| | | ql.QuoteId = q.Id; |
| | | ql.ProductSetName__c = s.Product_Set_Name; |
| | | ql.Name__c = s.pageObject.Name__c; |
| | | ql.Cost__c = s.Cost_c; |
| | | ql.Cost_Subtotal__c = s.Cost_Subtotal_c; |
| | | // s.pageObject.Cost__c = s.Cost_c; |
| | | // s.pageObject.Cost_Subtotal__c = s.Cost_Subtotal_c; |
| | | ql.UnitPrice__c = ql.UnitPrice_Page__c; |
| | | ql.UnitPrice_Page__c = 0; |
| | | ql.ListPrice__c = s.ListPrice_Page; |
| | | ql.GuranteePrice__c = s.GuranteePrice; |
| | | ql.ProductGuranteePrice__c = s.ProductGuranteePrice; |
| | | ql.Maintenance_Price_Year__c = s.Maintenance_Price_Year; |
| | | ql.CanNotCancelFlag__c = s.CanNotCancelledGurantee; |
| | | ql.SFDA_Status__c = prd2LatestValMap.get(s.pageObject.Id__c).SFDA_Status__c; |
| | | ql.Item_Order__c = i;//预测金额修改 fy |
| | | if (s.pageObject.Subtotal__c != null && quo.OCM_Sales_Forecast__c != null && quo.QuoteTotal_Page__c != null) { |
| | | if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//预测金额修改 fy |
| | | ql.OCM_Sales_Forecast__c = quo.OCM_Sales_Forecast__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c); |
| | | } |
| | | } |
| | | qlist.add(ql); |
| | | product_lines.add(s.pageObject.PricebookEntryId); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | system.debug('qlist+++---+++'+qlist); |
| | | insert qlist; |
| | | } |
| | | system.debug('○○○○○Save2○○○○○'); |
| | | List<PricebookEntry> entrys = product_lines!= null && product_lines.size() > 0 ? [select Id from PricebookEntry where Id in :product_lines and Product2.ENG_New__c = 'ENG2'] : null; |
| | | Is_Eng2_Opp = entrys != null && entrys.size() > 0 ? true : false; |
| | | Opportunity o = New Opportunity(); |
| | | List<Opportunity> os = New List<Opportunity>(); |
| | | os = [select Id, Estimation_List_Price__c, Dealer_Final_Price__c, Estimation_List_Price_Without_Tax__c, |
| | | Stock_Submit_Date__c,Stock_Confrim_Date__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Stocking_Price__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_Update_Sum__c , Hospital__c,Is_Corrosion__c |
| | | ,StageName ,OlyNumberHosts__c |
| | | From Opportunity Where Id = :oppid]; |
| | | if (os.size() > 0) { |
| | | o = os[0]; |
| | | o.Estimation_List_Price__c = quo.Estimation_List_Price__c; |
| | | o.Wholesale_Price__c = q.OCM_Sales_Forecast__c;//预测金额修改 fy |
| | | o.Dealer_Final_Price__c = quo.Dealer_Final_Price_Page__c; |
| | | o.Agency1__c = opp.Agency1__c; |
| | | o.OCM_Agent1_Price__c = quo.OCM_Agent1_Price_Page__c; |
| | | o.Agency1_Profit__c = quo.Agency1_Profit__c; |
| | | o.Agency1_Profit_Rate__c = quo.Agency1_Profit_Rate__c; |
| | | o.Agency2__c = opp.Agency2__c; |
| | | o.Agent1_Agent2_Price__c = quo.Agent1_Agent2_Price_Page__c; |
| | | o.Agency2_Profit__c = quo.Agency2_Profit__c; |
| | | o.Agency2_Profit_Rate__c = quo.Agency2_Profit_Rate__c; |
| | | o.Stocking_Price__c = quo.Stocking_Price__c; |
| | | o.Estimation_No__c = q.Quote_No__c; |
| | | o.Estimation_Name__c = q.Name; |
| | | o.Estimation_Id__c = q.Id; |
| | | o.Installation_location__c = q.Installation_location__c; |
| | | o.HasType3Machine__c = q.HasType3Machine__c; |
| | | o.AgencyDiscount__c = quo.AgencyDiscount__c; |
| | | o.Gurantee_Period__c = quo.Gurantee_Period__c ; |
| | | o.multiYearWarranty__c = quo.multiYearWarranty__c ; |
| | | o.MultiYearWarrantyTotalPrice__c = quo.MultiYearWarrantyTotalPrice__c ; |
| | | o.quoteSavedDate__c = Date.today(); |
| | | // o.OlyNumberHosts__c = 0; |
| | | // List<String> oppIds = New List<String>(); |
| | | // List<String> product2Ids = New List<String>(); |
| | | // Map<String,Decimal> product2IdsMap = new Map<String,Decimal>(); |
| | | // if (activities.size() > 0) { |
| | | // for (QELine a : activities) { |
| | | // if(String.isBlank(a.pageObject.Id__c) == false) { |
| | | // product2Ids.add(a.pageObject.Id__c); |
| | | // product2IdsMap.put(a.pageObject.Id__c,a.pageObject.Quantity__c); |
| | | // } |
| | | // } |
| | | // for (Product2 prod : [Select Id,ProductClass__c From Product2 Where Id IN :product2Ids]) { |
| | | // if(o.StageName == '引合' || o.StageName == '注残' || o.StageName == '出荷' || o.StageName == '完了'){ |
| | | // if(prod.ProductClass__c == '主机'){ |
| | | // if(product2IdsMap.containsKey(prod.Id)){ |
| | | // o.OlyNumberHosts__c += product2IdsMap.get(prod.Id); |
| | | // oppIds.add(o.Id); |
| | | // ControllerUtil.UpdateBiddingFlag(oppIds); |
| | | // } |
| | | // }else{ |
| | | // o.OlyNumberHosts__c += 0; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | if(quoId==null && UserInfo.getProfileId() != System.Label.ProfileId_2S6){ |
| | | o.Stock_Submit_Date__c = null; |
| | | o.Stock_Confrim_Date__c = null; |
| | | } |
| | | if (o.Quote_Update_Sum__c == null) { |
| | | o.Quote_Update_Sum__c = 1; |
| | | } else { |
| | | o.Quote_Update_Sum__c = o.Quote_Update_Sum__c + 1; |
| | | } |
| | | o.ENG2_Opp__c = Is_Eng2_Opp; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | update o; |
| | | |
| | | |
| | | //OpportunityLineItem-------------------------------------------- |
| | | List<OpportunityLineItem> ols = New List<OpportunityLineItem>(); |
| | | OpportunityLineItem ol = New OpportunityLineItem(); |
| | | ols = [select Id, Quantity from OpportunityLineItem Where OpportunityId = :oppid]; |
| | | if (ols.size() > 0) { |
| | | ControllerUtil.delOppLine(ols); |
| | | } |
| | | i = 1; |
| | | ols = New List<OpportunityLineItem>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | if (s.pageObject.PricebookEntryId != null) { |
| | | ol = New OpportunityLineItem(); |
| | | ol.OpportunityId = oppid; |
| | | ol.Id__c = s.pageObject.Id__c; |
| | | // ol.SFDA_Status__c = s.pageObject.SFDA_Status__c; |
| | | ol.SFDA_Status__c = prd2LatestValMap.get(s.pageObject.Id__c).SFDA_Status__c; |
| | | ol.Name__c = s.pageObject.Name__c; |
| | | ol.ListPrice__c = s.ListPrice_Page; |
| | | ol.Quantity = s.pageObject.Quantity__c; |
| | | ol.UnitPrice = 0; |
| | | ol.UnitPrice__c = s.pageObject.UnitPrice_Page__c; |
| | | ol.AgencyUnitPrice__c = s.pageObject.AgencyUnitPrice__c; |
| | | ol.Present__c = s.pageObject.Present__c; |
| | | ol.AgencySubtotal__c = s.pageObject.AgencySubtotal__c; |
| | | ol.GuaranteePeriod__c = s.pageObject.GuaranteePeriod__c; |
| | | if (opp.CurrencyIsoCode != null ) { |
| | | ol.multiYearWarranty__c = s.pageObject.multiYearWarranty__c; |
| | | ol.ServicePrice__c = s.pageObject.ServicePrice__c; |
| | | ol.If_Cancel_Guarantee__c = s.pageObject.If_Cancel_Guarantee__c; |
| | | ol.ProductEntend_gurantee_period_all__c |
| | | = s.pageObject.ProductEntend_gurantee_period_all__c; |
| | | ol.GuranteeType__c = s.pageObject.GuranteeType__c; |
| | | ol.NoDiscountTotal__c = s.pageObject.NoDiscountTotal__c; |
| | | ol.warrantyType__c = s.pageObject.warrantyType__c; |
| | | ol.productServicePrice__c = s.pageObject.productServicePrice__c; |
| | | ol.GuranteePrice__c = s.GuranteePrice; |
| | | ol.ProductGuranteePrice__c = s.ProductGuranteePrice; |
| | | ol.Maintenance_Price_Year__c = s.Maintenance_Price_Year; |
| | | ol.provistonPeriod__c = s.pageObject.provistonPeriod__c; |
| | | } |
| | | ol.Qty_Unit__c = s.pageObject.Qty_Unit__c; |
| | | ol.Cost__c = s.pageObject.Cost__c; |
| | | ol.BSS_Category__c = s.pageObject.BSS_Category__c; |
| | | ol.CanNotCancelFlag__c = s.CanNotCancelledGurantee;//预测金额修改 fy |
| | | if (s.pageObject.Subtotal__c != null && o.Wholesale_Price__c != null && quo.QuoteTotal_Page__c != null) { |
| | | if (s.pageObject.Subtotal__c > 0 && quo.QuoteTotal_Page__c > 0) {//预测金额修改 fy |
| | | ol.OCM_Sales_Forecast__c = o.Wholesale_Price__c * (s.pageObject.Subtotal__c / quo.QuoteTotal_Page__c); |
| | | } |
| | | } |
| | | ol.PricebookEntryId = s.pageObject.PricebookEntryId; |
| | | ol.Item_Order__c = i; |
| | | ols.add(ol); |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | ControllerUtil.insOppLine(ols); |
| | | } |
| | | |
| | | } else { |
| | | system.debug('*****SystemError OpportunityId is Null*****'); |
| | | } |
| | | if (String.isBlank(quoId)) { |
| | | quoIdreturn = q.Id; |
| | | // newQuoteFlag = false; |
| | | } |
| | | }else{ |
| | | errorflg = true; |
| | | errormessage = '该询价已经decide,不可再修改'; |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | //防止多开页面加验证查询 |
| | | private static boolean checkIsDecide() { |
| | | List<Opportunity> oppsde = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId]; |
| | | if (oppsde.size() > 0) { |
| | | if(oppsde[0].Estimation_Decision__c){ |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | //检索新建报价产品 |
| | | @AuraEnabled |
| | | public static List<PricebookEntry> serContact(String tradec,String SearchName,String celon){ |
| | | trade = tradec; |
| | | String x = '×'; |
| | | String searchSql = 'select Id,Product2Id,Product2.Name,Product2.ProductCode,Product2.StorageStatus__c,Product2.OT_CODE_no_link__c, Product2.Alternative_Products__c, ' |
| | | + 'Product2.Foreign_Trade_Cost_US__c, Product2.Foreign_Trade_List_US__c, Product2.Intra_Trade_Cost_RMB__c, Product2.Intra_Trade_List_RMB__c, ' |
| | | + 'Product2.Asset_Model_No__c, Product2.Serial_Lot_No__c, Product2.Sales_Possibility__c, Product2.Estimation_Entry_Possibility__c, ' |
| | | + 'Product2.SFDA_Status__c, Product2.Qty_Unit__c, Product2.BSSCategory__c, Product2.Asset_loaner_category__c, Product2.Packing_list_manual__c ' |
| | | + ' ,Product2.Extend_new_product_gurantee_MD__c , Product2.Extend_new_product_gurantee__c , Product2.Entend_gurantee_period_all__c , ' |
| | | + ' Product2.Intra_Trade_Gurantee_RMB__c ' |
| | | + ',Product2.Intra_Trade_Foreign_RMB__c,Product2.NoDiscount_Foreign__c,Product2.Repair_Contract_USD__c ' |
| | | + ' , Product2.Intra_Trade_Service_RMB__c,Product2.CanNotCancelledGurantee__c,Product2.Is_DangerousChemicals__c ' |
| | | + ' , Product2.GuranteeType__c , product2.VenderName__c , product2.Maintenance_Price_Year__c ' |
| | | + ' , Product2.suitDepartment__c ' |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | + ' , Product2.Category5__c ' |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | + ' , Product2.Estimated_ConsumptionDueDate__c ' |
| | | + 'FROM PricebookEntry '; |
| | | String whereStr = 'Where Product2.Asset_Model_No__c != null And Product2.Manual_Entry__c = false And Product2.Estimation_Entry_Possibility__c !=' + '\'' + x + '\' ' |
| | | + 'AND CurrencyIsoCode =' + '\'' + String.escapeSingleQuotes(trade) + '\' ' |
| | | + 'AND IsActive = true '; |
| | | String whereSql = ''; |
| | | if (searchMode == 'CS') { |
| | | whereSql += 'and Product2.Asset_loaner_category__c = \'为耗材管理\' '; |
| | | } |
| | | if (SearchName != null && SearchName != '') { |
| | | String likename = String.escapeSingleQuotes(SearchName); |
| | | String prdcd = String.escapeSingleQuotes(SearchName); |
| | | if (likename.indexOf('*') >= 0) { |
| | | likename = likename.replace('*', '%'); |
| | | } else { |
| | | likename = '%' + likename + '%'; |
| | | } |
| | | whereSql += 'and (Product2.Name Like ' + '\'' + likename + '\' or Product2.ProductCode = ' + '\'' + prdcd + '\' or Product2.Asset_Model_No__c Like ' + '\'' + likename + '\') '; |
| | | } |
| | | celon = String.isNotBlank(celon) ? celon : null; |
| | | whereSql += ' and Product2.Celon_Product__c = :celon '; |
| | | searchSql = searchSql + whereStr + whereSql; |
| | | searchSql += ' order by Product2.Asset_Model_No__c Limit 450'; |
| | | List<PricebookEntry> pbes = Database.query(searchSql); |
| | | return pbes; |
| | | } |
| | | //检索产品配套 |
| | | @AuraEnabled |
| | | public static List<Product_Set__c> serSetContact(String SearchName,String SearchCode,String filterName){ |
| | | String searchSql = 'Select id, name, Price__c, Product_Set_CD__c, Quantity__c,Valid_Status__c,Quote_Select_Info__c From Product_Set__c '; |
| | | String whereStr = 'Where Valid_Status__c = true '; |
| | | String whereSql = ''; |
| | | if(SearchName != null && SearchName != ''){ |
| | | whereSql += 'and name Like ' + '\'%' + SearchName + '%\' '; |
| | | } |
| | | if(filterName != null && filterName != ''){ |
| | | whereSql += 'and Applicable_Department__c =\'' + filterName + '\''; |
| | | } |
| | | if(SearchCode != null && SearchCode != ''){ |
| | | whereSql += 'and Product_Set_CD__c like ' + '\'%' + SearchCode + '%\' '; |
| | | } |
| | | searchSql = searchSql + whereStr + whereSql; |
| | | searchSql += ' order by Product_Set_CD__c limit 500'; |
| | | List<Product_Set__c> cl = Database.query(searchSql); |
| | | return cl; |
| | | } |
| | | //产品检索配套赋值 |
| | | @AuraEnabled |
| | | public static String setProductEntry(String setProduct_text, |
| | | String activitiesCan, |
| | | String oppInfoc, |
| | | String quoc) { |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | setOppFromOppInfo(); |
| | | List<String> productIDLIST = new List<String>(); |
| | | if (setProduct_text == null) { |
| | | // PageArrange(); |
| | | return JSON.serialize(activities); |
| | | } else { |
| | | productIDLIST = setProduct_text.split(','); |
| | | } |
| | | System.debug('productIDLIST-c++'+productIDLIST); |
| | | List<Id> productIds = null; |
| | | List<Product_Set_Detail__c> productSetDetails = [SELECT Id, Product__c, Quantity__c, Product_Set__r.Name,Product__r.VenderName__c,Product__r.CanNotCancelledGurantee__c,Product__r.Is_DangerousChemicals__c,Product__r.Estimated_ConsumptionDueDate__c FROM Product_Set_Detail__c Where Product_Set__c in :productIDLIST]; |
| | | if (productSetDetails.size() == 0) { |
| | | // PageArrange(); |
| | | return JSON.serialize(activities); |
| | | } else { |
| | | productIds = new List<Id>(); |
| | | for (Product_Set_Detail__c local : productSetDetails) { |
| | | productIds.add(local.Product__c); |
| | | } |
| | | } |
| | | System.debug('productIds++'+productIds); |
| | | System.debug('activities++'+activities); |
| | | tmpactivities = activities; |
| | | activities = new List<QELine>(); |
| | | boolean lineflg = false; |
| | | Map<Id, Product2> items = new Map<Id, Product2>(); |
| | | List<Product2> products = [select Id, Name, ProductCode, |
| | | Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c, |
| | | SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c |
| | | , Entend_gurantee_period_all__c |
| | | , Intra_Trade_Gurantee_RMB__c |
| | | , Intra_Trade_Service_RMB__c |
| | | , GuranteeType__c |
| | | , Maintenance_Price_Year__c |
| | | ,CanNotCancelledGurantee__c |
| | | ,Is_DangerousChemicals__c |
| | | ,Repair_Contract_USD__c |
| | | ,LastbuyProductFLG__c |
| | | ,Intra_Trade_Foreign_RMB__c |
| | | ,NoDiscount_Foreign__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ,Estimated_ConsumptionDueDate__c |
| | | FROM Product2 Where Id IN :productIds |
| | | And Manual_Entry__c = false]; |
| | | for (Product2 product : products) { |
| | | items.put(product.Id, product); |
| | | } |
| | | System.debug('items++'+items); |
| | | Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>(); |
| | | List<PricebookEntry> workEntries = [ |
| | | SELECT Id, Product2Id |
| | | FROM PricebookEntry Where Product2Id IN :productIds |
| | | AND CurrencyIsoCode = :(opp.Trade__c == '外貿' ? 'USD' : 'CNY') |
| | | AND IsActive = true |
| | | ]; |
| | | for (PricebookEntry workEntry : workEntries) { |
| | | entries.put(workEntry.Product2Id, workEntry); |
| | | } |
| | | System.debug('entries-c++'+entries); |
| | | Integer i = 1; |
| | | Integer rightcnt = 0; |
| | | for (QELine t : tmpactivities) { |
| | | QELine a = New QELine(); |
| | | a.lineNo = i; |
| | | System.debug('i-c++'+i); |
| | | a = t; |
| | | a.lineNo = i; |
| | | activities.add(a); |
| | | |
| | | i++; |
| | | } |
| | | if (items.size() > 0) { |
| | | System.debug('productSetDetails-c++'+productSetDetails); |
| | | for (Integer l = 0; l < productSetDetails.size(); l++) { |
| | | Product_Set_Detail__c nowDetail = productSetDetails[l]; |
| | | Product2 prd = items.get(nowDetail.product__c); |
| | | PricebookEntry pbe = entries.get(nowDetail.product__c); |
| | | if (pbe == null) { |
| | | } else { |
| | | QELine c = null; |
| | | Integer Quantity_c = nowDetail.Quantity__c > 0 ? Integer.valueOf(nowDetail.Quantity__c) : 1; |
| | | if (opp.Trade__c == '外貿') { |
| | | if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) { |
| | | c = new QELine(i, prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c,nowDetail.Product_Set__r.Name, |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, |
| | | prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c, |
| | | prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantity_c, prd.Foreign_Trade_List_US__c, |
| | | prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c, |
| | | prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Foreign_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.NoDiscount_Foreign__c, prd.Repair_Contract_USD__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | } else { |
| | | continue; |
| | | } |
| | | } else if (opp.Trade__c == '内貿') { |
| | | if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) { |
| | | c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c,nowDetail.Product_Set__r.Name, |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, |
| | | prd.ProductCode, nowDetail.product__c, prd.SFDA_Status__c, |
| | | prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantity_c, prd.Intra_Trade_List_RMB__c, |
| | | prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c, |
| | | prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Gurantee_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.Intra_Trade_Service_RMB__c |
| | | , prd.Maintenance_Price_Year__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | } else { |
| | | continue; |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | activities.add(c); |
| | | i++; |
| | | rightcnt++; |
| | | lineflg = true; |
| | | } |
| | | } |
| | | } |
| | | // PageArrange(); |
| | | if (productSetDetails.size() > 0) { |
| | | errorflg = true; |
| | | String Message = ''; |
| | | List<String> Nl = new List<String>(); |
| | | Map<String,String> nameMap = new Map<String,String>(); |
| | | for(Product_Set_Detail__c Psd : productSetDetails){ |
| | | nameMap.put(Psd.Product_Set__r.Name, Psd.Product_Set__r.Name); |
| | | |
| | | } |
| | | for(String name : nameMap.keySet()){ |
| | | Message += name+' '; |
| | | } |
| | | errormessage = Message + ' 导入结束,导入 ' + productSetDetails.size() + ' 件,成功' + rightcnt + ' 件'; |
| | | } |
| | | System.debug('activities-to++'+activities); |
| | | return errormessage + '---' + JSON.serialize(activities); |
| | | } |
| | | //excelImport |
| | | @AuraEnabled |
| | | public static String excelImport(String excel_text, |
| | | String activitiesCan, |
| | | String oppInfoc, |
| | | String quoc) { |
| | | |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | setOppFromOppInfo(); |
| | | errorflg = false; |
| | | errormessage = ''; |
| | | Integer j = 0; |
| | | tmpactivities = activities; |
| | | activities = new List<QELine>(); |
| | | Integer i = 0; |
| | | Integer xlscnt = 0; |
| | | Integer rightcnt = 0; |
| | | |
| | | string[] xlslists = excel_text.split('\n', -1); |
| | | List<string> xlslist = New list<string>(); |
| | | List<string> codelist = New List<string>(); |
| | | List<Integer> Quantitylist = New List<Integer>(); |
| | | //String str ; |
| | | |
| | | Map<String, Integer> mp = new Map<String, Integer>(); |
| | | string xlscode; |
| | | Integer xlsQuantity; |
| | | |
| | | try { |
| | | for (string xls : xlslists) { |
| | | if (xls == null || xls == '') { |
| | | } else { |
| | | xlscode = null; |
| | | xlsQuantity = null; |
| | | xlslist = xls.split('\t', -1); |
| | | system.debug('xlslist+++'+xlslist); |
| | | for (String s : xlslist) { |
| | | //odd number or even number |
| | | if (math.mod(i, 2) != 0) { |
| | | system.debug('xlslist1+++'+s); |
| | | //odd number |
| | | if (s == '' || s == null) { |
| | | errorflg = true; |
| | | errormessage = System.Label.Error_Message31; |
| | | activities = tmpactivities; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } else { |
| | | s = s.trim(); |
| | | xlsQuantity = Integer.valueOf(s); |
| | | Quantitylist.add(xlsQuantity); |
| | | } |
| | | } else { |
| | | system.debug('xlslist2+++'+s); |
| | | //even number |
| | | if (s == '' || s == null) { |
| | | errorflg = true; |
| | | errormessage = System.Label.Error_Message31; |
| | | activities = tmpactivities; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } else { |
| | | s = s.trim(); |
| | | codelist.add(s); |
| | | xlscode = s; |
| | | } |
| | | } |
| | | i++; |
| | | } |
| | | //mp.put(xlscode, xlsQuantity); |
| | | xlscnt++; |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | system.debug('xlslist3+++'+xlscnt); |
| | | activities = tmpactivities; |
| | | errorflg = true; |
| | | errormessage = System.Label.Error_Message31; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } |
| | | |
| | | system.debug(j); |
| | | system.debug('xlscnt:::::' + xlscnt); |
| | | |
| | | if (codelist.size() == 0 || Quantitylist.size() == 0) { |
| | | activities = tmpactivities; |
| | | errorflg = true; |
| | | system.debug('codelist+++'+codelist); |
| | | system.debug('Quantitylist+++'+Quantitylist); |
| | | errormessage = System.Label.Error_Message31; |
| | | // pageArrange(); |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | } |
| | | |
| | | |
| | | i = 1; |
| | | boolean lineflg = false; |
| | | for (QELine t : tmpactivities) { |
| | | QELine a = New QELine(); |
| | | a = t; |
| | | a.lineNo = i; |
| | | activities.add(a); |
| | | i++; |
| | | } |
| | | Map<String, Product2> mpProduct2 = new Map<String, Product2>(); |
| | | List<Product2> items = [select Id, Name, ProductCode, |
| | | Foreign_Trade_Cost_US__c, Foreign_Trade_List_US__c, Intra_Trade_Cost_RMB__c, Intra_Trade_List_RMB__c, |
| | | Asset_Model_No__c, Sales_Possibility__c, Estimation_Entry_Possibility__c,VenderName__c, |
| | | SFDA_Status__c, Qty_Unit__c, BSSCategory__c, Packing_list_manual__c, StorageStatus__c |
| | | , Entend_gurantee_period_all__c |
| | | , Intra_Trade_Gurantee_RMB__c |
| | | , Intra_Trade_Service_RMB__c |
| | | , GuranteeType__c |
| | | , Maintenance_Price_Year__c |
| | | ,CanNotCancelledGurantee__c |
| | | ,Is_DangerousChemicals__c |
| | | ,Repair_Contract_USD__c |
| | | ,Intra_Trade_Foreign_RMB__c |
| | | ,NoDiscount_Foreign__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ,Estimated_ConsumptionDueDate__c |
| | | FROM Product2 Where ProductCode In :codelist |
| | | And Manual_Entry__c = false]; |
| | | for (Product2 prd : items) { |
| | | system.debug('prd.ProductCode:::::' + prd.ProductCode); |
| | | mpProduct2.put(prd.ProductCode, prd); |
| | | } |
| | | Map<String, PricebookEntry> entries = new Map<String, PricebookEntry>(); // keyがProductCodeです。 |
| | | List<PricebookEntry> pbes = [ |
| | | select Id, PricebookEntry.Product2.ProductCode |
| | | FROM PricebookEntry Where PricebookEntry.Product2.ProductCode IN :codelist |
| | | AND CurrencyIsoCode = :(opp.Trade__c == '外貿' ? 'USD' : 'CNY') |
| | | AND IsActive = true]; |
| | | for (PricebookEntry pbe : pbes) { |
| | | system.debug('pbe.Product2.ProductCode:::::' + pbe.Product2.ProductCode); |
| | | entries.put(pbe.Product2.ProductCode, pbe); |
| | | } |
| | | |
| | | for (Integer l = 0; l < codelist.size(); l++) { |
| | | system.debug('codelist[l]:::::' + codelist[l]); |
| | | Product2 prd = mpProduct2.get(codelist[l]); |
| | | if (prd != null) { |
| | | PricebookEntry pbe = entries.get(codelist[l]); |
| | | QELine c = null; |
| | | if (pbe != null && (opp.Trade__c == '外貿' || opp.Trade__c == '内貿')) { |
| | | if (opp.Trade__c == '外貿') { |
| | | if (prd.Foreign_Trade_List_US__c > 0 && prd.Foreign_Trade_Cost_US__c > 0) { |
| | | c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c, prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c,'', |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantitylist[l], prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_List_US__c, prd.Foreign_Trade_Cost_US__c, prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Foreign_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.NoDiscount_Foreign__c, |
| | | prd.Repair_Contract_USD__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | |
| | | } else { |
| | | continue; |
| | | } |
| | | } else { |
| | | if (prd.Intra_Trade_List_RMB__c > 0 && prd.Intra_Trade_Cost_RMB__c > 0) { |
| | | c = new QELine(i,prd.Is_DangerousChemicals__c,prd.CanNotCancelledGurantee__c,prd.VenderName__c, |
| | | prd.Estimated_ConsumptionDueDate__c,'', |
| | | pbe.Id, prd.Asset_Model_No__c, prd.StorageStatus__c, prd.ProductCode, prd.Id, prd.SFDA_Status__c, prd.Sales_Possibility__c, prd.Name, prd.BSSCategory__c, |
| | | Quantitylist[l], prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_List_RMB__c, prd.Intra_Trade_Cost_RMB__c, prd.Packing_list_manual__c |
| | | , prd.Entend_gurantee_period_all__c |
| | | , prd.Intra_Trade_Gurantee_RMB__c |
| | | , prd.GuranteeType__c |
| | | , prd.Intra_Trade_Service_RMB__c |
| | | , prd.Maintenance_Price_Year__c |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | , prd.Category5__c |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ); |
| | | |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | } else { |
| | | continue; |
| | | } |
| | | activities.add(c); |
| | | i++; |
| | | rightcnt++; |
| | | } |
| | | } |
| | | // messageを出す |
| | | errorflg = true; |
| | | errormessage = '数据导入结束,导入 ' + codelist.size() + ' 件,成功' + rightcnt + ' 件'; |
| | | // pageArrange(); |
| | | |
| | | return errormessage+'---'+JSON.serialize(activities); |
| | | |
| | | } |
| | | @AuraEnabled |
| | | public static Map<String,String> QuoteDecision(String activitiesCan, |
| | | String CheckItemCan , |
| | | boolean WinOrDecideAlertc, |
| | | boolean productStatusUpdatedc, |
| | | String oppInfoc, |
| | | boolean enableSalesc, |
| | | String quoc, |
| | | String oppIdc, |
| | | String quoIdc, |
| | | boolean newQuoteFlagc, |
| | | Boolean changedAfterPrintc, |
| | | String quoteGurantee_Periodc, |
| | | String quotemultiYearWarrantyc, |
| | | String selection_hpc, |
| | | Boolean SkipQuotefilgc) { |
| | | oppId = oppIdc; |
| | | quoId = quoIdc; |
| | | System.debug('quoId+'+quoId); |
| | | WinOrDecideAlert = WinOrDecideAlertc; |
| | | productStatusUpdated = productStatusUpdatedc; |
| | | newQuoteFlag = newQuoteFlagc; |
| | | changedAfterPrint = changedAfterPrintc; |
| | | quoteGurantee_Period = quoteGurantee_Periodc; |
| | | quotemultiYearWarranty = quotemultiYearWarrantyc; |
| | | selection_hp = selection_hpc; |
| | | SkipQuotefilg = SkipQuotefilgc; |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | quo = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | if(String.isNotBlank(activitiesCan)){ |
| | | activities = (List<QELine>)JSON.deserialize(activitiesCan,List<QELine>.class); |
| | | }else { |
| | | activities = null; |
| | | } |
| | | if(String.isNotBlank(CheckItemCan)){ |
| | | CheckItem = (List<QuoteLineItem>)JSON.deserialize(CheckItemCan,List<QuoteLineItem>.class); |
| | | }else { |
| | | CheckItem = null; |
| | | } |
| | | enableSales = enableSalesc; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Map<String,String> result = new Map<String,String>(); |
| | | try { |
| | | setOppFromOppInfo(); |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | //需求表没通过,没有需求表:报价不能Decide, |
| | | List<IS_Opportunity_Demand__c> ISOstutas = [SELECT id,Approval_Date__c,Func_SOD_Status__c,Opportunity_ID__r.Stock_Confrim_Date__c from IS_Opportunity_Demand__c WHERE Opportunity_ID__c = :oppid]; |
| | | List<opportunity> oldListCheck = [select Old_Opportunity_ID__c from Opportunity where id =:oppid]; |
| | | integer PassFlg = 0; |
| | | Integer StockFlg = 0; |
| | | for(IS_Opportunity_Demand__c iso : ISOstutas){ |
| | | if( iso.Approval_Date__c != null ){ |
| | | PassFlg ++; |
| | | } |
| | | if(iso.Opportunity_ID__r.Stock_Confrim_Date__c ==null){ |
| | | StockFlg++; |
| | | } |
| | | } |
| | | if (!(opp.If_Account_Change__c != null ? opp.If_Account_Change__c : false)) { |
| | | if(!ReservedProductVerification()){ |
| | | if(flglastbuy==1){ |
| | | errorflg = true; |
| | | errormessage = '预留产品表中没有该询价,请通过本部窗口联系营业管理课' ; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | }else if(flglastbuy==2){ |
| | | errorflg = true; |
| | | errormessage = errorProductmodel+'产品数量不可超过产品预留数量' ; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | }else if(flglastbuy==3){ |
| | | errorflg = true; |
| | | errormessage = '预留产品'+errorProductmodel+'未录入预留产品表'; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | if(checkVirtual('包含虚拟产品,无法进行decide')){ |
| | | errorflg = true; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | if(PassFlg == 0&&oldListCheck[0].Old_Opportunity_ID__c==null){ |
| | | errorflg = true; |
| | | errormessage = '没有批准的需求表,不能Decide (From Apex 1120)'; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | if(StockFlg>0){//&&ISOstutas.size()>0 |
| | | errorflg = true; |
| | | errormessage = '备货确认日为空,不可以decide 报价 (From Apex 1125)'; |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | String updateStr = ISO_DemandOperAndDemonsController.SetQuoteDecide(oppid); |
| | | // if (checkIsQuoteTrial()) { |
| | | // errorflg = true; |
| | | // result.put('errormessage', errormessage); |
| | | // return result; |
| | | // } |
| | | if (enableSales == true) { |
| | | if (dataCheckDecide() == false) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | if(hongzi){ |
| | | String act = JSON.serialize(activities); |
| | | result.put('act', act); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | | if (dataCheck() == false) { |
| | | result.put('errormessage', errormessage); |
| | | result = resultFlag(result); |
| | | return result; |
| | | } |
| | | if (dataEntry() == false) { |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | // if(SkipQuotefilg){ |
| | | // errorflg = true; |
| | | // errormessage = '产品配置或者经销商信息发生变化,已经生成新的报价单,请重新操作报价计算'; |
| | | // quo.IsQuoteTrial__c = false; |
| | | // result.put('errormessage', errormessage); |
| | | // return result; |
| | | // } |
| | | if (String.isBlank(oppId)) { |
| | | } else { |
| | | List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId]; |
| | | |
| | | if (opps.size() > 0) { |
| | | opps[0].Estimation_Decision__c = true; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | update opps[0]; |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | system.debug('quoId+++++'+quoId); |
| | | Quote q = new Quote(); |
| | | if(String.isBlank(quoId)){ |
| | | q = [select Id from Quote where Id = :quoIdreturn]; |
| | | }else{ |
| | | q = [select Id from Quote where Id = :quoId]; |
| | | } |
| | | q.Quote_Decision_Date__c = date.Today(); |
| | | update q; |
| | | result.put('success', System.Label.Message_002); |
| | | if(String.isBlank(quoId)){ |
| | | result.put('quoId',quoIdreturn); |
| | | } |
| | | if(errormessagewarn != null){ |
| | | result.put('warn', errormessagewarn); |
| | | String act = JSON.serialize(activities); |
| | | result.put('act', act); |
| | | } |
| | | return result; |
| | | |
| | | // pageArrange(); |
| | | } |
| | | } catch (DmlException de) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = de.getDmlMessage(0); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } catch (Exception e) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | | errormessage = e.getLineNumber()+':'+e.getMessage(); |
| | | result.put('errormessage', errormessage); |
| | | return result; |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | private static boolean dataCheckDecide() { |
| | | Boolean error = false; |
| | | errorflg = false; |
| | | errormessage = null; |
| | | errormessagewarn = null; |
| | | if (quo.Dealer_Final_Price_Page__c == null) { |
| | | // quo.Dealer_Final_Price__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.Dealer_Final_Price__c.label; |
| | | dfpp = true; |
| | | error = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (checkAgentsDeleteFlag() == false) { |
| | | return false; |
| | | } |
| | | if (WinOrDecideAlert && (!productStatusUpdated)) { |
| | | // PriceStatusUpdate(); |
| | | error = true; |
| | | errorMessage = '产品状态发生变化,请更新'; |
| | | } |
| | | if (opp.Agency1__c == null) { |
| | | // opp.Agency1__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency1__c.label; |
| | | error = true; |
| | | Agency1 = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (quo.OCM_Agent1_Price_Page__c == null || quo.OCM_Agent1_Price_Page__c == 0) { |
| | | // quo.OCM_Agent1_Price__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Quote.fields.OCM_Agent1_Price__c.label; |
| | | error = true; |
| | | oapp = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (opp.Agency2__c == null && quo.Agent1_Agent2_Price_Page__c != null) { |
| | | // opp.Agency2__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agency2__c.label; |
| | | error = true; |
| | | Agency2 = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | if (opp.Agency2__c != null && quo.Agent1_Agent2_Price_Page__c == null) { |
| | | // quo.Agent1_Agent2_Price__c.addError(System.Label.Error_Message3); |
| | | String label = Schema.SObjectType.Opportunity.fields.Agent1_Agent2_Price__c.label; |
| | | error = true; |
| | | aapp = true; |
| | | errormessage = label+':'+System.Label.Error_Message3; |
| | | } |
| | | |
| | | if (opp.If_Need_Authorize__c == true) { |
| | | ID tmpid = opp.Agency2__c == null ? opp.Agency1__c : opp.Agency2__c; |
| | | List<Account> accName = [select name from Account where id = : tmpid]; |
| | | if (accName[0].name != opp.Authorized_Finish_Sales__c) { |
| | | error = true; |
| | | errormessage = '经销商未授权或授权未完成,请先授权。' ; |
| | | } |
| | | } |
| | | //wql 报价试算 判断是否进行过报价试算 start |
| | | if(!quo.IsQuoteTrial__c){ |
| | | //没有报价试算过进入 |
| | | error = true; |
| | | errormessage = 'decide报价还没进行报价试算,请先报价试算!' ; |
| | | |
| | | } |
| | | |
| | | //wql 报价试算 判断是否进行过报价试算 end |
| | | |
| | | |
| | | //wql 报价试算 检索促销政策是否有效 start |
| | | //1.获取报价id |
| | | //2.根据报价id 检索出所有报价试算行,并带出每一行,选择的政策的有效期 3个表 |
| | | //3.循环遍历 是否所有选择的政策有效期都为true 只有有一个为false 就返回true 直接跳出循环 |
| | | //如果报价id不为空的话 |
| | | if(quoId !=null){ |
| | | boolean IsActivePsp = true; |
| | | String errorPsp =''; |
| | | //根据id 检索 所有的试算行上面选择政策的有效期 |
| | | List<PromotionSalesProducts__c> promotionSalesProductsList =[select id,PromotionSales__c,QuantityId__c,PromotionSales__r.name,PromotionSales__r.IsPolicyEffective__c from PromotionSalesProducts__c where QuantityId__c=: quoId]; |
| | | //如果有报价试算数据 说明选择了促销政策 |
| | | if(promotionSalesProductsList.size()>0){ |
| | | for(PromotionSalesProducts__c psp :promotionSalesProductsList){ |
| | | if(psp.PromotionSales__r.IsPolicyEffective__c == '无效'){ |
| | | IsActivePsp =false; |
| | | errorPsp = psp.PromotionSales__r.name; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(!IsActivePsp){ |
| | | error = true; |
| | | errormessage = '报价试算中,选择的促销政策:'+errorPsp+',不在有效期内,请检查!' ; |
| | | } |
| | | } |
| | | if (opp.Trade__c == '内貿') { |
| | | Map<Id, String> proMap = new Map<Id, String>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine qli : activities) { |
| | | if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | proMap.put(qli.pageObject.Id__c, qli.PageObject.Name__c); |
| | | } |
| | | } |
| | | } |
| | | Map<String, String> chkMap = new Map<String, String>(); |
| | | chkMap = OpportunityWebService.MapCheckProRegisterDecide(proMap, opp.Agency1__c, ''); |
| | | if (chkMap.size() > 0) { |
| | | errorflg = true; |
| | | error = true; |
| | | if (chkMap.containsKey('agency')) { |
| | | errormessage = '第一经销商没有有效的医疗器械经营许可证。'; |
| | | } |
| | | Integer inerr = 0; |
| | | if (activities.size() > 0) { |
| | | for (QELine s : activities) { |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | if (chkMap.containsKey(s.PageObject.Id__c)) { |
| | | if (chkMap.get(s.PageObject.Id__c) == '1') { |
| | | s.haveno_Register = true; |
| | | inerr ++; |
| | | } else if (chkMap.get(s.PageObject.Id__c) == '2') { |
| | | s.wrong_Register = true; |
| | | inerr ++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (inerr > 0) { |
| | | errormessage = '请检查红字内容(NMPA状态红字,不可销售产品;产品名称红字,超过经销商经营范围)。'; |
| | | hongzi = true; |
| | | } |
| | | return false; |
| | | } |
| | | // Boolean isDangerError = false; |
| | | // Boolean isNotDangerError = false; |
| | | // if (activities.size() > 0) { |
| | | // for (QELine qli : activities) { |
| | | // if (qli.Asset_Model != null && qli.Asset_Model != '') { |
| | | // if (opp.Is_Corrosion__c) { |
| | | // if(!qli.Is_DangerousChemicals){ |
| | | // isNotDangerError =true; |
| | | // qli.wrong_Register = true; |
| | | // } |
| | | |
| | | // }else{ |
| | | // if(qli.Is_DangerousChemicals){ |
| | | // isDangerError =true; |
| | | // qli.wrong_Register = true; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // if (enableSales == true&&opp.Is_Corrosion__c&&opp.Trade__c == '内貿') { |
| | | // String str = OpportunityWebService.checkDangerItem(opp.agency1__c); |
| | | // if (str != 'OK') { |
| | | // error = true; |
| | | // errormessage = str; |
| | | // } |
| | | // if(isNotDangerError){ |
| | | // error = true; |
| | | // errormessage = '当阿西塞多时,行项目的产品必须全选择危化品。'; |
| | | // } |
| | | // }else if(!opp.Is_Corrosion__c){ |
| | | // if(isDangerError){ |
| | | // error = true; |
| | | // errormessage = '当询价不是阿西塞多时,行项目的产品不能选择危化品。'; |
| | | // } |
| | | // } |
| | | } |
| | | if (error == true) { |
| | | // PageArrange(); |
| | | errorflg = true; |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | private static boolean checkIsQuoteTrial() { |
| | | Boolean error = false; |
| | | errorflg = false; |
| | | errormessage = null; |
| | | if(opp.If_Need_PriceApply__c){ |
| | | if(!quo.IsQuoteTrial__c){ |
| | | error = true; |
| | | errormessage = 'decide报价还没进行报价试算,请先报价试算!' ; |
| | | } |
| | | if(quoId !=null){ |
| | | boolean IsActivePsp = true; |
| | | String errorPsp =''; |
| | | List<PromotionSalesProducts__c> promotionSalesProductsList =[select id,PromotionSales__c,QuantityId__c,PromotionSales__r.name,PromotionSales__r.IsPolicyEffective__c,recordTypeName__c from PromotionSalesProducts__c where QuantityId__c=: quoId]; |
| | | if(promotionSalesProductsList.size()>0){ |
| | | for(PromotionSalesProducts__c psp :promotionSalesProductsList){ |
| | | if(psp.PromotionSales__r.IsPolicyEffective__c == '无效'&&psp.recordTypeName__c!='NormalProduct'){ |
| | | IsActivePsp =false; |
| | | errorPsp = psp.PromotionSales__r.name; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(!IsActivePsp){ |
| | | error = true; |
| | | errormessage = '报价试算中,选择的促销政策:'+errorPsp+',不在有效期内,请检查!' ; |
| | | } |
| | | } |
| | | } |
| | | return error; |
| | | } |
| | | public static boolean ReservedProductVerification() { |
| | | filg=true; |
| | | Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>(); |
| | | List<Id> lastProductFLGListId = new List<Id>(); |
| | | List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>(); |
| | | List<QuoteLineItem> act = new List<QuoteLineItem>(); |
| | | List<QuoteLineItem> act2 = new List<QuoteLineItem>(); |
| | | for(QELine aaa :activities){ |
| | | if(aaa.pageObject.PricebookEntry.Product2Id!=null){ |
| | | act.add(aaa.pageObject); |
| | | } |
| | | } |
| | | act2=act.deepClone(); |
| | | Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>(); |
| | | System.debug('activities1111111111112为所当为多多!!!'+activities); |
| | | integer i =0; |
| | | for(QuoteLineItem pspsc :act2){ |
| | | if(pspsc.PricebookEntry.Product2Id!=null){ |
| | | if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){ |
| | | QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id); |
| | | quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c; |
| | | map1.put(pspsc.PricebookEntry.Product2Id,quoteLine); |
| | | }else{ |
| | | map1.put(pspsc.PricebookEntry.Product2Id,pspsc); |
| | | } |
| | | System.debug('34499879!!!'+activities); |
| | | } |
| | | } |
| | | System.debug('3434343!!!'+activities); |
| | | System.debug('5656565!!!'+map1); |
| | | for (QuoteLineItem value : map1.values()) { |
| | | if(value.PricebookEntry.Product2.LastbuyProductFLG__c){ |
| | | lastProductFLGListId.add(value.PricebookEntry.Product2Id); |
| | | quotlinitMap.put(value.PricebookEntry.Product2Id,value); |
| | | lastProductFLGList.add(value); |
| | | } |
| | | } |
| | | System.debug('activities++++!!!'+activities); |
| | | System.debug('activities!!!'+map1.values()); |
| | | System.debug('oppId!!!'+oppId); |
| | | System.debug('lastProductFLGList!!!'+lastProductFLGListId); |
| | | if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){ |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true]; |
| | | Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>(); |
| | | System.debug('LastbuyObjList+++++!!!'+LastbuyObjList); |
| | | if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){ |
| | | for(LastbuyProduct__c lastbuypr :LastbuyObjList){ |
| | | LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr); |
| | | } |
| | | }else{ |
| | | flglastbuy=1; |
| | | filg=false; |
| | | return filg; |
| | | } |
| | | System.debug('LastbuyObjMap!!!'+LastbuyObjMap); |
| | | System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList); |
| | | if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){ |
| | | for(QuoteLineItem lastbuypr :lastProductFLGList){ |
| | | Decimal quoteLItemNum=0; |
| | | if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){ |
| | | quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c; |
| | | System.debug('quoteLItemNum!!!'+quoteLItemNum); |
| | | System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c); |
| | | if(lastbuypr.Quantity__c>quoteLItemNum){ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | flglastbuy=2; |
| | | filg=false; |
| | | break; |
| | | } |
| | | }else{ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | flglastbuy=3; |
| | | filg=false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | system.debug('filg====='+filg); |
| | | return filg; |
| | | } |
| | | // DB202307431108 报价单】经销商1合同金额默认值规则修改 fy start |
| | | public static String getValueFromJSONStringPlus(String jsonstring,String key,String key1) { |
| | | if (String.isNotBlank(jsonstring)) { |
| | | Map<String, Object> map1 = (Map<String, Object>) JSON.deserializeUntyped(jsonstring); |
| | | Map<String, Map<String,Object>> mapping = new Map<String, Map<String,Object>>(); |
| | | for (String str : map1.keySet()) { |
| | | Map<String,Object> mapvalue = (Map<String,Object>) map1.get(str); |
| | | mapping.put(str, mapvalue); |
| | | } |
| | | return mapping.get(key) != null ? (mapping.get(key).get(key1) !=null ? String.valueOf(mapping.get(key).get(key1)) :( mapping.get(key).get('Other') !=null ? String.valueOf(mapping.get(key).get('Other')):null)) : (mapping.get('Default') != null ? (mapping.get('Default').get(key1) !=null ? String.valueOf(mapping.get('Default').get(key1)) : (mapping.get('Default').get('Other') != null ? String.valueOf(mapping.get('Default').get('Other')):null)): null); |
| | | } |
| | | return null; |
| | | } |
| | | @AuraEnabled |
| | | public static InitData getModulus(String oppInfoc){ |
| | | opp = (Opportunity)JSON.deserialize(oppInfoc,Opportunity.class); |
| | | InitData res = new InitData(); |
| | | String str_rate_hospital = ControllerUtil.getValueFromJSONString(System.Label.Quote_HospitalAmount_Rate, opp.Salesdepartment_Owner__c); |
| | | String str_rate_agency1 = lexSINewQuoteEntryController.getValueFromJSONStringPlus(System.Label.Quote_Agency1Amount_Rate, opp.Salesdepartment_Owner__c,opp.Opportunity_Category__c); |
| | | res.rate_hospital = String.isNotBlank(str_rate_hospital) ? Decimal.valueOf(str_rate_hospital) : 1.0; |
| | | res.rate_agency1 = String.isNotBlank(str_rate_agency1) ? Decimal.valueOf(str_rate_agency1) : 1.0; |
| | | return res; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | public static Boolean checkVirtual(String message){ |
| | | |
| | | List<String> idList = new List<String>(); |
| | | for (QELine s : activities) { |
| | | if (String.isNotBlank(s.Category5) && s.Category5 == '虚拟') { |
| | | idList.add(s.Category5); |
| | | } |
| | | System.debug('Category5+'+s.Category5); |
| | | } |
| | | if(idList.size() > 0){ |
| | | errorMessage = message; |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | @AuraEnabled |
| | | public static String submitOppoApplyStock(String oppIdc,String quoIdc){ |
| | | oppId = oppIdc; |
| | | quoId = quoIdc; |
| | | id oppIDs = null; |
| | | if(oppid == null){ |
| | | Quote qupSet = [SELECT Opportunityid from Quote WHERE id =:quoId]; |
| | | oppIDs = qupSet.Opportunityid; |
| | | }else{ |
| | | oppIDs = oppid; |
| | | } |
| | | Opportunity ops = [SELECT id,Stock_Submit_Date__c,Stock_Confrim_Date__c,Sales_assistant_ID__c, |
| | | Stock_Check_Leader__c,Quote_Update_Sum__c, |
| | | is_CheckTarget_TF__c from Opportunity WHERE id =:oppIDs]; |
| | | User ThisAssisUser = [select id,SI_Stock_Checker__c,Salesdepartment__c,Profileid from user where id = :UserInfo.getUserId()]; |
| | | String ProfileId_IThelp = System.Label.ProfileId_IThelp; |
| | | System.debug('ProfileId_IThelp'+ProfileId_IThelp); |
| | | if(ops.Sales_assistant_ID__c!=UserInfo.getUserId().substring(0,15) && ThisAssisUser.Profileid!=System.Label.ProfileId_SystemAdmin && ThisAssisUser.Profileid!=ProfileId_IThelp){ |
| | | errormessage = 'errorss:申请备货确认,须由询价助理提出申请 (From Apex 1043)'; |
| | | return errormessage; |
| | | }else{ |
| | | if(ThisAssisUser.SI_Stock_Checker__c == null){ |
| | | if(ThisAssisUser.Salesdepartment__c == '5.华东'){ |
| | | ThisAssisUser.SI_Stock_Checker__c = System.label.SI_Stock_HD; |
| | | }else if(ThisAssisUser.Salesdepartment__c == '2.东北' || ThisAssisUser.Salesdepartment__c == '4.西南'){ |
| | | ThisAssisUser.SI_Stock_Checker__c = System.label.SI_Stock_HDHN; |
| | | }else if(ThisAssisUser.Salesdepartment__c == '1.华北' || ThisAssisUser.Salesdepartment__c == '6.华南'){ |
| | | ThisAssisUser.SI_Stock_Checker__c = System.label.si_stock_dbhb; |
| | | }else if(ThisAssisUser.Salesdepartment__c == '3.西北'){ |
| | | ThisAssisUser.SI_Stock_Checker__c = System.label.SI_Stock_XBXN; |
| | | } |
| | | update ThisAssisUser; |
| | | } |
| | | ops.Stock_Submit_Date__c = Date.today(); |
| | | if (ops.Quote_Update_Sum__c == null) { |
| | | ops.Quote_Update_Sum__c = 1; |
| | | } else { |
| | | ops.Quote_Update_Sum__c = ops.Quote_Update_Sum__c + 1; |
| | | } |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try{ |
| | | update ops; |
| | | Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); |
| | | psr.setObjectId(oppIDs); |
| | | Approval.ProcessResult submitResult = Approval.process(psr); |
| | | errormessage = '备货确认申请已提交 (From Apex 1000)'; |
| | | return errormessage; |
| | | }catch (Exception o){ |
| | | Database.rollback(sp); |
| | | return 'errorss:'+o; |
| | | } |
| | | } |
| | | } |
| | | //报价确认 |
| | | @AuraEnabled |
| | | public static String QuoteConfirm(String quoid){ |
| | | System.debug('报价确认进入======'); |
| | | List<Quote> QuoteList = [SELECT id,Queto_Confirm_Date__c,Opportunity.Sales_assistant_ID__c, |
| | | CreatedBy.SalesManager__c,CreatedBy.ZongjianApprovalManager__c, |
| | | CreatedBy.BuchangApprovalManagerSales__c,OpportunityId,Opportunity.Quote_Update_Sum__c |
| | | from Quote WHERE id=:quoid]; |
| | | Map<Id,Opportunity> oppMap = new Map<Id,Opportunity>(); |
| | | for(Quote Qu : QuoteList){ |
| | | Qu.Queto_Confirm_Date__c = Date.today(); |
| | | Qu.OpporsAssistance__c = Qu.Opportunity.Sales_assistant_ID__c; |
| | | Qu.Manager_Sell__c = Qu.CreatedBy.SalesManager__c; |
| | | Qu.Minister_Sell__c = Qu.CreatedBy.BuchangApprovalManagerSales__c; |
| | | Qu.Majordomo_Sell__c =Qu.CreatedBy.ZongjianApprovalManager__c; |
| | | if (String.isBlank(Qu.OpportunityId) == false) { |
| | | Opportunity opp = new Opportunity(); |
| | | opp.Id = Qu.OpportunityId; |
| | | if (Qu.Opportunity.Quote_Update_Sum__c == null) { |
| | | opp.Quote_Update_Sum__c = 1; |
| | | } else { |
| | | opp.Quote_Update_Sum__c = Qu.Opportunity.Quote_Update_Sum__c + 1; |
| | | } |
| | | oppMap.put(Qu.id, opp); |
| | | } |
| | | } |
| | | Savepoint Sp = Database.setSavepoint(); |
| | | try{ |
| | | Update QuoteList; |
| | | Update oppMap.values(); |
| | | return 'success'; |
| | | }catch (Exception o){ |
| | | Database.rollback(Sp); |
| | | return 'errorss:'+o; |
| | | } |
| | | } |
| | | public class InitData{ |
| | | @AuraEnabled |
| | | public Decimal rate_hospital; |
| | | @AuraEnabled |
| | | public Decimal rate_agency1; |
| | | } |
| | | //行项目自定义结构 |
| | | //行项目原值 |
| | | public class QELinelatestInfo { |
| | | public String ProductCode { get; set; } |
| | | public String ProductName { get; set; } |
| | | public String SFDA_Status { get; set; } |
| | | public String Sales_Possibility { get; set; } |
| | | public Decimal ListPrice { get; set; } |
| | | public Decimal Cost { get; set; } |
| | | public Integer Specifications {get; set;} |
| | | public string GuranteeType {get; set;} |
| | | public Decimal Intra_Trade_Gurantee {get; set;} |
| | | public Decimal ProductEntend_gurantee_period_all {get; set;} |
| | | public Decimal Intra_Trade_Service {get; set;} |
| | | public Decimal Maintenance_Price_Year {get; set;} |
| | | public Boolean CanNotCancelledGurantee {get; set;} |
| | | public Boolean Is_DangerousChemicals {get; set;} |
| | | } |
| | | //行项目新值 |
| | | public class QELine { |
| | | public Integer lineNo; |
| | | public String Asset_Model; |
| | | public String Sales_Possibility; |
| | | public QuoteLineItem pageObject; |
| | | public Decimal Cost_c; |
| | | public Decimal Cost_Subtotal_c; |
| | | public Decimal ListPrice_Page; |
| | | public String StorageStatus; |
| | | public Integer Specifications; |
| | | public String VenderName; |
| | | public String Product_Set_Name; |
| | | public Boolean CanNotCancelledGurantee; |
| | | public Boolean Is_DangerousChemicals; |
| | | public QELinelatestInfo latestInfo; |
| | | public boolean changed_name; |
| | | public boolean changed_sfda; |
| | | public boolean changed_list; |
| | | public boolean changed_cost; |
| | | public boolean haveno_Register; |
| | | public boolean wrong_Register; |
| | | public String Estimated_ConsumptionDueDate; |
| | | public Decimal GuranteePrice; |
| | | public Decimal ProductGuranteePrice; |
| | | public decimal Maintenance_Price_Year; |
| | | public String Category5; |
| | | public QELine(){} |
| | | public QELine(QuoteLineItem qli, Integer i, String copyQuoId) { |
| | | this.lineNo = i; |
| | | pageObject = qli.clone(); |
| | | pageObject.Id__c = qli.PricebookEntry.Product2Id; |
| | | pageObject.Quantity__c = qli.Quantity; |
| | | if (String.isNotBlank(copyQuoId)) { |
| | | pageObject.SFDA_Status__c = qli.PricebookEntry.Product2.SFDA_Status__c; |
| | | pageObject.Name__c = qli.PricebookEntry.Product2.Name; |
| | | } |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | Category5 = qli.PricebookEntry.Product2.Category5__c; |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | this.Asset_Model = qli.Asset_Model_No__c; |
| | | if (qli.Cost__c > 0 && qli.Quantity > 0) { |
| | | this.Cost_Subtotal_c = qli.Cost__c * qli.Quantity; |
| | | } |
| | | this.VenderName = qli.PricebookEntry.Product2.VenderName__c; |
| | | if(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c != null){ |
| | | this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(qli.PricebookEntry.Product2.Estimated_ConsumptionDueDate__c).replaceAll('-','/'); |
| | | }else{ |
| | | this.Estimated_ConsumptionDueDate = ''; |
| | | } |
| | | if(VenderName==null||VenderName==''){ |
| | | this.VenderName =' 无 '; |
| | | } |
| | | this.Product_Set_Name = qli.ProductSetName__c; |
| | | this.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c; |
| | | this.Is_DangerousChemicals = qli.PricebookEntry.Product2.Is_DangerousChemicals__c; |
| | | this.StorageStatus = qli.PricebookEntry.Product2.StorageStatus__c; |
| | | this.ListPrice_Page = qli.ListPrice__c; |
| | | this.Cost_c = qli.Cost__c; |
| | | pageObject.Subtotal__c = qli.TotalPrice__c; |
| | | pageObject.UnitPrice_Page__c = qli.UnitPrice__c; |
| | | latestInfo = new QELinelatestInfo(); |
| | | latestInfo.ProductCode = qli.ProductCode__c; |
| | | latestInfo.ProductName = qli.PricebookEntry.Product2.Name; |
| | | latestInfo.SFDA_Status = qli.PricebookEntry.Product2.SFDA_Status__c; |
| | | latestInfo.ProductEntend_gurantee_period_all = qli.PricebookEntry.Product2.Entend_gurantee_period_all__c; |
| | | if(qli.Quote.Opportunity.Trade__c == '内貿'){ |
| | | latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c; |
| | | latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.Intra_Trade_Service_RMB__c; |
| | | if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){ |
| | | latestInfo.Maintenance_Price_Year = 0; |
| | | }else{ |
| | | latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Maintenance_Price_Year__c; |
| | | } |
| | | }else if(qli.Quote.Opportunity.Trade__c == '外貿'){ |
| | | latestInfo.Intra_Trade_Gurantee = qli.PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c; |
| | | latestInfo.Intra_Trade_Service = qli.PricebookEntry.Product2.NoDiscount_Foreign__c; |
| | | if(qli.PricebookEntry.Product2.Maintenance_Price_Year__c == null){ |
| | | latestInfo.Maintenance_Price_Year = 0; |
| | | }else{ |
| | | latestInfo.Maintenance_Price_Year = qli.PricebookEntry.Product2.Repair_Contract_USD__c; |
| | | } |
| | | } |
| | | latestInfo.GuranteeType = qli.PricebookEntry.Product2.GuranteeType__c; |
| | | latestInfo.CanNotCancelledGurantee = qli.PricebookEntry.Product2.CanNotCancelledGurantee__c; |
| | | this.Maintenance_Price_Year = qli.Maintenance_Price_Year__c; |
| | | this.GuranteePrice = qli.GuranteePrice__c; |
| | | this.ProductGuranteePrice = qli.ProductGuranteePrice__c; |
| | | latestInfo.Sales_Possibility = qli.PricebookEntry.Product2.Sales_Possibility__c; |
| | | if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) { |
| | | latestInfo.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + ''); |
| | | } |
| | | latestInfo.ListPrice = qli.Product_ListPrice__c; |
| | | latestInfo.Cost = qli.Product_Cost__c; |
| | | if (qli.PricebookEntry.Product2.Packing_list_manual__c != null) { |
| | | this.Specifications = integer.valueof(qli.PricebookEntry.Product2.Packing_list_manual__c + ''); |
| | | } |
| | | this.changed_name = false; |
| | | this.changed_sfda = false; |
| | | this.changed_list = false; |
| | | this.changed_cost = false; |
| | | this.haveno_Register = false; |
| | | this.wrong_Register = false; |
| | | } |
| | | public QELine(Integer i,Boolean Is_DangerousChemicals,Boolean CanNotCancelledGurantee,String VenderName, |
| | | Date Estimated_ConsumptionDueDate,String ProductSetName, |
| | | String PricebookEntryId, |
| | | String Asset_Model, String StorageStatus, |
| | | String ProductCode, String Id_c, |
| | | String SFDA_Status_c, String Sales_Possibility_c, |
| | | String Name_c, String BSS_Category_c, |
| | | Integer Quantity, Decimal ListPrice_c, |
| | | Decimal UnitPrice_c, Decimal Cost_c, |
| | | Decimal Packing_list_manual |
| | | , Decimal Entend_gurantee_period_all |
| | | , decimal ProductGuranteePrice |
| | | , string GuranteeType |
| | | , Decimal productServicePrice |
| | | , Decimal productMaintenance_Price_Year |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | ,String Category5 |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | ) { |
| | | pageObject = New QuoteLineItem(); |
| | | pageObject.Quantity__c = Quantity; |
| | | this.lineNo = i; |
| | | this.Asset_Model = Asset_Model; |
| | | this.Sales_Possibility = Sales_Possibility_c; |
| | | if(Estimated_ConsumptionDueDate != null){ |
| | | this.Estimated_ConsumptionDueDate = NFMUtil.formatDate2StrSpo(Estimated_ConsumptionDueDate).replaceAll('-','/'); |
| | | }else{ |
| | | this.Estimated_ConsumptionDueDate = ''; |
| | | } |
| | | this.StorageStatus = StorageStatus; |
| | | pageObject.Id__c = Id_c; |
| | | pageObject.SFDA_Status__c = SFDA_Status_c; |
| | | pageObject.Name__c = Name_c; |
| | | pageObject.BSS_Category__c = BSS_Category_c; |
| | | this.ListPrice_Page = ListPrice_c; |
| | | pageObject.UnitPrice_Page__c = UnitPrice_c; |
| | | pageObject.Subtotal__c = UnitPrice_c * Quantity; |
| | | this.Product_Set_Name = ProductSetName; |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | Category5 = Category5; |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | if(VenderName==null||VenderName==''){ |
| | | this.VenderName =' 无 '; |
| | | }else{ |
| | | this.VenderName = VenderName; |
| | | } |
| | | this.CanNotCancelledGurantee = CanNotCancelledGurantee; |
| | | this.Is_DangerousChemicals = Is_DangerousChemicals; |
| | | pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all; |
| | | pageObject.productServicePrice__c = productServicePrice; |
| | | pageObject.GuranteeType__c = GuranteeType; |
| | | this.ProductGuranteePrice = ProductGuranteePrice; |
| | | this.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | this.Cost_c = Cost_c; |
| | | this.Cost_Subtotal_c = Cost_c * Quantity; |
| | | pageObject.PricebookEntryId = PricebookEntryId; |
| | | latestInfo = New QELinelatestInfo(); |
| | | latestInfo.ProductCode = ProductCode; |
| | | latestInfo.ProductName = Name_c; |
| | | latestInfo.SFDA_Status = SFDA_Status_c; |
| | | latestInfo.Sales_Possibility = Sales_Possibility_c; |
| | | latestInfo.ListPrice = this.ListPrice_Page; |
| | | latestInfo.Cost = pageObject.Cost__c; |
| | | latestInfo.ProductEntend_gurantee_period_all = Entend_gurantee_period_all; |
| | | latestInfo.Intra_Trade_Gurantee = ProductGuranteePrice; |
| | | latestInfo.Intra_Trade_Service = productServicePrice; |
| | | latestInfo.GuranteeType = GuranteeType; |
| | | latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | latestInfo.CanNotCancelledGurantee = CanNotCancelledGurantee; |
| | | latestInfo.Is_DangerousChemicals = Is_DangerousChemicals; |
| | | if (Packing_list_manual != null) { |
| | | latestInfo.Specifications = integer.valueof('' + Packing_list_manual); |
| | | } |
| | | if (Packing_list_manual != null) { |
| | | this.Specifications = integer.valueof('' + Packing_list_manual); |
| | | } |
| | | this.changed_name = false; |
| | | this.changed_sfda = false; |
| | | this.changed_list = false; |
| | | this.changed_cost = false; |
| | | this.haveno_Register = false; |
| | | this.wrong_Register = false; |
| | | } |
| | | } |
| | | } |
| New file |
| | |
| | | @isTest |
| | | public class lexSINewQuoteEntryControllerTest { |
| | | static final String RC_BYOUIN = '病院'; |
| | | static final String RC_HANBAOITEN = '販売店'; |
| | | static final String RC_KEIYAKU = '契約'; |
| | | public static String CurrencyIso = 'CNY'; |
| | | private static String quoteNo = 'textQutote01'; |
| | | public static String trade = '内貿'; |
| | | |
| | | private static Boolean isUnitPrice = true; |
| | | private static Boolean isOfferAmount = true; |
| | | private static Boolean isTotalPrice = true; |
| | | private static Boolean isDiscountRate = true; |
| | | private static Boolean isDiscountAmount = true; |
| | | private static Boolean isTradingPrice = true; |
| | | private static Boolean isContractDetail = true; |
| | | |
| | | private static Date offerExpireDate = Date.today(); |
| | | private static String clientName = 'test client'; |
| | | private static String offerComment = 'test comment'; |
| | | private static Date offerPrintDate = Date.today(); |
| | | private static String agentName = 'test agent name'; |
| | | @isTest |
| | | static void Test1(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | lexSINewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(长期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(长期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | lexSINewQuoteEntryController.selectProById(prostr); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"暂停出库(短期)","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | quoteflg = true; |
| | | lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | lexSINewQuoteEntryController.setOppFromOppInfo(); |
| | | } |
| | | @isTest |
| | | static void Test2(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | |
| | | Product_Set_Detail__c psd1 = new Product_Set_Detail__c(); |
| | | psd1.Product_Set__c = ps1.id; |
| | | psd1.Price__c = 100; |
| | | psd1.Quantity__c = 10; |
| | | psd1.Product__c = product1.id; |
| | | |
| | | insert psd1; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('12','121','122'); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<Product_Set__c> pstc = lexSINewQuoteEntryController.serSetContact('品','1',''); |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String setProduct_text = ps1.Id; |
| | | String setprd = lexSINewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc); |
| | | String excel_text = 'OTV-SP1H-NA-12E\r1\nN1085630\r1\nN1085930\r1\nN1085530\r1\nN2303830\r1'; |
| | | String eximt = lexSINewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | private static Id pricebookId = ControllerUtil.getStandardPricebook().Id; |
| | | |
| | | static testMethod void Test3(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | // 产品 |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'Prd1'; |
| | | prd1.ProductCode = 'Prd1'; |
| | | prd1.Repair_Product_Code__c = 'Prd1_RP'; |
| | | prd1.Name = 'Prd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Category2__c = '本体'; |
| | | prd1.Category3__c = '纤维镜'; |
| | | prd1.Category4__c = 'CV'; |
| | | prd1.Category5__c = '260SL系列'; |
| | | prd1.Asset_Model_No__c = '1001'; |
| | | prd1.Important_product__c = true; |
| | | prd1.Important_Rroduct_1GI__c = true; |
| | | insert prd1; |
| | | |
| | | PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id); |
| | | entry.UnitPrice = 0; |
| | | entry.IsActive = true; |
| | | entry.UseStandardPrice = false; |
| | | entry.CurrencyIsoCode = 'CNY'; |
| | | insert entry; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | lexSINewQuoteEntryController.selectAccountById(contractA.Id); |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | insert opp; |
| | | |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":true,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quos.OpportunityId = opp.Id; |
| | | quos.Pricebook2Id = pricebookId; |
| | | // 删除ID属性 |
| | | quos.Id = null; |
| | | // 执行插入操作 |
| | | insert quos; |
| | | |
| | | lexSINewQuoteEntryController.selectQuoteById(quos.Id); |
| | | // 报价行项目 |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quos.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = prd1.id; |
| | | target.PricebookEntryId = entry.Id; |
| | | insert target; |
| | | |
| | | |
| | | lexSINewQuoteEntryController.selectQuoteLineItem(quos.Id,opp.Id); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),''); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'',''); |
| | | lexSINewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',true); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoteGurantee_Periodc = null; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | Boolean quoteflg = true; |
| | | prd1.Category5__c = '虚拟'; |
| | | update prd1; |
| | | lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | lexSINewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,'',quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false); |
| | | quoIdc = quos.Id; |
| | | oppIdc = null; |
| | | oppInfoc = JSON.serialize(opp); |
| | | lexSINewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,false); |
| | | } |
| | | static testMethod void Test5(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | // 产品 |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'Prd1'; |
| | | prd1.ProductCode = 'Prd1'; |
| | | prd1.Repair_Product_Code__c = 'Prd1_RP'; |
| | | prd1.Name = 'Prd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prd1.Category2__c = '本体'; |
| | | prd1.Category3__c = '纤维镜'; |
| | | prd1.Category4__c = 'CV'; |
| | | prd1.Category5__c = '260SL系列'; |
| | | prd1.Asset_Model_No__c = '1001'; |
| | | prd1.Important_product__c = true; |
| | | prd1.Important_Rroduct_1GI__c = true; |
| | | insert prd1; |
| | | |
| | | PricebookEntry entry = new PricebookEntry(Pricebook2Id = pricebookId, Product2Id = prd1.Id); |
| | | entry.UnitPrice = 0; |
| | | entry.IsActive = true; |
| | | entry.UseStandardPrice = false; |
| | | entry.CurrencyIsoCode = 'CNY'; |
| | | insert entry; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | lexSINewQuoteEntryController.selectAccountById(contractA.Id); |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = 'ET24時間販売'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | opp.Is_Corrosion__c=true; |
| | | opp.SAP_Province__c='上海市'; |
| | | |
| | | |
| | | insert opp; |
| | | |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quos.OpportunityId = opp.Id; |
| | | quos.Pricebook2Id = pricebookId; |
| | | // 删除ID属性 |
| | | quos.Id = null; |
| | | // 执行插入操作 |
| | | insert quos; |
| | | |
| | | lexSINewQuoteEntryController.selectQuoteById(quos.Id); |
| | | // 报价行项目 |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quos.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | // target.TotalPrice = 100; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = prd1.id; |
| | | target.PricebookEntryId = entry.Id; |
| | | target.Item_Order__c = 3; |
| | | |
| | | insert target; |
| | | |
| | | |
| | | lexSINewQuoteEntryController.selectQuoteLineItem(target.Id,opp.Id); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),String.valueOf(opp.Id),''); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount(String.valueOf(quos.Id),'',''); |
| | | lexSINewQuoteEntryController.getPicklistValues('Quote','QuotationChange__c',false); |
| | | String CheckItemCan = null; |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":null,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":true,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":null,"OCM_Agent1_Price_Page__c":0,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | String quoIdc = quos.Id; |
| | | String quoteGurantee_Periodc = null; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexSINewQuoteEntryController.QuoteConfirm(quoIdc); |
| | | lexSINewQuoteEntryController.print( activitiesCan,CheckItemCan ,WinOrDecideAlertc,productStatusUpdatedc,oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc,quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,true); |
| | | } |
| | | @isTest |
| | | static void Test4(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | lexSINewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | lexSINewQuoteEntryController.selectProById(prostr); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"暂停出库(短期)","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"暂停出库(短期)","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"Id__c":null,"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[1].pageObject.Id__c = product2.Id; |
| | | for(lexSINewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexSINewQuoteEntryController.SaveQuote(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc,quoteflg); |
| | | } |
| | | @isTest |
| | | static void Test6(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | |
| | | Product_Set_Detail__c psd1 = new Product_Set_Detail__c(); |
| | | psd1.Product_Set__c = ps1.id; |
| | | psd1.Price__c = 100; |
| | | psd1.Quantity__c = 10; |
| | | psd1.Product__c = product1.id; |
| | | |
| | | insert psd1; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('12','121','122'); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<Product_Set__c> pstc = lexSINewQuoteEntryController.serSetContact('品','1',''); |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String setProduct_text = ps1.Id; |
| | | String setprd = lexSINewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc); |
| | | String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1'; |
| | | String eximt = lexSINewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | @isTest |
| | | static void Test7(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '内貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'CNY'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | lexSINewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = CurrencyIso; |
| | | //pE. |
| | | insert pE2; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | lexSINewQuoteEntryController.selectProById(prostr); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"暂停出库(短期)","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"暂停出库(短期)","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"Id__c":null,"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[1].pageObject.Id__c = product2.Id; |
| | | for(lexSINewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | lexSINewQuoteEntryController.submitOppoApplyStock(opp.Id,''); |
| | | } |
| | | @isTest |
| | | static void Test8(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'USD'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | lexSINewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | product1.LastbuyProductFLG__c = true; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | LastbuyProduct__c lbp = new LastbuyProduct__c(); |
| | | lbp.Name = 'Test0215'; |
| | | lbp.ProductName__c = product1.Id; |
| | | lbp.InquiryCode__c = opp.Id; |
| | | lbp.effectiveFLG__c = true; |
| | | lbp.LastbuyQuantity__c = 1; |
| | | insert lbp; |
| | | Quote quote = new Quote( Name = 'テスト見積'); |
| | | quote.OpportunityId = opp.Id; |
| | | quote.Pricebook2Id = pricebook.id; |
| | | quote.Quote_No__c = 'textQutote01'; |
| | | quote.Unit_Price__c = isUnitPrice; |
| | | quote.Offer_Amount__c = isOfferAmount; |
| | | quote.TOTAL__c = isTotalPrice; |
| | | quote.Discount__c = isDiscountRate; |
| | | quote.Pricing__c = isDiscountAmount; |
| | | quote.Preferential_Trading_Price__c = isTradingPrice; |
| | | quote.Contract__c = isContractDetail; |
| | | quote.Quote_Comment__c = offerComment; |
| | | insert quote; |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quote.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = product1.id; |
| | | target.PricebookEntryId = pE.Id; |
| | | insert target; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | lexSINewQuoteEntryController.selectProById(prostr); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = lexSINewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id); |
| | | List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[0].pageObject.Quantity__c = 2; |
| | | activities[0].pageObject.PricebookEntryId = pE.Id; |
| | | for(lexSINewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | } |
| | | @isTest |
| | | static void Test9(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'USD'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | lexSINewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | product1.LastbuyProductFLG__c = false; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | LastbuyProduct__c lbp = new LastbuyProduct__c(); |
| | | lbp.Name = 'Test0215'; |
| | | lbp.ProductName__c = product1.Id; |
| | | lbp.InquiryCode__c = opp.Id; |
| | | lbp.effectiveFLG__c = true; |
| | | lbp.LastbuyQuantity__c = 1; |
| | | // insert lbp; |
| | | Quote quote = new Quote( Name = 'テスト見積'); |
| | | quote.OpportunityId = opp.Id; |
| | | quote.Pricebook2Id = pricebook.id; |
| | | quote.Quote_No__c = 'textQutote01'; |
| | | quote.Unit_Price__c = isUnitPrice; |
| | | quote.Offer_Amount__c = isOfferAmount; |
| | | quote.TOTAL__c = isTotalPrice; |
| | | quote.Discount__c = isDiscountRate; |
| | | quote.Pricing__c = isDiscountAmount; |
| | | quote.Preferential_Trading_Price__c = isTradingPrice; |
| | | quote.Contract__c = isContractDetail; |
| | | quote.Quote_Comment__c = offerComment; |
| | | insert quote; |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quote.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = product1.id; |
| | | target.PricebookEntryId = pE.Id; |
| | | insert target; |
| | | License_Information__c linc = new License_Information__c( name='Test20181204', |
| | | LicenseType__c = '医疗器械经营许可证', |
| | | BusinessLicense__c = '20180522', |
| | | ValidFrom__c = date.newinstance(2018, 05, 22), |
| | | ValidTo__c = date.newinstance(2088, 05, 22), |
| | | Scope3__c = '6815;6822;6823;6825', |
| | | LicenseAndAccount__c = sellerA.id |
| | | ); |
| | | insert linc; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | lexSINewQuoteEntryController.selectProById(prostr); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = lexSINewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id); |
| | | List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[0].pageObject.Quantity__c = 2; |
| | | activities[0].pageObject.PricebookEntryId = pE.Id; |
| | | activities[0].pageObject.SFDA_Status__c = '暂停出库(短期)'; |
| | | activities[0].pageObject.UnitPrice_Page__c = 200; |
| | | activities[0].pageObject.AgencyUnitPrice__c = 200; |
| | | for(lexSINewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = true; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quos.IsQuoteTrial__c = true; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | } |
| | | @isTest |
| | | static void Test10(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Medical_Equipment_Num__c = '有证'; |
| | | sellerA.Business_Authorization_No__c = '0001'; |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | opp.CurrencyIsoCode = 'USD'; |
| | | opp.Stock_Confrim_Date__c = Date.today().addDays(50); |
| | | insert opp; |
| | | IS_Opportunity_Demand__c ISOhead = new IS_Opportunity_Demand__c(); |
| | | ISOhead.name = '*'; |
| | | ISOhead.Opportunity_ID__c = opp.id; |
| | | ISOhead.Approval_Date__c = Date.today(); |
| | | ISOhead.Public_Hospital_TF__c = true; |
| | | ISOhead.Preparation_Stage_TF__c = true; |
| | | ISOhead.Data_Check_TF__c = true; |
| | | ISOhead.Operating_Room_Plane_Graph_TF__c = true; |
| | | ISOhead.Demonstration_Area_Plane_Graph_TF__c = true; |
| | | insert ISOhead; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | lexSINewQuoteEntryController.getquoDes(); |
| | | |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '暂停出库(短期)'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | product1.LastbuyProductFLG__c = false; |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '暂停出库(短期)'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | LastbuyProduct__c lbp = new LastbuyProduct__c(); |
| | | lbp.Name = 'Test0215'; |
| | | lbp.ProductName__c = product1.Id; |
| | | lbp.InquiryCode__c = opp.Id; |
| | | lbp.effectiveFLG__c = true; |
| | | lbp.LastbuyQuantity__c = 1; |
| | | // insert lbp; |
| | | Quote quote = new Quote( Name = 'テスト見積'); |
| | | quote.OpportunityId = opp.Id; |
| | | quote.Pricebook2Id = pricebook.id; |
| | | quote.Quote_No__c = 'textQutote01'; |
| | | quote.Unit_Price__c = isUnitPrice; |
| | | quote.Offer_Amount__c = isOfferAmount; |
| | | quote.TOTAL__c = isTotalPrice; |
| | | quote.Discount__c = isDiscountRate; |
| | | quote.Pricing__c = isDiscountAmount; |
| | | quote.Preferential_Trading_Price__c = isTradingPrice; |
| | | quote.Contract__c = isContractDetail; |
| | | quote.Quote_Comment__c = offerComment; |
| | | insert quote; |
| | | QuoteLineItem target = new QuoteLineItem(); |
| | | target.Name__c = 'テスト商品'; |
| | | target.QuoteId = quote.id; |
| | | target.Quantity = 1; |
| | | target.Cost_Subtotal__c = 0; |
| | | target.Cost__c = 200; |
| | | target.Item_Order__c = 3; |
| | | target.UnitPrice = 10; |
| | | target.Product2Id = product1.id; |
| | | target.PricebookEntryId = pE.Id; |
| | | insert target; |
| | | License_Information__c linc = new License_Information__c( name='Test20181204', |
| | | LicenseType__c = '医疗器械经营许可证', |
| | | BusinessLicense__c = '20180522', |
| | | ValidFrom__c = date.newinstance(2018, 05, 22), |
| | | ValidTo__c = date.newinstance(2088, 05, 22), |
| | | Scope3__c = '6815;6822;6823;6825', |
| | | LicenseAndAccount__c = sellerA.id |
| | | ); |
| | | insert linc; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('','',''); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<String> proList = new List<String>(); |
| | | proList.add(product1.Id); |
| | | proList.add(product2.Id); |
| | | String prostr = JSON.serialize(proList); |
| | | lexSINewQuoteEntryController.selectProById(prostr); |
| | | Boolean SkipQuotefilgc = false; |
| | | boolean WinOrDecideAlertc = false; |
| | | String activitiesCan = lexSINewQuoteEntryController.selectQuoteLineItem(quote.Id,opp.Id); |
| | | List<lexSINewQuoteEntryController.QELine> activities = (List<lexSINewQuoteEntryController.QELine>)JSON.deserialize(activitiesCan,List<lexSINewQuoteEntryController.QELine>.class); |
| | | List<QuoteLineItem> bbb = new List<QuoteLineItem>(); |
| | | Integer i = 0; |
| | | activities[0].pageObject.Id__c = product1.Id; |
| | | activities[0].pageObject.Quantity__c = 2; |
| | | activities[0].pageObject.PricebookEntryId = pE.Id; |
| | | activities[0].pageObject.SFDA_Status__c = '暂停出库(短期)'; |
| | | for(lexSINewQuoteEntryController.QELine aa:activities){ |
| | | bbb.add(aa.pageObject); |
| | | i++; |
| | | } |
| | | String CheckItemCan =JSON.serialize(bbb); |
| | | activitiesCan = JSON.serialize(activities); |
| | | Boolean changedAfterPrintc = false; |
| | | boolean enableSalesc = false; |
| | | boolean newQuoteFlagc = false; |
| | | String oppIdc = opp.Id; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | boolean productStatusUpdatedc = false; |
| | | String quoIdc = ''; |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quos.IsQuoteTrial__c = true; |
| | | quoc = JSON.serialize(quos); |
| | | String quoteGurantee_Periodc = null; |
| | | Boolean quoteflg = false; |
| | | String quotemultiYearWarrantyc = null; |
| | | String selection_hpc = '杭州市丁桥医院'; |
| | | lexSINewQuoteEntryController.QuoteDecision(activitiesCan,CheckItemCan,WinOrDecideAlertc,productStatusUpdatedc, |
| | | oppInfoc,enableSalesc,quoc,oppIdc,quoIdc,newQuoteFlagc,changedAfterPrintc,quoteGurantee_Periodc, |
| | | quotemultiYearWarrantyc,selection_hpc,SkipQuotefilgc); |
| | | } |
| | | @isTest |
| | | static void Test11(){ |
| | | RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_BYOUIN limit 1]; |
| | | Account hospital = new Account(Name = 'テスト病院'); |
| | | hospital.RecordTypeId = recByoin.id; |
| | | hospital.Site = 'テスト病院部門'; |
| | | hospital.Alias_Name2__c = 'テスト病院別名'; |
| | | insert hospital; |
| | | |
| | | RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_HANBAOITEN limit 1]; |
| | | Account sellerA = new Account(Name = '販売店'); |
| | | sellerA.RecordTypeId = recHanbaiten.id; |
| | | sellerA.Hospital__c = hospital.id; |
| | | sellerA.Tax_Practice_No__c = '001'; |
| | | sellerA.Sales_Shop_Class__c = '特約販売店(区域)'; |
| | | sellerA.Business_Authorization_No__c = '001'; |
| | | sellerA.Tax_Practice_Expiration_Date__c = Date.today().addDays(20); |
| | | sellerA.Business_Paper_Expiration_Date__c = Date.today().addDays(20); |
| | | insert sellerA; |
| | | |
| | | RecordType recKeiyaku = [select id from RecordType where IsActive = true and SobjectType= 'Account' and Name=:RC_KEIYAKU limit 1]; |
| | | Account contractA = new Account(Name = '*'); |
| | | contractA.RecordTypeId = recKeiyaku.id; |
| | | contractA.Agent_Ref__c = sellerA.id; |
| | | contractA.Hospital__c=hospital.id; |
| | | contractA.ParentId = sellerA.id; |
| | | insert contractA; |
| | | StaticParameter.EscapeOppandStaTrigger = true; |
| | | Opportunity opp = new Opportunity( Name='aiueo', StageName='contact', CloseDate=Date.today()); |
| | | opp.Trade__c = '外貿'; |
| | | //opp.CurrencyIsoCode = CurrencyIso; |
| | | opp.Sales_Root__c = '販売店'; |
| | | opp.StageName = '引合'; |
| | | opp.Fixed_Check__c = false; |
| | | opp.owner_not_automatically_update__c = true; |
| | | //opp.Pricebook2Id = pricebook.id; |
| | | opp.Purchase_Type__c = '一般引合'; |
| | | opp.Promise_Class__c = '外貿'; |
| | | opp.Fund_Basis__c = '政府資金'; |
| | | opp.AccountId = contractA.id; |
| | | opp.Hospital__c = contractA.id; |
| | | opp.Agency1__c = sellerA.id; |
| | | opp.Wholesale_Price__c = 9000; |
| | | opp.Opportunity_stage__c = '还没申请预算'; |
| | | opp.Close_Forecasted_Date__c = Date.today().addDays(50); |
| | | opp.Special_Opp_lanhai__c = false; |
| | | insert opp; |
| | | Boolean QuotCalfag = lexSINewQuoteEntryController.QuotCalfagAss(); |
| | | lexSINewQuoteEntryController.selectQuoteListLineItemCount('','',String.valueOf(opp.Id)); |
| | | User us = lexSINewQuoteEntryController.selecUser(); |
| | | Opportunity opp1 = lexSINewQuoteEntryController.selectOpportunityById(String.valueOf(opp.Id)); |
| | | String oppvalue = JSON.serialize(opp1); |
| | | lexSINewQuoteEntryController.InitData ind = lexSINewQuoteEntryController.getModulus(oppvalue); |
| | | Product2 product1 = new Product2( Name = '11111'); |
| | | product1.SFDA_Status__c = '不要'; |
| | | product1.Intra_Trade_List_RMB_1__c = 100; |
| | | product1.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product1.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product1.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product1.Manual_Entry__c = false; |
| | | product1.Asset_Model_No__c = '11111'; |
| | | product1.MDM_Model_No__c = '11111'; |
| | | product1.ProductCode = 'OTV-SP1H-NA-12E'; |
| | | product1.Foreign_Trade_Cost_US_1__c =10.00; |
| | | product1.Foreign_Trade_List_US_1__c =10.00; |
| | | product1.Foreign_Trade_Cost_US_Date1__c = date.today().addDays(-10); |
| | | product1.Foreign_Trade_Cost_US_Date2__c = date.today().addDays(-15); |
| | | product1.Foreign_Trade_Cost_US_End_Date1__c = date.today().addDays(10); |
| | | product1.Foreign_Trade_List_US_Date1__c = date.today().addDays(-10); |
| | | product1.Foreign_Trade_List_US_Date2__c = date.today().addDays(-15); |
| | | product1.Foreign_Trade_List_US_End_Date1__c = date.today().addDays(10); |
| | | insert product1; |
| | | system.debug('##product.Id=[' + product1.Id + ']' ); |
| | | |
| | | Product2 product2 = new Product2( Name = '11112'); |
| | | product2.SFDA_Status__c = '不要'; |
| | | product2.Intra_Trade_List_RMB_1__c = 100; |
| | | product2.Intra_Trade_List_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c = 200; |
| | | product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); |
| | | product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); |
| | | product2.Manual_Entry__c = false; |
| | | product2.Asset_Model_No__c = '11112'; |
| | | product2.MDM_Model_No__c = '11112'; |
| | | insert product2; |
| | | system.debug('##product1.Id=[' + product1.Id + ']' ); |
| | | system.debug('##product2.Id=[' + product2.Id + ']' ); |
| | | |
| | | Pricebook2 pricebook = ControllerUtil.getStandardPricebook(); |
| | | |
| | | PricebookEntry pE = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product1.Id); |
| | | |
| | | pE.UnitPrice = 0; |
| | | pE.IsActive = true; |
| | | pE.UseStandardPrice = false; |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | | pE2.IsActive = true; |
| | | pE2.UseStandardPrice = false; |
| | | pE2.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE2; |
| | | Product_Set__c ps1 = new Product_Set__c(); |
| | | ps1.Name = 'セット品1'; |
| | | ps1.Product_Set_CD__c = '111111'; |
| | | ps1.Description__c = '説明'; |
| | | ps1.Qty__c = 10; |
| | | //ps1.Valid__c = true; |
| | | ps1.Valid_Date__c = date.today().addDays(-5); |
| | | insert ps1; |
| | | |
| | | Product_Set_Detail__c psd1 = new Product_Set_Detail__c(); |
| | | psd1.Product_Set__c = ps1.id; |
| | | psd1.Price__c = 100; |
| | | psd1.Quantity__c = 10; |
| | | psd1.Product__c = product1.id; |
| | | |
| | | insert psd1; |
| | | List<PricebookEntry> pri = lexSINewQuoteEntryController.serContact('12','121','122'); |
| | | // PageReference page = new PageReference('/apex/lexNewQuoteEntry'); |
| | | // System.Test.setCurrentPage(page); |
| | | Apexpages.currentPage().getParameters().put('oppid', opp.id); |
| | | List<Product_Set__c> pstc = lexSINewQuoteEntryController.serSetContact('品','1',''); |
| | | String activitiesCan = '[{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":0,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H170L","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H170L:电子大肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuZAAX","Qty_Unit__c":"1","Cost__c":87235,"UnitPrice__c":358440,"ListPrice__c":358440,"Quantity":1,"TotalPrice__c":358440,"ProductCode__c":"N4479980","Product_Cost__c":87235,"Product_ListPrice__c":358440,"UnitPrice_Page__c":358440,"AgencyUnitPrice__c":186388.8,"AgencySubtotal__c":186388.8,"Present__c":false,"multiYearWarranty__c":false,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":1,"ServicePrice__c":0,"GuranteePrice__c":0,"ProductEntend_gurantee_period_all__c":0,"ProductGuranteePrice__c":0,"productServicePrice__c":0,"NoDiscountTotal__c":0,"provistonPeriod__c":0,"Maintenance_Price_Year__c":22000,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuZAAX"},"Product2Id":"01t10000002pc9SAAQ","Id":"01u1000000DLEuZAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9SAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":false,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H170L:电子大肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":0,"Intra_Trade_Gurantee_RMB__c":0,"Intra_Trade_Service_RMB__c":0,"Maintenance_Price_Year__c":22000,"Repair_Contract_USD__c":2864,"Intra_Trade_Foreign_RMB__c":0,"NoDiscount_Foreign__c":0,"LastbuyProductFLG__c":false,"Category5__c":"170系列","Estimated_ConsumptionDueDate__c":"2023-10-01","Id":"01t10000002pc9SAAQ"}},"Id__c":"01t10000002pc9SAAQ","Quantity__c":1,"Subtotal__c":358440,"GuranteeType__c":"","ListPrice_Page":358440},"Maintenance_Price_Year":22000,"ListPrice_Page":358440,"lineNo":1,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H170L:电子大肠内窥镜","ProductEntend_gurantee_period_all":0,"ProductCode":"N4479980","Maintenance_Price_Year":22000,"ListPrice":358440,"Is_DangerousChemicals":null,"Intra_Trade_Service":0,"Intra_Trade_Gurantee":0,"GuranteeType":"","Cost":87235,"CanNotCancelledGurantee":false},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":0,"Estimated_ConsumptionDueDate":"2023/10/01","Cost_Subtotal_c":87235,"Cost_c":87235,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"170系列","CanNotCancelledGurantee":false,"Asset_Model":"CF-H170L","Quantity__c":1,"UnitPrice_Page__c":358440,"AgencySubtotal__c":186388.8,"AgencyUnitPrice__c":186388.8,"multiYearWarranty__c":false,"GuaranteePeriod__c":1,"NoDiscountTotal__c":0,"SFDA_Status__c":"有效","Name__c":"CF-H170L:电子大肠内窥镜","Subtotal__c":358440,"Name":"/01t10000002pc9SAAQ","EstimatedConsumptionDueDateclass":"slds-text-color_error slds-text-title_caps"},{"wrong_Register":false,"VenderName":"OSH","StorageStatus":null,"Specifications":1,"Sales_Possibility":null,"ProductGuranteePrice":32698,"pageObject":{"attributes":{"type":"QuoteLineItem"},"Asset_Model_No__c":"CF-H190I","SFDA_Status__c":"有効","Product_Sales_Possibility__c":"○","Name__c":"CF-H190I:电子结肠内窥镜","BSS_Category__c":"GI Imaging","QuoteId":"0Q0Hy000000BLvXKAW","PricebookEntryId":"01u1000000DLEuTAAX","Qty_Unit__c":"1","Cost__c":119033,"UnitPrice__c":394600,"ListPrice__c":363600,"Quantity":1,"TotalPrice__c":394600,"ProductCode__c":"N3802480","Product_Cost__c":119033,"Product_ListPrice__c":363600,"UnitPrice_Page__c":394600,"AgencyUnitPrice__c":220072,"AgencySubtotal__c":220072,"Present__c":false,"multiYearWarranty__c":true,"If_Cancel_Guarantee__c":false,"GuaranteePeriod__c":3,"ServicePrice__c":31000,"GuranteePrice__c":32698,"ProductEntend_gurantee_period_all__c":3,"ProductGuranteePrice__c":32698,"GuranteeType__c":"市场","warrantyType__c":"市场多年保修","productServicePrice__c":31000,"NoDiscountTotal__c":31000,"provistonPeriod__c":3,"Maintenance_Price_Year__c":19400,"Quote":{"attributes":{"type":"Quote","url":"/services/data/v58.0/sobjects/Quote/0Q0Hy000000BLvXKAW"},"OpportunityId":"006Hy00000A10ElIAJ","Id":"0Q0Hy000000BLvXKAW","Opportunity":{"attributes":{"type":"Opportunity","url":"/services/data/v58.0/sobjects/Opportunity/006Hy00000A10ElIAJ"},"Trade__c":"内貿","Id":"006Hy00000A10ElIAJ"}},"PricebookEntry":{"attributes":{"type":"PricebookEntry","url":"/services/data/v58.0/sobjects/PricebookEntry/01u1000000DLEuTAAX"},"Product2Id":"01t10000002pc9PAAQ","Id":"01u1000000DLEuTAAX","Product2":{"attributes":{"type":"Product2","url":"/services/data/v58.0/sobjects/Product2/01t10000002pc9PAAQ"},"VenderName__c":"OSH","CanNotCancelledGurantee__c":true,"Is_DangerousChemicals__c":false,"SFDA_Status__c":"有効","Sales_Possibility__c":"○","Name":"CF-H190I:电子结肠内窥镜","Packing_list_manual__c":1,"Entend_gurantee_period_all__c":3,"Intra_Trade_Gurantee_RMB__c":32698,"Intra_Trade_Service_RMB__c":31000,"GuranteeType__c":"市场","Maintenance_Price_Year__c":19400,"Repair_Contract_USD__c":2525,"Intra_Trade_Foreign_RMB__c":4045,"NoDiscount_Foreign__c":4035,"LastbuyProductFLG__c":false,"Category5__c":"190系列","Id":"01t10000002pc9PAAQ"}},"Id__c":"01t10000002pc9PAAQ","Quantity__c":1,"Subtotal__c":394600,"ListPrice_Page":363600},"Maintenance_Price_Year":19400,"ListPrice_Page":363600,"lineNo":2,"latestInfo":{"Specifications":1,"SFDA_Status":"有効","Sales_Possibility":"○","ProductName":"CF-H190I:电子结肠内窥镜","ProductEntend_gurantee_period_all":3,"ProductCode":"N3802480","Maintenance_Price_Year":19400,"ListPrice":363600,"Is_DangerousChemicals":null,"Intra_Trade_Service":31000,"Intra_Trade_Gurantee":32698,"GuranteeType":"市场","Cost":119033,"CanNotCancelledGurantee":true},"Is_DangerousChemicals":false,"haveno_Register":false,"GuranteePrice":32698,"Estimated_ConsumptionDueDate":"","Cost_Subtotal_c":119033,"Cost_c":119033,"changed_sfda":false,"changed_name":false,"changed_list":false,"changed_cost":false,"Category5":"190系列","CanNotCancelledGurantee":true,"Asset_Model":"CF-H190I","Quantity__c":1,"UnitPrice_Page__c":394600,"AgencySubtotal__c":220072,"AgencyUnitPrice__c":220072,"multiYearWarranty__c":true,"GuaranteePeriod__c":3,"warrantyType__c":"市场多年保修","NoDiscountTotal__c":31000,"SFDA_Status__c":"有效","Name__c":"CF-H190I:电子结肠内窥镜","Subtotal__c":394600,"Name":"/01t10000002pc9PAAQ","EstimatedConsumptionDueDateclass":""}]'; |
| | | String oppInfoc = JSON.serialize(opp); |
| | | String quoc = '{"Name":"测试425","Cancel_Decide__c":false,"CreatedDate":"2023-10-03","PriceRefreshDate__c":"2023-10-03","MainEngineWithoutMonitor__c":false,"Interdepartmental__c":false,"Dealer_Final_Price__c":577632,"TotalPrice__c":753040,"Estimation_List_Price__c":722040,"QuoteNumber":"00333230","Quote_Expiration_Date__c":"2023-11-02","Unit_Price__c":false,"Offer_Amount__c":true,"TOTAL__c":true,"Discount__c":false,"Pricing__c":false,"Preferential_Trading_Price__c":false,"Contract__c":false,"Agency1__c":"0011000000V9RB6AAN","OCM_Agent1_Price__c":406460.8,"Agency1_Profit__c":171171.2,"Agency1_Profit_Rate__c":29.63,"Print_HP_Name__c":"上海交通大学医学院附属瑞金医院舟山分院","Agency2_Profit__c":0,"Agency2_Profit_Rate__c":0,"Quote_No__c":"SH-BF-ZJ0847324-01","Quote_Adjust_Amount__c":0,"Quote_Adjust_Calculate__c":0,"Discount_Amount__c":175408,"Discount_Amount_Calculate__c":23.29,"AgencyDiscount__c":52,"Gurantee_Period__c":"1","multiYearWarranty__c":false,"MultiYearWarrantyTotalPrice__c":31000,"Preferential_Gurantee_Period__c":true,"LineItemCount":2,"IsQuoteTrial__c":false,"OpportunityId":"006Hy00000A10ElIAJ","Opportunity":{"RecordTypeId":"01210000000QekKAAS","Id":"006Hy00000A10ElIAJ","RecordType":{"DeveloperName":"Opportunity","Id":"01210000000QekKAAS"}},"PriceRefreshPeriod":4,"QuoteName__c":"测试425","QuoteTotal_Page__c":753040,"Dealer_Final_Price_Page__c":577632,"Quote_Adjust_Amount_Page__c":0,"OCM_Agent1_Price_Page__c":406460.8,"Agent1_Agent2_Price_Page__c":null,"hidden_Estimation_List":"722040.00","Stocking_Price__c":206268,"Agency2__c":null}'; |
| | | Quote quos = (Quote)JSON.deserialize(quoc,Quote.class); |
| | | quos.Agency1__c = sellerA.id; |
| | | quoc = JSON.serialize(quos); |
| | | String setProduct_text = ps1.Id; |
| | | String setprd = lexSINewQuoteEntryController.setProductEntry(setProduct_text,activitiesCan,oppInfoc,quoc); |
| | | String excel_text = product1.ProductCode+'\t1\n'+product2.ProductCode+'\t1'; |
| | | String eximt = lexSINewQuoteEntryController.excelImport(excel_text,activitiesCan,oppInfoc,quoc); |
| | | StaticParameter.EscapeOppandStaTrigger = false; |
| | | } |
| | | } |
| New file |
| | |
| | | import { createElement } from 'lwc'; |
| | | import LexNewQuoteEntry from 'c/lexNewQuoteEntry'; |
| | | |
| | | describe('c-lex-new-quote-entry', () => { |
| | | afterEach(() => { |
| | | // The jsdom instance is shared across test cases in a single file so reset the DOM |
| | | while (document.body.firstChild) { |
| | | document.body.removeChild(document.body.firstChild); |
| | | } |
| | | }); |
| | | |
| | | it('TODO: test case generated by CLI command, please fill in test logic', () => { |
| | | // Arrange |
| | | const element = createElement('c-lex-new-quote-entry', { |
| | | is: LexNewQuoteEntry |
| | | }); |
| | | |
| | | // Act |
| | | document.body.appendChild(element); |
| | | |
| | | // Assert |
| | | // const div = element.shadowRoot.querySelector('div'); |
| | | expect(1).toBe(1); |
| | | }); |
| | | }); |
| New file |
| | |
| | | @import 'c/lexCssUtility'; |
| | | :host { |
| | | --slds-c-textarea-sizing-min-height: 200px; |
| | | } |
| | | .my-icon { |
| | | --slds-c-icon-color-foreground-default: white; |
| | | } |
| | | .quobutton{ |
| | | font-size: 18px; |
| | | font-family: 'sans-serif'; |
| | | font-weight:500; |
| | | width: 160px; |
| | | height: 36px; |
| | | border-radius: 4px; |
| | | opacity: 1; |
| | | background:#0A81DF; |
| | | color:#FFFFFF; |
| | | } |
| | | /* .slds-scope .slds-alert_error { |
| | | --slds-c-alert-color-background: #ba0517 !important; |
| | | } */ |
| | | |
| | | /* input[name="QuoteSalesBack"] { |
| | | text-align: right; |
| | | } |
| | | input[type="text" i] { |
| | | writing-mode: horizontal-tb !important; |
| | | padding-block: 1px; |
| | | padding-inline: 2px; |
| | | text-align: right; |
| | | } */ |
| | | /*.THIS .QuoteSalesBack input { |
| | | text-align: right; |
| | | }*/ |
| | | /* .QuoteSalesBack input { |
| | | text-align: right; |
| | | } */ |
| | | .my-icons{ |
| | | position: relative; |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 100%; |
| | | padding-top: var(--slds-c-alert-spacing-block-start, var(--sds-c-alert-spacing-block-start, var(--lwc-spacingXSmall,0.5rem))); |
| | | padding-right: var(--slds-c-alert-spacing-inline-end, var(--sds-c-alert-spacing-inline-end, var(--lwc-spacingXLarge,2rem))); |
| | | padding-bottom: var(--slds-c-alert-spacing-block-end, var(--sds-c-alert-spacing-block-end, var(--lwc-spacingXSmall,0.5rem))); |
| | | padding-left: var(--slds-c-alert-spacing-inline-start, var(--sds-c-alert-spacing-inline-start, var(--lwc-spacingXSmall,0.5rem))); |
| | | color: var(--slds-c-alert-text-color, var(--sds-c-alert-text-color, var(--slds-g-color-neutral-base-100, var(--lwc-colorTextInverse,rgb(255, 255, 255))))); |
| | | font-weight: var(--slds-c-alert-font-weight, var(--sds-c-alert-font-weight)); |
| | | text-align: center; |
| | | background-color: var(--slds-c-alert-color-background, var(--sds-c-alert-color-background, var(--slds-g-color-neutral-base-50, var(--lwc-colorBackgroundToast,rgb(116, 116, 116))))); |
| | | /* background-image: var(--slds-c-alert-image-background, var(--sds-c-alert-image-background, linear-gradient(45deg, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 25%, transparent 25%, transparent 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 75%, transparent 75%, transparent))); */ |
| | | background-size: var(--slds-c-alert-size-background, var(--sds-c-alert-size-background, 64px 64px)); |
| | | --slds-c-alert-color-background: #ba0517 !important; |
| | | } |
| | | .inputs { |
| | | padding-top: 0; |
| | | padding-right: var(--slds-c-input-spacing-horizontal-end, var(--sds-c-input-spacing-horizontal-end, var(--lwc-spacingMedium,1rem))); |
| | | padding-bottom: 0; |
| | | padding-left: var(--slds-c-input-spacing-horizontal-start, var(--sds-c-input-spacing-horizontal-start, var(--lwc-spacingSmall,0.75rem))); |
| | | width: 100%; |
| | | height: 1.875rem; |
| | | border: var(--lwc-borderWidthThin,1px) solid var(--slds-c-input-color-border, var(--sds-c-input-color-border, var(--slds-g-color-border-base-4, var(--lwc-colorBorderInput,rgb(201, 201, 201))))); |
| | | border-radius: var(--slds-c-input-radius-border, var(--sds-c-input-radius-border, var(--lwc-borderRadiusMedium,0.25rem))); |
| | | background-color: var(--slds-c-input-color-background, var(--sds-c-input-color-background, var(--slds-g-color-neutral-base-100, var(--lwc-colorBackgroundInput,rgb(255, 255, 255))))); |
| | | color: var(--slds-c-input-text-color, var(--sds-c-input-text-color)); |
| | | box-shadow: var(--slds-c-input-shadow, var(--sds-c-input-shadow)); |
| | | transition: border var(--lwc-durationQuickly,0.1s) linear,background-color var(--lwc-durationQuickly,0.1s) linear; |
| | | display: inline-block; |
| | | text-align: right !important; |
| | | } |
| | | |
| | | .THIS .myCustomClass input { |
| | | text-align: right; |
| | | } |
| | | .THIS .slds-form-element__control input { |
| | | text-align: right; |
| | | } |
| | | .myCustomClass ::part(input) { |
| | | text-align: right; |
| | | } |
| New file |
| | |
| | | <template> |
| | | <!-- 全局加载标识 --> |
| | | <div class="exampleHolder" if:true={IsLoading} > |
| | | <lightning-spinner alternative-text="Loading" size="large" style="height: 100%;top: 0%; z-index: 7"></lightning-spinner> |
| | | </div> |
| | | <div style="float:right; z-index: 8;" > |
| | | <div class="demo-only demo-only_viewport" style="height:4.5rem;" if:true = {Tongzhishow}> |
| | | <div class="slds-notification-container" style={IsLeftStyle}> |
| | | <div aria-live="assertive" aria-atomic="true" class="slds-assistive-text">提示</div> |
| | | <section class="slds-notification" role="dialog" aria-labelledby="noti77" aria-describedby="dialog-body-id-43" > |
| | | <div class="slds-notification__body" id="dialog-body-id-43" > |
| | | <a class="slds-notification__target slds-media" href="#" style={BgColorStyle}> |
| | | <div class="slds-media__body"> |
| | | <!-- <h2 class="slds-text-heading_small slds-m-bottom_xx-small" id="noti77" style="color:white;"> |
| | | <span class="slds-assistive-text" >task notification:</span> |
| | | 提示 |
| | | </h2> --> |
| | | <p style="color:white;" >{SaveShowText}</p> |
| | | </div> |
| | | </a> |
| | | <button class="slds-button slds-button_icon slds-button_icon-container slds-notification__close" title="close"> |
| | | <lightning-icon class="my-icon" icon-name="utility:close" alternative-text="close" title="close" size="x-small" onclick={CloseAlert}></lightning-icon> |
| | | </button> |
| | | </div> |
| | | </section> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 全局加载标识 --> |
| | | <!-- 基本信息 --> |
| | | <!-- 基本信息 --> |
| | | <div > |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>基本信息</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div > |
| | | <!-- 医院名 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {HPName}:</label> |
| | | <div class="slds-form-element__control" style="width:230px; display: inline-block;">{oppInfo.HP_Name__c}</div> |
| | | <!-- 医院名 --> |
| | | <!-- 科室名 --> |
| | | <label class="slds-form-element__label" style="width:50px;text-align:right;margin-left: 10px;"> {DepartmentName}:</label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Department_Name__c}</div> |
| | | <!-- 科室名 --> |
| | | <!-- 销售渠道 --> |
| | | <label class="slds-form-element__label" style="width:95px;text-align:right;margin-left: 52px;"> {SalesRoot}:</label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Sales_Root__c}</div> |
| | | <!-- 销售渠道 --> |
| | | <!-- 货币 --> |
| | | <label class="slds-form-element__label" style="width:90px;text-align:right;margin-left: 80px;"> {Currency}:</label> |
| | | <div class="slds-form-element__control" style="width:60px; display: inline-block;">{oppInfo.CurrencyIsoCode}</div> |
| | | <!-- 货币 --> |
| | | </div> |
| | | <div > |
| | | <!-- 报价编码 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right; margin-left: 20px;"> {QuotoNo}:</label> |
| | | <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Quote_No__c}</div> |
| | | <!-- 报价编码 --> |
| | | <!-- 报价名称 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {QuotoName}:</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="text" value={quo.QuoteName__c} disabled ={Decisiontag} onblur={QuoteNameAssignment}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.qname}>请输入值!</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!-- 报价名称 --> |
| | | <!-- 报价总额 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {TotalPrice}:</label> |
| | | <div class ="slds-form-element__control" style=" width:200px;display: inline-block;">{quo.QuoteTotal_Page__c}</div> |
| | | <!-- 报价总额 --> |
| | | <!-- 产品标准定价总额 --> |
| | | <label class="slds-form-element__label" style="width:110px;text-align:right; margin-left: 10px;">产品标准定价总额:</label> |
| | | <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Estimation_List_Price__c}</div> |
| | | <!-- 产品标准定价总额 --> |
| | | </div> |
| | | <div > |
| | | <!-- OCM预测额销售 --> |
| | | <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ForecastAmounts}:</label> |
| | | <!-- <div class="slds-form-element__control" style="width:170px; display: inline-block;">{oppInfo.Wholesale_Price__c}</div> --> |
| | | <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.OCM_Sales_Forecast__c}</div> |
| | | <!-- OCM预测额销售 --> |
| | | <!-- 最终客户成交价(仅OLY供货产品) --> |
| | | <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ContactPrice}:</label> |
| | | <div class ="slds-form-element__control" style=" width:177px;display: inline-block;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Dealer_Final_Price_Page__c} disabled ={Decisiontag} onblur={DealerFinalPricePageChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.dfpp}>请输入值!</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!-- 最终客户成交价(仅OLY供货产品) --> |
| | | <!-- 主机装机地 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;">主机装机地点:</label> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;"> |
| | | <lightning-combobox |
| | | name="progress" |
| | | value={quo.Installation_location__c} |
| | | options={HostInstallationLocationoptions} |
| | | onchange={HostInstallationLocationhandleChange} disabled ={Decisiontag}></lightning-combobox> |
| | | </div> |
| | | <!-- 主机装机地 --> |
| | | <!-- 成本 --> |
| | | <!-- <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 105px;"> {Cost} :</label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.Stocking_Price__c}</div> --> |
| | | <!-- 成本 --> |
| | | </div> |
| | | <div > |
| | | <!-- 合同保修期(年) --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right; margin-left: 0px;">合同保修期(年):</label> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:true={QuotCalfag}> |
| | | <lightning-combobox |
| | | data-parent-id="GuranteePeriodId" |
| | | name="progress" |
| | | value={quo.Gurantee_Period__c} |
| | | options={ContractWarrantyPeriodYearOptions} |
| | | onchange={ContractWarrantyPeriodYearHandleChange} disabled ={Decisiontag}></lightning-combobox> |
| | | </div> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:false={QuotCalfag}> |
| | | {quo.Gurantee_Period__c} |
| | | </div> |
| | | <!-- 合同保修期(年) --> |
| | | <!-- 取消市场多年保修 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left:50px;">取消市场多年保修: </label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="checkbox" checked={quo.multiYearWarranty__c} disabled ={Decisiontag} onchange={multiYearWarrantyChange}> </lightning-input> |
| | | </div> |
| | | <!-- 取消市场多年保修 --> |
| | | <!-- 多年保价格合计 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 165px;">多年保价格合计: </label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.MultiYearWarrantyTotalPrice__c}</div> |
| | | <!-- 多年保价格合计 --> |
| | | </div> |
| | | <div> |
| | | <!-- 报价变化 --> |
| | | <label class="slds-form-element__label" style="width:80px;text-align:right; margin-left: 40px;">报价变化: </label> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;"> |
| | | <lightning-combobox |
| | | name="progress" |
| | | value={quo.QuotationChange__c} |
| | | options={QuotationChangesOptions} |
| | | onchange={QuotationChangesHandleChange} disabled ={Decisiontag}></lightning-combobox> |
| | | </div> |
| | | <!-- 报价变化 --> |
| | | <!-- 主机不带监视器台车 --> |
| | | <label class="slds-form-element__label" style="width:130px;text-align:right;margin-left: 40px;">主机不带监视器台车: </label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="checkbox" checked={quo.MainEngineWithoutMonitor__c} disabled ={Decisiontag} onchange={MainEngineWithoutMonitorChange}> </lightning-input> |
| | | </div> |
| | | <!-- 主机不带监视器台车 --> |
| | | <!-- 跨科室 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 145px;">跨科室: </label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="checkbox" checked={quo.Interdepartmental__c} disabled ={Decisiontag} onchange={InterdepartmentalChange}> </lightning-input> |
| | | </div> |
| | | <!-- 跨科室 --> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 基本信息 --> |
| | | <!-- 经销商价格 --> |
| | | <div > |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>经销商价格</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <!-- style="background-color:#ffd6c1" --> |
| | | <div > |
| | | <div style="margin-bottom: 15px; "> |
| | | <!--报价调整折扣 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">报价调整折扣</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Calculate__c} disabled ={Decisiontag} onblur={QuoteAdjustCalculateChange} variant="label-hidden"> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.qacc}>请输入值!</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!--报价调整折扣 --> |
| | | <!-- 百分比标签 --> |
| | | <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label> |
| | | <!-- 百分比标签 --> |
| | | <!--报价调整金额 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">报价调整金额</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block; margin-left: 15px;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Amount_Page__c} disabled ={Decisiontag} onblur={QuoteAdjustAmountPageChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.qaapc}>请输入值!</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!--报价调整金额 --> |
| | | <!--是否已报价计算标识 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 20px;">是否已报价计算:</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;" if:true={hidden}> |
| | | <lightning-input type="checkbox" checked={quo.IsQuoteTrial__c} disabled> </lightning-input> |
| | | </div> |
| | | <!--是否已报价计算标识 --> |
| | | </div> |
| | | <div style="margin-bottom: 5px; "> |
| | | <!--经销商一名称 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">{SalesName1}</label> |
| | | <div style="display: inline-block;"> |
| | | <c-jzlookuplightning2 data-parent-id="Agency1Id" recordid ={quoId} onsearchchange={onsearchchange1} objectname="Quote" fieldname="Agency1__c" variant = "label-hidden" lookupstyle="width:300px;"> </c-jzlookuplightning2> |
| | | |
| | | <!-- <lightning-record-edit-form |
| | | object-api-name="Quote" record-id="0Q0Hy000000BMRYKA4"> |
| | | <lightning-input-field field-name="Agency1__c" value="0011000000V9RBDAA3"> |
| | | </lightning-input-field> |
| | | </lightning-record-edit-form> |
| | | |
| | | <lightning-record-view-form |
| | | record-id="0Q0Hy000000BMRYKA4" |
| | | object-api-name="Quote"> |
| | | <lightning-output-field field-name="Agency1__c" value="0011000000V9RBDAA3"> |
| | | </lightning-output-field> |
| | | </lightning-record-view-form> --> |
| | | |
| | | |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency1}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency1}>请不要输入値。</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!--经销商一名称 --> |
| | | <!-- 合同金额标签 --> |
| | | <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label> |
| | | <!-- 合同金额标签 --> |
| | | <!--经销商一合同金额 --> |
| | | <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:false ={Decisiontag}> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={quo.IsQuoteTrial__c} onblur ={OCMAgent1PricePageonChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>请不要输入値。</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:true ={Decisiontag}> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={Decisiontag} onblur ={OCMAgent1PricePageonChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>请不要输入値。</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!--经销商一合同金额 --> |
| | | <!-- 利润标签 --> |
| | | <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}:</label> |
| | | <!-- 利润标签 --> |
| | | <!--经销商一利润显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency1_Profit__c}</div> |
| | | <!--经销商一利润显示 --> |
| | | <!--经销商一百分比显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency1_Profit_Rate__c}</div> |
| | | <!--经销商一百分比显示 --> |
| | | <!-- 百分比标签 --> |
| | | <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label> |
| | | <!-- 百分比标签 --> |
| | | </div> |
| | | <div style="margin-bottom: 15px; "> |
| | | <!--经销商二名称 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">{Sales_Name2}</label> |
| | | <div style="display: inline-block;"> |
| | | <c-jzlookuplightning2 data-parent-id="Agency2Id" recordid ={quoId} onsearchchange={onsearchchange2} objectname="Quote" fieldname="Agency2__c" variant = "label-hidden" lookupstyle="width:300px; display: inline-block;"> </c-jzlookuplightning2> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency2}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency2}>请不要输入値。</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!--经销商二名称 --> |
| | | <!-- 合同金额标签 --> |
| | | <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label> |
| | | <!-- 合同金额标签 --> |
| | | <!--经销商二合同金额 --> |
| | | <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Agent1_Agent2_Price_Page__c} disabled ={Decisiontag} onblur ={Agent1Agent2PricePageChange} > </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.aapp}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.naapp}>请不要输入値。</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!--经销商二合同金额 --> |
| | | <!-- 利润标签 --> |
| | | <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}:</label> |
| | | <!-- 利润标签 --> |
| | | <!--经销商二利润显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency2_Profit__c}</div> |
| | | <!--经销商二利润显示 --> |
| | | <!--经销商二百分比显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency2_Profit_Rate__c}</div> |
| | | <!--经销商二百分比显示 --> |
| | | <!-- 百分比标签 --> |
| | | <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label> |
| | | <!-- 百分比标签 --> |
| | | </div> |
| | | <div style="margin-bottom: 15px; "> |
| | | <!-- 保存 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={savebuttonClick} if:true={hidden}>保存</button> |
| | | <!-- 保存 --> |
| | | <!-- 保存并关闭 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={Saveandback} if:true={hidden}>{Opp_Button}</button> |
| | | <!-- 保存并关闭 --> |
| | | <!-- 报价计算 --> |
| | | <button class={QTcss} style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={showQuotationCalculation} if:true={QuotCalfag}>报价计算</button> |
| | | <!-- 报价计算 --> |
| | | <!-- Decide --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decision_button} onclick={decisionbuttonClick} if:true={hidden}>{QuoteDecision_Button}</button> |
| | | <!-- Decide --> |
| | | <!-- 复制 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={copyToClipboardNewQuoteEntry} if:true={hidden}>{Copy_Detail}</button> |
| | | <!-- 复制 --> |
| | | <!-- 不保存(返回) --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" onclick={noSaveback}>不保存(返回)</button> |
| | | <!-- 不保存(返回) --> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 经销商价格 --> |
| | | <!-- 选择报价产品 --> |
| | | <!-- <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct}></c-jz-data-table> |
| | | </div> --> |
| | | <div if:false={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>选择报价产品</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div style="margin-bottom: 15px; "> |
| | | <!-- 选择产品 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={NewQuotationProducts}>选择产品</button> |
| | | <!-- 选择产品 --> |
| | | <!-- 产品配套搜索 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openSetProduct}>{SetProduct}</button> |
| | | <!-- 产品配套搜索 --> |
| | | <!-- Excel导入 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openQuoteExcelImport}>{ExcelImport}</button> |
| | | <!-- Excel导入 --> |
| | | <!-- 删除 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={deletejzDataToBeproduct}>删除产品</button> |
| | | <!-- 删除 --> |
| | | <!-- 更新价格状态 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick ={productCompare}>{StatusUpdate}</button> |
| | | <!-- 更新价格状态 --> |
| | | <!-- 替换产品otcode --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:130px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={updateOtcode}>替换产品otcode</button> |
| | | <!-- 替换产品otcode --> |
| | | </div> |
| | | <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table idkey="lineNo" miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct} if:true={tobeflag}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 选择报价产品 --> |
| | | <!-- 测试报价计算组件 --> |
| | | <!-- <div if:true={pricePolicyflag1}> |
| | | <c-quote-trial paramid={quoId}></c-quote-trial> |
| | | </div> --> |
| | | <!-- 报价计算待选产品 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>报价计算待选产品</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div style="min-height: 60px;"> |
| | | <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedFnDefault} name="jzDataTableDefault" ongettabledata={getTableDataDefault} table-data={jzDataDefault} table-is-loding={tableIsLodingDefault} options={initDataTableDefault}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 报价计算待选产品 --> |
| | | <!-- 报价计算使用价格政策 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>报价计算使用价格政策</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div if:true={buttonIsShow}> |
| | | <!-- <button class="slds-button slds-button_brand" onclick={showModal}>选择促销方案固定价格</button> --> |
| | | <!-- 选择促销方案 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:170px;text-align:right; font-size:small;" onclick={showModal}>选择促销方案固定价格</button> |
| | | <!-- 选择促销方案 --> |
| | | <!-- 选择一般产品固定价格 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalFix}>选择一般产品固定价格</button> |
| | | <!-- 选择一般产品固定价格 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={deleteFixedPrice}>删除</button> |
| | | </div> |
| | | <div if:true={jzDataTableFixedPriceIsShow}> |
| | | <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnFixedPrice} name="jzDataTableFixedPrice" ongettabledata={getTableDataFixedPrice} table-data={jzDataFixedPrice} table-is-loding={tableIsLodingFixedPrice} options={initDataTableFixedPrice} onsave={handleSaveFixedPrice} if:true={jzshows3}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 报价计算使用价格政策 --> |
| | | <!-- 报价计算使用折扣政策 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>报价计算使用折扣政策</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div if:true={buttonIsShow}> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalSpecial} >选择特约折扣</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalCommonly}>选择一般折扣</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableDiscount}>删除</button> |
| | | </div> |
| | | <div if:true={jzDataTableDiscountIsShow}></div> |
| | | <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table class="jzdtdis" miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnDiscount} name="jzDataTableDiscount" ongettabledata={getTableDataDiscount} table-data={jzDataDiscount} table-is-loding={tableIsLodingDiscount} options={initDataTableDiscount} onsave={handleSaveDiscount} if:true={jzshows2}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 报价计算使用折扣政策 --> |
| | | <!-- 产品明细 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>产品明细</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div if:true={buttonIsShow}> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableProduct}>删除</button> |
| | | </div> |
| | | <div style="min-height: 60px;max-height: 400px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table data-parent-id="chuxiao" idkey="DelectId" miniheight="min-height: 60px" onrowselection={SelectedFnProduct} name="jzDataTableProduct" ongettabledata={getTableDataProduct} table-data={jzDataProduct} table-is-loding={tableIsLodingProduct} options={initDataTableProduct} if:true={jzshows}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 产品明细 --> |
| | | <!-- 报价计算底部 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <!-- 合同总价 --> |
| | | <p align="center" ><b>合同总价:{ContractPrice}</b></p> |
| | | <!-- 合同总价 --> |
| | | <!-- 保存报价计算结果按钮 --> |
| | | <div align="right" style="margin-bottom: 15px;margin-right: 15px; "> |
| | | <button if:true={buttonIsShow} style="font-size:small;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" onclick={saveAllDataProductFn}>保存报价计算结果</button> |
| | | </div> |
| | | <!-- 保存报价计算结果按钮 --> |
| | | </div> |
| | | <!-- 报价计算底部 --> |
| | | <!-- 文件打印 --> |
| | | <div > |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>文件打印</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div> |
| | | <!-- 打印报价 --> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Quote_Print}</label> |
| | | <!-- 打印报价 --> |
| | | <!-- 单价 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Unit_Price__c} onchange={UnitPriceChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">单价</label> |
| | | <!-- 单价 --> |
| | | <!-- 报价金额 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Offer_Amount__c} onchange={OfferAmountChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">报价金额</label> |
| | | <!-- 报价金额 --> |
| | | <!-- 报价总额 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.TOTAL__c} onchange={TOTALChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{TotalPrice}</label> |
| | | <!-- 报价总额 --> |
| | | <!-- 优惠折扣 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Discount__c} onchange={DiscountChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Total_Discount_Percent}</label> |
| | | <!-- 优惠折扣 --> |
| | | <!-- 优惠价格 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Pricing__c} onchange={PricingChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">优惠价格</label> |
| | | <!-- 优惠价格 --> |
| | | <!-- 优惠成交价 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Preferential_Trading_Price__c} onchange={PreferentialTradingPriceChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Row_Total_Sum}</label> |
| | | <!-- 优惠成交价 --> |
| | | <!-- 保修年限 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Preferential_Gurantee_Period__c} onchange={PreferentialGuranteePeriodChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left: 5px;">保修年限 </label> |
| | | <!-- 保修年限 --> |
| | | <!-- 合同配置 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px;" if:true={enableContract}> |
| | | <lightning-input type="checkbox" checked={quo.Contract__c} onchange={ContractcChange}> </lightning-input> |
| | | </div> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px;" if:false={enableContract}> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left:5px;">{Contract_Breakdown}</label> |
| | | <!-- 合同配置 --> |
| | | </div> |
| | | <div> |
| | | <!-- 打印客户名称 --> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Print_HPName}</label> |
| | | <div class ="slds-form-element__control" style="width:400px; display: inline-block;"> |
| | | <lightning-combobox |
| | | name="progress" |
| | | value={selection_hp} |
| | | options={PrintCustomerNameoptions} |
| | | onchange={PrintCustomerNamehandleChange} ></lightning-combobox> |
| | | </div> |
| | | <!-- 打印客户名称 --> |
| | | <!-- 打印按钮 --> |
| | | <div style="display: inline-block;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 380px; font-size:small;" disabled={print_buttonflg} onclick={PrintButton} if:true={hidden}>{Print_Button}</button> |
| | | </div> |
| | | <!-- 打印按钮 --> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 文件打印 --> |
| | | <!-- 新增报价产品模态框 --> |
| | | <div if:true = {showproductfalg} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-5"> |
| | | <!-- 报价产品搜索框 --> |
| | | <div class="exampleHolder" if:true={IsLoadingjdpt} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <!-- <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataProduct} options={initSearchFormProduct}></c-jz-search-form> --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label="产品型号:" style="width:150px" onblur={jzProductsearchChange}></lightning-input> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={jzProductsearchbutton}>搜索</button> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={additionaljzProductbutton}>追加</button> |
| | | </div> |
| | | <!-- 报价产品搜索框 --> |
| | | <!-- 报价产品列表 --> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedProductFn} data-parent-id="parent-div-productid" name="jzDataproductTable" ongettabledata={getTableProductData} table-data={jzProductData} table-is-loding={tableIsproductLoding} options={initDataProductTable} ></c-jz-data-table> |
| | | </div> |
| | | <!-- 报价产品列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelProduct}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 新增报价产品模态框 --> |
| | | <!-- 新增产品配套模态框 --> |
| | | <div if:true = {showSetProductfalg} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-10"> |
| | | <!-- 产品配套搜索框 --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label=" 产品配套名:" style="width:150px;margin-left: 20px;" onblur={jzSearchNameChange}></lightning-input> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label=" 产品配套编码:" style="width:150px;margin-left: 20px;" onblur={jzSearchCodeChange}></lightning-input> |
| | | </div> |
| | | <div class ="slds-form-element__control" style="width:150px; display: inline-block;;margin-left: 20px;"> |
| | | <lightning-combobox |
| | | label = '适用科室 :' |
| | | name="setpro" |
| | | options={listViewOptions} |
| | | onchange={filterNameChange} ></lightning-combobox> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={jzsetProductsearchbutton}>搜索</button> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={additionaljzsetProductbutton}>追加</button> |
| | | </div> |
| | | <!--产品配套搜索框 --> |
| | | <!-- 产品配套列表 --> |
| | | <div class="exampleHolder" if:true={IsLoadingjdspt} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table data-parent-id="parent-div-setid" onrowselection={SelectedSetProductFn} name="jzDataSetProductTable" ongettabledata={getTableSetProductData} table-data={jzSetProductData} table-is-loding={tableIsSetProductLoding} options={initDataSetProductTable} ></c-jz-data-table> |
| | | </div> |
| | | <!-- 产品配套列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelsetProduct}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 新增产品配套模态框 --> |
| | | <!-- 新增Excel导入模态框 --> |
| | | <div if:true = {showQuoteExcelImport} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-9"> |
| | | <!-- 产品配套搜索框 --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{ImportText}</div> |
| | | <div class ="form-group" > |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{Tab_Text}</div> |
| | | </div> |
| | | <lightning-textarea class="inputFont" name="exceltext" onchange={exceltextChange} value={exceltextvalue}></lightning-textarea> |
| | | |
| | | <!--产品配套搜索框 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelQuoteExcelImport}>关闭</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSQuoteExcelImport} >保存</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 新增Excel导入模态框 --> |
| | | <!-- 选择促销方案模态框 --> |
| | | <div if:true = {show} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1"> |
| | | <!-- 促销方案搜索框 --> |
| | | <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchData} options={initSearchForm}></c-jz-search-form> |
| | | <!-- 促销方案搜索框 --> |
| | | <!-- 促销方案列表 --> |
| | | <div class="exampleHolder" if:true={IsLoading6} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFn} data-parent-id="parent-div-id" name="jzDataTable1" ongettabledata={getTableData} table-data={jzData} table-is-loding={tableIsLoding} options={initDataTable} onsave={savejzData} if:true={jzdateflag}></c-jz-data-table> |
| | | </div> |
| | | <!-- 促销方案列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancel}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择促销方案模态框 --> |
| | | <!-- 选择一般产品固定价格模态框 --> |
| | | <div if:true = {ShowFix} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2"> |
| | | <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataFix} options={initSearchFormFix}></c-jz-search-form> |
| | | <c-jz-data-table onrowselection={SelectedFnFix} data-parent-id="parent-div-idFix" name="jzDataTableFix" ongettabledata={getTableDataFix} table-data={jzDataFix} table-is-loding={tableIsLodingFix} options={initDataTableFix}></c-jz-data-table> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelFix}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择一般产品固定价格模态框 --> |
| | | <!-- 选择特约折扣模态框 --> |
| | | <div if:true = {ShowSpecial} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <!-- 特约折扣模态框错误提示 --> |
| | | <div if:true = {ShowSpecialIsError}> |
| | | <div class="my-icons" role="alert"> |
| | | <span class="slds-assistive-text">error</span> |
| | | <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed"> |
| | | <svg class="slds-icon slds-icon_x-small" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use> |
| | | </svg> |
| | | </span> |
| | | <h2>{ShowSpecialError} |
| | | </h2> |
| | | <div class="slds-notify__close"> |
| | | <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close"> |
| | | <svg class="slds-button__icon" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use> |
| | | </svg> |
| | | <span class="slds-assistive-text">Close</span> |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 特约折扣模态框错误提示 --> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3"> |
| | | <!-- 特约折扣待选方案列表 --> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFnSpecial} data-parent-id="parent-div-idSpecial" name="jzDataTableSpecial" ongettabledata={getTableDataSpecial} table-data={jzDataSpecial} table-is-loding={tableIsLodingSpecial} options={initDataTableSpecial}></c-jz-data-table> |
| | | </div> |
| | | <!-- 特约折扣待选方案列表 --> |
| | | <!-- 特约折扣待选产品列表 --> |
| | | <div class="exampleHolder" if:true={IsLoading5} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%px;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFnOtherData} data-parent-id="parent-div-idOtherData" name="jzDataTableOtherData" ongettabledata={getTableDataOtherData} table-data={jzDataOtherData} table-is-loding={tableIsLodingOtherData} options={initDataTableOtherData} onsave={SaveSpecialDiscount} if:true={jzshows5}></c-jz-data-table> |
| | | </div> |
| | | <!-- 特约折扣待选产品列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSpecial}>关闭</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSpecial} >确定</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择特约折扣模态框 --> |
| | | <!-- 选择一般折扣模态框 --> |
| | | <div if:true = {ShowCommonly} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <!-- 一般折扣模态框错误提示 --> |
| | | <div if:true = {ShowCommonlyIsError}> |
| | | <div class="my-icons" role="alert"> |
| | | <span class="slds-assistive-text">error</span> |
| | | <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed"> |
| | | <svg class="slds-icon slds-icon_x-small" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use> |
| | | </svg> |
| | | </span> |
| | | <h2>{ShowCommonlyError} |
| | | <a href="#"></a> |
| | | </h2> |
| | | <div class="slds-notify__close"> |
| | | <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close"> |
| | | <svg class="slds-button__icon" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use> |
| | | </svg> |
| | | <span class="slds-assistive-text">Close</span> |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 一般折扣模态框错误提示 --> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-4"> |
| | | <!-- 产品系列 --> |
| | | <div class ="form-group"> |
| | | <div class ="form-group" style=" display: inline-block; margin-right: 20px;margin-bottom: 15px;"> |
| | | <div class="slds-form-element"> |
| | | <label class="slds-form-element__label" for="select-01">产品系列:</label> |
| | | <div class="slds-form-element__control"> |
| | | <div class="slds-select_container"> |
| | | <select class="slds-select" style="width:150px" onchange={handleChangeLb}> |
| | | <option value="">选择</option> |
| | | <option>GI分野</option> |
| | | <option>SP分野</option> |
| | | <option>ET分野</option> |
| | | <option>能量刀头</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 产品系列 --> |
| | | <!-- 使用折扣 --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label="使用折扣:" style="width:150px" onblur={handleChangeZk}></lightning-input> |
| | | </div> |
| | | <!-- 使用折扣 --> |
| | | </div> |
| | | <!-- 一般折扣待选产品列表 --> |
| | | <div class="exampleHolder" if:true={IsLoading4} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%px;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFnCommonly} data-parent-id="parent-div-idCommonly" name="jzDataTableCommonly" ongettabledata={getTableDataCommonly} table-data={jzDataCommonly} table-is-loding={tableIsLodingCommonly} options={initDataTableCommonly} onsave={SaveGeneralDiscount} if:true={jzshows4}></c-jz-data-table> |
| | | </div> |
| | | <!-- 一般折扣待选产品列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelCommonly}>关闭</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSaveCommonly}>确定</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择一般折扣模态框 --> |
| | | </template> |
| New file |
| | |
| | | import { LightningElement,wire,track,api} from 'lwc'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import Quoto_No from '@salesforce/label/c.Quoto_No'; |
| | | import Quoto_Name from '@salesforce/label/c.Quoto_Name'; |
| | | import HP_Name from '@salesforce/label/c.HP_Name'; |
| | | import Department_Name from '@salesforce/label/c.Department_Name'; |
| | | import Currency from '@salesforce/label/c.Currency'; |
| | | import Total_Price from '@salesforce/label/c.Total_Price'; |
| | | import Contact_Price from '@salesforce/label/c.Contact_Price'; |
| | | import Forecast_Amounts from '@salesforce/label/c.Forecast_Amounts'; |
| | | import Sales_Root from '@salesforce/label/c.Sales_Root'; |
| | | import Status_Update from '@salesforce/label/c.Status_Update'; |
| | | import Set_Product from '@salesforce/label/c.Set_Product'; |
| | | import Excel_Import from '@salesforce/label/c.Excel_Import'; |
| | | import deleteLabel from '@salesforce/label/c.deleteLabel'; |
| | | import Cost from '@salesforce/label/c.Cost'; |
| | | import Calculate from '@salesforce/label/c.Calculate'; |
| | | import AdjustAmount from '@salesforce/label/c.AdjustAmount'; |
| | | import Quote_Adjustment from '@salesforce/label/c.Quote_Adjustment'; |
| | | import Amount from '@salesforce/label/c.Amount'; |
| | | import Sales_Profit from '@salesforce/label/c.Sales_Profit'; |
| | | import Percent from '@salesforce/label/c.Percent'; |
| | | import Sales_Name1 from '@salesforce/label/c.Sales_Name1'; |
| | | import Sales_Name2 from '@salesforce/label/c.Sales_Name2'; |
| | | import Error_Message33 from '@salesforce/label/c.Error_Message33'; |
| | | import Opp_Button from '@salesforce/label/c.Opp_Button'; |
| | | import QuoteDecision_Button from '@salesforce/label/c.QuoteDecision_Button'; |
| | | import Copy_Detail from '@salesforce/label/c.Copy_Detail'; |
| | | import Quote_Print from '@salesforce/label/c.Quote_Print'; |
| | | import Detail_Price from '@salesforce/label/c.Detail_Price'; |
| | | import Detail_Sum from '@salesforce/label/c.Detail_Sum'; |
| | | import Total_Discount_Percent from '@salesforce/label/c.Total_Discount_Percent'; |
| | | import Total_Discount_Amount from '@salesforce/label/c.Total_Discount_Amount'; |
| | | import Row_Total_Sum from '@salesforce/label/c.Row_Total_Sum'; |
| | | import Contract_Breakdown from '@salesforce/label/c.Contract_Breakdown'; |
| | | import Print_HPName from '@salesforce/label/c.Print_HPName'; |
| | | import Print_Button from '@salesforce/label/c.Print_Button'; |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | import QuoteEntryMaxLine2 from '@salesforce/label/c.QuoteEntryMaxLine2'; |
| | | import Sales_Outlet from '@salesforce/label/c.Sales_Outlet'; |
| | | import OCM_Direct from '@salesforce/label/c.OCM_Direct'; |
| | | import Price_Valid_Period from '@salesforce/label/c.Price_Valid_Period'; |
| | | import Message_001 from '@salesforce/label/c.Message_001'; |
| | | import ImportText from '@salesforce/label/c.ImportText'; |
| | | import Tab_Text from '@salesforce/label/c.Tab_Text'; |
| | | import Paste_IE from '@salesforce/label/c.Paste_IE'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import selectQuoteById from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteById'; |
| | | import selectQuoteListLineItemCount from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteListLineItemCount'; |
| | | import selectQuoteLineItem from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteLineItem'; |
| | | import selecUser from '@salesforce/apex/lexNewQuoteEntryController.selecUser'; |
| | | import QuotCalfagAss from '@salesforce/apex/lexNewQuoteEntryController.QuotCalfagAss'; |
| | | import selectOpportunityById from '@salesforce/apex/lexNewQuoteEntryController.selectOpportunityById'; |
| | | import selectAccountById from '@salesforce/apex/lexNewQuoteEntryController.selectAccountById'; |
| | | import getPicklistValues from '@salesforce/apex/lexNewQuoteEntryController.getPicklistValues'; |
| | | import SaveQuote from '@salesforce/apex/lexNewQuoteEntryController.SaveQuote'; |
| | | import Print from '@salesforce/apex/lexNewQuoteEntryController.Print'; |
| | | import QuoteDecision from '@salesforce/apex/lexNewQuoteEntryController.QuoteDecision'; |
| | | import serContact from '@salesforce/apex/lexNewQuoteEntryController.serContact' |
| | | import serSetContact from '@salesforce/apex/lexNewQuoteEntryController.serSetContact' |
| | | import setProductEntry from '@salesforce/apex/lexNewQuoteEntryController.setProductEntry' |
| | | import excelImport from '@salesforce/apex/lexNewQuoteEntryController.excelImport' |
| | | import getModulus from '@salesforce/apex/lexNewQuoteEntryController.getModulus' |
| | | import getquoDes from '@salesforce/apex/lexNewQuoteEntryController.getquoDes' |
| | | import getProduct2 from '@salesforce/apex/NewQuoteEntryWebService.getProduct2'; |
| | | import updateOTCodeweb from '@salesforce/apex/NewQuoteEntryWebService.updateOTCode'; |
| | | import getQuoteLineItem from '@salesforce/apex/NewQuoteEntryWebService.getQuoteLineItem'; |
| | | import Message_Please_Save_Quote from '@salesforce/label/c.Please_Save_Quote'; |
| | | import Message_Check_Your_Clipboard from '@salesforce/label/c.Check_Your_Clipboard'; |
| | | import SelectAllDataDiscount from '@salesforce/apex/QuoteTrialController.selectAllDataDiscount'; |
| | | import GetPromotionDefalut from '@salesforce/apex/QuoteTrialController.GetPromotionDefalut'; |
| | | import GetPromotionPromotionSearch from '@salesforce/apex/QuoteTrialController.GetPromotionPromotionSearch'; |
| | | import GetNormalProductSearch from '@salesforce/apex/QuoteTrialController.GetNormalProductSearch'; |
| | | import GetAuthorizerSearch from '@salesforce/apex/QuoteTrialController.GetAuthorizerSearch'; |
| | | import GetSearchProductById from '@salesforce/apex/QuoteTrialController.GetSearchProductById'; |
| | | import saveAllDataProduct from '@salesforce/apex/QuoteTrialController.saveAllDataProduct'; |
| | | import SelectAllDataProduct from '@salesforce/apex/QuoteTrialController.selectAllDataProduct'; |
| | | import GetQuoteData from '@salesforce/apex/QuoteTrialController.GetQuoteData'; |
| | | import GetAgencyRName from '@salesforce/apex/QuoteTrialController.GetAgencyRName'; |
| | | import selectUpdateFiexedpriceData from '@salesforce/apex/QuoteTrialController.selectUpdateFiexedpriceData'; |
| | | import selectUpdateQuoteLineItemData from '@salesforce/apex/QuoteTrialController.selectUpdateQuoteLineItemData'; |
| | | import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; |
| | | import {localParseInt,toNum,initDataTableToBeproductConfig,saveEvoluationLogic,oppInfosave,quoLineItemsave,filterNameoptionList,initDataSetProductTablefig,quoteTotalPriceActionLogic,CheckForCost,actState,tStringe, |
| | | toNumComma,localParseFloat,NewQcopyLogic,productCompareLogic,bflag,jzProductsearchLogic,additionaljzProductLogic,initDataProductTablefig,checkNMPA,saveQuotel,CheckForListPrice,calGuranteePeriodLogic,EstimationL,checkch, |
| | | additionabuttonLoc,DataStatus,InitializeProductAssignment,PriceStatusUpdateLogic,newQuoteFlagex,calGuranteeAllFieldsLogic,MultiYearWarrantyTotalPriceExport,newQuoteFlagExp,AlertForCFDA,UnitPriceUpdateLogic,nafgExp,flg, |
| | | PrintCustomerNameoptionsvlue,selection_hpExp,options_hpflgExp,initquoassignment,initquoassignmentcopy,salesProfit1Logic,salesCalculation1Logic,salesProfit2Logic,salesCalculation2Logic,SubtotalupdateLogic,alfExp,resultFlag, |
| | | productStatusUpdatedExp,initQuoteLineItemcheck,MarkRed,quoteAgencyTotalPriceActionLogic,calPriceAllLogic,QuoteAdjustLogic,quoExp,AgencyDiscountCalculation1Logic,onsaveToBeproductLoc,fagExp,PrintButtonLoc,alertExp,decisionlol, |
| | | saverebackloc,DisCalculationfunctionLoc,quoteTotalPriceLoc,calUnitPriceTotalLoc,ListPriceTotalExp,unitPriceTotalExp,pageArrangeLoc,openQuotePage,errorflg,StrExp,quoteinit,IsQuoteTrialExp,setOCMAmountc,DisAmountfunctionc} from "./lexNexQuoteEntryUtil.js"; |
| | | import {arrTempsss,arrProductTempsss,initDataTableProduct2,initDataTable2,initSearchForm2,getQueryVariable,ChangeFiexedData,GetUUID,initDataTableDefault2, |
| | | initSearchFormDefalt2,QTcssE,initDataTableFixedPrice2,initDataTableDiscount2,initDataTableSpecial2,initSearchFormFix2,initDataTableFix2,CompareDataL,isChangeExp, |
| | | initDataTableOtherData2,initDataTableCommonly2,ProductAssignmentSelect,ProductSelected,UnselectedScheme,SelectedScheme,commonlyDiscountLogic,ChangeProductData, |
| | | PriceConsolidation,ReplacementUnitPriceLogic,ConsolidatedDiscountDetailsLogic,ConsolidatedDiscountPolicyLogic, |
| | | addOfferLogic,ReverseCalculationModifyDiscountLogic,HeTongPriceComputeLogic,InverseCalculationTiShi,ContractPriceComputeLogic,GeneralDiscountContractSummaryLogic,handleSaveFixedPriceLogic, |
| | | SpecialSavesChangePartLogic,NewDefaultDatass,AddProductDatass,jzDataFixedPriceTemps,jzDataDiscountTemps,updatesNumsLogic,updateCDLogic,DeftCopyQtyLists,initquoT,buttonIsShowE,initDTFP,initDTD,initDTOD,initDTC , |
| | | countListAndNodLogic,jzDataDefaultExp,jzDataProductExp,jzDataFixedPriceExp,jzDataDiscountExp,comparisonUniqueKeyLogic,SearchProductByIdLogic,jzDataDefaultCopyQuantityListExp,AddNumsLogic,CompareFullDataExp,SelectedFnCommonlyLogic, |
| | | ComputeDataPromotionLogic,newArrsTemp3Exp,newArrsTemp4Exp,jzDataDefaultCopyExp,ComputeDataNormalProductLogic,ComputeDiscountAuthorizerLogic,newArrsTempExp,newArrsTemp2Exp,MergeDuplicateSchemesLogic,delectTableDiscountTempLogic, |
| | | handleSaveDiscountLogic,booleanExp,boolean2Exp,boolean3Exp,newDataExp,newData2Exp,newData3Exp,editnewDateExp,GuaranteeDiscount__cZuiXiaoExp,NormalDiscount__cZuiXiaoExp,HeTongTotalExp,SelectedFnDataFixedPriceExp,deleteFixedPriceLogic, |
| | | CompareFullDataTempExp,jzDataDefaultNotChangeExp,DeleteChangesFnLogic,deleteFixedPriceTempLogic,GetSearchProductByIdLogic,iflagExp,getTableDataCommonlyLogic,idsExp,DeleteIsChangelogicExp,DeleteIsChangesFnjiage,falgExp, |
| | | DeleteIsChangesFnzhekou,SaveGeneralDiscountLogic,DeleteSchemeMatchingLogic,savecountLogic,ComparePushDataLogic,newTempExp,saveAllDataProductFnChuanshen,saveAllDataProductFnPanduan,ifnullExp} from "./lexquoteTrialUtil.js"; |
| | | |
| | | export default class LexNewQuoteEntry extends LightningElement { |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.fragment; |
| | | if (urlValue) { |
| | | this.location = urlValue; |
| | | } |
| | | } |
| | | } |
| | | location = ''; |
| | | @track |
| | | pricePolicyflag1 = false; |
| | | @track |
| | | ImportText = ImportText; |
| | | @track |
| | | Tab_Text = Tab_Text; |
| | | @track |
| | | Paste_IE = Paste_IE; |
| | | @track |
| | | QuotoNo = Quoto_No; |
| | | @track |
| | | QuotoName = Quoto_Name; |
| | | @track |
| | | HPName = HP_Name; |
| | | @track |
| | | DepartmentName = Department_Name; |
| | | @track |
| | | Currency = Currency; |
| | | @track |
| | | TotalPrice = Total_Price; |
| | | @track |
| | | ContactPrice = Contact_Price; |
| | | @track |
| | | ForecastAmounts = Forecast_Amounts; |
| | | @track |
| | | SalesRoot = Sales_Root; |
| | | @track |
| | | StatusUpdate = Status_Update; |
| | | @track |
| | | SetProduct = Set_Product; |
| | | @track |
| | | ExcelImport = Excel_Import; |
| | | @track |
| | | deleteLabel = deleteLabel; |
| | | @track |
| | | Cost = Cost; |
| | | @track |
| | | Calculate = Calculate; |
| | | @track |
| | | AdjustAmount = AdjustAmount; |
| | | @track |
| | | QuoteAdjustment = Quote_Adjustment; |
| | | @track |
| | | Amount = Amount; |
| | | @track |
| | | SalesProfit = Sales_Profit; |
| | | @track |
| | | Percent = Percent; |
| | | @track |
| | | SalesName1 = Sales_Name1; |
| | | @track |
| | | Sales_Name2 = Sales_Name2; |
| | | @track |
| | | Opp_Button = Opp_Button; |
| | | @track |
| | | QuoteDecision_Button = QuoteDecision_Button; |
| | | @track |
| | | Copy_Detail = Copy_Detail; |
| | | |
| | | @track |
| | | Quote_Print = Quote_Print; |
| | | @track |
| | | Detail_Price = Detail_Price; |
| | | @track |
| | | Detail_Sum = Detail_Sum; |
| | | @track |
| | | Total_Discount_Percent = Total_Discount_Percent; |
| | | @track |
| | | Total_Discount_Amount = Total_Discount_Amount; |
| | | @track |
| | | Row_Total_Sum = Row_Total_Sum; |
| | | @track |
| | | Contract_Breakdown = Contract_Breakdown; |
| | | @track |
| | | Print_HPName = Print_HPName; |
| | | @track |
| | | Print_Button = Print_Button; |
| | | @track |
| | | QuotCalfag = false; |
| | | |
| | | quoteEntryMaxLine = QuoteEntryMaxLine2; |
| | | @track |
| | | IsLoading = false; |
| | | OnLoading(flag) { |
| | | this.IsLoading = flag; |
| | | } |
| | | stylesLoaded = false; |
| | | renderedCallback(){ |
| | | if (!this.stylesLoaded) { |
| | | Promise.all([loadStyle(this, WrappedHeaderTable)]) |
| | | .then(() => { |
| | | this.stylesLoaded = true; |
| | | }) |
| | | .catch((error) => { |
| | | }); |
| | | } |
| | | Promise.all([ |
| | | loadStyle(this, lwcCSS) |
| | | ]); |
| | | } |
| | | //报价对象 |
| | | @track |
| | | quo = {Installation_location__c:'',QuotationChange__c:''}; |
| | | //询价对象 |
| | | @track |
| | | oppInfo ={}; |
| | | //自定义结构 |
| | | @track |
| | | qb = {}; |
| | | @track |
| | | hidden = false; |
| | | //成本 |
| | | hidden_Stocking_Price = ''; |
| | | //询价Id |
| | | oppId = ''; |
| | | //报价Id |
| | | quoId = ''; |
| | | //是否跳过报价计算标识 |
| | | SkipQuotefilg; |
| | | //复制报价Id |
| | | copyid = ''; |
| | | //内外贸 |
| | | trade = ''; |
| | | //直销经销商标识 |
| | | enableSales; |
| | | //判断特殊经销商价格显示权限标识 |
| | | displayFlg; |
| | | //特殊经销商价格显示权限 |
| | | viewSpecialAgencyAmout |
| | | //当前登录用户 |
| | | User; |
| | | //报价修改权限标识 |
| | | verified; |
| | | //上传订单权限标识 |
| | | specialAuthority; |
| | | //询价产品成本参照权限标识 |
| | | displayCost; |
| | | //init查询询价相关标识 start |
| | | QuoteDecision; |
| | | QuoteDecide; |
| | | QuoteSapSented; |
| | | QuoteCorrect; |
| | | @track |
| | | enableContract; |
| | | productStatusUpdated =false; |
| | | //init查询询价相关标识 end |
| | | //合同保修期(年)全局 |
| | | quoteGurantee_Period; |
| | | //取消市场多年保修全局 |
| | | quotemultiYearWarranty; |
| | | //经销商初始化时备份 start |
| | | agency1Name; |
| | | agency2Name; |
| | | Saleslet = false; |
| | | //经销商初始化时备份 end |
| | | //数据是否发生变化标识 |
| | | newQuoteFlag = false; |
| | | //状态更新 |
| | | productStatusUpdated = false; |
| | | //查询询价获取客户Id |
| | | accountid; |
| | | //打印标识 |
| | | print_buttonflg = false; |
| | | //decide按钮标识 |
| | | Decision_button = false; |
| | | sap_button; |
| | | //save和decide按钮标识 |
| | | Save_button = false; |
| | | Decisiontag = false; |
| | | //经销商一利润显示 |
| | | Salesprofit1value; |
| | | //经销商二利润显示 |
| | | Salesprofit2value; |
| | | //经销商一百分比显示 |
| | | SalesCalculation1value |
| | | //经销商二百分比显示 |
| | | SalesCalculation2value |
| | | //隐藏多年保修价格合计 |
| | | hidden_MultiYearWarrantyTotalPrice |
| | | //经销商折扣 |
| | | WinOrDecideAlert; |
| | | //备份初始化时的报价行项目 |
| | | CheckItem; |
| | | //初始化方法 |
| | | ifquocom = false; |
| | | acts = false; |
| | | actL = []; |
| | | connectedCallback() { |
| | | this.tobeflag = false; |
| | | this.quoteEntryMaxLine = Number(this.quoteEntryMaxLine); |
| | | debugger |
| | | this.SkipQuotefilg = false; |
| | | var quoteflg = true; |
| | | this.displayFlg = true; |
| | | this.WinOrDecideAlert = false; |
| | | this.OnLoading(true); |
| | | if(this.quoId == ''){ |
| | | this.quoId = getQueryVariable('Id',this.location); |
| | | } |
| | | if(this.copyid == ''){ |
| | | this.copyid = getQueryVariable('copyid',this.location); |
| | | } |
| | | if(this.oppId == ''){ |
| | | this.oppId = getQueryVariable('oppid',this.location); |
| | | } |
| | | this.nafg = resultFlag(this.nafg,''); |
| | | selectQuoteListLineItemCount({quoId:this.quoId,oppId:this.oppId,copyid:this.copyid}).then(quoteByopp=>{ |
| | | debugger |
| | | if(this.oppId){ |
| | | if(this.copyid){ |
| | | this.quoId = this.copyid; |
| | | } |
| | | } |
| | | if(quoteByopp.length > 0){ |
| | | if (!this.oppId) { |
| | | this.oppId = quoteByopp[0].OpportunityId; |
| | | } |
| | | } |
| | | selecUser().then(Userobj=>{ |
| | | this.User = Userobj; |
| | | if(JSON.stringify(Userobj) != "{}"){ |
| | | this.verified =this.User.Quote_Correct__c; |
| | | this.specialAuthority = this.User.Quote_Special_Operation__c; |
| | | this.displayCost = this.User.Cost_Referable__c; |
| | | this.viewSpecialAgencyAmout = this.User.ViewSpecialAgencyAmout__c; |
| | | } |
| | | selectOpportunityById({oppId:this.oppId}).then(oppobj=>{ |
| | | debugger |
| | | this.oppInfo = oppobj; |
| | | var oppvalue = JSON.stringify(oppobj); |
| | | getModulus({oppInfoc:oppvalue}).then(rtn=>{ |
| | | this.oppInfo.rate_hospital = rtn.rate_hospital; |
| | | this.oppInfo.rate_agency1 = rtn.rate_agency1; |
| | | }); |
| | | this.trade = '外貿'; |
| | | if(JSON.stringify(oppobj) != "{}"){ |
| | | this.trade = oppobj.Trade__c; |
| | | this.QuoteDecision = oppobj.Estimation_Decision__c; |
| | | this.QuoteDecide = this.QuoteDecision; |
| | | this.QuoteSapSented = oppobj.SAP_Send_OK__c; |
| | | this.QuoteCorrect = oppobj.New_Opportunity__c; |
| | | this.enableSales = false; |
| | | this.oppInfo.Wholesale_Price__c = toNumComma(oppobj.Wholesale_Price__c); |
| | | if (this.oppInfo.Sales_Root__c != null) { |
| | | if (oppobj.Sales_Root__c == '販売店') { |
| | | this.enableSales = true; |
| | | this.oppInfo.Sales_Root__c = Sales_Outlet; |
| | | this.Saleslet = true; |
| | | } else { |
| | | this.enableSales = false; |
| | | this.oppInfo.Sales_Root__c = OCM_Direct; |
| | | } |
| | | } |
| | | this.accountid = this.oppInfo.AccountId; |
| | | |
| | | if (this.QuoteDecision) { |
| | | this.enableContract = true; |
| | | } else { |
| | | this.enableContract = false; |
| | | } |
| | | this.oppInfo.SAP_Send_OK__c = true; |
| | | if (!this.oppInfo.SAP_Send_OK__c) { |
| | | this.displayFlg = true; |
| | | } else { |
| | | if(this.oppInfo.Agency1__r == undefined){ |
| | | this.oppInfo.Agency1__r = {}; |
| | | } |
| | | if(this.oppInfo.Agency2__r == undefined){ |
| | | this.oppInfo.Agency2__r = {}; |
| | | } |
| | | if(this.oppInfo.Account == undefined){ |
| | | this.oppInfo.Account = {}; |
| | | }else{ |
| | | if(this.oppInfo.Account.Parent == undefined){ |
| | | this.oppInfo.Account.Parent = {}; |
| | | } |
| | | } |
| | | if (this.oppInfo.Agency1__r.Special__c || this.oppInfo.Agency2__r.Special__c || this.oppInfo.Account.Parent.Special__c) { |
| | | if (this.viewSpecialAgencyAmout) { |
| | | this.displayFlg = true; |
| | | } else { |
| | | this.displayFlg = false; |
| | | } |
| | | } else { |
| | | this.displayFlg = true; |
| | | } |
| | | } |
| | | } |
| | | debugger |
| | | if (!this.QuoteCorrect) { |
| | | this.print_buttonflg = true; |
| | | } else if (!this.verified) { |
| | | this.print_buttonflg = true; |
| | | } else { |
| | | this.print_buttonflg = false; |
| | | } |
| | | if (this.QuoteDecision == false) { |
| | | this.sap_button = true; |
| | | } else if (this.specialAuthority == false) { |
| | | this.sap_button = true; |
| | | } else { |
| | | this.sap_button = false; |
| | | } |
| | | if (this.verified) { |
| | | this.Decision_button = false; |
| | | } else if (!this.QuoteCorrect) { |
| | | this.Decision_button = true; |
| | | } else if (this.QuoteDecision) { |
| | | this.Decision_button = true; |
| | | } else { |
| | | this.Decision_button = false; |
| | | } |
| | | if (this.QuoteSapSented || this.QuoteDecision) { |
| | | this.Decision_button = true; |
| | | } |
| | | if (this.QuoteDecision) { |
| | | this.Save_button = true; |
| | | this.Decisiontag = true; |
| | | var lg = this.template.querySelectorAll('c-jzlookuplightning2'); |
| | | lg.forEach(l=>{ |
| | | l.todisabled(); |
| | | }) |
| | | } else { |
| | | this.Save_button = false; |
| | | this.Decisiontag = false; |
| | | this.initDataTableToBeproduct.columns[4].editable = true; |
| | | } |
| | | this.tobeflag = true; |
| | | this.OnLoading(false); |
| | | }); |
| | | }); |
| | | getquoDes().then(it=>{ |
| | | QuotCalfagAss().then(r=>{ |
| | | if(this.quoId !=''){ |
| | | selectQuoteById({quoId:this.quoId}).then(quote=>{ |
| | | debugger |
| | | this.quo=quote; |
| | | selectQuoteLineItem({quoId:this.quoId,copyid:this.copyid}).then(result=>{ |
| | | debugger |
| | | var tempArr = result.split("---"); |
| | | var quoteLineItem = JSON.parse(tempArr[0]); |
| | | this.CheckItem = JSON.parse(tempArr[1]); |
| | | if(JSON.stringify(quote) != "{}"){ |
| | | debugger |
| | | if(this.copyid == ''){ |
| | | this.quo = initquoassignment(quote,this.quo,it); |
| | | this.hidden = this.quo.rtn; |
| | | this.QuotCalfag = (r&&this.hidden); |
| | | this.quoteGurantee_Period = quote.Gurantee_Period__c; |
| | | this.quotemultiYearWarranty = quote.multiYearWarranty__c; |
| | | this.agency1Name = quote.Agency1__c; |
| | | this.agency2Name = quote.Agency2__c; |
| | | this.Salesprofit1value = quote.Agency1_Profit__c; |
| | | this.Salesprofit2value = quote.Agency2_Profit__c; |
| | | this.SalesCalculation1value = quote.Agency1_Profit_Rate__c; |
| | | this.SalesCalculation2value = quote.Agency2_Profit_Rate__c; |
| | | this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c; |
| | | this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c); |
| | | this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c); |
| | | }else{ |
| | | this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c; |
| | | this.quo = initquoassignmentcopy(quote,this.quo,it); |
| | | this.hidden = this.quo.rtn; |
| | | this.QuotCalfag = (r&&this.hidden); |
| | | this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c); |
| | | this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c); |
| | | |
| | | } |
| | | } |
| | | if(quoteLineItem.length > 0 && !this.QuoteDecision){ |
| | | this.productStatusUpdated = false; |
| | | quoteLineItem = initQuoteLineItemcheck(quoteLineItem,this.productStatusUpdated); |
| | | this.newQuoteFlag = newQuoteFlagExp; |
| | | this.productStatusUpdated = productStatusUpdatedExp; |
| | | } |
| | | if(JSON.stringify(quoteLineItem) != "{}"){ |
| | | quoteLineItem = InitializeProductAssignment(quoteLineItem); |
| | | if(this.acts){ |
| | | quoteLineItem = actState(this.actL,quoteLineItem); |
| | | } |
| | | this.jzDataToBeproduct =[].concat(quoteLineItem); |
| | | } |
| | | this.pageArrange(); |
| | | if (this.productStatusUpdated) { |
| | | this.calPriceAll(); |
| | | this.setOCMAmount(); |
| | | this.OnLoading(false); |
| | | } else { |
| | | this.EstimationListPrice(); |
| | | this.calUnitPriceTotal(); |
| | | this.setCostTatal(); |
| | | this.checkProductStatusValidPeriod(); |
| | | } |
| | | var IsQuoteTrial =this.quo.IsQuoteTrial__c; |
| | | this.ifquocom = IsQuoteTrial; |
| | | debugger |
| | | var z = this.quo.Estimation_List_Price__c; |
| | | var s = this.quo.OCM_Agent1_Price_Page__c; |
| | | var id = this.quoId; |
| | | debugger |
| | | if(!id){ |
| | | if(!s){ |
| | | var IsQuoteTrial =this.quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | var mp =this.quo.MultiYearWarrantyTotalPrice__c; |
| | | mp = localParseFloat(mp); |
| | | var num = this.quo.Quote_Adjust_Calculate__c; |
| | | num = localParseFloat(num); |
| | | this.quo.Quote_Adjust_Calculate__c = toNumComma(num); |
| | | num = (100 + num) / 100; |
| | | z = localParseFloat(z); |
| | | var rh = this.oppInfo.rate_hospital; |
| | | var ra = this.oppInfo.rate_agency1; |
| | | this.quo.Dealer_Final_Price_Page__c = toNumComma(z*rh); |
| | | this.quo.OCM_Agent1_Price_Page__c = this.Saleslet ? toNumComma(z*num*ra+mp):''; |
| | | this.setOCMAmount() |
| | | this.calFromContactPrice(); |
| | | } |
| | | } |
| | | this.OnLoading(false); |
| | | } |
| | | if(this.copyid){ |
| | | this.quoId = ''; |
| | | this.SkipQuotefilg = true; |
| | | } |
| | | }); |
| | | this.quo = quoteinit(this.quo); |
| | | this.HiddenGurantee_Period = this.quo.Gurantee_Period__c; |
| | | }); |
| | | }else{ |
| | | this.quo = quoteinit(this.quo); |
| | | this.HiddenGurantee_Period = this.quo.Gurantee_Period__c; |
| | | this.quo.multiYearWarranty__c = false; |
| | | this.pageArrange(); |
| | | this.hidden = it; |
| | | this.QuotCalfag = (r&&it); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | }); |
| | | //Add DTT - Hua Jian 20231018 Start |
| | | const inputAlignright = document.createElement('style'); |
| | | inputAlignright .innerText = `.input-text-align_right input{ text-align: right!important; }`; |
| | | document.body.appendChild(inputAlignright); |
| | | //Add DTT - Hua Jian 20231018 End |
| | | } |
| | | pageArrange(){ |
| | | this.quo = pageArrangeLoc(this.quo); |
| | | } |
| | | calPriceAll() { |
| | | debugger |
| | | this.calGuranteeAllFields(); |
| | | this.jzDataToBeproduct = calPriceAllLogic(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.EstimationListPrice(); |
| | | this.calUnitPriceTotal(); |
| | | this.quoteTotalPrice(); |
| | | this.quoteAgencyTotalPriceAction(); |
| | | this.AgencyDiscountCalculation1(); |
| | | } |
| | | // |
| | | calGuranteeAllFields() { |
| | | this.jzDataToBeproduct = calGuranteeAllFieldsLogic(this.jzDataToBeproduct,this.quo); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_MultiYearWarrantyTotalPrice = MultiYearWarrantyTotalPriceExport; |
| | | this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(MultiYearWarrantyTotalPriceExport); |
| | | } |
| | | EstimationListPrice() { |
| | | this.jzDataToBeproduct = EstimationL(this.jzDataToBeproduct,this.quo); |
| | | this.quo = quoExp; |
| | | } |
| | | |
| | | ListPriceTotalhidden = 0; |
| | | UnitPriceTotalhidden = 0; |
| | | calUnitPriceTotal() { |
| | | this.jzDataToBeproduct = calUnitPriceTotalLoc(this.jzDataToBeproduct); |
| | | this.ListPriceTotalhidden = ListPriceTotalExp; |
| | | this.UnitPriceTotalhidden = unitPriceTotalExp; |
| | | } |
| | | |
| | | quoteTotalPrice() { |
| | | var result = quoteTotalPriceLoc(this.jzDataToBeproduct,this.quo,this.quoId,this.oppInfo,this.Saleslet); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(result); |
| | | var id = this.quoId; |
| | | if(!id){ |
| | | var IsQuoteTrial =this.quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | this.setOCMAmount(); |
| | | this.calFromContactPrice(); |
| | | } |
| | | } |
| | | this.DisAmountfunction(); |
| | | this.QuoteAdjust(); |
| | | this.salesProfit2(); |
| | | this.setCostTatal(); |
| | | } |
| | | setOCMAmount() { |
| | | debugger |
| | | this.oppInfo = setOCMAmountc(this.enableSales,this.quo,this.oppInfo); |
| | | this.quo = quoExp; |
| | | } |
| | | /* |
| | | 医院的合同金额 格式化为 带分位符的字段; |
| | | */ |
| | | calFromContactPrice() { |
| | | var x = 0; |
| | | x = this.quo.Dealer_Final_Price_Page__c; |
| | | x = localParseFloat(x); |
| | | this.quo.Dealer_Final_Price_Page__c = toNumComma(x); |
| | | this.DisAmountfunction(); |
| | | this.salesProfit1(); |
| | | this.salesProfit2(); |
| | | this.setCostTatal(); |
| | | } |
| | | |
| | | DisAmountfunction() { |
| | | this.quo = DisAmountfunctionc(this.quo); |
| | | this.DisCalculationfunction(); |
| | | } |
| | | DisCalculationfunction() { |
| | | this.quo = DisCalculationfunctionLoc(this.quo); |
| | | } |
| | | salesProfit1() { |
| | | this.Salesprofit1value = salesProfit1Logic(this.quo,this.Salesprofit1value); |
| | | this.quo = quoExp; |
| | | this.salesCalculation1(); |
| | | } |
| | | salesCalculation1() { |
| | | this.SalesCalculation1value = salesCalculation1Logic(this.quo,this.Salesprofit1value,this.SalesCalculation1value); |
| | | this.quo = quoExp; |
| | | } |
| | | salesProfit2() { |
| | | this.Salesprofit2value = salesProfit2Logic(this.quo,this.Salesprofit2value); |
| | | this.quo = quoExp; |
| | | this.salesCalculation2(); |
| | | this.salesProfit1(); |
| | | } |
| | | |
| | | salesCalculation2() { |
| | | this.SalesCalculation2value = salesCalculation2Logic(this.quo,this.Salesprofit2value,this.SalesCalculation2value) |
| | | this.quo = quoExp; |
| | | } |
| | | setCostTatal() { |
| | | var z = 0; |
| | | this.jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var s = 0; |
| | | s = localParseFloat(jzdtbt.Cost_Subtotal_c); |
| | | if (!isNaN(s)) { |
| | | z = z + s; |
| | | } |
| | | }); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_Stocking_Price = toNum(z); |
| | | if (this.displayCost) { |
| | | this.quo.Stocking_Price__c = toNumComma(z); |
| | | } |
| | | } |
| | | QuoteAdjust() { |
| | | this.jzDataToBeproduct = QuoteAdjustLogic(this.jzDataToBeproduct,this.quo,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | |
| | | quoteAgencyTotalPriceAction() { |
| | | this.jzDataToBeproduct = quoteAgencyTotalPriceActionLogic(this.jzDataToBeproduct,this.quo,this.oppInfo,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | AgencyDiscountCalculation1() { |
| | | this.jzDataToBeproduct = AgencyDiscountCalculation1Logic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | Confirm_PriceRefresh = '报价作成后'+Price_Valid_Period+'天,还没有更新过价格,需要执行'+Status_Update+'?'; |
| | | checkProductStatusValidPeriod() { |
| | | var period = this.quo.PriceRefreshPeriod; |
| | | if (parseInt(period) > parseInt(Price_Valid_Period) && this.QuoteDecide != true) { |
| | | if (confirm(this.Confirm_PriceRefresh)) { |
| | | this.productCompare(); |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | productCompare() { |
| | | try { |
| | | var returnflg; |
| | | var b = true; |
| | | var t = this.trade; |
| | | var ids = new Array(); |
| | | this.jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var id =jzdtbt.pageObject.Id__c; |
| | | if (id != '') { |
| | | ids.push(jzdtbt.pageObject.Id__c); |
| | | } |
| | | }); |
| | | getProduct2({ids:ids}).then(results=>{ |
| | | debugger |
| | | var id2Product = new Object(); |
| | | for (var j = 0; j < results.length; j++) { |
| | | id2Product[results[j].Id] = results[j]; |
| | | } |
| | | var reslut = productCompareLogic(this.jzDataToBeproduct,id2Product,t,b); |
| | | b = bflag; |
| | | this.jzDataToBeproduct =[].concat(reslut); |
| | | if (b == false) { |
| | | if (window.confirm(Message_001)) { |
| | | this.PriceStatusUpdate(); |
| | | this.OnLoading(false); |
| | | this.productStatusUpdated = true; |
| | | this.WinOrDecideAlert = false; |
| | | returnflg = true; |
| | | } else { |
| | | returnflg = false; |
| | | } |
| | | } else { |
| | | this.Alert("价格状态没有变化。",'warning'); |
| | | this.productStatusUpdated = true; |
| | | returnflg = false; |
| | | } |
| | | }); |
| | | return returnflg; |
| | | } catch (e) { |
| | | this.Alert(e,'error'); |
| | | } |
| | | |
| | | } |
| | | //替换产品otcode |
| | | updateOtcode() { |
| | | this.OnLoading(true); |
| | | var id = this.quoId; |
| | | var nmpa = checkNMPA(this.jzDataToBeproduct); |
| | | if (nmpa) { |
| | | updateOTCodeweb({tempQuoId: id}).then(results=>{ |
| | | if (results) { |
| | | this.Alert('产品otcode替换完成!','success'); |
| | | window.location.reload(); |
| | | } else { |
| | | this.Alert('产品otcode替换失败,请联系管理员!','error'); |
| | | } |
| | | this.OnLoading(false); |
| | | }); |
| | | } else { |
| | | this.OnLoading(false); |
| | | this.Alert('报价行项目没有NMPA状态为停止的产品,无法替换!','error'); |
| | | } |
| | | } |
| | | PriceStatusUpdate(){ |
| | | this.setOppFromOppInfo(); |
| | | //全件洗い替えします。 |
| | | if (this.jzDataToBeproduct.length > 0) { |
| | | this.jzDataToBeproduct = PriceStatusUpdateLogic(this.jzDataToBeproduct,this.newQuoteFlag); |
| | | this.newQuoteFlag = newQuoteFlagex; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.productStatusUpdated = true; |
| | | } |
| | | this.pageArrange(); |
| | | this.calPriceAll(); |
| | | this.Alert('更新完毕!','success'); |
| | | } |
| | | setOppFromOppInfo() { |
| | | this.oppInfo.Agency1__c = this.quo.Agency1__c; |
| | | this.oppInfo.Agency2__c = this.quo.Agency2__c; |
| | | } |
| | | |
| | | quoteAgencyTotalPriceAction1(str) { |
| | | var Sales_Root = this.oppInfo.Sales_Root__c; |
| | | Sales_Root = Sales_Root + ''; |
| | | Sales_Root = Sales_Root.replace(/\s+/g, ""); |
| | | if (str == Sales_Root) { |
| | | this.quoteAgencyTotalPriceAction(); |
| | | } |
| | | } |
| | | //报价名称赋值 |
| | | QuoteNameAssignment(event){ |
| | | this.quo.QuoteName__c = event.target.value; |
| | | } |
| | | //最终客户成交价Change事件 |
| | | DealerFinalPricePageChange(event){ |
| | | this.quo.Dealer_Final_Price_Page__c = event.target.value; |
| | | debugger |
| | | this.calFromContactPrice(); |
| | | this.setOCMAmount(); |
| | | this.quoteAgencyTotalPriceAction1('OCM直接销售'); |
| | | } |
| | | //计算%的change |
| | | QuoteAdjustCalculateChange(event){ |
| | | debugger |
| | | if(this.quo.Quote_Adjust_Calculate__c !== event.target.value){ |
| | | this.quo.Quote_Adjust_Calculate__c = event.target.value; |
| | | this.UnitPriceUpdate(); |
| | | event.target.value = this.quo.Quote_Adjust_Calculate__c; |
| | | } |
| | | } |
| | | //调整金额的change |
| | | QuoteAdjustAmountPageChange(event){ |
| | | debugger |
| | | if(this.quo.Quote_Adjust_Amount_Page__c !== event.target.value){ |
| | | this.quo.Quote_Adjust_Amount_Page__c = event.target.value; |
| | | this.calFromQuoAmont() |
| | | } |
| | | } |
| | | //经销商一合同金额change |
| | | OCMAgent1PricePageonChange(event){ |
| | | this.quo.OCM_Agent1_Price_Page__c = event.target.value; |
| | | this.salesProfit1(); |
| | | this.setOCMAmount(); |
| | | this.quoteAgencyTotalPriceAction1('经销商'); |
| | | this.AgencyDiscountCalculation1(); |
| | | } |
| | | //经销商二合同金额change |
| | | Agent1Agent2PricePageChange(event){ |
| | | this.quo.Agent1_Agent2_Price_Page__c = event.target.value; |
| | | this.salesProfit2(); |
| | | } |
| | | |
| | | copyToClipboardNewQuoteEntry() { |
| | | var QuoteId = this.quoId; |
| | | if (QuoteId == null || QuoteId == '') { |
| | | this.Alert(Message_Please_Save_Quote,'error'); |
| | | return null; |
| | | } |
| | | var records; |
| | | var x; |
| | | var targetString = tStringe; |
| | | try { |
| | | getQuoteLineItem({ |
| | | quoId: QuoteId |
| | | }).then(reslut=>{ |
| | | NewQcopyLogic(Message_Check_Your_Clipboard,records,x,targetString,reslut,this.displayCost,this.oppInfo.CurrencyIsoCode); |
| | | if(alfExp){ |
| | | this.Alert(alertExp,'success'); |
| | | }else{ |
| | | this.Alert(alertExp,'error'); |
| | | } |
| | | }); |
| | | } catch (e) { |
| | | this.Alert(e.faultcode + ',' + e.faultstring,'error'); |
| | | } |
| | | } |
| | | @track |
| | | nafg={}; |
| | | //保存报价按钮 |
| | | savebuttonClick(){ |
| | | this.OnLoading(true); |
| | | this.checkchangedAfterPrint('sa'); |
| | | if(this.fg){ |
| | | this.sal(); |
| | | } |
| | | } |
| | | sal(){ |
| | | debugger |
| | | this.tobeflag=false; |
| | | var shut = AlertForCFDA(this.jzDataToBeproduct); |
| | | if (shut == true) { |
| | | this.Alert('提示:包含重新申请CFDA的产品,不可进行订货。','error'); |
| | | } |
| | | var cost = CheckForCost(this.jzDataToBeproduct); |
| | | if (cost) { |
| | | this.Alert('产品成本为空时不可报价!','error'); |
| | | this.OnLoading(false); |
| | | this.tobeflag=true; |
| | | } else { |
| | | var er = ''; |
| | | var listPrice = CheckForListPrice(this.jzDataToBeproduct); |
| | | if (listPrice) { |
| | | er = '目前产品定价未确定,请于产品本部联系确认!'; |
| | | } |
| | | var SaveQuotecan = saveQuotel(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert,this.productStatusUpdated,this.enableSales, |
| | | this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period,this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.quoteflg); |
| | | SaveQuote(SaveQuotecan).then(resaut=>{ |
| | | debugger |
| | | var Setmap = new Map() |
| | | var key = Object.keys(resaut) |
| | | key.forEach(item=>{ |
| | | Setmap.set(item,resaut[item]); |
| | | }); |
| | | if(Setmap.has('errormessage')){ |
| | | er += Setmap.get('errormessage'); |
| | | this.quoteflg = false; |
| | | }else{ |
| | | if(this.Sback){ |
| | | window.open('/' +this.oppId, '_self'); |
| | | }else{ |
| | | if(Setmap.has('QuoteNo')){ |
| | | this.quo.Quote_No__c = Setmap.get('QuoteNo'); |
| | | } |
| | | if(this.quoteflg){ |
| | | if(Setmap.has('quoId')){ |
| | | this.quoId = Setmap.get('quoId'); |
| | | this.quo.IsQuoteTrial__c = false; |
| | | this.ifquocom = false; |
| | | this.quoteGurantee_Period = this.quo.Gurantee_Period__c; |
| | | this.quotemultiYearWarranty = this.quo.multiYearWarranty__c; |
| | | } |
| | | this.index = 3; |
| | | this.quoteTrialInit(); |
| | | }else{ |
| | | if(Setmap.has('warn')){ |
| | | this.Alert(Setmap.get('warn'),'warning'); |
| | | this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct); |
| | | this.acts = true; |
| | | this.actL = Setmap.get('act'); |
| | | }else{ |
| | | this.Alert(Setmap.get('success'),'success'); |
| | | } |
| | | if(Setmap.has('quoId')){ |
| | | debugger |
| | | this.quoId = Setmap.get('quoId'); |
| | | window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_top'); |
| | | this.location = 'Id='+ Setmap.get('quoId'); |
| | | this.copyid = ''; |
| | | this.oppId = ''; |
| | | this.connectedCallback(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | this.nafg = resultFlag(this.nafg,Setmap); |
| | | if(er){ |
| | | this.Alert(er,'error'); |
| | | } |
| | | this.tobeflag=true; |
| | | this.OnLoading(false); |
| | | }); |
| | | return true; |
| | | } |
| | | } |
| | | //价格政策表单开关标识符 |
| | | jzDataTableFixedPriceIsShow = false; |
| | | //报价计算初始化 |
| | | quoteTrialInit(){ |
| | | this.OnLoadSavesDatas(); |
| | | this.OnLoadQuoteData(this.quoId); |
| | | var event = { |
| | | page: 1, |
| | | pageLimit: 10, |
| | | search: "", |
| | | sortOrder: "asc", |
| | | sortPlus: undefined, |
| | | fag: true |
| | | }; |
| | | setTimeout(() => { |
| | | this.getTableDataFix(event); |
| | | this.getTableData(event); |
| | | }, 1000); |
| | | } |
| | | OnLoadProduct = []; //未选择产品 |
| | | OnLoadSaveProduct = []; //已选择产品 |
| | | OnLoadDiscount = []; //折扣政策 |
| | | OnLoadFixDiscount = []; //价格政策 |
| | | flagall = false; |
| | | OnLoadSavesDatas() { |
| | | debugger |
| | | SelectAllDataDiscount({ |
| | | ParamIdStr: this.quoId |
| | | }).then(result => { |
| | | result.forEach(item => { |
| | | if (item.ismatch__c == "0") { |
| | | item = ProductAssignmentSelect(item); |
| | | this.OnLoadProduct.push(item); |
| | | } else if (item.ismatch__c == "1") { |
| | | item = ProductSelected(item); |
| | | this.OnLoadSaveProduct.push(item); |
| | | } |
| | | }) |
| | | var arrss = [].concat(this.OnLoadSaveProduct); |
| | | this.addOffer(arrss); |
| | | this.comparisonUniqueKey(); |
| | | if (this.OnLoadProduct != undefined && this.OnLoadProduct.length > 0) { |
| | | this.flagall = true; |
| | | this.jzDataDefault = this.OnLoadProduct; |
| | | if (this.jzDataDefault != undefined && this.jzDataDefault.length > 0) { |
| | | this.UpdateSaveDataQuoteLineItemSelectByID(0); |
| | | } |
| | | } |
| | | if (this.OnLoadSaveProduct != undefined && this.OnLoadSaveProduct.length > 0) { |
| | | this.flagall = true; |
| | | this.jzDataProduct = this.OnLoadSaveProduct; |
| | | debugger |
| | | if (this.jzDataProduct != undefined && this.jzDataProduct.length > 0) { |
| | | this.UpdateSaveDataQuoteLineItemSelectByID(1); |
| | | } |
| | | this.updateIdStr("1"); |
| | | this.ContractPriceCompute(); |
| | | } |
| | | }) |
| | | SelectAllDataProduct({ |
| | | ParamIdStr: this.quoId |
| | | }).then(result => { |
| | | result.forEach(items => { |
| | | if (items.typess__c == "折扣政策") { |
| | | items = UnselectedScheme(items); |
| | | this.OnLoadDiscount.push(items); |
| | | } else if (items.typess__c == "价格政策") { |
| | | items = SelectedScheme(items) |
| | | this.OnLoadFixDiscount.push(items); |
| | | } |
| | | }) |
| | | this.comparisonUniqueKey(); |
| | | if (this.OnLoadFixDiscount != undefined && this.OnLoadFixDiscount.length > 0) { |
| | | this.jzDataFixedPrice = this.OnLoadFixDiscount; |
| | | if (this.jzDataFixedPrice != undefined && this.jzDataFixedPrice.length > 0) { |
| | | this.UpdateSaveDataFixedPriceSelectByID(); |
| | | } |
| | | } |
| | | if (this.OnLoadDiscount != undefined && this.OnLoadDiscount.length > 0) { |
| | | this.jzDataDiscount = this.OnLoadDiscount; |
| | | this.updateIdStr("2"); |
| | | } |
| | | }) |
| | | } |
| | | //合并上一次的报价行 |
| | | lastQuotation = []; |
| | | addOffer(TrialLine) { |
| | | this.lastQuotation = [].concat(addOfferLogic(TrialLine)); |
| | | } |
| | | index = 3; |
| | | comparisonUniqueKey() { |
| | | this.index--; |
| | | if (this.index == 0) { |
| | | comparisonUniqueKeyLogic(this.index,this.flagall,this.jzDataDefaultCopy,this.jzDataDefault,this.jzDataProduct,this.jzDataFixedPrice,this.jzDataDiscount,this.lastQuotation); |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataProduct = jzDataProductExp; |
| | | this.jzDataFixedPrice = jzDataFixedPriceExp; |
| | | this.jzDataDiscount = jzDataDiscountExp; |
| | | this.ContractPriceCompute() |
| | | } |
| | | } |
| | | Complate = false; |
| | | //从数据库更新已保存的数据 产品 UpdateBy 2021 06 29 |
| | | UpdateSaveDataQuoteLineItemSelectByID(flag) { |
| | | if (flag == 0) { |
| | | var idArr = []; |
| | | this.jzDataDefault.forEach(item => { |
| | | idArr.push(item.QuiteLineitem__c); |
| | | }) |
| | | selectUpdateQuoteLineItemData({ |
| | | ItemId: idArr |
| | | }).then(result => { |
| | | var newArr = []; |
| | | this.jzDataDefault.forEach(dp => { |
| | | var temp = { |
| | | ...{}, |
| | | ...dp |
| | | }; |
| | | result.forEach(item => { |
| | | if (item.Id == temp.QuiteLineitem__c) { |
| | | var keys = Object.keys(temp); |
| | | keys.forEach(k => { |
| | | var flag = ChangeProductData(k); |
| | | if (flag && item[k] != undefined && item[k] != temp[k]) { |
| | | this.Complate = true; |
| | | temp[k] = item[k]; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | newArr.push(temp); |
| | | }) |
| | | this.jzDataDefault = newArr; |
| | | }) |
| | | } |
| | | if (flag == 1) { |
| | | var idArrPro = []; |
| | | this.jzDataProduct.forEach(item => { |
| | | idArrPro.push(item.QuiteLineitem__c); |
| | | }) |
| | | selectUpdateQuoteLineItemData({ |
| | | ItemId: idArrPro |
| | | }).then(result => { |
| | | var newArr = []; |
| | | this.jzDataProduct.forEach(dp => { |
| | | var temp = { |
| | | ...{}, |
| | | ...dp |
| | | }; |
| | | result.forEach(item => { |
| | | if (item.Id == temp.QuiteLineitem__c) { |
| | | var keys = Object.keys(temp); |
| | | keys.forEach(k => { |
| | | var flag = ChangeProductData(k); |
| | | if (flag && item[k] != undefined && item[k] != temp[k]) { |
| | | this.Complate = true; |
| | | temp[k] = item[k]; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | newArr.push(temp); |
| | | }) |
| | | debugger |
| | | this.jzDataProduct = newArr; |
| | | this.updateIdStr("1"); |
| | | this.ContractPriceCompute(); |
| | | }) |
| | | } |
| | | } |
| | | //删除时需要用的唯一id的添加 |
| | | updateIdStr(str) { |
| | | var newArr = []; |
| | | var indexNum = 0; |
| | | var jzdpdc = []; |
| | | if (str == "1") { |
| | | jzdpdc = [].concat(this.jzDataProduct); |
| | | } else if (str == "2") { |
| | | jzdpdc = [].concat(this.jzDataDiscount); |
| | | } else if (str == "3") { |
| | | jzdpdc = [].concat(this.jzDataFixedPrice); |
| | | } |
| | | jzdpdc.forEach(item => { |
| | | indexNum++; |
| | | var temp = { |
| | | ...item |
| | | }; |
| | | temp.DelectId = indexNum; |
| | | newArr.push(temp); |
| | | }) |
| | | if (str == "1") { |
| | | this.jzDataProduct = [].concat(newArr); |
| | | } else if (str == "2") { |
| | | this.jzDataDiscount = [].concat(newArr); |
| | | } else if (str == "3") { |
| | | this.jzDataFixedPrice = [].concat(newArr); |
| | | } |
| | | } |
| | | //合同价格汇总 |
| | | ContractPrice = 0; |
| | | ContractPriceCompute() { |
| | | this.HeTongPriceCompute(); |
| | | this.ContractPrice = 0; |
| | | var sum = this.ContractPrice; |
| | | sum = parseFloat(sum); |
| | | sum=ContractPriceComputeLogic(sum,this.jzDataProduct,this.jzDataDiscount,this.jzDataFixedPrice); |
| | | this.ContractPrice = sum; |
| | | } |
| | | HeTongPriceCompute() { |
| | | var HeTongPriceList = []; |
| | | HeTongPriceList=HeTongPriceComputeLogic(this.jzDataDiscount,this.jzDataProduct); |
| | | if (HeTongPriceList.length > 0) { |
| | | this.jzDataDiscount = HeTongPriceList; |
| | | } |
| | | } |
| | | //从数据库更新已保存的数据 方案 UpdateBy 2021 06 29 |
| | | UpdateSaveDataFixedPriceSelectByID() { |
| | | var idArr = []; |
| | | this.jzDataFixedPrice.forEach(item => { |
| | | idArr.push(item.Id); |
| | | }) |
| | | selectUpdateFiexedpriceData({ |
| | | ProId: idArr |
| | | }).then(result => { |
| | | var newArr = []; |
| | | this.jzDataFixedPrice.forEach(dp => { |
| | | var temp = { |
| | | ...{}, |
| | | ...dp |
| | | }; |
| | | result.forEach(item => { |
| | | if (item.Id == temp.Id) { |
| | | var keys = Object.keys(temp); |
| | | keys.forEach(k => { |
| | | var flag = ChangeFiexedData(k); |
| | | if (flag && item[k] != undefined && item[k] != temp[k]) { |
| | | temp[k] = item[k]; |
| | | this.Complate = true; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | newArr.push(temp); |
| | | }) |
| | | this.jzDataFixedPrice = newArr; |
| | | this.updateIdStr("3"); |
| | | }) |
| | | } |
| | | //加载报价数据 |
| | | QuoteData = []; |
| | | OnLoadQuoteData(idStr) { |
| | | GetQuoteData({ |
| | | QuoteID: idStr |
| | | }).then(result => { |
| | | var responseObj = JSON.parse(result); |
| | | this.QuoteData = initquoT(responseObj,this.buttonIsShow,this.initDataTableFixedPrice,this.initDataTableDiscount,this.initDataTableOtherData,this.initDataTableCommonly); |
| | | this.buttonIsShow = buttonIsShowE; |
| | | this.initDataTableFixedPrice = initDTFP; |
| | | this.initDataTableDiscount = initDTD; |
| | | this.initDataTableOtherData = initDTOD; |
| | | this.initDataTableCommonly = initDTC; |
| | | this.jzDataTableFixedPriceIsShow = true; |
| | | this.jzDataTableDiscountIsShow = true; |
| | | this.QTcss = QTcssE(this.pricePolicyflag); |
| | | this.pricePolicyflag = true; |
| | | if(!this.QuoteDecision){ |
| | | this.Save_button = true; |
| | | this.Decision_button = true; |
| | | } |
| | | }) |
| | | } |
| | | //打印按钮 |
| | | PrintButton(){ |
| | | var id = this.quoId; |
| | | if (id == null || id == '') { |
| | | this.Alert(Error_Message33,'error'); |
| | | return false; |
| | | } |
| | | return this.chkEstimation_Entry_Possibility(id); |
| | | } |
| | | chkEstimation_Entry_Possibility(q) { |
| | | try { |
| | | this.OnLoading(true); |
| | | var dataChun = PrintButtonLoc(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert, |
| | | this.productStatusUpdated,this.enableSales,this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period, |
| | | this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.QuoteDecision) |
| | | Print(dataChun).then(resaut=>{ |
| | | debugger |
| | | this.quoId = saverebackloc(resaut,this.quoId,this.nafg); |
| | | this.OnLoading(false); |
| | | if(errorflg){ |
| | | this.Alert(alertExp,'error'); |
| | | this.nafg = nafgExp; |
| | | } |
| | | if(flg){ |
| | | this.location = 'Id='+ this.quoId; |
| | | this.copyid = ''; |
| | | this.oppId = ''; |
| | | this.connectedCallback(); |
| | | } |
| | | openQuotePage(this.quo.Contract__c,errorflg,this.quoId); |
| | | }); |
| | | } catch (e) { |
| | | this.Alert(e,'error'); |
| | | } |
| | | } |
| | | //不保存返回按钮 |
| | | noSaveback(){ |
| | | window.open('/' +this.oppId, '_self'); |
| | | } |
| | | Sback = false; |
| | | //保存并返回 |
| | | Saveandback(){ |
| | | this.Sback = true; |
| | | this.savebuttonClick(); |
| | | } |
| | | //decide报价按钮 |
| | | decisionbuttonClick(){ |
| | | debugger |
| | | this.checkchangedAfterPrint('de'); |
| | | if(this.fg){ |
| | | this.decisionlo(); |
| | | } |
| | | } |
| | | decisionlo(){ |
| | | var ff = decisionlol(this.jzDataToBeproduct,this.oppInfo,this.QuotationCalculationFag); |
| | | if(ff){ |
| | | this.Alert(alertExp,'error'); |
| | | }else{ |
| | | this.chkSalesPossibilityDecision(); |
| | | } |
| | | } |
| | | chkSalesPossibilityDecision() { |
| | | try { |
| | | debugger |
| | | this.tobeflag=false; |
| | | var quoc = saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var CheckItemCan = JSON.stringify(this.CheckItem); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | this.OnLoading(true); |
| | | if(this.WinOrDecideAlert &&(!this.productStatusUpdated)){ |
| | | this.PriceStatusUpdate(); |
| | | } |
| | | QuoteDecision({activitiesCan:quoLineItemCan, |
| | | CheckItemCan:CheckItemCan, |
| | | WinOrDecideAlertc:this.WinOrDecideAlert, |
| | | productStatusUpdatedc:this.productStatusUpdated, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan, |
| | | enableSalesc:this.enableSales, |
| | | oppIdc:this.oppId, |
| | | quoIdc:this.quoId, |
| | | newQuoteFlagc:this.newQuoteFlag, |
| | | changedAfterPrintc:this.changedAfterPrint, |
| | | quoteGurantee_Periodc:this.quoteGurantee_Period, |
| | | quotemultiYearWarrantyc:this.quotemultiYearWarranty, |
| | | selection_hpc:this.selection_hp, |
| | | SkipQuotefilgc:this.SkipQuotefilg |
| | | }).then(resaut=>{ |
| | | debugger |
| | | var Setmap = new Map() |
| | | var key = Object.keys(resaut) |
| | | key.forEach(item=>{ |
| | | Setmap.set(item,resaut[item]); |
| | | }); |
| | | if(Setmap.has('errormessage')){ |
| | | this.Alert(Setmap.get('errormessage'),'error'); |
| | | if(Setmap.get('act')){ |
| | | this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct); |
| | | } |
| | | }else{ |
| | | if(Setmap.has('warn')){ |
| | | this.Alert(Setmap.get('warn'),'warning'); |
| | | this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct); |
| | | this.acts = true; |
| | | this.actL = Setmap.get('act'); |
| | | }else{ |
| | | this.Alert(Setmap.get('success'),'success'); |
| | | } |
| | | if(Setmap.has('quoId')){ |
| | | window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_self'); |
| | | this.location = 'Id='+ Setmap.get('quoId'); |
| | | this.copyid = ''; |
| | | this.oppId = ''; |
| | | this.connectedCallback(); |
| | | } |
| | | this.QuoteDecision = true; |
| | | this.enableContract = true; |
| | | this.Save_button = true; |
| | | this.Decisiontag = true; |
| | | var lg = this.template.querySelectorAll('c-jzlookuplightning2'); |
| | | lg.forEach(l=>{ |
| | | l.todisabled(); |
| | | }) |
| | | this.initDataTableToBeproduct.columns[4].editable = false; |
| | | if (this.QuoteDecision == false) { |
| | | this.sap_button = true; |
| | | } else if (this.specialAuthority == false) { |
| | | this.sap_button = true; |
| | | } else { |
| | | this.sap_button = false; |
| | | } |
| | | this.Decision_button = true; |
| | | } |
| | | this.nafg = resultFlag(this.nafg,Setmap); |
| | | this.tobeflag=true; |
| | | this.OnLoading(false); |
| | | }); |
| | | return true; |
| | | } catch (e) { |
| | | this.Alert(e,'error'); |
| | | } |
| | | } |
| | | //保存判断是否生成新报价标识 |
| | | fg = true; |
| | | changedAfterPrint = false; |
| | | QuotationCalculationFag = false; |
| | | checkchangedAfterPrint(dec) { |
| | | this.fg = true; |
| | | var id = this.quoId; |
| | | this.changedAfterPrint = false; |
| | | var detailChanged = false; |
| | | if (!id) { |
| | | return; |
| | | }else{ |
| | | this.fg = false; |
| | | } |
| | | var activities = checkch(this.jzDataToBeproduct); |
| | | getQuoteLineItem({ |
| | | quoId: id |
| | | }).then(results=>{ |
| | | debugger |
| | | var quote_Date__c = null; |
| | | if (results.length > 0) { |
| | | quote_Date__c = results[0]['Quote']['Quote_Date__c']; |
| | | } |
| | | if (!detailChanged) { |
| | | if (activities.length != results.length) { |
| | | detailChanged = true; |
| | | } |
| | | } |
| | | if (!detailChanged) { |
| | | for (var j = 0; j < results.length; j++) { |
| | | if (results[j].PricebookEntryId != activities[j].PricebookEntryId || |
| | | results[j].SFDA_Status__c != activities[j].SFDA_Status__c || |
| | | results[j].UnitPrice__c != activities[j].UnitPrice__c || |
| | | results[j].ListPrice__c != activities[j].ListPrice__c || |
| | | results[j].Quantity != activities[j].Quantity |
| | | ) { |
| | | detailChanged = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if(dec === 'de'){ |
| | | var IsQuoteTrial = this.quo.IsQuoteTrial__c; |
| | | }else if(dec === 'sa'){ |
| | | var IsQuoteTrial = this.ifquocom; |
| | | } |
| | | if (detailChanged && ((quote_Date__c != null && quote_Date__c != "" && quote_Date__c != undefined) || IsQuoteTrial)) { |
| | | this.changedAfterPrint = true; |
| | | } |
| | | if(detailChanged && !this.changedAfterPrint){ |
| | | this.QuotationCalculationFag= true; |
| | | }else{ |
| | | this.QuotationCalculationFag= false; |
| | | } |
| | | if(dec === 'de'){ |
| | | this.decisionlo(); |
| | | }else if(dec === 'sa'){ |
| | | this.sal(); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | calFromQuoAmont() { |
| | | var x = 0, |
| | | y = 0; |
| | | x = this.quo.hidden_Estimation_List; |
| | | x = localParseFloat(x); |
| | | y = this.quo.Quote_Adjust_Amount_Page__c; |
| | | this.quo.Quote_Adjust_Amount_Page__c = toNumComma(y); |
| | | y = localParseFloat(y); |
| | | var noDiscountPriceTotal = this.hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | this.quo.QuoteTotal_Page__c = toNumComma(y + x + noDiscountPriceTotal); |
| | | var z = this.quo.Estimation_List_Price__c; |
| | | var id = this.quoId; |
| | | if(!id){ |
| | | var IsQuoteTrial = this.quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | var mp =this.quo.MultiYearWarrantyTotalPrice__c; |
| | | mp = localParseFloat(mp); |
| | | var num = this.quo.Quote_Adjust_Calculate__c; |
| | | num = localParseFloat(num); |
| | | this.quo.Quote_Adjust_Calculate__c = toNumComma(num); |
| | | num = (100 + num) / 100; |
| | | z = localParseFloat(z); |
| | | var rh = this.oppInfo.rate_hospital; |
| | | var ra = this.oppInfo.rate_agency1; |
| | | this.quo.Dealer_Final_Price_Page__c = toNumComma(z*rh); |
| | | this.quo.OCM_Agent1_Price_Page__c = this.Saleslet ? toNumComma(z*num*ra+mp) : ''; |
| | | this.setOCMAmount(); |
| | | this.calFromContactPrice(); |
| | | } |
| | | } |
| | | if (y == 0) { |
| | | this.quo.Quote_Adjust_Calculate__c = 0; |
| | | this.UnitPriceUpdate(); |
| | | } else { |
| | | this.quoteTotalPriceAction(); |
| | | } |
| | | } |
| | | UnitPriceUpdate() { |
| | | this.jzDataToBeproduct = UnitPriceUpdateLogic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.Subtotalupdate(); |
| | | this.calUnitPriceTotal(); |
| | | this.quoteTotalPrice(); |
| | | } |
| | | Subtotalupdate() { |
| | | this.jzDataToBeproduct = SubtotalupdateLogic(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | quoteTotalPriceAction() { |
| | | this.jzDataToBeproduct = quoteTotalPriceActionLogic(this.quo,this.jzDataToBeproduct,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | debugger |
| | | this.quo = quoExp; |
| | | this.calUnitPriceTotal(); |
| | | this.QuoteAdjust(); |
| | | this.DisAmountfunction(); |
| | | } |
| | | |
| | | multiYearWarrantyChange(event){ |
| | | debugger |
| | | this.quo.multiYearWarranty__c = event.detail.checked; |
| | | this.calPriceAll(); |
| | | } |
| | | //主机不带监视器台车change事件 |
| | | MainEngineWithoutMonitorChange(event){ |
| | | this.quo.MainEngineWithoutMonitor__c = event.detail.checked; |
| | | } |
| | | //跨科室change事件 |
| | | InterdepartmentalChange(event){ |
| | | this.quo.Interdepartmental__c = event.detail.checked; |
| | | this.calPriceAll(); |
| | | } |
| | | //单价change事件 |
| | | UnitPriceChange(event){ |
| | | this.quo.Unit_Price__c = event.detail.checked; |
| | | } |
| | | //报价金额change事件 |
| | | OfferAmountChange(event){ |
| | | this.quo.Offer_Amount__c = event.detail.checked; |
| | | } |
| | | //报价总额change事件 |
| | | TOTALChange(event){ |
| | | this.quo.TOTAL__c = event.detail.checked; |
| | | } |
| | | //优惠折扣change事件 |
| | | DiscountChange(event){ |
| | | this.quo.Discount__c = event.detail.checked; |
| | | } |
| | | //优惠价格change事件 |
| | | PricingChange(event){ |
| | | this.quo.Pricing__c = event.detail.checked; |
| | | } |
| | | //优惠成交价change事件 |
| | | PreferentialTradingPriceChange(event){ |
| | | this.quo.Preferential_Trading_Price__c = event.detail.checked; |
| | | } |
| | | //保修年限change事件 |
| | | PreferentialGuranteePeriodChange(event){ |
| | | this.quo.Preferential_Gurantee_Period__c = event.detail.checked; |
| | | } |
| | | //合同配置change事件 |
| | | ContractcChange(event){ |
| | | this.quo.Contract__c = event.detail.checked; |
| | | } |
| | | |
| | | //主机装机地 optionList |
| | | HostInstallationLocationoptionsvalue = []; |
| | | get HostInstallationLocationoptions() { |
| | | if(this.HostInstallationLocationoptionsvalue.length<=0){ |
| | | getPicklistValues({objstr:'Quote',fld:'Installation_location__c',ifempty:true}).then(keyvalue=>{ |
| | | this.HostInstallationLocationoptionsvalue = keyvalue; |
| | | }); |
| | | }else{ |
| | | return this.HostInstallationLocationoptionsvalue |
| | | } |
| | | } |
| | | |
| | | HostInstallationLocationhandleChange(event) { |
| | | this.quo.Installation_location__c = event.detail.value; |
| | | } |
| | | |
| | | //合同保修期(年)start |
| | | ContractWarrantyPeriodYearOptionsvalue = []; |
| | | get ContractWarrantyPeriodYearOptions() { |
| | | if(this.ContractWarrantyPeriodYearOptionsvalue.length<=0){ |
| | | getPicklistValues({objstr:'Quote',fld:'Gurantee_Period__c',ifempty:false}).then(keyvalue=>{ |
| | | this.ContractWarrantyPeriodYearOptionsvalue = keyvalue; |
| | | }); |
| | | }else{ |
| | | return this.ContractWarrantyPeriodYearOptionsvalue |
| | | } |
| | | } |
| | | |
| | | ContractWarrantyPeriodYearHandleChange(event) { |
| | | debugger |
| | | this.quo.Gurantee_Period__c = event.detail.value; |
| | | this.calGuranteePeriod(); |
| | | } |
| | | // 更新多年保修 保修期 |
| | | //隐藏合同保修期(年) |
| | | HiddenGurantee_Period; |
| | | calGuranteePeriod() { |
| | | var AllGurantee_Period = this.quo.Gurantee_Period__c; |
| | | this.HiddenGurantee_Period = AllGurantee_Period; |
| | | this.jzDataToBeproduct = calGuranteePeriodLogic(this.jzDataToBeproduct,AllGurantee_Period); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | |
| | | //报价变化 start |
| | | QuotationChangesOptionsvalue = []; |
| | | get QuotationChangesOptions() { |
| | | if(this.QuotationChangesOptionsvalue.length<=0){ |
| | | getPicklistValues({objstr:'Quote',fld:'QuotationChange__c',ifempty:true}).then(keyvalue=>{ |
| | | this.QuotationChangesOptionsvalue = keyvalue; |
| | | }); |
| | | }else{ |
| | | return this.QuotationChangesOptionsvalue |
| | | } |
| | | } |
| | | |
| | | QuotationChangesHandleChange(event) { |
| | | this.quo.QuotationChange__c = event.detail.value; |
| | | } |
| | | // 经销商一名称输入框 start |
| | | onsearchchange1(event){ |
| | | this.quo.Agency1__c = event.detail.value; |
| | | } |
| | | // 经销商二名称输入框 start |
| | | onsearchchange2(event){ |
| | | this.quo.Agency2__c = event.detail.value; |
| | | } |
| | | //报价产品选中数据 |
| | | @track |
| | | selectjzDataTableToBeproduct = []; |
| | | SelectedToBeproduct(event) { |
| | | let arr = event.detail.rows; |
| | | this.selectjzDataTableToBeproduct = arr; |
| | | } |
| | | //删除报价产品按钮 |
| | | deletejzDataToBeproduct(){ |
| | | debugger |
| | | var delFlag=false; |
| | | var num = this.jzDataToBeproduct.length; |
| | | for (var j = 0; j < this.selectjzDataTableToBeproduct.length; j++) { |
| | | for (var i = 0; i < this.jzDataToBeproduct.length; i++) { |
| | | if (this.selectjzDataTableToBeproduct[j].lineNo == this.jzDataToBeproduct[i].lineNo) { |
| | | this.jzDataToBeproduct.splice(i, 1); |
| | | i--; |
| | | delFlag=true; |
| | | } |
| | | } |
| | | } |
| | | var ItemL = MarkRed(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct =[].concat(ItemL); |
| | | if(this.jzDataToBeproduct.length!=num){ |
| | | this.quo.IsQuoteTrial__c = false; |
| | | } |
| | | if(!delFlag){ |
| | | this.Alert("请选择可以操作的行",'error'); |
| | | } |
| | | console.warn(this.jzDataToBeproduct.length); |
| | | this.calPriceAll(); |
| | | } |
| | | getTableDataToBeproduct(event) { |
| | | } |
| | | @track jzDataToBeproduct = []; |
| | | @track tableIsLodingToBeproduct = false; |
| | | @track |
| | | initDataTableToBeproduct = initDataTableToBeproductConfig; |
| | | @track |
| | | tobeflag = true |
| | | //报价产品编辑列 |
| | | onsaveToBeproduct(event){ |
| | | debugger |
| | | this.tobeflag = false |
| | | var data = event.detail.rows; |
| | | this.jzDataToBeproduct = onsaveToBeproductLoc(data,this.jzDataToBeproduct); |
| | | if(fagExp){ |
| | | this.quo.IsQuoteTrial__c = false; |
| | | this.quoteAgencyTotalPriceAction(); |
| | | this.AgencyDiscountCalculation1(); |
| | | } |
| | | this.updateNoDiscountPricetotal(); |
| | | this.EstimationListPrice(); |
| | | this.calUnitPriceTotal(); |
| | | this.quoteTotalPrice(); |
| | | setTimeout(() => { |
| | | this.tobeflag = true; |
| | | },1); |
| | | } |
| | | // 计算 No Discount Price合计 |
| | | updateNoDiscountPricetotal() { |
| | | var noDiscountPriceTotal = 0; |
| | | this.jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice = localParseFloat(noDiscountPrice); |
| | | var Quantity = jzdtbt.Quantity__c; |
| | | Quantity = localParseFloat(Quantity); |
| | | noDiscountPriceTotal = noDiscountPriceTotal + noDiscountPrice * Quantity; |
| | | if (jzdtbt.NoDiscountTotal__c) { |
| | | jzdtbt.NoDiscountTotal__c = toNumComma(noDiscountPrice * Quantity); |
| | | } |
| | | }); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_MultiYearWarrantyTotalPrice = noDiscountPriceTotal; |
| | | this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(noDiscountPriceTotal); |
| | | } |
| | | handleRowAction(event){ |
| | | debugger |
| | | const actionName = event.detail.row; |
| | | } |
| | | //打开产品配套模态框开关 |
| | | @track |
| | | showSetProductfalg = false; |
| | | //产品配套按钮 |
| | | openSetProduct(event){ |
| | | this.showSetProductfalg = true; |
| | | } |
| | | //产品配套 optionList |
| | | get listViewOptions() { |
| | | return filterNameoptionList(); |
| | | } |
| | | // 产品配套模态框关闭 |
| | | cancelsetProduct(){ |
| | | this.showSetProductfalg = false; |
| | | this.jzSetProductData = []; |
| | | } |
| | | // 适用科室 |
| | | filterName; |
| | | // 适用科室Change事件 |
| | | filterNameChange(event){ |
| | | this.filterName = event.target.value; |
| | | } |
| | | // 产品配套名 |
| | | setSearchName; |
| | | //产品配套名Change事件 |
| | | jzSearchNameChange(event){ |
| | | this.setSearchName = event.target.value; |
| | | } |
| | | //产品配套编码 |
| | | SearchCode; |
| | | //产品配套编码Change事件 |
| | | jzSearchCodeChange(event){ |
| | | this.SearchCode = event.target.value; |
| | | } |
| | | initDataSetProductTable = initDataSetProductTablefig; |
| | | @track |
| | | jzSetProductData = []; |
| | | @track |
| | | tableIsSetProductLoding = false; |
| | | @track |
| | | IsLoadingjdspt = false; |
| | | //产品配套搜索 |
| | | jzsetProductsearchbutton(){ |
| | | debugger |
| | | this.IsLoadingjdspt = true; |
| | | let SearchCode = this.SearchCode; |
| | | let filterName = this.filterName; |
| | | let setSearchName = this.setSearchName; |
| | | serSetContact({SearchName:setSearchName,SearchCode:SearchCode,filterName:filterName}).then(result=>{ |
| | | this.jzSetProductData = result; |
| | | this.IsLoadingjdspt = false; |
| | | }); |
| | | } |
| | | //产品配套选中数据 |
| | | SelectedNewsetProduct = [] |
| | | //产品配套选中数据 |
| | | SelectedSetProductFn(event){ |
| | | let arr = event.detail.rows; |
| | | this.SelectedNewsetProduct = arr; |
| | | } |
| | | //追加产品配套搜索 |
| | | additionaljzsetProductbutton(){ |
| | | debugger |
| | | var dataChunanshen = additionabuttonLoc(this.SelectedNewsetProduct,this.quo,this.oppInfo,this.jzDataToBeproduct) |
| | | var num = this.jzDataToBeproduct.length; |
| | | var isPrepared = DataStatus; |
| | | var Str = StrExp; |
| | | if(isPrepared!='Fin'){ |
| | | confirm(isPrepared); |
| | | }else if(!Str){ |
| | | if(confirm("您尚未选取任何产品配套,确认完成么?")){ |
| | | this.cancelsetProduct(); |
| | | }else{ |
| | | } |
| | | }else{ |
| | | this.OnLoading(true); |
| | | setProductEntry(dataChunanshen).then(reslut=>{ |
| | | var tempArr=reslut.split("---"); |
| | | var errormessage=tempArr[0]; |
| | | var quoteLineItem=JSON.parse(tempArr[1]); |
| | | quoteLineItem=InitializeProductAssignment(quoteLineItem); |
| | | this.jzDataToBeproduct=quoteLineItem; |
| | | if(quoteLineItem.length!=num){ |
| | | this.quo.IsQuoteTrial__c=false; |
| | | } |
| | | this.calPriceAll(); |
| | | if(errormessage.indexOf('成功') >= 0){ |
| | | this.Alert(errormessage,'success'); |
| | | }else{ |
| | | this.Alert(errormessage,'error'); |
| | | } |
| | | this.OnLoading(false); |
| | | }); |
| | | this.cancelsetProduct(); |
| | | } |
| | | this.SelectedNewsetProduct = []; |
| | | } |
| | | |
| | | getTableSetProductData(event) { |
| | | this.tableIsproductLoding = false; |
| | | } |
| | | @track |
| | | showQuoteExcelImport = false; |
| | | openQuoteExcelImport(event){ |
| | | this.showQuoteExcelImport = true; |
| | | } |
| | | cancelQuoteExcelImport(){ |
| | | this.showQuoteExcelImport = false; |
| | | this.exceltextvalue = ''; |
| | | } |
| | | SavesSQuoteExcelImport(){ |
| | | let Str = this.exceltextvalue; |
| | | var num = this.jzDataToBeproduct.length; |
| | | var quoc = saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | this.OnLoading(true); |
| | | excelImport({excel_text:Str, |
| | | activitiesCan:quoLineItemCan, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan}).then(reslut=>{ |
| | | debugger |
| | | var tempArr = reslut.split("---"); |
| | | var errormessage = tempArr[0]; |
| | | var quoteLineItem = JSON.parse(tempArr[1]); |
| | | quoteLineItem = InitializeProductAssignment(quoteLineItem); |
| | | this.jzDataToBeproduct = quoteLineItem; |
| | | if(quoteLineItem.length!=num){ |
| | | this.quo.IsQuoteTrial__c = false; |
| | | } |
| | | this.calPriceAll(); |
| | | if(errormessage.indexOf('成功') >= 0){ |
| | | this.Alert(errormessage,'success'); |
| | | }else{ |
| | | this.Alert(errormessage,'error'); |
| | | } |
| | | |
| | | this.OnLoading(false); |
| | | this.cancelQuoteExcelImport(); |
| | | }); |
| | | } |
| | | @track |
| | | exceltextvalue; |
| | | exceltextChange(event){ |
| | | let value = event.detail.value; |
| | | this.exceltextvalue = value; |
| | | } |
| | | //打开新建产品模态框开关 |
| | | showproductfalg = false; |
| | | //新增报价产品按钮 |
| | | NewQuotationProducts(event){ |
| | | this.showproductfalg = true; |
| | | } |
| | | @track |
| | | IsLoadingjdpt = false; |
| | | //选择数据 |
| | | SelectedNewProduct = []; |
| | | //新增报价产品列表选事件 |
| | | SelectedProductFn(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedNewProduct = arr; |
| | | } |
| | | //追加新增产品按钮 |
| | | additionaljzProductbutton(){ |
| | | debugger |
| | | if(this.SelectedNewProduct.length == 0){ |
| | | if(confirm("您尚未选取任何产品,确认完成么?")){ |
| | | this.cancelProduct(); |
| | | } |
| | | }else{ |
| | | this.tobeflag = false |
| | | var selectvlue = this.SelectedNewProduct; |
| | | var Listvalue = this.jzDataToBeproduct; |
| | | this.jzDataToBeproduct = additionaljzProductLogic(selectvlue,Listvalue,this.oppInfo.CurrencyIsoCode,this.quo.IsQuoteTrial__c); |
| | | if(alertExp){ |
| | | this.Alert(alertExp,'error'); |
| | | } |
| | | setTimeout(() => { |
| | | this.tobeflag = true; |
| | | },1); |
| | | this.quo.IsQuoteTrial__c = IsQuoteTrialExp; |
| | | this.calPriceAll(); |
| | | this.cancelProduct(); |
| | | this.SelectedNewProduct = []; |
| | | } |
| | | } |
| | | //新增报价产品模态框取消按钮 |
| | | cancelProduct() { |
| | | this.showproductfalg = false; |
| | | this.jzProductData = []; |
| | | } |
| | | //新增报价产品检索条件 |
| | | @track |
| | | SearchName = ''; |
| | | jzProductsearchChange(event){ |
| | | if(this.SearchName != event.target.value){ |
| | | this.SearchName = event.target.value; |
| | | } |
| | | } |
| | | //新增报价产品检索按钮 |
| | | jzProductsearchbutton(event){ |
| | | debugger |
| | | this.IsLoadingjdpt = true; |
| | | let tradec = this.oppInfo.CurrencyIsoCode; |
| | | let celon = this.oppInfo.CelonOpportunity; |
| | | let SearchName = this.SearchName; |
| | | serContact({tradec:tradec,SearchName:SearchName,celon:celon}).then(result=>{ |
| | | this.jzProductData = jzProductsearchLogic(result); |
| | | this.IsLoadingjdpt = false; |
| | | }); |
| | | } |
| | | //新增报价产品列表加载数据 |
| | | getTableProductData(event) { |
| | | this.tableIsproductLoding = false; |
| | | } |
| | | //新增报价产品列表数据 |
| | | @track jzProductData = []; |
| | | //新增报价产品列表加载动图标识 |
| | | @track tableIsproductLoding = true; |
| | | // 新增报价产品列表列配置 |
| | | @track |
| | | initDataProductTable = initDataProductTablefig; |
| | | |
| | | //打开报价计算标识 |
| | | quoteflg = false; |
| | | @track |
| | | QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder"; |
| | | showQuotationCalculation(event){ |
| | | debugger |
| | | if(this.pricePolicyflag){ |
| | | this.QTcss = QTcssE(this.pricePolicyflag); |
| | | this.pricePolicyflag = false; |
| | | this.quoteflg = false; |
| | | this.OnLoadProduct = []; |
| | | this.jzDataDefault = []; |
| | | this.OnLoadSaveProduct = []; |
| | | this.jzDataProduct = []; |
| | | this.OnLoadDiscount = []; |
| | | this.jzDataDiscount = []; |
| | | this.OnLoadFixDiscount = []; |
| | | this.jzDataFixedPrice = []; |
| | | this.ContractPriceCompute(); |
| | | if(!this.QuoteDecision){ |
| | | this.Save_button = false; |
| | | this.Decision_button = false; |
| | | } |
| | | }else{ |
| | | this.quoteflg = true; |
| | | if(this.QuoteDecision){ |
| | | this.quoteTrialInit(); |
| | | }else{ |
| | | this.savebuttonClick(); |
| | | } |
| | | } |
| | | } |
| | | //报价计算区域展开标识 |
| | | pricePolicyflag = false; |
| | | //报价计算按钮展开标识 |
| | | buttonIsShow = false; |
| | | //合同总价 |
| | | ContractPrice = 0; |
| | | ifFTip=true; |
| | | //保存报价计算结果按钮方法 |
| | | saveAllDataProductFn() { |
| | | var dataChunanshen = saveAllDataProductFnChuanshen(this.jzDataFixedPrice,this.jzDataDiscount,this.quoId,this.QuoteData,this.jzDataProduct,this.jzDataDefault,this.ContractPrice) |
| | | var newTemp = newTempExp; |
| | | if (this.jzDataDefault.length == 0) { |
| | | var ifnunum = saveAllDataProductFnPanduan(this.jzDataProduct,newTemp); |
| | | var ifnull = ifnullExp; |
| | | if (ifnull&&ifnunum==1) { |
| | | this.IsLoading=true; |
| | | saveAllDataProduct(dataChunanshen).then(result => { |
| | | this.IsLoading=false; |
| | | this.quo.IsQuoteTrial__c = true; |
| | | this.SkipQuotefilg = false; |
| | | this.ifquocom = true; |
| | | if(this.oppInfo.Sales_Root__c == Sales_Outlet){ |
| | | var target = {value :this.ContractPrice} |
| | | var event = {target:target} |
| | | this.OCMAgent1PricePageonChange(event); |
| | | }else{ |
| | | this.quo.Dealer_Final_Price_Page__c = toNumComma(this.ContractPrice); |
| | | var target = {value :this.ContractPrice} |
| | | var event = {target:target} |
| | | this.DealerFinalPricePageChange(event); |
| | | } |
| | | this.Alert("数据已保存", 'success'); |
| | | }); |
| | | } else { |
| | | if(ifnunum==2){ |
| | | this.ifFTip=false; |
| | | this.Alert("产品明细中金额有负数,不可保存",'error'); |
| | | }else{ |
| | | this.ifFTip=false; |
| | | this.Alert("一般产品的合同价格为空,不可保存",'error'); |
| | | } |
| | | } |
| | | } else { |
| | | this.ifFTip=false; |
| | | this.Alert("产品未选完,不可保存",'error'); |
| | | } |
| | | } |
| | | //报价计算打开按钮 end |
| | | SelectedFnDefault(rows) { |
| | | let arr = rows; |
| | | } |
| | | //获取待选择产品列表数据 |
| | | UniqueKey = new Map(); |
| | | getTableDataDefault(event) { |
| | | let data = []; |
| | | //todu10 |
| | | GetPromotionDefalut({ |
| | | IdParam: this.quoId |
| | | }).then(result => { |
| | | this.jzDataDefaultNotChange = []; |
| | | this.jzDataDefaultCopy = []; |
| | | var i = 1; |
| | | result.forEach(rItem => { |
| | | rItem.ListPrice = rItem.ListPrice__c; |
| | | rItem.HangHao = i++; |
| | | rItem.Id = rItem.Product2Id; |
| | | let tempS = { |
| | | ...{}, |
| | | ...rItem |
| | | }; |
| | | this.jzDataDefaultNotChange.push(tempS); |
| | | this.jzDataDefaultCopy.push(tempS); |
| | | }); |
| | | this.getschemedetails(); |
| | | if (this.flagall) { |
| | | var newList = []; |
| | | this.OnLoadProduct.forEach(items => { |
| | | var DataTemp = {}; |
| | | result.forEach(reItgem => { |
| | | if (reItgem.Id == items.Id) { |
| | | DataTemp = reItgem; |
| | | return; |
| | | } |
| | | reItgem.ListPrice = reItgem.ListPrice__c; |
| | | }) |
| | | if (DataTemp != undefined && DataTemp != {}) { |
| | | DataTemp = { |
| | | ...DataTemp, |
| | | ...items |
| | | }; |
| | | } |
| | | newList.push(DataTemp); |
| | | }) |
| | | this.jzDataDefault = newList; |
| | | this.tableIsLodingDefault = false; |
| | | this.comparisonUniqueKey(); |
| | | return; |
| | | } else { |
| | | result.forEach(rItems => { |
| | | rItems.ListPrice = rItems.ListPrice__c; |
| | | }); |
| | | this.jzDataDefault = result; |
| | | this.tableIsLodingDefault = false; |
| | | var event = { |
| | | page: 1, |
| | | pageLimit: 10, |
| | | search: "", |
| | | sortOrder: "asc", |
| | | sortPlus: undefined, |
| | | fag: true |
| | | }; |
| | | this.getTableDataFix(event); |
| | | } |
| | | }) |
| | | this.tableIsLodingDefault = false; |
| | | } |
| | | //查询价格政策方案关联产品明细 |
| | | //算出的合计 |
| | | sumTotal = []; |
| | | getschemedetails() { |
| | | this.jzDataFixedPrice.forEach(jdfp => { |
| | | var SeachData = { |
| | | SearchId: jdfp.Id |
| | | }; |
| | | GetSearchProductById(SeachData).then(result => { |
| | | var tempObject = { |
| | | ...{}, |
| | | ...jdfp |
| | | } |
| | | jdfp = this.countListAndNod(tempObject, result); |
| | | this.sumTotal.push(jdfp); |
| | | }); |
| | | }); |
| | | } |
| | | @track jzDataDefault = []; //数据 待选择产品数据据 |
| | | jzDataDefaultNotChange = []; |
| | | jzDataDefaultCopy = []; |
| | | @track tableIsLodingDefault = true; |
| | | @track |
| | | initSearchFormDefalt = initSearchFormDefalt2; |
| | | @track |
| | | initDataTableDefault = initDataTableDefault2; |
| | | @track |
| | | show = false |
| | | //选择促销方案打开按钮 |
| | | showModal(){ |
| | | this.show = true; |
| | | let inputFields=this.template.querySelectorAll('c-jz-data-table'); |
| | | console.log("=====show======"); |
| | | console.log(JSON.parse(JSON.stringify(inputFields))); |
| | | inputFields.forEach(field => { |
| | | console.log(JSON.parse(JSON.stringify(field.name))); |
| | | }); |
| | | } |
| | | //选择促销方案模态框取消按钮 |
| | | cancel() { |
| | | this.show = false |
| | | } |
| | | @track ShowFix; |
| | | showModalFix() { |
| | | this.ShowFix = true |
| | | } |
| | | cancelFix() { |
| | | this.ShowFix = false |
| | | } |
| | | @track |
| | | initSearchFormFix = initSearchFormFix2; |
| | | @track |
| | | initDataTableFix = initDataTableFix2; |
| | | |
| | | @track jzDataFix = []; |
| | | @track tableIsLodingFix = true; |
| | | // 点击搜索触发 |
| | | searchDataFix(event) { |
| | | let searchParams = event.detail.searchParams || {}; |
| | | this.template.querySelector('[data-parent-id="parent-div-idFix"]').refreshDataTable({ |
| | | searchParams: searchParams |
| | | }); |
| | | } |
| | | deleteFixedPrice(){ |
| | | debugger |
| | | var fag = deleteFixedPriceLogic(this.SelectedFnDataFixedPrice,this.CompareFullData); |
| | | this.SelectedFnDataFixedPrice = SelectedFnDataFixedPriceExp; |
| | | this.CompareFullData = CompareFullDataExp; |
| | | var ids = idsExp; |
| | | if (fag) { |
| | | //删除所选方案匹配的产品 |
| | | this.DeleteChangesFn(ids, "价格政策"); |
| | | //调用删除价格政策 |
| | | this.deleteFixedPriceTemp(); |
| | | this.ContractPriceCompute(); |
| | | }else{ |
| | | this.Alert("一般产品为强制匹配,不可删除",'error'); |
| | | } |
| | | } |
| | | // 删除所选方案匹配的产品 |
| | | DeleteChangesFn(ids, TypeName) { |
| | | var CompareFullDataTemp = []; |
| | | ids.forEach(id => { |
| | | this.jzDataProduct = DeleteChangesFnLogic(id,TypeName,CompareFullDataTemp,this.CompareFullData,this.jzDataFixedPrice,this.jzDataDiscount,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultNotChange); |
| | | CompareFullDataTemp = CompareFullDataTempExp; |
| | | this.jzDataFixedPrice = jzDataFixedPriceExp; |
| | | this.jzDataDiscount = jzDataDiscountExp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultNotChange = jzDataDefaultNotChangeExp; |
| | | this.ContractPriceCompute(); |
| | | }); |
| | | this.CompareFullData = CompareFullDataTemp; |
| | | } |
| | | //删除价格政策 |
| | | deleteFixedPriceTemp() { |
| | | this.jzDataFixedPrice = deleteFixedPriceTempLogic(this.SelectedFnDataFixedPrice,this.jzDataFixedPrice,this.CompareFullData); |
| | | this.CompareFullData = CompareFullDataExp; |
| | | this.SelectedFnDataFixedPrice = []; |
| | | } |
| | | //价格政策列表选中的数据 |
| | | @track SelectedFnDataFixedPrice = []; |
| | | //价格政策选择事件 |
| | | SelectedFnFixedPrice(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnDataFixedPrice = arr; |
| | | } |
| | | //价格政策列表配置列 |
| | | @track |
| | | initDataTableFixedPrice = initDataTableFixedPrice2; |
| | | //价格政策加载数据方法 |
| | | getTableDataFixedPrice(event) { |
| | | this.tableIsLodingFixedPrice = false; |
| | | } |
| | | //价格政策数据 |
| | | @track jzDataFixedPrice = []; |
| | | //价格政策列表loding |
| | | @track tableIsLodingFixedPrice = true; |
| | | //价格政策列表展示标识 |
| | | @track jzshows3 = true; |
| | | //对比价格政策赋值 |
| | | comparativeAssignment() { |
| | | debugger |
| | | this.jzDataFixedPrice.forEach(jdfp => { |
| | | this.sumTotal.forEach(stl => { |
| | | if (jdfp.Id == stl.Id) { |
| | | if (stl.sumListPrice != undefined && stl.sumNoDiscount != undefined) { |
| | | jdfp.sumListPrice = stl.sumListPrice; |
| | | jdfp.sumNoDiscount = stl.sumNoDiscount; |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | //保存价格政策编辑列方法 |
| | | handleSaveFixedPrice(event) { |
| | | this.comparativeAssignment(); |
| | | let editnewDate = []; |
| | | editnewDate = handleSaveFixedPriceLogic(this.CompareFullData,event,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,this.jzDataDefault); |
| | | this.CompareFullData = CompareFullDataExp; |
| | | var HeTongTotal = HeTongTotalExp; |
| | | let newData = newDataExp; |
| | | var boolean = booleanExp; |
| | | var newArrs = [].concat(editnewDate); |
| | | if (boolean == 1) { |
| | | this.jzDataFixedPrice = newData; |
| | | newArrs.forEach(item => { |
| | | this.ComputeData(item.Id, '价格政策'); |
| | | this.Alert("数据修改成功", 'success'); |
| | | }); |
| | | this.jzDataProduct = this.newArrsTemp3.concat(this.newArrsTemp4); |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } else if (boolean == 3) { |
| | | this.Alert("修改错误,次数已经超过最大值,不可增加",'error'); |
| | | } else if (boolean == 4) { |
| | | this.Alert("修改错误,次数不可以为0",'error'); |
| | | } else if (boolean == 5) { |
| | | this.Alert("该方案为强制匹配,次数不可修改!",'error'); |
| | | } else if (boolean == 6) { |
| | | var str1 = String(HeTongTotal); |
| | | var str = "修改错误,合同价格不得小于"; |
| | | var str3 = str + str1; |
| | | this.Alert(str3,'error'); |
| | | } |
| | | //刷新 |
| | | this.jzshows3 = false; |
| | | this.IsLoading3 = true; |
| | | setTimeout(() => { |
| | | this.IsLoading3 = false; |
| | | this.jzshows3 = true; |
| | | }, 800); |
| | | } |
| | | newArrsTemp3 = []; |
| | | newArrsTemp4 = []; |
| | | //========促销方案模态框 start========= |
| | | // 促销方案搜索框搜索按钮方法 |
| | | searchData(event) { |
| | | let searchParams = event.detail.searchParams || {}; |
| | | let temp = this.template; |
| | | this.template.querySelector('[data-parent-id="parent-div-id"]').refreshDataTable({ |
| | | searchParams: searchParams |
| | | }); |
| | | } |
| | | // 促销方案搜索框配置列 |
| | | @track |
| | | initSearchForm = initSearchForm2; |
| | | //促销方案列表选事件 |
| | | SelectedFn(event) { |
| | | let arr = event.detail.rows; |
| | | if (arr.length > 1) { |
| | | this.Alert("价格政策只可选择一个方案",'error'); |
| | | } else { |
| | | this.ifqianpi = true; |
| | | this.GetSearchProductByIdFn(arr[0].Id, arr[0], "价格政策", [], arr); |
| | | } |
| | | this.cancel(); |
| | | } |
| | | //促销方案列表加载数据 |
| | | // 后台交互,获取列表数据 |
| | | getTableData(event) { |
| | | debugger |
| | | let listQuery = event; |
| | | if (event.fag == undefined) { |
| | | listQuery = event.detail.listQuery; |
| | | } |
| | | GetPromotionPromotionSearch(listQuery).then(result => { //促销方案查询结果 |
| | | debugger |
| | | var responseObj = JSON.parse(result); |
| | | responseObj.records.forEach(item => { |
| | | var SeachData = { |
| | | SearchId: item.Id |
| | | }; |
| | | GetSearchProductById(SeachData).then(result => { //方案关联的产品 |
| | | debugger |
| | | var newarrjdf = SearchProductByIdLogic(result,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,item); |
| | | this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp; |
| | | this.jzDataFixedPrice = [].concat(newarrjdf); |
| | | }); |
| | | }); |
| | | this.jzData = [].concat(responseObj.records); |
| | | this.tableIsLoding = false; |
| | | }) |
| | | } |
| | | jzDataDefaultCopyQuantityList = []; |
| | | // 后台交互,获取一般产品列表数据 |
| | | ifqianpi = true; |
| | | getTableDataFix(event) { |
| | | let listQuery = event; |
| | | if (event.fag) { |
| | | this.ifqianpi = false; |
| | | } else { |
| | | listQuery = event.detail.listQuery; |
| | | } |
| | | listQuery.pageLimit = 200; |
| | | GetNormalProductSearch(listQuery).then(result => { |
| | | //BBBB |
| | | var tempArr = result.split("--"); |
| | | var responseObj = JSON.parse(tempArr[0]); |
| | | var responseObjAll = JSON.parse(tempArr[1]); |
| | | //排序 |
| | | var newArrs = new Array; |
| | | responseObjAll.forEach(item => { |
| | | newArrs.push(item); |
| | | }) |
| | | newArrs.sort((a, b) => { |
| | | return a.OrderNo__c - b.OrderNo__c; |
| | | }) |
| | | newArrs.forEach(item => { //排序后的一般产品主数据 |
| | | var SeachData = { |
| | | SearchId: item.Id |
| | | }; |
| | | GetSearchProductById(SeachData).then(results => { |
| | | var newarrjdf = GetSearchProductByIdLogic(item,results,this.jzDataDefaultCopyQuantityList,this.jzDataFixedPrice); |
| | | this.jzDataFixedPrice = [].concat(newarrjdf); |
| | | var iflag = iflagExp; |
| | | this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp; |
| | | if (event.fag && iflag) { |
| | | var newArr = []; |
| | | newArr.push(item); |
| | | this.ifqianpi = false; |
| | | this.GetSearchProductByIdFn(item.Id, item, "价格政策", [], newArr, false); |
| | | } |
| | | }); |
| | | }); |
| | | var respons = []; |
| | | responseObj.records.forEach(rrds => { //查出的前十条 |
| | | responseObjAll.forEach(rsja => { //查出的所有一般产品数据 |
| | | if (rrds.Id == rsja.Id) { |
| | | respons.push(rsja); |
| | | } |
| | | }) |
| | | }) |
| | | this.jzDataFix = [].concat(respons); |
| | | this.tableIsLodingFix = false; |
| | | }) |
| | | } |
| | | SelectedFnFix(event) { |
| | | let arr = event.detail.rows; |
| | | this.ifqianpi = true; |
| | | if (arr.length > 1) { |
| | | this.Alert("价格政策只可选择一个方案",'error'); |
| | | } else { |
| | | //获取数据 |
| | | this.GetSearchProductByIdFn(arr[0].Id, arr[0], "价格政策", [], arr); |
| | | } |
| | | this.cancelFix(); |
| | | } |
| | | //价格政策匹配 |
| | | GetSearchProductByIdFn(idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow = true) { |
| | | //dddd |
| | | var SeachData = { |
| | | SearchId: idStr |
| | | }; |
| | | GetSearchProductById(SeachData).then(result => { |
| | | var tempObject = { |
| | | ...{}, |
| | | ...jzDataProductParam |
| | | } |
| | | jzDataProductParam = this.countListAndNod(tempObject, result); |
| | | arrData = [].concat(jzDataProductParam); |
| | | //返回数据比较规则 |
| | | this.CompareData(result, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow); |
| | | }) |
| | | } |
| | | //计算listPrice的和以及nod和 |
| | | countListAndNod(item, result) { |
| | | var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //内外贸信息 |
| | | var copydate=this.jzDataDefaultCopy; |
| | | var DeftCopyQtyList = this.jzDataDefaultCopyQuantityList; |
| | | //计算list和nod合计逻辑 |
| | | item=countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList); |
| | | this.jzDataDefaultCopyQuantityList=DeftCopyQtyLists; |
| | | var arr = { |
| | | ...{}, |
| | | ...item |
| | | }; |
| | | return arr; |
| | | } |
| | | //匹配价格政策时数据比较规则 |
| | | CompareData(list, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow) { |
| | | var TempsJzDataToCompare = CompareDataL(list,this.jzDataDefault); |
| | | var isChange = isChangeExp; |
| | | //End |
| | | if (TempsJzDataToCompare.length == list.length&&list.length!=0) { |
| | | TempsJzDataToCompare.forEach(TempsItems => { |
| | | this.ComparePushData(TempsItems.item.Quantity, TempsItems.element.Quantity__c, TempsItems.element.Asset_Model_No__c, idStr, jzDataProductParam, TypeName); |
| | | }); |
| | | //判断是否显示 提示框 |
| | | if (isShow) { |
| | | if (this.ifqianpi) { |
| | | this.Alert("促销方案选择完成", 'success'); |
| | | } |
| | | } |
| | | } else { |
| | | if (isShow) { |
| | | if (this.ifqianpi) { |
| | | this.Alert("促销方案不满足,请重新选择",'error'); |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | if (isChange) { |
| | | this.ChangeNumZeroTrueChanges(); |
| | | } |
| | | var temps = this.CompareFullData; |
| | | //添加 |
| | | this.UpdateJZData(arrData); |
| | | //更新次数 |
| | | this.updatesNums(); |
| | | //合并重复价格政策方案 |
| | | var jzarr = [].concat(this.jzDataFixedPrice);; |
| | | this.MergeDuplicateSchemes(jzarr); |
| | | //保存最大次数 |
| | | this.savecount(idStr); |
| | | //计算价格 |
| | | this.ComputeData(idStr, '价格政策'); |
| | | } |
| | | ComparePushData(length, Quantity, Asset_Model_No__c, Id, jzDataProductParam, TypeName) { |
| | | //修改 产品明细 |
| | | let num = parseInt(length / Quantity); |
| | | var newDataDefault = ComparePushDataLogic(this.jzDataDefault,this.jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num); |
| | | this.jzDataProduct = jzDataProductExp; |
| | | this.ContractPriceCompute(); |
| | | this.jzDataDefault = newDataDefault; |
| | | this.ChangeNumZeroTrue(); |
| | | this.AddNums(TypeName, Asset_Model_No__c, num, Id); |
| | | } |
| | | ChangeNumZeroTrueChanges() { |
| | | if (this.jzDataDefault.length != this.ChangeNumZeroTrueData) { |
| | | this.jzDataDefault = this.ChangeNumZeroTrueData; |
| | | } |
| | | } |
| | | UpdateJZData(arrs) { //arrs 选中的数据集合 |
| | | if (this.jzDataFixedPrice == null || this.jzDataFixedPrice.length <= 0) { |
| | | this.jzDataFixedPrice = arrs; |
| | | } else { |
| | | this.jzDataFixedPrice = this.jzDataFixedPrice.concat(arrs); |
| | | }; |
| | | } |
| | | // =======更新促销方案次数数据 |
| | | updatesNums() { |
| | | var jzDataFixedPriceTemp = [].concat(this.jzDataFixedPrice); |
| | | var jzDataDiscountTemp = [].concat(this.jzDataDiscount); |
| | | var CompareFullData = this.CompareFullData; |
| | | updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData); |
| | | this.jzDataFixedPrice = jzDataFixedPriceTemps; |
| | | this.jzDataDiscount = jzDataDiscountTemps; |
| | | } |
| | | //合并重复价格政策方案 |
| | | MergeDuplicateSchemes(SchemeSet) { |
| | | var arr = []; |
| | | arr = MergeDuplicateSchemesLogic(this.CompareFullData,SchemeSet); |
| | | this.CompareFullData = CompareFullDataExp; |
| | | this.jzDataFixedPrice = [].concat(arr); |
| | | this.ConsolidationProgramProducts(arr); |
| | | } |
| | | //计算价格政策价格 |
| | | ComputeData(id, category) { //id 选中的数据ID category 方案类型 |
| | | //调用替换listprice单价 |
| | | this.ReplacementUnitPrice(); |
| | | //数据 |
| | | this.updateIdStr("3"); |
| | | var arrTemp = this.jzDataFixedPrice; // id 价格政策 |
| | | this.updateIdStr("1"); |
| | | var arrProductTemp = this.jzDataProduct; // PromotionId 产品明细 |
| | | var arrTemp2 = this.jzDataDefault; //待选产品 |
| | | if (category == '价格政策') { |
| | | arrTemp.forEach(item => { // item价格政策 |
| | | if (id == item.Id) { |
| | | item.Total = item.Counts * item.Price_CNY__c; |
| | | item.sumNoDiscountTotal = item.sumNoDiscount * item.Counts; |
| | | //计算促销总价&& item.HeTongTotal == undefined |
| | | if (item.Price_CNY__c != undefined) { |
| | | if (item.determine != '改过') { |
| | | if (item.if_Contain_Nod__c) { |
| | | item.HeTongTotal = item.Total; |
| | | } else { |
| | | item.HeTongTotal = item.Total + item.sumNoDiscountTotal; |
| | | } |
| | | } |
| | | } |
| | | //计算选择促销政策的经销商单价和小计 |
| | | var PromotionHeadRecordId = item.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Promotion") { //促销方案 |
| | | arrProductTemp = ComputeDataPromotionLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault); |
| | | this.newArrsTemp3 = newArrsTemp3Exp; |
| | | this.newArrsTemp4 = newArrsTemp4Exp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultCopy = jzDataDefaultCopyExp; |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } else if (PromotionHeadRecordId == "NormalProduct") { //一般产品 |
| | | //todu3 |
| | | arrProductTemp = ComputeDataNormalProductLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault); |
| | | this.newArrsTemp3 = newArrsTemp3Exp; |
| | | this.newArrsTemp4 = newArrsTemp4Exp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultCopy = jzDataDefaultCopyExp; |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | } |
| | | }); |
| | | this.jzDataFixedPrice = [].concat(arrTemp); |
| | | } |
| | | } |
| | | ReplacementUnitPrice() { |
| | | var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //内外贸 |
| | | var arr = [].concat(this.jzDataProduct);//20230214 |
| | | this.jzDataProduct = [].concat(ReplacementUnitPriceLogic(arr, ifTrade));//20230214 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | //保存最大次数 |
| | | savecount(idStr) { //idStr 选中的数据ID |
| | | this.jzDataFixedPrice = savecountLogic(this.jzDataFixedPrice,idStr); |
| | | } |
| | | ChangeNumZeroTrueData = [] |
| | | ChangeNumZeroTrue() { |
| | | this.ChangeNumZeroTrueData = [].concat(this.jzDataDefault); |
| | | var newJzDataDefault = this.ChangeNumZeroTrueData.filter(item => { |
| | | if (item.Quantity > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }) |
| | | this.ChangeNumZeroTrueData = newJzDataDefault; |
| | | } |
| | | //用于填充次数 |
| | | CompareFullData = [] |
| | | AddNums(ListName, Asset_Model_No__c, addNums, Id) { |
| | | this.CompareFullData = AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,this.CompareFullData); |
| | | } |
| | | //归并相同价格政策方案的产品 |
| | | ConsolidationProgramProducts(arrSchemes) { |
| | | var jzdataList = [].concat(this.jzDataProduct); |
| | | this.jzDataProduct = PriceConsolidation(arrSchemes, jzdataList); |
| | | } |
| | | //促销方案列表数据 |
| | | @track jzData = []; |
| | | //促销方案列表加载动图标识 |
| | | @track tableIsLoding = true; |
| | | // 促销方案列表列配置 |
| | | @track |
| | | initDataTable =initDataTable2; |
| | | jzdateflag=true; |
| | | IsLoading6 = false; |
| | | //促销方案列表编辑列保存 |
| | | savejzData(event){ |
| | | var data = event.detail.rows; |
| | | for (var i = 0; i < this.jzData.length; i++) { |
| | | for (var j = 0; j < data.length; j++) { |
| | | var id = data[j].Id.replace("row-", ""); |
| | | if (this.jzData[i].Id == id) { |
| | | this.jzData[i].Quantity__c=data[j].Quantity__c; |
| | | } |
| | | } |
| | | } |
| | | this.jzdateflag = false; |
| | | this.IsLoading6 = true; |
| | | setTimeout(() => { |
| | | this.jzdateflag = true; |
| | | this.IsLoading6 = false; |
| | | }, 1000); |
| | | } |
| | | //=========促销方案模态框 end============ |
| | | //***************价格政策 end************** |
| | | |
| | | //********折扣政策 start*********** |
| | | //选择特约折扣打开按钮 |
| | | showModalSpecial(){ |
| | | this.QuoteData.forEach(qtd => { |
| | | if (!qtd.Opportunity.IsAuthorized__c) { |
| | | this.Alert("该询价不是特约经销商授权",'error'); |
| | | } else { |
| | | this.ShowSpecial = true; |
| | | } |
| | | }); |
| | | } |
| | | //选择一般折扣打开按钮 |
| | | showModalCommonly(){ |
| | | this.ShowCommonly = true |
| | | } |
| | | //折扣政策删除按钮事件 |
| | | delectTableDiscount(){ |
| | | let ids = []; |
| | | for (var j = 0; j < this.SelectedFnDataDiscount.length; j++) { |
| | | ids.push(this.SelectedFnDataDiscount[j].Id); |
| | | } |
| | | this.DeleteSchemeMatching(this.SelectedFnDataDiscount, "折扣政策"); |
| | | this.delectTableDiscountTemp(); |
| | | this.ContractPriceCompute(); |
| | | } |
| | | DeleteSchemeMatching(ids, TypeName) { |
| | | var CompareFullDataTemp = []; |
| | | ids.forEach(id => { |
| | | this.jzDataProduct = DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,this.CompareFullData,this.jzDataFixedPrice,this.jzDataDiscount,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultNotChange); |
| | | CompareFullDataTemp = CompareFullDataTempExp; |
| | | this.jzDataFixedPrice = jzDataFixedPriceExp; |
| | | this.jzDataDiscount = jzDataDiscountExp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultNotChange = jzDataDefaultNotChangeExp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | }); |
| | | this.CompareFullData = CompareFullDataTemp; |
| | | } |
| | | //折扣政策选中列表数据 |
| | | @track SelectedFnDataDiscount = [] |
| | | //折扣政策选择事件 |
| | | SelectedFnDiscount(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnDataDiscount = arr; |
| | | } |
| | | //折扣政策列表数据 |
| | | @track jzDataDiscount = []; |
| | | //折扣政策列表加载动图标识 |
| | | @track tableIsLodingDiscount = true; |
| | | //折扣政策列表列配置 |
| | | @track |
| | | initDataTableDiscount = initDataTableDiscount2; |
| | | //折扣政策列表列加载方法 |
| | | getTableDataDiscount(event) { |
| | | this.tableIsLodingDiscount = false; |
| | | } |
| | | @track |
| | | Tongzhishow = false; //提示显示的标识 |
| | | SaveShowText = "操作成功"; //提示框的文本 |
| | | TongzhiIcon = 'standard:account' //提示框的图标 |
| | | IsLeftStyle = "" //提示框的样式 |
| | | BgColorStyle = "" |
| | | //弹框提示 content 内容 error 是否是错误提示框 left 是否居左 |
| | | Alert(msg,type) { |
| | | if(type == 'success'){ |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type, |
| | | }); |
| | | this.dispatchEvent(event); |
| | | }else{ |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type, |
| | | mode: 'sticky' |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | } |
| | | //折扣政策编辑列保存方法 |
| | | handleSaveDiscount(event) { |
| | | this.jzDataDiscount = handleSaveDiscountLogic(this.jzDataDiscount,this.jzDataProduct,event); |
| | | var boolean = booleanExp; |
| | | var boolean2 = boolean2Exp; |
| | | var boolean3 = boolean3Exp; |
| | | let newData = newDataExp; |
| | | let newData2 = newData2Exp; |
| | | let newData3 = newData3Exp; |
| | | let editnewDate = editnewDateExp; |
| | | var GuaranteeDiscount__cZuiXiao = GuaranteeDiscount__cZuiXiaoExp; |
| | | var NormalDiscount__cZuiXiao = NormalDiscount__cZuiXiaoExp; |
| | | this.jzDataProduct = jzDataProductExp; |
| | | //haha2 |
| | | debugger |
| | | if (boolean == 0) { |
| | | this.jzDataDiscount = newData; |
| | | var newArrs = [].concat(editnewDate);//20230214 |
| | | newArrs.forEach(item => { |
| | | //合并折扣政策重复方案 |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | this.ComputeDiscount(item.Id, item.NormalDiscount__c_Input, item.GuaranteeDiscount__c_Input, item.Category__c, item.JxsType); |
| | | }); |
| | | this.jzDataProduct = this.newArrsTemp2.concat(this.newArrsTemp);//20230213 |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | this.Alert("数据修改成功", 'success'); |
| | | } else if (boolean == 1) { |
| | | this.Alert("修改错误,对象品折扣不得小于对象品最低折扣:"+GuaranteeDiscount__cZuiXiao+"%",'error'); |
| | | } else if (boolean == 2) { |
| | | this.Alert("修改错误,非对象品折扣不得小于非对象品最低折扣:"+NormalDiscount__cZuiXiao+"%",'error'); |
| | | } else if (boolean == 3) { |
| | | this.Alert("修改错误,一般折扣没有对象品折扣",'error'); |
| | | } else if (boolean == 5) { |
| | | this.Alert("非对象品折扣不可以为空或小于0",'error'); |
| | | } else if (boolean == 4) { |
| | | this.jzDataDiscount = newData; |
| | | var ffgg=0; |
| | | if(boolean3){ |
| | | newData2.forEach(HeTo => { |
| | | //根据合同价格计算一般折扣 |
| | | HeTo = this.ComouteProductDiscount(HeTo.Id,HeTo.Category__c,HeTo.GuaranteeDiscount__c_Input, HeTo.NormalDiscount__c_Input, HeTo.GuaranteeDiscount_H_Money__c,HeTo.NormalDiscount_H_Money__c, HeTo); |
| | | if(HeTo==1||HeTo==2||HeTo==12||HeTo==3){ |
| | | ffgg=HeTo; |
| | | return ; |
| | | } |
| | | //合并折扣政策重复方案 |
| | | let jzDataDiscountx = [].concat(this.jzDataDiscount);//20230214 |
| | | this.ConsolidatedDiscountPolicy(jzDataDiscountx); |
| | | //一般折扣更改过合同价格计算 |
| | | this.updateCommonlyDiscountLogic(HeTo.Id,HeTo.JxsType,HeTo.GuaranteeDiscount__c_Input,HeTo.NormalDiscount__c_Input,HeTo.Category__c,this.jzDataDiscount); |
| | | }); |
| | | } |
| | | if(boolean2&&ffgg==0){ |
| | | newData3.forEach(TeYue=>{ |
| | | //根据合同价格计算特约折扣 |
| | | GuaranteeDiscount__cZuiXiao=parseFloat(TeYue.GuaranteeDiscount__c); |
| | | NormalDiscount__cZuiXiao=parseFloat(TeYue.NormalDiscount__c); |
| | | TeYue=this.ComouteProductDiscount(TeYue.Id,TeYue.Category__c,TeYue.GuaranteeDiscount__c_Input, TeYue.NormalDiscount__c_Input, TeYue.GuaranteeDiscount_H_Money__c,TeYue.NormalDiscount_H_Money__c, TeYue); |
| | | if(TeYue==1||TeYue==2||TeYue==12||TeYue==3){ |
| | | ffgg=TeYue; |
| | | return ; |
| | | }else{ |
| | | //合并折扣政策重复方案 |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | //一般折扣更改过合同价格计算 |
| | | this.updateCommonlyDiscountLogic(TeYue.Id,TeYue.JxsType,TeYue.GuaranteeDiscount__c_Input,TeYue.NormalDiscount__c_Input,TeYue.Category__c,this.jzDataDiscount); |
| | | } |
| | | }); |
| | | } |
| | | if(ffgg==1||ffgg==2||ffgg==12||ffgg==3){ |
| | | this.Alert(InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao),'error'); |
| | | }else{ |
| | | this.Alert("数据修改成功", 'success'); |
| | | } |
| | | } |
| | | //刷新 |
| | | this.jzshows2 = false; |
| | | setTimeout(() => { |
| | | this.jzshows2 = true; |
| | | }, 800) |
| | | } |
| | | newArrsTemp = []; |
| | | newArrsTemp2 = []; |
| | | //计算一般折扣非对象品折扣 |
| | | ComouteProductDiscount(Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item) { |
| | | //todu12 |
| | | this.updateIdStr("2"); |
| | | this.updateIdStr("1"); |
| | | var reslut=ReverseCalculationModifyDiscountLogic(this.jzDataDiscount,this.jzDataProduct,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item); |
| | | this.jzDataDiscount=[].concat(arrTempsss); |
| | | this.jzDataProduct=[].concat(arrProductTempsss);//20230214 |
| | | return reslut; |
| | | } |
| | | //一般折扣更改过合同价格计算 |
| | | updateCommonlyDiscountLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount) { |
| | | //todu13 |
| | | this.updateIdStr("1"); |
| | | this.jzDataProduct=updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,this.jzDataProduct); |
| | | this.GeneralDiscountContractSummary(); |
| | | } |
| | | //更改一般折扣合同价格计算合同总价 |
| | | GeneralDiscountContractSummary(){ |
| | | this.ContractPrice = 0; |
| | | var sum = this.ContractPrice; |
| | | sum = parseFloat(sum); |
| | | sum=GeneralDiscountContractSummaryLogic(sum,this.jzDataDiscount,this.jzDataFixedPrice); |
| | | this.ContractPrice = sum; |
| | | } |
| | | //折扣政策列表展示标识 |
| | | jzshows2 = true; |
| | | ///特约折扣待选方案列表选择数据 |
| | | @track SelectedFnDataSpecial = []; |
| | | //特约折扣模态框错误提示开关 |
| | | ShowSpecialIsError = false; |
| | | //特约折扣待选方案列表选中方法 |
| | | SelectedFnSpecial(event) { |
| | | let arr = event.detail.rows; |
| | | if (event.detail.rows.length > 1) { |
| | | this.ShowSpecialIsError = true; |
| | | } else { |
| | | this.ShowSpecialIsError = false; |
| | | } |
| | | var TempArr = []; |
| | | TempArr.push(arr[0]) |
| | | var tempObject = { |
| | | ...{}, |
| | | ...TempArr[0] |
| | | } |
| | | tempObject.CompareId = GetUUID(); |
| | | this.SelectedFnDataSpecial = [tempObject]; |
| | | } |
| | | //特约折扣待选方案列表加载方法 |
| | | getTableDataSpecial(event) { |
| | | let listQuery = event.detail.listQuery; |
| | | var Agency1__c = this.QuoteData[0].Agency1__c; |
| | | listQuery.pageLimit = 40; |
| | | listQuery.Agency1c = Agency1__c; |
| | | GetAuthorizerSearch(listQuery).then(result => { |
| | | var responseObj = JSON.parse(result); |
| | | this.jzDataSpecial = responseObj.records; |
| | | this.jzDataSpecial.forEach(element => { |
| | | element.JxsType = "特约折扣"; |
| | | element.NormalDiscount__c = element.NormalDiscount__c+"%"; |
| | | element.GuaranteeDiscount__c = element.GuaranteeDiscount__c+'%'; |
| | | }); |
| | | GetAgencyRName().then(gar => { |
| | | var a = JSON.parse(gar); |
| | | a.forEach(ga => { |
| | | if (ga.Agency__r != undefined) { |
| | | var arr = []; |
| | | this.jzDataSpecial.forEach(jzdsc => { |
| | | if (ga.Agency__c == jzdsc.Agency__c) { |
| | | jzdsc.Agency__Name = ga.Agency__r.Name; |
| | | arr.push(jzdsc); |
| | | } else { |
| | | arr.push(jzdsc); |
| | | } |
| | | }); |
| | | this.jzDataSpecial = [].concat(arr); |
| | | } |
| | | }); |
| | | }) |
| | | this.tableIsLodingSpecial = false; |
| | | }) |
| | | } |
| | | //特约折扣待选方案列表列配置 |
| | | @track |
| | | initDataTableSpecial = initDataTableSpecial2; |
| | | //特约折扣待选方案列表数据 |
| | | @track jzDataSpecial = []; |
| | | //特约折扣待选方案列表加载动图标识 |
| | | @track tableIsLodingSpecial = true; |
| | | //特约折扣待选产品列表选择数据 |
| | | @track SelectedOtherDataArr = []; |
| | | //特约折扣待选产品列表选中方法 |
| | | SelectedFnOtherData(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedOtherDataArr = arr; |
| | | } |
| | | //特约折扣待选产品列表列配置 |
| | | @track |
| | | initDataTableOtherData = initDataTableOtherData2; |
| | | @track jzDataOtherData = []; |
| | | @track tableIsLodingOtherData = true; |
| | | //特约折扣模开关 |
| | | @track ShowSpecial; |
| | | //特约折扣待选产品列表加载方法 |
| | | getTableDataOtherData(event) { |
| | | if (!this.IsLoadingFlag1) { |
| | | return |
| | | }; |
| | | this.jzDataOtherData = this.jzDataDefault; |
| | | var jzDataOtherDataTemp = []; |
| | | this.jzDataOtherData.forEach(jzdod => { |
| | | var ItemsTemp = { |
| | | ...{}, |
| | | ...jzdod |
| | | }; |
| | | ItemsTemp.SplitQuantity = ItemsTemp.Quantity; |
| | | jzDataOtherDataTemp.push(ItemsTemp); |
| | | }) |
| | | this.jzDataOtherData = jzDataOtherDataTemp; |
| | | this.tableIsLodingOtherData = false; |
| | | } |
| | | //特约折扣待选产品列表外加载动图标识 |
| | | IsLoading5 = false; |
| | | //特约折扣待选产品展示标识 |
| | | jzshows5 = true; |
| | | // |
| | | IsLoadingFlag1 = true; |
| | | //特约折扣待选产品编辑列保存方法 |
| | | SaveSpecialDiscount(event) { |
| | | debugger |
| | | var data = event.detail.rows; |
| | | let newData = []; |
| | | let editnewDate = []; |
| | | var boolean = 1; |
| | | for (var i = 0; i < this.jzDataOtherData.length; i++) { |
| | | var editData = {}; |
| | | var flag = false; |
| | | for (var j = 0; j < data.length; j++) { |
| | | var id = data[j].Id; |
| | | if (this.jzDataOtherData[i].Id == id) { |
| | | editData = { |
| | | SplitQuantity: '' |
| | | }; |
| | | //拆分次数 |
| | | editData.SplitQuantity = data[j].SplitQuantity; |
| | | flag = true; |
| | | } |
| | | } |
| | | if (flag) { |
| | | var newItem = { |
| | | ...this.jzDataOtherData[i], |
| | | ...{} |
| | | }; |
| | | if (editData.SplitQuantity != undefined) { |
| | | newItem.SplitQuantity = Number(editData.SplitQuantity); |
| | | } |
| | | newData.push(newItem); |
| | | editnewDate.push(newItem); |
| | | } else { |
| | | newData.push({ |
| | | ...{}, |
| | | ...this.jzDataOtherData[i] |
| | | }); |
| | | } |
| | | } |
| | | var newArrs = [].concat(editnewDate); |
| | | newArrs.forEach(item => { |
| | | if (item.Quantity < item.SplitQuantity) { |
| | | boolean = 2; |
| | | } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') { |
| | | boolean = 3; |
| | | } |
| | | }); |
| | | if (boolean == 1) { |
| | | this.jzDataOtherData = newData; |
| | | this.ShowSpecialIsError = false; |
| | | } else if (boolean == 2) { |
| | | this.errorTiShi("修改错误,使用数量不得大于数量"); |
| | | } else if (boolean == 3) { |
| | | this.errorTiShi("修改错误,使用数量不得为0或为空"); |
| | | } |
| | | |
| | | this.jzshows5 = false; |
| | | this.IsLoading5 = true; |
| | | this.IsLoadingFlag1 = false; |
| | | setTimeout(() => { |
| | | this.SelectedOtherDataArr = []; |
| | | this.IsLoading5 = false; |
| | | this.jzshows5 = true; |
| | | }, 1000); |
| | | setTimeout(() => { |
| | | this.IsLoadingFlag1 = true; |
| | | }, 2000); |
| | | } |
| | | //特约错误提示 |
| | | errorTiShi(str){ |
| | | this.ShowSpecialIsError = true; |
| | | this.ShowSpecial = true; |
| | | this.ShowSpecialError = str; |
| | | } |
| | | //特约折扣模态框取消按钮方法 |
| | | cancelSpecial() { |
| | | this.ShowSpecial = false |
| | | this.ShowSpecialIsError = false; |
| | | this.SelectedFnDataSpecial = []; |
| | | this.SelectedOtherDataArr = []; |
| | | } |
| | | //特约折扣模态框保存按钮方法 |
| | | SavesSpecial() { |
| | | this.ShowSpecialIsError = false; |
| | | this.ShowSpecial = false; |
| | | var ItempTempData = { |
| | | ...{}, |
| | | ...this.SelectedFnDataSpecial[0] |
| | | }; |
| | | if (this.SelectedOtherDataArr.length == 0 && this.SelectedFnDataSpecial.length != 0) { |
| | | this.errorTiShi("请选择特约折扣产品!"); |
| | | } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length != 0) { |
| | | this.errorTiShi("请选择特约折扣方案!"); |
| | | } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length == 0) { |
| | | this.errorTiShi("请选择特约折扣方案和产品!"); |
| | | } else { |
| | | ItempTempData.itemss = this.SelectedOtherDataArr; |
| | | ItempTempData.IsTempItems = true; |
| | | ItempTempData.NormalDiscount__c_Input = ItempTempData.NormalDiscount__c; |
| | | ItempTempData.GuaranteeDiscount__c_Input = ItempTempData.GuaranteeDiscount__c; |
| | | this.SelectedFnDataSpecial[0] = ItempTempData; |
| | | this.UpdateDiscountData(this.SelectedFnDataSpecial); |
| | | this.SpecialSavesChange("特约折扣", ItempTempData, this.SelectedFnDataSpecial[0].Id, this.SelectedFnDataSpecial[0].CompareId); |
| | | this.Alert("特约折扣选择完成", 'success'); |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType); |
| | | this.SelectedFnDataSpecial = []; |
| | | this.SelectedOtherDataArr = []; |
| | | } |
| | | } |
| | | //计算折扣政策 |
| | | ComputeDiscount(id, NormalDiscount__c_Input, GuaranteeDiscount__c_Input, Category__c, JxsType) { |
| | | this.updateIdStr("1"); |
| | | var arrProductTemp = this.jzDataProduct; |
| | | this.updateIdStr("2"); |
| | | var arrTemp1 = this.jzDataDiscount; |
| | | arrTemp1.forEach(item => { |
| | | if (JxsType == '特约折扣') { |
| | | if (item.JxsType == '特约折扣') { |
| | | if (id == item.Id) { |
| | | if (item.iftrue != "改过" && |
| | | item.GuaranteeDiscount__c_Input == undefined && |
| | | item.NormalDiscount__c_Input == undefined) { |
| | | item.GuaranteeDiscount__c_Input = item.GuaranteeDiscount__c; |
| | | item.NormalDiscount__c_Input = item.NormalDiscount__c; |
| | | } |
| | | if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && |
| | | GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) { |
| | | arrProductTemp = ComputeDiscountAuthorizerLogic(this.newArrsTemp,this.newArrsTemp2,item,arrProductTemp); |
| | | this.newArrsTemp = newArrsTempExp; |
| | | this.newArrsTemp2 = newArrsTemp2Exp; |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | } |
| | | } |
| | | } else if (JxsType == '一般折扣') { |
| | | if (item.JxsType == '一般折扣') { |
| | | if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && |
| | | Category__c == item.Category__c) { |
| | | this.newArrsTemp = []; |
| | | this.newArrsTemp2 = []; |
| | | arrProductTemp.forEach(itemss => { |
| | | if (itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input && |
| | | itemss.Category__c == item.Category__c) { |
| | | itemss = commonlyDiscountLogic(itemss, item); //一般折扣计算逻辑 |
| | | this.newArrsTemp.push(itemss); |
| | | } else if (itemss.Category__c != item.Category__c || |
| | | itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) { |
| | | this.newArrsTemp2.push(itemss); |
| | | } |
| | | }); |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | this.jzDataDiscount = [].concat(arrTemp1); |
| | | } |
| | | //折扣政策匹配规则 |
| | | SpecialSavesChange(SaveName, SelectedData, IdStr, CompareId) { |
| | | var newDicountData = []; |
| | | newDicountData=SpecialSavesChangePartLogic(this.jzDataDefault,SaveName, SelectedData, IdStr, CompareId,0,newDicountData,this.jzDataDiscount); |
| | | this.jzDataDefault = NewDefaultDatass; |
| | | this.jzDataProduct =this.jzDataProduct.concat(AddProductDatass); |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | this.jzDataDiscount = newDicountData; |
| | | } |
| | | //合并折扣政策重复方案 |
| | | ConsolidatedDiscountPolicy(SchemeSet) { |
| | | var arr = []; |
| | | arr = ConsolidatedDiscountPolicyLogic(SchemeSet, arr); |
| | | this.jzDataDiscount = [].concat(arr); |
| | | this.ConsolidatedDiscountDetails(arr); |
| | | } |
| | | //合并折扣政策产品明细 |
| | | ConsolidatedDiscountDetails(arrSchemes) { |
| | | var jzdataList = [].concat(this.jzDataProduct); |
| | | this.jzDataProduct = ConsolidatedDiscountDetailsLogic(arrSchemes, jzdataList); |
| | | } |
| | | //==========特约折扣模态框 end============= |
| | | //=========一般折扣模态框 start=========== |
| | | //一般折扣模态框开关 |
| | | @track ShowCommonly; |
| | | //一般折扣待选产品列表外加载动图标识 |
| | | IsLoading4 = false; |
| | | //一般折扣待选产品展示标识 |
| | | jzshows4 = true; |
| | | // |
| | | IsLoadingFlag = true; |
| | | //一般折扣待选产品编辑列保存方法 |
| | | SaveGeneralDiscount(event) { |
| | | var data = event.detail.rows; |
| | | let newData = SaveGeneralDiscountLogic(data,this.jzDataCommonly); |
| | | var boolean = booleanExp; |
| | | if (boolean == 1) { |
| | | this.jzDataCommonly = newData; |
| | | this.ShowCommonlyIsError = false; |
| | | } else if (boolean == 2) { |
| | | this.ShowCommonlyIsError = true; |
| | | this.ShowCommonlyError = "修改错误,使用数量不得大于数量"; |
| | | } else if (boolean == 3) { |
| | | this.ShowCommonlyIsError = true; |
| | | this.ShowCommonlyError = "修改错误,使用数量不得为0或为空"; |
| | | } |
| | | this.jzshows4 = false; |
| | | this.IsLoading4 = true; |
| | | this.IsLoadingFlag = false; |
| | | setTimeout(() => { |
| | | this.SelectedFnCommonlyData = []; |
| | | this.IsLoading4 = false; |
| | | this.jzshows4 = true; |
| | | }, 1000); |
| | | setTimeout(() => { |
| | | this.IsLoadingFlag = true; |
| | | }, 2000); |
| | | } |
| | | //一般折扣模态框取消按钮方法 |
| | | cancelCommonly() { |
| | | this.ShowCommonly = false; |
| | | this.ShowCommonlyIsError = false; |
| | | this.SelectedFnCommonlyData = []; |
| | | this.SaveLb = ''; |
| | | this.SaveZk = ''; |
| | | } |
| | | //一般折扣待选产品列表列配置 |
| | | @track |
| | | initDataTableCommonly = initDataTableCommonly2; |
| | | //一般折扣待选产品列表数据 |
| | | @track jzDataCommonly = []; |
| | | //一般折扣待选产品列表加载动图标识 |
| | | @track tableIsLodingCommonly = true; |
| | | //一般折扣待选方案列表加载方法 |
| | | getTableDataCommonly(event) { |
| | | if (!this.IsLoadingFlag) { |
| | | return |
| | | }; |
| | | this.jzDataCommonly = this.jzDataDefault; |
| | | this.jzDataCommonly = getTableDataCommonlyLogic(this.jzDataCommonly); |
| | | this.tableIsLodingCommonly = false; |
| | | } |
| | | //一般折扣待选产品列表选择数据 |
| | | SelectedFnCommonlyData = []; |
| | | //一般折扣待选产品列表选中方法 |
| | | SelectedFnCommonly(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnCommonlyData = SelectedFnCommonlyLogic(arr); |
| | | } |
| | | //产品系列数据 |
| | | SaveLb = ''; |
| | | //使用折扣数据 |
| | | SaveZk = ''; |
| | | //产品系列方法 |
| | | handleChangeLb(event) { |
| | | this.SaveLb = event.target.value; |
| | | } |
| | | //使用折扣方法 |
| | | handleChangeZk(event) { |
| | | if (event.target.value !== '') { |
| | | event.target.value = parseFloat(event.target.value) + "%"; |
| | | } |
| | | this.SaveZk = event.target.value; |
| | | } |
| | | //一般折扣模态框错误提示方法 |
| | | errorTiShiYi(str){ |
| | | this.ShowCommonlyIsError = true; |
| | | this.ShowCommonlyError = str; |
| | | } |
| | | //一般折扣模态框错误提示默认内容 |
| | | ShowCommonlyError = "请选择一般产品!"; |
| | | //一般折扣模态框错误提示开关 |
| | | ShowCommonlyIsError = false; |
| | | //一般折扣模态框取消按钮方法 |
| | | cancelSaveCommonly() { |
| | | //处理数据 |
| | | var arr = this.SelectedFnCommonlyData; |
| | | this.ShowCommonlyIsError = false; |
| | | if (this.SelectedFnCommonlyData.length != 0) { |
| | | var ItempTempData = {}; |
| | | ItempTempData.Id = GetUUID(); |
| | | ItempTempData.CompareId = GetUUID(); |
| | | ItempTempData.Name = '一般折扣'; |
| | | ItempTempData.JxsType = "一般折扣"; |
| | | ItempTempData.itemss = arr; |
| | | if (this.SaveLb == '' || this.SaveZk == '') { |
| | | if (this.SaveLb == '' && this.SaveZk != '') { |
| | | this.errorTiShiYi("请选择产品类别!"); |
| | | } else if (this.SaveZk == '' && this.SaveLb != '') { |
| | | this.errorTiShiYi("请输入使用折扣!"); |
| | | } else if (this.SaveZk == '' && this.SaveLb == '') { |
| | | this.errorTiShiYi("请输入使用折扣和产品类别!"); |
| | | } |
| | | } else { |
| | | ItempTempData.Category__c = this.SaveLb; |
| | | ItempTempData.NormalDiscount__c_Input = this.SaveZk; |
| | | ItempTempData.if_Contain_Nod__c = false; |
| | | var TempList = []; |
| | | TempList.push(ItempTempData); |
| | | this.UpdateDiscountData(TempList); |
| | | this.SpecialSavesChange("一般折扣", ItempTempData, ItempTempData.Id, ItempTempData.CompareId); |
| | | this.cancelCommonly(); |
| | | this.Alert("一般折扣选择完成", 'success'); |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | //计算折扣政策价格 |
| | | this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c_Input, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType); |
| | | } |
| | | } else { |
| | | this.errorTiShiYi("请选择一般产品!"); |
| | | } |
| | | } |
| | | //将产品与方案匹配 |
| | | UpdateDiscountData(arrs) { |
| | | if (this.jzDataDiscount == null || this.jzDataDiscount.length <= 0) { |
| | | this.jzDataDiscount = arrs; |
| | | } else { |
| | | this.jzDataDiscount = this.jzDataDiscount.concat(arrs); |
| | | } |
| | | } |
| | | //=========一般折扣模态框 end========= |
| | | //*********折扣政策 end********* |
| | | |
| | | //************产品明细 start*********** |
| | | //产品明细删除方法 |
| | | delectTableProduct(){ |
| | | this.DeleteIsChangesFnSingle(this.SelectedFnProductData); |
| | | } |
| | | DeleteIsChangesFnSingle(list) { |
| | | let num = 0; |
| | | list.forEach(item => { |
| | | num++; |
| | | var falg = true; |
| | | if (item.TypeName == "价格政策") { |
| | | this.DeleteIsChangelogic(item, item.TypeName, num, list); |
| | | var TempItem = DeleteIsChangesFnjiage(this.jzDataFixedPrice,this.jzDataProduct,falg,item); |
| | | falg = falgExp; |
| | | if (TempItem && falg) { |
| | | this.SelectedFnDataFixedPrice.push(TempItem); |
| | | this.deleteFixedPriceTemp(); |
| | | } |
| | | } else if (item.TypeName == "折扣政策") { |
| | | this.DeleteIsChangelogic(item, item.TypeName, num, list); |
| | | var TempItemTOName = DeleteIsChangesFnzhekou(this.jzDataDiscount,this.jzDataProduct,falg,item); |
| | | falg = falgExp; |
| | | if (TempItemTOName != undefined && falg) { |
| | | this.SelectedFnDataDiscount.push(TempItemTOName); |
| | | this.delectTableDiscountTemp(); |
| | | } |
| | | } |
| | | this.ContractPriceCompute(); |
| | | }) |
| | | } |
| | | DeleteIsChangelogic(item, TypeName, num, list) { |
| | | var boofag = DeleteIsChangelogicExp(item,TypeName,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultCopy); |
| | | this.jzDataProduct = jzDataProductExp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultCopy = jzDataDefaultCopyExp; |
| | | if(boofag == 1){ |
| | | this.Alert("促销方案内产品型号,数量固定,不可删除明细",'error'); |
| | | }else if(boofag == 2){ |
| | | this.Alert("该产品为一般产品,不可删除明细",'error'); |
| | | } |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | delectTableDiscountTemp() { |
| | | this.jzDataDiscount = delectTableDiscountTempLogic(this.SelectedFnDataDiscount,this.jzDataDiscount); |
| | | this.SelectedFnDataDiscount = []; |
| | | } |
| | | //产品明细列表数据加载方法 |
| | | getTableDataProduct(event) { |
| | | this.tableIsLodingProduct = false; |
| | | } |
| | | //产品明细选中列表数据 |
| | | @track SelectedFnProductData = []; |
| | | //产品明细选中列表方法 |
| | | SelectedFnProduct(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnProductData = arr; |
| | | } |
| | | //产品明细列表列配置 |
| | | @track |
| | | initDataTableProduct = initDataTableProduct2; |
| | | //产品明细列表数据 |
| | | @track jzDataProduct = []; |
| | | //产品明细列表加载动图标识 |
| | | @track tableIsLodingProduct = true; |
| | | //产品明细列表展示标识 |
| | | jzshows= true; |
| | | //*********产品明细 end********** |
| | | //打印客户名称 start |
| | | selection_hp = ''; |
| | | options_hp = []; |
| | | options_hpflg = true; |
| | | get PrintCustomerNameoptions() { |
| | | debugger |
| | | if (this.accountid) { |
| | | if(this.options_hpflg){ |
| | | selectAccountById({accountid : this.accountid}).then(accs =>{ |
| | | this.options_hp = PrintCustomerNameoptionsvlue(this.options_hp,this.selection_hp,this.quo,this.options_hpflg,accs); |
| | | this.selection_hp = selection_hpExp; |
| | | this.options_hpflg = options_hpflgExp; |
| | | }); |
| | | }else{ |
| | | return this.options_hp; |
| | | } |
| | | }else{ |
| | | return this.options_hp; |
| | | } |
| | | } |
| | | PrintCustomerNamehandleChange(event) { |
| | | this.selection_hp = event.detail.value; |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!-- <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <isExposed>false</isExposed> |
| | | </LightningComponentBundle> --> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexNewQuoteEntr"> |
| | | <apiVersion>57.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__Tab</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__HomePage</target> |
| | | <target>lightning__RecordAction</target> |
| | | </targets> |
| | | </LightningComponentBundle> |
| New file |
| | |
| | | export var bflag; |
| | | export var oppInfosave; |
| | | export var quoLineItemsave; |
| | | export var DataStatus; |
| | | export var newQuoteFlagex; |
| | | export var MultiYearWarrantyTotalPriceExport; |
| | | export var newQuoteFlagExp; |
| | | export var productStatusUpdatedExp; |
| | | export var quoExp; |
| | | export var selection_hpExp; |
| | | export var options_hpflgExp; |
| | | export var fagExp; |
| | | export var ListPriceTotalExp; |
| | | export var unitPriceTotalExp; |
| | | export var errorflg; |
| | | export var StrExp; |
| | | export var IsQuoteTrialExp; |
| | | export var alertExp = ''; |
| | | export var alfExp = 0; |
| | | export var nafgExp = {}; |
| | | export var flg = false; |
| | | export var tStringe = 'No.\t编码\t状态\t名称\tListPrice\t数量\t规格\t医院单价\t医院小计\t赠送\t经销商单价\t经销商小计'; |
| | | tStringe += '\t多年保修\t保修\tNoDiscount小计'; |
| | | tStringe += '\t保修期\t通货'; |
| | | var addproductList = []; |
| | | var trade; |
| | | |
| | | //选择报价产品配置列 |
| | | export var initDataTableToBeproductConfig = { |
| | | columns: [ |
| | | { |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model', |
| | | editable: false, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: 'NMPA状态', |
| | | fieldName: 'SFDA_Status__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'SFDAStatuclass' |
| | | }, |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '供应商名称', |
| | | fieldName: 'VenderName', |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '主报价价格', |
| | | fieldName: 'ListPrice_Page', |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | }, |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'ListPricePageclass' |
| | | }, |
| | | alignment: 'right' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity__c', |
| | | type: 'number', |
| | | editable: false, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '规格', |
| | | fieldName: 'Specifications', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '医院单价', |
| | | fieldName: 'UnitPrice_Page__c', |
| | | // editable: true, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right', |
| | | }, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '医院小计', |
| | | fieldName: 'Subtotal__c', |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '多年保修', |
| | | fieldName: 'multiYearWarranty__c', |
| | | type: 'boolean', |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '保修', |
| | | fieldName: 'warrantyType__c', |
| | | type: 'text', |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '保修年限', |
| | | fieldName: 'GuaranteePeriod__c', |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '预计消耗至', |
| | | fieldName: 'Estimated_ConsumptionDueDate', |
| | | type: 'date', |
| | | typeAttributes:{ |
| | | // weekday: "long", |
| | | year: "numeric", |
| | | month: "long", |
| | | day: "2-digit" |
| | | }, |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'EstimatedConsumptionDueDateclass' |
| | | }, |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '库存状态', |
| | | fieldName: 'StorageStatus', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name', |
| | | type: 'url', |
| | | typeAttributes: { |
| | | label: { |
| | | fieldName: 'Name__c' |
| | | }, |
| | | tooltip: { |
| | | fieldName: 'website' |
| | | }, |
| | | target: '_blank' |
| | | }, |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'Nameclass' |
| | | }, |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 300 |
| | | }, |
| | | |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: [] |
| | | }; |
| | | //产品配套配置列 |
| | | export var initDataSetProductTablefig = { |
| | | columns: [ |
| | | { |
| | | label: '产品配套名', |
| | | fieldName: 'Name', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '产品配套编码', |
| | | fieldName: 'Product_Set_CD__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '补足信息', |
| | | fieldName: 'Quote_Select_Info__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '有効', |
| | | fieldName: 'Valid_Status__c', |
| | | type: 'boolean', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: [] |
| | | }; |
| | | //新增产品产品配置列 |
| | | export var initDataProductTablefig = { |
| | | columns: [{ |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model_No__c', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 110 |
| | | }, |
| | | { |
| | | label: '产品编码', |
| | | fieldName: 'OT_CODE_no_link__c', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 120 |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 270 |
| | | }, |
| | | { |
| | | label: '适用科室', |
| | | fieldName: 'suitDepartment__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: '代替产品', |
| | | fieldName: 'Alternative_Products__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: 'NMPA状态', |
| | | fieldName: 'SFDA_Status__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 115 |
| | | }, |
| | | { |
| | | label: 'ListPrice(内贸)', |
| | | fieldName: 'Intra_Trade_List_RMB__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 130 |
| | | }, |
| | | { |
| | | label: 'ListPrice(外贸)', |
| | | fieldName: 'Foreign_Trade_List_US__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 130 |
| | | }, |
| | | { |
| | | label: '规格', |
| | | fieldName: 'Packing_list_manual__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 60 |
| | | }, |
| | | |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns:[] |
| | | }; |
| | | export function localParseInt( input) { |
| | | input += ""; |
| | | input = input.split(" "); |
| | | if (input.length > 1) { |
| | | input = input[1]; |
| | | } else { |
| | | input = input[0]; |
| | | } |
| | | input = input.replace(/,/g, ""); |
| | | input = input.replace(/ /g, ""); |
| | | if ( input == '' || isNaN( input)) { |
| | | input = 0; |
| | | } |
| | | input = parseInt(input); |
| | | if (isNaN( input)) input = 0.00; |
| | | return input; |
| | | } |
| | | export function number_format_common (number, decimals, dec_point, thousands_sep) { |
| | | number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); |
| | | var n = !isFinite(+number) ? 0 : +number, |
| | | prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), |
| | | sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, |
| | | dec = (typeof dec_point === 'undefined') ? '.' : dec_point, |
| | | s = '', |
| | | toFixedFix = function (n, prec) { |
| | | var k = Math.pow(10, prec); |
| | | return '' + Math.round(n * k) / k; |
| | | }; |
| | | // Fix for IE parseFloat(0.55).toFixed(0) = 0; |
| | | s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); |
| | | if (s[0].length > 3) { |
| | | s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); |
| | | } |
| | | if ((s[1] || '').length < prec) { |
| | | s[1] = s[1] || ''; |
| | | s[1] += new Array(prec - s[1].length + 1).join('0'); |
| | | } |
| | | return ( s.join(dec)); |
| | | } |
| | | export function toNum( input) { |
| | | return number_format_common( input, 2, ".", ""); |
| | | } |
| | | export function toNumComma( input) { |
| | | return number_format_common( input, 2, ".", ","); |
| | | } |
| | | export function toNumComma_One_digit(input) { |
| | | return number_format_common( input, 1, ".", ","); |
| | | } |
| | | export function localParseFloat( input) { |
| | | input += ""; |
| | | input = input.split(" "); |
| | | if (input.length > 1) { |
| | | input = input[1]; |
| | | } else { |
| | | input = input[0]; |
| | | } |
| | | input = input.replace(/,/g, ""); |
| | | input = input.replace(/ /g, ""); |
| | | if ( input == '' || isNaN( input)) { |
| | | input = 0.00; |
| | | } |
| | | input = parseFloat(input); |
| | | if (isNaN( input)) input = 0.00; |
| | | return input; |
| | | } |
| | | //复制按钮change |
| | | export function NewQcopyLogic(Check_Your_Clipboard,records,x,targetString,reslut,displayCost,CurrencyIsoCode){ |
| | | records=reslut; |
| | | alfExp = false; |
| | | alertExp = ''; |
| | | for (var i = 0; i < records.length; i++) { |
| | | x = records[i]; |
| | | //判断空 |
| | | // x=IfCopyProperties(x); |
| | | targetString += '\r\n' + (i + 1) + '\t' + '=MID(( "_" & "' + x.ProductCode__c + '"),2,LEN("' + '_' + x.ProductCode__c + '")-1)' + '\t' + x.SFDA_Status__c + '\t' + x.Name__c + '\t' + toNumComma(x.ListPrice__c) + '\t' + x.Quantity + '\t' + (x.Qty_Unit__c == null ? '' : x.Qty_Unit__c) + '\t' + toNumComma(x.UnitPrice__c) + '\t' + toNumComma(x.UnitPrice__c * x.Quantity) + |
| | | '\t' + x.Present__c + '\t' + toNumComma_One_digit(x.AgencyUnitPrice__c) + '\t' + toNumComma_One_digit(x.AgencySubtotal__c); |
| | | if (!x.warrantyType__c) { |
| | | x.warrantyType__c = ''; |
| | | } |
| | | targetString += '\t' + x.multiYearWarranty__c + '\t' + x.warrantyType__c + |
| | | '\t' + toNumComma(x.NoDiscountTotal__c); |
| | | targetString += '\t' + x.GuaranteePeriod__c; |
| | | ; |
| | | if (displayCost) { |
| | | targetString += '\t' + toNumComma(x.Cost__c) + '\t' + CurrencyIsoCode; |
| | | } |
| | | } |
| | | try { |
| | | console.warn(targetString); |
| | | var tag = document.createElement('textarea'); |
| | | tag.setAttribute('id', 'cp_hgz_textarea'); |
| | | var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length; |
| | | tag.maxLength=strlenght+666; |
| | | tag.value = targetString; |
| | | document.getElementsByTagName('body')[0].appendChild(tag); |
| | | document.getElementById('cp_hgz_textarea').select(); |
| | | document.execCommand('copy'); |
| | | document.getElementById('cp_hgz_textarea').remove(); |
| | | alfExp = true; |
| | | alertExp = Check_Your_Clipboard; |
| | | } catch (error) { |
| | | alfExp = false; |
| | | alertExp = error; |
| | | } |
| | | } |
| | | export function productCompareLogic(jzDataToBeproduct,id2Product,t,b){ |
| | | debugger |
| | | bflag = b; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var a = jzdtbt.pageObject.Id__c; |
| | | if (a != '') { |
| | | var newProductGuranteePrice = 0; |
| | | var newProductServicePrice = 0; |
| | | var newMaintenance_Price_Year = 0; |
| | | if (t == '外貿') { |
| | | var recordTypeRecord = id2Product[a]; |
| | | var y1 = recordTypeRecord.Name; |
| | | var y2 = recordTypeRecord.Foreign_Trade_List_US__c; |
| | | var y3 = recordTypeRecord.Foreign_Trade_Cost_US__c; |
| | | newProductGuranteePrice = recordTypeRecord.Intra_Trade_Foreign_RMB__c; |
| | | newProductServicePrice = recordTypeRecord.NoDiscount_Foreign__c; |
| | | newMaintenance_Price_Year = recordTypeRecord.Repair_Contract_USD__c; |
| | | } else { |
| | | var recordTypeRecord = id2Product[a]; |
| | | var y1 = recordTypeRecord.Name; |
| | | var y2 = recordTypeRecord.Intra_Trade_List_RMB__c; |
| | | var y3 = recordTypeRecord.Intra_Trade_Cost_RMB__c; |
| | | newProductGuranteePrice = recordTypeRecord.Intra_Trade_Gurantee_RMB__c; |
| | | newProductServicePrice = recordTypeRecord.Intra_Trade_Service_RMB__c; |
| | | newMaintenance_Price_Year = recordTypeRecord.Maintenance_Price_Year__c; |
| | | } |
| | | // 保修类型 |
| | | var newGuranteeType = recordTypeRecord.GuranteeType__c; |
| | | if (!newGuranteeType) { |
| | | var newGuranteeType = ''; |
| | | } |
| | | var newProductEntend_gurantee_period_all = recordTypeRecord.Entend_gurantee_period_all__c; |
| | | var oldGuranteeType = jzdtbt.pageObject.GuranteeType__c; |
| | | var oldProductEntend_gurantee_period_all = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c; |
| | | var oldProductGuranteePrice = jzdtbt.ProductGuranteePrice; |
| | | var oldProductServicePrice = jzdtbt.pageObject.productServicePrice__c; |
| | | var oldMaintenance_Price_Year = jzdtbt.Maintenance_Price_Year; |
| | | oldProductServicePrice = localParseFloat(oldProductServicePrice); |
| | | newProductServicePrice = localParseFloat(newProductServicePrice); |
| | | oldProductGuranteePrice = localParseFloat(oldProductGuranteePrice); |
| | | newProductGuranteePrice = localParseFloat(newProductGuranteePrice); |
| | | newProductEntend_gurantee_period_all = localParseFloat(newProductEntend_gurantee_period_all); |
| | | oldMaintenance_Price_Year = localParseFloat(oldMaintenance_Price_Year); |
| | | newMaintenance_Price_Year = localParseFloat(newMaintenance_Price_Year); |
| | | var y4 = recordTypeRecord.SFDA_Status__c; |
| | | var s1 = recordTypeRecord.StorageStatus__c; |
| | | var x1 = jzdtbt.pageObject.Name__c; |
| | | var x2 = jzdtbt.ListPrice_Page; |
| | | var x3 = jzdtbt.Cost_c; |
| | | var x4 = jzdtbt.pageObject.SFDA_Status__c; |
| | | //連続半角スペース対応 |
| | | y1 = y1 + ''; |
| | | // y1 = y1.replace(/\s+/g, " "); |
| | | x2 = localParseFloat(x2); |
| | | x3 = localParseFloat(x3); |
| | | y2 = localParseFloat(y2); |
| | | y3 = localParseFloat(y3); |
| | | if ((x1 === y1) && (x2 === y2) && (x3 === y3) && (x4 === y4) |
| | | && |
| | | (oldGuranteeType === newGuranteeType) && |
| | | (oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all) && |
| | | (oldProductGuranteePrice === newProductGuranteePrice) && |
| | | (oldProductServicePrice === newProductServicePrice) && |
| | | (oldMaintenance_Price_Year === newMaintenance_Price_Year) |
| | | ) {} else { |
| | | console.warn('x1 === y1'+(x1 === y1)); |
| | | console.warn('x2 === y2'+(x2 === y2)); |
| | | console.warn('x3 === y3'+(x3 === y3)); |
| | | console.warn('x4 === y4'+(x4 === y4)); |
| | | console.warn('oldGuranteeType === newGuranteeType'+(oldGuranteeType === newGuranteeType)); |
| | | console.warn('oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all'+(oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all)); |
| | | console.warn('oldProductGuranteePrice === newProductGuranteePrice'+(oldProductGuranteePrice === newProductGuranteePrice)); |
| | | console.warn('oldProductServicePrice === newProductServicePrice'+(oldProductServicePrice === newProductServicePrice)); |
| | | console.warn('oldMaintenance_Price_Year === newMaintenance_Price_Year'+(oldMaintenance_Price_Year === newMaintenance_Price_Year)); |
| | | bflag = false; |
| | | } |
| | | |
| | | jzdtbt.latestInfo.GuranteeType = newGuranteeType; |
| | | jzdtbt.latestInfo.ProductEntend_gurantee_period_all = newProductEntend_gurantee_period_all; |
| | | jzdtbt.latestInfo.Intra_Trade_Gurantee = localParseFloat(recordTypeRecord.Intra_Trade_Gurantee_RMB__c); |
| | | jzdtbt.latestInfo.Intra_Trade_Service = localParseFloat(recordTypeRecord.Intra_Trade_Service_RMB__c); |
| | | jzdtbt.latestInfo.Maintenance_Price_Year = localParseFloat(recordTypeRecord.Maintenance_Price_Year__c); |
| | | jzdtbt.latestInfo.ProductName = recordTypeRecord.Name; |
| | | jzdtbt.latestInfo.ListPrice = y2; |
| | | jzdtbt.latestInfo.Cost = y3; |
| | | jzdtbt.latestInfo.SFDA_Status = y4; |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function TimeToString(newDate){ |
| | | var value=newDate.toLocaleDateString(); |
| | | var value2=value.split('/'); |
| | | if(value2[1].length == 1){ |
| | | value2[1]='0'+value2[1]; |
| | | } |
| | | if(value2[2].length == 1){ |
| | | value2[2]='0'+value2[2]; |
| | | } |
| | | value=value2[0]+'-'+value2[1]+'-'+value2[2]; |
| | | return value; |
| | | } |
| | | export function saveEvoluationLogic(quoin,oppInfoIn,quoLineItemIn){ |
| | | debugger |
| | | var quo ={...{},...quoin}; |
| | | quo.Dealer_Final_Price_Page__c = quoin.Dealer_Final_Price_Page__c!=undefined&&quoin.Dealer_Final_Price_Page__c!=='' ?localParseFloat(quoin.Dealer_Final_Price_Page__c):null; |
| | | quo.OCM_Agent1_Price_Page__c = quoin.OCM_Agent1_Price_Page__c!=undefined &&quoin.OCM_Agent1_Price_Page__c!==''? localParseFloat(quoin.OCM_Agent1_Price_Page__c):null; |
| | | quo.MultiYearWarrantyTotalPrice__c = quoin.MultiYearWarrantyTotalPrice__c!=undefined? localParseFloat(quoin.MultiYearWarrantyTotalPrice__c):null; |
| | | quo.Estimation_List_Price__c = quoin.Estimation_List_Price__c!=undefined? localParseFloat(quoin.Estimation_List_Price__c):null; |
| | | quo.QuoteTotal_Page__c = quoin.QuoteTotal_Page__c !=undefined?localParseFloat(quoin.QuoteTotal_Page__c):null; |
| | | quo.Agency1_Profit__c = quoin.Agency1_Profit__c !=undefined?localParseFloat(quoin.Agency1_Profit__c):null; |
| | | quo.Agency1_Profit_Rate__c = quoin.Agency1_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency1_Profit_Rate__c):null; |
| | | quo.Agent1_Agent2_Price_Page__c = quoin.Agent1_Agent2_Price_Page__c!=undefined &&quoin.Agent1_Agent2_Price_Page__c!=='' ?localParseFloat(quoin.Agent1_Agent2_Price_Page__c):null; |
| | | quo.Agency2_Profit__c = quoin.Agency2_Profit__c !=undefined?localParseFloat(quoin.Agency2_Profit__c):null; |
| | | quo.Agency2_Profit_Rate__c = quoin.Agency2_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency2_Profit_Rate__c):null; |
| | | quo.Quote_Adjust_Amount_Page__c = quoin.Quote_Adjust_Amount_Page__c !=undefined&&quoin.Quote_Adjust_Amount_Page__c!==''?localParseFloat(quoin.Quote_Adjust_Amount_Page__c):null; |
| | | console.warn(quoin.Quote_Adjust_Amount_Page__c); |
| | | console.warn(quoin.Quote_Adjust_Amount_Page__c !=undefined && quoin.Quote_Adjust_Amount_Page__c!==''); |
| | | console.warn(quoin.Quote_Adjust_Amount_Page__c !=undefined); |
| | | console.warn(quoin.Quote_Adjust_Amount_Page__c!='0'); |
| | | quo.Quote_Adjust_Calculate__c = quoin.Quote_Adjust_Calculate__c !=undefined&&quoin.Quote_Adjust_Calculate__c!==''?localParseFloat(quoin.Quote_Adjust_Calculate__c):null; |
| | | quo.Stocking_Price__c = quoin.Stocking_Price__c!=undefined? localParseFloat(quoin.Stocking_Price__c):null; |
| | | quo.Discount_Amount__c = quoin.Discount_Amount__c !=undefined?localParseFloat(quoin.Discount_Amount__c):null; |
| | | quo.AgencyDiscount__c = quoin.AgencyDiscount__c !=undefined?localParseFloat(quoin.AgencyDiscount__c):null; |
| | | quo.Discount_Amount_Calculate__c = quoin.Discount_Amount_Calculate__c !=undefined?localParseFloat(quoin.Discount_Amount_Calculate__c):null; |
| | | debugger |
| | | quo.PriceRefreshDate__c =quoin.PriceRefreshDate__c? TimeToString(new Date(quoin.PriceRefreshDate__c)):null; |
| | | quo.CreatedDate =quoin.CreatedDate? TimeToString(new Date(quoin.CreatedDate)):null; |
| | | quo.Quote_Expiration_Date__c =quoin.Quote_Expiration_Date__c? TimeToString(new Date(quoin.Quote_Expiration_Date__c)):null; |
| | | quo.Agency1__c =quoin.Agency1__c? quoin.Agency1__c:null; |
| | | quo.Agency2__c =quoin.Agency2__c? quoin.Agency2__c:null; |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = quoin.OCM_Sales_Forecast__c!=undefined? localParseFloat(quoin.OCM_Sales_Forecast__c):null; |
| | | //预测金额修改 fy |
| | | |
| | | var oppInfo ={...{},...oppInfoIn}; |
| | | oppInfo.Wholesale_Price__c =oppInfoIn.Wholesale_Price__c!=undefined? localParseFloat(oppInfoIn.Wholesale_Price__c):null; |
| | | oppInfosave = oppInfo; |
| | | |
| | | var quoitemList = [...[],...quoLineItemIn]; |
| | | quoitemList.forEach(quoitem=>{ |
| | | debugger |
| | | quoitem.pageObject.Quantity__c = quoitem.Quantity__c; |
| | | quoitem.pageObject.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c); |
| | | quoitem.pageObject.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c); |
| | | quoitem.pageObject.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c); |
| | | quoitem.pageObject.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page); |
| | | quoitem.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c); |
| | | quoitem.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c); |
| | | quoitem.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c); |
| | | quoitem.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page); |
| | | quoitem.pageObject.multiYearWarranty__c = quoitem.multiYearWarranty__c; |
| | | quoitem.pageObject.GuaranteePeriod__c = quoitem.GuaranteePeriod__c; |
| | | quoitem.pageObject.warrantyType__c = quoitem.warrantyType__c; |
| | | quoitem.pageObject.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c); |
| | | quoitem.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c); |
| | | // quoitem.pageObject.SFDA_Status__c = quoitem.SFDA_Status__c; |
| | | quoitem.pageObject.Name__c = quoitem.Name__c; |
| | | quoitem.pageObject.Subtotal__c = localParseFloat(quoitem.Subtotal__c); |
| | | quoitem.Subtotal__c = localParseFloat(quoitem.Subtotal__c); |
| | | quoitem.Cost_Subtotal_c = localParseFloat(quoitem.Cost_Subtotal_c); |
| | | }); |
| | | quoLineItemsave = quoitemList; |
| | | |
| | | return quo; |
| | | } |
| | | export function jzProductsearchLogic(result){ |
| | | debugger |
| | | var jzProductData =[...[],...result]; |
| | | jzProductData.forEach(izpd=>{ |
| | | izpd.Asset_Model_No__c = izpd.Product2.Asset_Model_No__c; |
| | | izpd.OT_CODE_no_link__c = izpd.Product2.OT_CODE_no_link__c; |
| | | izpd.Name = izpd.Product2.Name; |
| | | izpd.suitDepartment__c = izpd.Product2.suitDepartment__c; |
| | | izpd.Alternative_Products__c = izpd.Product2.Alternative_Products__c; |
| | | izpd.SFDA_Status__c = izpd.Product2.SFDA_Status__c; |
| | | izpd.SFDA_Status__c = SFDAtranslate(izpd.SFDA_Status__c); |
| | | izpd.Intra_Trade_List_RMB__c = izpd.Product2.Intra_Trade_List_RMB__c; |
| | | izpd.Foreign_Trade_List_US__c = izpd.Product2.Foreign_Trade_List_US__c; |
| | | izpd.Packing_list_manual__c = izpd.Product2.Packing_list_manual__c; |
| | | }); |
| | | return jzProductData; |
| | | } |
| | | export function additionaljzProductLogic(selectvlue,Listvalue,tradec,IsQuoteTrial){ |
| | | IsQuoteTrialExp = IsQuoteTrial; |
| | | debugger |
| | | var LineNoList = []; |
| | | Listvalue.forEach(lsv=>{ |
| | | lsv.lineNo = localParseInt(lsv.lineNo); |
| | | if(lsv.lineNo){ |
| | | LineNoList.push(lsv.lineNo); |
| | | } |
| | | }); |
| | | var maxLineNo = FindMaximumMalue(LineNoList); |
| | | maxLineNo += 1; |
| | | // var newvalueList = []; |
| | | selectvlue.forEach(selectv=>{ |
| | | debugger |
| | | alertExp = ''; |
| | | // var newvalue = {...{},...selectv}; |
| | | // var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c; |
| | | // var GuranteeType = selectv.Product2.GuranteeType__c; |
| | | //是否登录报价 |
| | | if(selectv.Product2.Estimation_Entry_Possibility__c=='×' ){ |
| | | var Estimation_Entry_Possibility = true; |
| | | }else{ |
| | | var Estimation_Entry_Possibility = false; |
| | | } |
| | | //内贸成本 |
| | | if(selectv.Product2.Intra_Trade_Cost_RMB__c > 0 ){ |
| | | var CostFlag= false; |
| | | }else{ |
| | | var CostFlag = true; |
| | | } |
| | | //内外贸 |
| | | trade = tradec; |
| | | //内贸报价金额 |
| | | var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c; |
| | | //外贸报价金额 |
| | | var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c; |
| | | //外贸成本 |
| | | var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c; |
| | | //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql start |
| | | // var Intra_Trade_Gurantee_USD = selectv.Product2.Intra_Trade_Foreign_RMB__c; |
| | | // var Intra_Trade_Service_USD = selectv.Product2.NoDiscount_Foreign__c; |
| | | // var Maintenance_Price_Year_USD = selectv.Product2.Repair_Contract_USD__c; |
| | | if(trade == "CNY") { |
| | | if(Estimation_Entry_Possibility){ |
| | | alertExp = '产品未登录报价时不可报价!'; |
| | | }else if(CostFlag){ |
| | | alertExp = '产品的成本为空时不可报价!'; |
| | | }else if(!Intra_Trade_List_RMB__c||Intra_Trade_List_RMB__c<0){ |
| | | alertExp = '产品的报价金额为空时不可报价!'; |
| | | }else{ |
| | | SetProductId(maxLineNo, selectv); |
| | | } |
| | | //外贸 |
| | | }else if(trade == "USD"){ |
| | | if(Estimation_Entry_Possibility){ |
| | | alertExp = '产品未登录报价时不可报价!'; |
| | | } |
| | | else if(!Foreign_Trade_List_US__c||Foreign_Trade_List_US__c<0 ){ |
| | | alertExp = '产品的报价金额为空时不可报价!'; |
| | | }else if(!Foreign_Trade_Cost_US__c||Foreign_Trade_Cost_US__c<0){ |
| | | alertExp = '产品的成本为空时不可报价!'; |
| | | }else{ |
| | | SetProductId(maxLineNo, selectv); |
| | | } |
| | | } |
| | | maxLineNo++; |
| | | }); |
| | | Listvalue = Listvalue.concat(addproductList); |
| | | addproductList = [] |
| | | return Listvalue; |
| | | } |
| | | export function FindMaximumMalue(value){ |
| | | if(value.length!=0){ |
| | | var max = getMaximin(value,"max"); |
| | | }else{ |
| | | var max = 0; |
| | | } |
| | | |
| | | return max; |
| | | } |
| | | function getMaximin(arr,maximin) { |
| | | if(maximin=="max") { |
| | | return Math.max.apply(Math,arr); |
| | | } |
| | | else if(maximin=="min") { |
| | | return Math.min.apply(Math, arr); |
| | | } |
| | | } |
| | | function SetProductId(lineno,selectv){ |
| | | var Product2 = {}; |
| | | var PricebookEntry = {Product2:Product2}; |
| | | var latestInfo = {}; |
| | | var pageObject = {}; |
| | | var addobj = {PricebookEntry:PricebookEntry, |
| | | latestInfo:latestInfo, |
| | | pageObject:pageObject}; |
| | | var Asset_Model_No__c = selectv.Product2.Asset_Model_No__c; |
| | | var Product2Id = selectv.Product2Id; |
| | | var SFDA_Status__c = selectv.Product2.SFDA_Status__c |
| | | var SFDA_Status = selectv.Product2.SFDA_Status__c; |
| | | var Estimated_ConsumptionDueDate__c = selectv.Product2.Estimated_ConsumptionDueDate__c; |
| | | var name = selectv.Product2.Name; |
| | | var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c; |
| | | var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c; |
| | | var NameCode = selectv.Product2.ProductCode; |
| | | var Sales_Possibility = selectv.Product2.Sales_Possibility__c; |
| | | var Intra_Trade_Cost_RMB__c = selectv.Product2.Intra_Trade_Cost_RMB__c; |
| | | var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c; |
| | | var Packing_list_manual__c = selectv.Product2.Packing_list_manual__c; |
| | | var Bsscategory = selectv.Product2.BSSCategory__c; |
| | | var PricebookEntryId = selectv.Id; |
| | | var StorageStatus__c = selectv.Product2.StorageStatus__c; |
| | | var Intra_Trade_Gurantee_USD = selectv.Product2.Intra_Trade_Foreign_RMB__c; |
| | | var Intra_Trade_Service_USD = selectv.Product2.NoDiscount_Foreign__c; |
| | | var Maintenance_Price_Year_USD = selectv.Product2.Repair_Contract_USD__c; |
| | | |
| | | addobj.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c; |
| | | addobj.StorageStatus = StorageStatus__c; |
| | | addobj.lineNo = parseInt(lineno); |
| | | addobj.Asset_Model = Asset_Model_No__c; |
| | | addobj.SFDA_Status__c = SFDA_Status__c; |
| | | addobj.SFDA_Status__c = SFDAtranslate(addobj.SFDA_Status__c); |
| | | addobj.Estimated_ConsumptionDueDate = Estimated_ConsumptionDueDate__c; |
| | | addobj.Estimated_ConsumptionDueDate1 = Estimated_ConsumptionDueDate__c; |
| | | addobj.pageObject.SFDA_Status__c = SFDA_Status; |
| | | addobj.latestInfo.Specifications = Packing_list_manual__c; |
| | | addobj.Specifications = Packing_list_manual__c; |
| | | addobj.Name = '/'+Product2Id; |
| | | addobj.Name__c = name; |
| | | addobj.pageObject.Name__c = name; |
| | | var ListPrice = 0; |
| | | var Cost_c = 0; |
| | | // var Extend_new_product_gurantee = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee__c")).val(); |
| | | |
| | | // var Extend_new_product_gurantee_MD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee_MD__c")).val(); |
| | | |
| | | var GuranteeType = selectv.Product2.GuranteeType__c; |
| | | var Entend_gurantee_period_all = selectv.Product2.Entend_gurantee_period_all__c; |
| | | var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c; |
| | | var Intra_Trade_Service_RMB = selectv.Product2.Intra_Trade_Service_RMB__c; |
| | | var Maintenance_Price_Year = selectv.Product2.Maintenance_Price_Year__c; |
| | | if(selectv.Product2.VenderName__c==null||selectv.Product2.VenderName__c==null){ |
| | | var VenderName =' 无 '; |
| | | }else{ |
| | | var VenderName = selectv.Product2.VenderName__c; |
| | | } |
| | | var CanNotCancelledGurantee = selectv.Product2.CanNotCancelledGurantee__c; |
| | | var Is_DangerousChemicals = selectv.Product2.Is_DangerousChemicals__c; |
| | | var ProductGuranteePrice = 0; |
| | | var ProductServicePrice = 0; |
| | | var productMaintenance_Price_Year = 0; |
| | | if(trade == "CNY") { |
| | | ProductGuranteePrice = Intra_Trade_Gurantee_RMB; |
| | | ProductServicePrice = Intra_Trade_Service_RMB; |
| | | productMaintenance_Price_Year = Maintenance_Price_Year; |
| | | ListPrice = Intra_Trade_List_RMB__c; |
| | | Cost_c = Intra_Trade_Cost_RMB__c; |
| | | } else if(trade == "USD"){ |
| | | ProductGuranteePrice = Intra_Trade_Gurantee_USD; |
| | | ProductServicePrice = Intra_Trade_Service_USD; |
| | | productMaintenance_Price_Year = Maintenance_Price_Year_USD; |
| | | ListPrice = Foreign_Trade_List_US__c; |
| | | Cost_c = Foreign_Trade_Cost_US__c; |
| | | } |
| | | Cost_c = toNum(Cost_c); |
| | | // ListPrice = toNum(ListPrice); |
| | | // addobj.ListPrice_Page = toNumComma(ListPrice); |
| | | addobj.ListPrice_Page = ListPrice; |
| | | addobj.pageObject.ListPrice_Page = ListPrice; |
| | | addobj.Quantity__c = 1; |
| | | // addobj.UnitPrice_Page__c = toNumComma(ListPrice); |
| | | addobj.UnitPrice_Page__c = ListPrice; |
| | | // addobj.Subtotal__c = toNumComma(ListPrice); |
| | | addobj.Subtotal__c = ListPrice; |
| | | addobj.pageObject.Subtotal__c = ListPrice; |
| | | addobj.latestInfo.ProductCode = NameCode; |
| | | addobj.latestInfo.ProductName = name; |
| | | addobj = MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c); |
| | | addobj.latestInfo.SFDA_Status = SFDA_Status__c; |
| | | addobj.latestInfo.Sales_Possibility = Sales_Possibility; |
| | | addobj.latestInfo.ListPrice = ListPrice; |
| | | addobj.latestInfo.Cost = Cost_c; |
| | | addobj.Cost_c = Cost_c; |
| | | addobj.Cost_Subtotal_c = Cost_c; |
| | | addobj.pageObject.BSS_Category__c = Bsscategory; |
| | | addobj.pageObject.Id__c = Product2Id; |
| | | addobj.pageObject.PricebookEntryId = PricebookEntryId; |
| | | addobj.pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all; |
| | | addobj.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | addobj.latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | addobj.pageObject.GuranteeType__c = GuranteeType; |
| | | addobj.VenderName = VenderName; |
| | | addobj.CanNotCancelledGurantee = CanNotCancelledGurantee; |
| | | addobj.Is_DangerousChemicals = Is_DangerousChemicals; |
| | | addobj.ProductGuranteePrice = ProductGuranteePrice; |
| | | addobj.pageObject.productServicePrice__c = ProductServicePrice; |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | addobj.Category5 = selectv.Product2.Category5__c; |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | addproductList.push(addobj); |
| | | // if(VenderName != 'OSH'&&VenderName != ''){ |
| | | // window.opener.j$(escapeVfId('Page:mainForm:block:lists:'+lineno+':UnitPrice')).attr('disabled','disabled'); |
| | | // } |
| | | IsQuoteTrialExp = false; |
| | | } |
| | | function MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c){ |
| | | |
| | | var date1 = new Date(); |
| | | var seperator = "/"; |
| | | var year = date1.getFullYear(); |
| | | var month = date1.getMonth() + 1; |
| | | var day = date1.getDate(); |
| | | if (month >= 1 && month <= 9) { |
| | | month = "0" + month; |
| | | } |
| | | if (day >= 0 && day <= 9) { |
| | | day = "0" + day; |
| | | } |
| | | var currentdate = year + seperator + month + seperator + day; |
| | | |
| | | //预计消耗到期日 - 当前日 相差天数(difDate) |
| | | var ndate = new Date(currentdate); |
| | | var nowDate = ndate.getTime(); |
| | | var edate = new Date(Estimated_ConsumptionDueDate__c); |
| | | var endDate = edate.getTime(); |
| | | var difDate = (endDate - nowDate)/((1000 * 60 * 60 * 24)); |
| | | |
| | | //判断 |
| | | if(difDate < 90){ |
| | | addobj.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | return addobj; |
| | | } |
| | | export function MarkRed(quoitemList) { |
| | | quoitemList.forEach(item=>{ |
| | | var a = item.Asset_Model; |
| | | var b = item.Estimated_ConsumptionDueDate; |
| | | if (a != '') { |
| | | var date1 = new Date(); |
| | | var seperator = "/"; |
| | | var year = date1.getFullYear(); |
| | | var month = date1.getMonth() + 1; |
| | | var day = date1.getDate(); |
| | | if (month >= 1 && month <= 9) { |
| | | month = "0" + month; |
| | | } |
| | | if (day >= 0 && day <= 9) { |
| | | day = "0" + day; |
| | | } |
| | | var currentdate = year + seperator + month + seperator + day; |
| | | |
| | | //预计消耗到期日 - 当前日 相差天数(difDate) |
| | | var ndate = new Date(currentdate); |
| | | var nowDate = ndate.getTime(); |
| | | var edate = new Date(b); |
| | | var endDate = edate.getTime(); |
| | | var difDate = (endDate - nowDate) / ((1000 * 60 * 60 * 24)); |
| | | |
| | | //判断 |
| | | if (difDate < 90) { |
| | | item.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps'; |
| | | }else{ |
| | | item.EstimatedConsumptionDueDateclass = ''; |
| | | } |
| | | } |
| | | }); |
| | | return quoitemList; |
| | | } |
| | | export function filterNameoptionList(){ |
| | | var optionList = [{label:'--无--',value: ''}, |
| | | {label:'消化科',value: '消化科'}, |
| | | {label:'呼吸科',value: '呼吸科'}, |
| | | {label:'普外科',value: '普外科'}, |
| | | {label:'泌尿科',value: '泌尿科'}, |
| | | {label:'妇科',value: '妇科'}, |
| | | {label:'耳鼻喉科',value: '耳鼻喉科'}, |
| | | {label:'能量',value: '能量'}, |
| | | {label:'SI',value: 'SI'}, |
| | | {label:'外科通用',value: '外科通用'}]; |
| | | return optionList; |
| | | } |
| | | export function SelectDone(activities){ |
| | | debugger |
| | | var setPFString = ''; |
| | | activities.forEach(arc=>{ |
| | | if(!setPFString){ |
| | | setPFString = arc.Id; |
| | | }else{ |
| | | setPFString = setPFString+','+arc.Id; |
| | | } |
| | | }); |
| | | DataStatus = 'Fin'; |
| | | return setPFString; |
| | | } |
| | | //初始化产品赋值 |
| | | export function InitializeProductAssignment(quoteLineItem){ |
| | | debugger |
| | | console.warn(JSON.stringify(quoteLineItem)); |
| | | quoteLineItem.forEach(quotltiem=>{ |
| | | quotltiem.Quantity__c = quotltiem.pageObject.Quantity__c; |
| | | quotltiem.UnitPrice_Page__c = quotltiem.pageObject.UnitPrice_Page__c; |
| | | // quotltiem.UnitPrice_Page__c = toNumComma(quotltiem.UnitPrice_Page__c); |
| | | quotltiem.AgencySubtotal__c = quotltiem.pageObject.AgencySubtotal__c; |
| | | quotltiem.AgencyUnitPrice__c = quotltiem.pageObject.AgencyUnitPrice__c; |
| | | // quotltiem.ListPrice_Page = toNumComma(quotltiem.ListPrice_Page); |
| | | quotltiem.multiYearWarranty__c = quotltiem.pageObject.multiYearWarranty__c; |
| | | quotltiem.GuaranteePeriod__c = quotltiem.pageObject.GuaranteePeriod__c; |
| | | quotltiem.warrantyType__c = quotltiem.pageObject.warrantyType__c; |
| | | quotltiem.NoDiscountTotal__c = quotltiem.pageObject.NoDiscountTotal__c; |
| | | quotltiem.SFDA_Status__c = quotltiem.pageObject.SFDA_Status__c; |
| | | quotltiem.SFDA_Status__c = SFDAtranslate(quotltiem.SFDA_Status__c); |
| | | quotltiem.Name__c = quotltiem.pageObject.Name__c; |
| | | quotltiem.Subtotal__c = quotltiem.pageObject.Subtotal__c; |
| | | // quotltiem.Subtotal__c = toNumComma(quotltiem.Subtotal__c); |
| | | quotltiem.Name = '/'+quotltiem.pageObject.Id__c; |
| | | if((!(!quotltiem.pageObject.Product_Sales_Possibility__c || quotltiem.pageObject.Product_Sales_Possibility__c == '○') && !quotltiem.changed_sfda)){ |
| | | quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(quotltiem.haveno_Register){ |
| | | quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(quotltiem.changed_list){ |
| | | quotltiem.ListPricePageclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(quotltiem.changed_name == true || quotltiem.wrong_Register == true){ |
| | | quotltiem.Nameclass = 'slds-text-color_red'; |
| | | } |
| | | |
| | | //产品Id |
| | | }); |
| | | const inputAlignright = document.createElement('style'); |
| | | inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`; |
| | | document.body.appendChild(inputAlignright); |
| | | quoteLineItem = MarkRed(quoteLineItem); |
| | | return quoteLineItem; |
| | | } |
| | | export function actState(reslut,list){ |
| | | var reslutList = JSON.parse(reslut); |
| | | var reMap = new Map(); |
| | | reslutList.forEach(itm=>{ |
| | | var val = { |
| | | haveno_Register:itm.haveno_Register, |
| | | wrong_Register:itm.wrong_Register |
| | | }; |
| | | reMap.set(itm.pageObject.Id__c,val); |
| | | }); |
| | | list.forEach(ac=>{ |
| | | if(reMap.has(ac.pageObject.Id__c)){ |
| | | var vlu = reMap.get(ac.pageObject.Id__c); |
| | | ac.haveno_Register = vlu.haveno_Register; |
| | | ac.wrong_Register = vlu.wrong_Register; |
| | | } |
| | | if((!(!ac.pageObject.Product_Sales_Possibility__c || ac.pageObject.Product_Sales_Possibility__c == '○') && !ac.changed_sfda)){ |
| | | ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(ac.haveno_Register){ |
| | | ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(ac.changed_list){ |
| | | ac.ListPricePageclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(ac.changed_name == true || ac.wrong_Register == true){ |
| | | ac.Nameclass = 'slds-text-color_red'; |
| | | } |
| | | }); |
| | | const inputAlignright = document.createElement('style'); |
| | | inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`; |
| | | document.body.appendChild(inputAlignright); |
| | | return list; |
| | | } |
| | | export function PriceStatusUpdateLogic(jzDataToBeproduct,newQuoteFlag){ |
| | | newQuoteFlagex = newQuoteFlag; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | debugger |
| | | if ((jzdtbt.Asset_Model != null) && (jzdtbt.Asset_Model != '')&& (jzdtbt.Asset_Model.length>0)) { |
| | | // 只要更新,就生成新报价编码 |
| | | jzdtbt.ListPrice_Page = localParseFloat(jzdtbt.ListPrice_Page); |
| | | if (jzdtbt.pageObject.SFDA_Status__c != jzdtbt.latestInfo.SFDA_Status || |
| | | jzdtbt.pageObject.Name__c != jzdtbt.latestInfo.ProductName || |
| | | jzdtbt.ListPrice_Page != jzdtbt.latestInfo.ListPrice || |
| | | jzdtbt.pageObject.Cost__c != jzdtbt.latestInfo.Cost || |
| | | jzdtbt.Cost_c != jzdtbt.latestInfo.Cost |
| | | //计提金额 |
| | | || jzdtbt.ProductGuranteePrice != jzdtbt.latestInfo.Intra_Trade_Gurantee |
| | | || jzdtbt.pageObject.productServicePrice__c != jzdtbt.latestInfo.Intra_Trade_Service |
| | | // 维修合同报价 |
| | | || jzdtbt.Maintenance_Price_Year != jzdtbt.latestInfo.Maintenance_Price_Year |
| | | ) { |
| | | newQuoteFlagex = true; |
| | | } |
| | | if (jzdtbt.pageObject.Name__c != jzdtbt.latestInfo.ProductName) { |
| | | jzdtbt.changed_name = true; |
| | | } |
| | | if (jzdtbt.pageObject.SFDA_Status__c != jzdtbt.latestInfo.SFDA_Status) { |
| | | jzdtbt.changed_sfda = true; |
| | | } |
| | | if (jzdtbt.ListPrice_Page != jzdtbt.latestInfo.ListPrice) { |
| | | jzdtbt.changed_list = true; |
| | | } |
| | | if (jzdtbt.pageObject.Cost__c != jzdtbt.latestInfo.Cost) { |
| | | jzdtbt.changed_cost = true; |
| | | } |
| | | // TODO katsu SFDAステータスの確認などいらないですか(最新商品XXXの項目も) |
| | | jzdtbt.pageObject.SFDA_Status__c = jzdtbt.latestInfo.SFDA_Status; |
| | | jzdtbt.SFDA_Status__c = jzdtbt.pageObject.SFDA_Status__c; |
| | | jzdtbt.pageObject.Name__c = jzdtbt.latestInfo.ProductName; |
| | | jzdtbt.Name__c = jzdtbt.pageObject.Name__c; |
| | | jzdtbt.ListPrice_Page = jzdtbt.latestInfo.ListPrice; |
| | | jzdtbt.pageObject.Cost__c = jzdtbt.latestInfo.Cost; |
| | | jzdtbt.Cost_c = jzdtbt.latestInfo.Cost; |
| | | jzdtbt.pageObject.ProductGuranteePrice__c = jzdtbt.latestInfo.Intra_Trade_Gurantee; |
| | | jzdtbt.pageObject.GuranteeType__c = jzdtbt.latestInfo.GuranteeType; |
| | | // 计提金额 |
| | | jzdtbt.pageObject.productServicePrice__c = jzdtbt.latestInfo.Intra_Trade_Service; |
| | | // 多年保修年限 |
| | | jzdtbt.pageObject.ProductEntend_gurantee_period_all__c |
| | | = jzdtbt.latestInfo.ProductEntend_gurantee_period_all; |
| | | // 维修合同报价 |
| | | jzdtbt.Maintenance_Price_Year = jzdtbt.latestInfo.Maintenance_Price_Year; |
| | | // jzdtbt.ListPrice_Page = toNumComma(jzdtbt.ListPrice_Page); |
| | | jzdtbt.ListPrice_Page = jzdtbt.ListPrice_Page; |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function calGuranteeAllFieldsLogic(jzDataToBeproduct,quo){ |
| | | debugger |
| | | var AllGurantee_Period = quo.Gurantee_Period__c; |
| | | var contractmultiYearWarranty = true; |
| | | if (quo.multiYearWarranty__c != null) { |
| | | contractmultiYearWarranty = quo.multiYearWarranty__c; |
| | | } |
| | | var MultiYearWarrantyTotalPrice__c = 0.00; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var GuranteeType =jzdtbt.pageObject.GuranteeType__c; |
| | | // 保修类型 |
| | | var warrantyType = ''; |
| | | // 产品保修期 |
| | | var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c; |
| | | // 产品计提金额 |
| | | var ProductGuranteePrice__c = jzdtbt.ProductGuranteePrice; |
| | | // 产品 service Price |
| | | var ServicePrice = jzdtbt.pageObject.productServicePrice__c; |
| | | // 保修 |
| | | var multiYearWarranty = false; |
| | | // 是否取消保修 |
| | | var If_Cancel_Guarantee = false; |
| | | //产品主数据增加“不可取消多年保” 2020/08/28 精琢技术 wql start |
| | | var CanNotCancelledGurantee = jzdtbt.CanNotCancelledGurantee; |
| | | //产品主数据增加“不可取消多年保” 2020/08/28 精琢技术 wql end |
| | | // 老 no discount price |
| | | var oldServicePrice =jzdtbt.pageObject.ServicePrice__c; |
| | | jzdtbt.pageObject.ServicePrice__c = 0; |
| | | jzdtbt.warrantyType__c = ''; |
| | | var NoDiscountTotal = 0; |
| | | if (GuranteeType == '服务') { |
| | | multiYearWarranty = true; |
| | | jzdtbt.warrantyType__c = '服务多年保修'; |
| | | warrantyType = '服务多年保修'; |
| | | } else if (GuranteeType == '市场' && contractmultiYearWarranty == false) { |
| | | multiYearWarranty = true; |
| | | jzdtbt.pageObject.ServicePrice__c = ServicePrice; |
| | | jzdtbt.warrantyType__c = '市场多年保修'; |
| | | warrantyType = '市场多年保修'; |
| | | var Quantity =jzdtbt.Quantity__c; |
| | | MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | } |
| | | else if (GuranteeType == '市场' && contractmultiYearWarranty && CanNotCancelledGurantee) { |
| | | multiYearWarranty = true; |
| | | jzdtbt.pageObject.ServicePrice__c = ServicePrice; |
| | | jzdtbt.warrantyType__c = '市场多年保修'; |
| | | warrantyType = '市场多年保修'; |
| | | // 数量 |
| | | var Quantity = jzdtbt.Quantity__c; |
| | | MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | } |
| | | else if (GuranteeType == '市场') { |
| | | If_Cancel_Guarantee = true; |
| | | } |
| | | // if (jzdtbt.NoDiscountTotal__c != null) { |
| | | jzdtbt.NoDiscountTotal__c = toNumComma(NoDiscountTotal); |
| | | // } |
| | | |
| | | // 更新后的 no discount price |
| | | var newServicePrice = jzdtbt.pageObject.ServicePrice__c; |
| | | newServicePrice = localParseFloat(newServicePrice); |
| | | oldServicePrice = localParseFloat(oldServicePrice); |
| | | if (newServicePrice != oldServicePrice) { |
| | | var unitPrice = jzdtbt.UnitPrice_Page__c; |
| | | unitPrice = localParseFloat(unitPrice); |
| | | // jzdtbt.UnitPrice_Page__c = toNum(unitPrice + newServicePrice - oldServicePrice); |
| | | jzdtbt.UnitPrice_Page__c = unitPrice + newServicePrice - oldServicePrice; |
| | | } |
| | | jzdtbt.pageObject.If_Cancel_Guarantee__c = If_Cancel_Guarantee; |
| | | // 设置保修 |
| | | // if (jzdtbt.multiYearWarranty__c != null) { |
| | | jzdtbt.multiYearWarranty__c = multiYearWarranty; |
| | | // } |
| | | var GuranteePrice = 0; |
| | | // 计提年限 |
| | | var provistonPeriod = 0; |
| | | // 根据产品信息设置保修年限 和计提金额 |
| | | if (GuranteeType == '服务') { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | GuranteePrice = ProductGuranteePrice__c; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | } else if (GuranteeType == '市场') { |
| | | if (contractmultiYearWarranty == false) { |
| | | if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | GuranteePrice = ProductGuranteePrice__c; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | }else if (contractmultiYearWarranty && CanNotCancelledGurantee) { |
| | | if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | GuranteePrice = ProductGuranteePrice__c; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | } |
| | | else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = 1; |
| | | jzdtbt.GuaranteePeriod__c = 1; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | } |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | } |
| | | jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0; |
| | | |
| | | }); |
| | | MultiYearWarrantyTotalPriceExport = MultiYearWarrantyTotalPrice__c; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function initQuoteLineItemcheck(quoteLineItem,productStatusUpdated){ |
| | | debugger |
| | | newQuoteFlagExp = false; |
| | | productStatusUpdatedExp = productStatusUpdated; |
| | | quoteLineItem.forEach(a=>{ |
| | | if(!a.Maintenance_Price_Year){ |
| | | a.Maintenance_Price_Year = 0; |
| | | } |
| | | if(!a.latestInfo.Maintenance_Price_Year){ |
| | | a.latestInfo.Maintenance_Price_Year = 0; |
| | | } |
| | | if(!a.pageObject.GuranteeType__c){ |
| | | a.pageObject.GuranteeType__c = ''; |
| | | } |
| | | if(!a.latestInfo.GuranteeType){ |
| | | a.latestInfo.GuranteeType = ''; |
| | | } |
| | | if (a.Asset_Model) { |
| | | if(a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status |
| | | ||a.pageObject.Name__c != a.latestInfo.ProductName |
| | | ||a.ListPrice_Page != a.latestInfo.ListPrice |
| | | ||a.pageObject.Cost__c != a.latestInfo.Cost |
| | | ||a.Cost_c != a.latestInfo.Cost |
| | | ||a.ProductGuranteePrice != a.latestInfo.Intra_Trade_Gurantee |
| | | ||a.pageObject.productServicePrice__c != a.latestInfo.Intra_Trade_Service |
| | | ||a.Maintenance_Price_Year != a.latestInfo.Maintenance_Price_Year |
| | | ||a.pageObject.GuranteeType__c != a.latestInfo.GuranteeType |
| | | ||a.pageObject.ProductEntend_gurantee_period_all__c != a.latestInfo.ProductEntend_gurantee_period_all |
| | | ||a.pageObject.PricebookEntry.Product2.CanNotCancelledGurantee__c != a.latestInfo.CanNotCancelledGurantee |
| | | ) { |
| | | newQuoteFlagExp = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.pageObject.Name__c != a.latestInfo.ProductName) { |
| | | a.changed_name = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status) { |
| | | a.changed_sfda = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.ListPrice_Page != a.latestInfo.ListPrice) { |
| | | a.changed_list = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.pageObject.Cost__c != a.latestInfo.Cost) { |
| | | a.changed_cost = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | a.pageObject.SFDA_Status__c = a.latestInfo.SFDA_Status; |
| | | a.pageObject.Name__c = a.latestInfo.ProductName; |
| | | a.ListPrice_Page = a.latestInfo.ListPrice; |
| | | a.pageObject.Cost__c = a.latestInfo.Cost; |
| | | a.Cost_c = a.latestInfo.Cost; |
| | | a.ProductGuranteePrice = a.latestInfo.Intra_Trade_Gurantee; |
| | | a.pageObject.productServicePrice__c = a.latestInfo.Intra_Trade_Service; |
| | | a.Maintenance_Price_Year = a.latestInfo.Maintenance_Price_Year; |
| | | a.pageObject.ProductEntend_gurantee_period_all__c= a.latestInfo.ProductEntend_gurantee_period_all; |
| | | a.pageObject.GuranteeType__c = a.latestInfo.GuranteeType; |
| | | } |
| | | }); |
| | | return quoteLineItem; |
| | | } |
| | | //加天数 |
| | | export function addDay(dayNumber, date) { |
| | | var ms = dayNumber * (1000 * 60 * 60 * 24) |
| | | var newDate = new Date(date.getTime() + ms); |
| | | return newDate; |
| | | } |
| | | //计算两个日期之间的天数 |
| | | export function dateDaysBetween(dateStrBegin, dateStrEnd) { |
| | | if (!dateStrBegin || !dateStrEnd) return 0; |
| | | var s1 = dateStrBegin.getTime(), |
| | | s2 = dateStrEnd.getTime(); |
| | | var total = (s2 - s1) / 1000; |
| | | var day = parseInt(total / (24 * 60 * 60)); |
| | | return day; |
| | | } |
| | | /* |
| | | 计算经销商单价和经销商小计 |
| | | */ |
| | | // quoteAgencyTotalPriceAction1 |
| | | // CHAN-B4YAB8 2018/9/28 计算经销商单价和小计 start |
| | | // 如果是OCSM直销,则更改医院合同价格时会计算经销商单价和小计 |
| | | // 如果是 经销商销售,则更改 第一经销商总价是会计算经销商单价和小计 |
| | | export function quoteAgencyTotalPriceActionLogic(jzDataToBeproduct,quo,oppInfo,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){ |
| | | debugger |
| | | var s,l; |
| | | var SalesAmount1 = quo.OCM_Agent1_Price_Page__c; |
| | | var Estimation_List_Price = 0; |
| | | var thirdPartyEstimation_List_Price = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName == '' || VenderName == 'OSH') { |
| | | Estimation_List_Price = Estimation_List_Price + s * l; |
| | | } else { |
| | | thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + s * l; |
| | | } |
| | | }); |
| | | // 医院的合同金额 |
| | | var Dealer_Final_Price = quo.Dealer_Final_Price_Page__c; |
| | | // 销售渠道 |
| | | var Sales_Root = oppInfo.Sales_Root__c; |
| | | var TotalPrice = 0; |
| | | var StardardPrice = 0; |
| | | var totalAgencyPrice = 0; |
| | | var AgencySubtotal = 0; |
| | | var LastAgencySubtotal = 0; |
| | | var j = 0; |
| | | var i = -1; |
| | | var lastQuantity = 0; |
| | | Sales_Root = Sales_Root + ''; |
| | | Sales_Root = Sales_Root.replace(/\s+/g, ""); |
| | | if (Sales_Root == '经销商') { |
| | | TotalPrice = SalesAmount1; |
| | | } else { |
| | | TotalPrice = Dealer_Final_Price; |
| | | } |
| | | TotalPrice = localParseFloat(TotalPrice); |
| | | var oldTotalPrice = TotalPrice; |
| | | totalAgencyPrice = TotalPrice; |
| | | //no discount price 合计 |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | TotalPrice = TotalPrice - noDiscountPriceTotal; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | if ((s == 0) || (l == 0)) { |
| | | //処理なし |
| | | } else if (oldTotalPrice == 0) { |
| | | jzdtbt.pageObject.AgencySubtotal__c = 0; |
| | | jzdtbt.AgencySubtotal__c = toNumComma_One_digit(0); |
| | | jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(0); |
| | | } else { |
| | | StardardPrice = s * l; |
| | | StardardPrice = localParseFloat(StardardPrice); |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | //行项目 no discount price: |
| | | var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice = localParseFloat(noDiscountPrice); |
| | | var Agency_UnitPrice = (l).toFixed(1); |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName == '' || VenderName == 'OSH') { |
| | | var Agency_UnitPrice = (StardardPrice * (TotalPrice - thirdPartyEstimation_List_Price) / (Estimation_List_Price * s) + noDiscountPrice ).toFixed(1); |
| | | } |
| | | AgencySubtotal = Agency_UnitPrice * s; |
| | | jzdtbt.pageObject.AgencySubtotal__c = AgencySubtotal; |
| | | jzdtbt.AgencySubtotal__c = toNumComma_One_digit(AgencySubtotal); |
| | | jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(Agency_UnitPrice); |
| | | totalAgencyPrice = totalAgencyPrice - toNum(AgencySubtotal); |
| | | i++; |
| | | j=i; |
| | | lastQuantity = s; |
| | | LastAgencySubtotal = AgencySubtotal; |
| | | } |
| | | }); |
| | | if (oldTotalPrice != 0){ |
| | | LastAgencySubtotal = LastAgencySubtotal + totalAgencyPrice; |
| | | if(jzDataToBeproduct.length>0){ |
| | | jzDataToBeproduct[j].pageObject.AgencySubtotal__c = toNum(LastAgencySubtotal); |
| | | jzDataToBeproduct[j].AgencySubtotal__c = toNumComma_One_digit(LastAgencySubtotal); |
| | | jzDataToBeproduct[j].AgencyUnitPrice__c = toNumComma_One_digit(LastAgencySubtotal / lastQuantity); |
| | | } |
| | | } |
| | | return jzDataToBeproduct; |
| | | } |
| | | //根据行项目上产品的信息 更新多年保修行项目所有字段, 并且更新No Discount Price合计 |
| | | export function calPriceAllLogic(jzDataToBeproduct){ |
| | | var x, y, z, c; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.Quantity__c; |
| | | x = localParseInt(x); |
| | | if (x > 0) { |
| | | y = jzdtbt.UnitPrice_Page__c; |
| | | c = jzdtbt.Cost_c; |
| | | y = localParseFloat(y); |
| | | c = localParseFloat(c); |
| | | z = x * y; |
| | | // jzdtbt.Subtotal__c = toNumComma(z); |
| | | jzdtbt.Subtotal__c = z; |
| | | jzdtbt.pageObject.Subtotal__c = toNum(z); |
| | | z = x * c; |
| | | jzdtbt.Cost_Subtotal_c = toNum(z); |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function QuoteAdjustLogic(jzDataToBeproduct,quo,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){ |
| | | debugger |
| | | var x = quo.QuoteTotal_Page__c; |
| | | x = localParseFloat(x); |
| | | var y = quo.hidden_Estimation_List; |
| | | y = localParseFloat(y); |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | var thirdPartyEstimation_List_Price = 0; |
| | | var price = 0; |
| | | var Quantity = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName != '' && VenderName != 'OSH') { |
| | | price = jzdtbt.ListPrice_Page; |
| | | price = localParseFloat(price); |
| | | Quantity = jzdtbt.Quantity__c; |
| | | Quantity = localParseInt(Quantity); |
| | | thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity; |
| | | } |
| | | }); |
| | | thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price); |
| | | quo.Quote_Adjust_Amount_Page__c = toNumComma(x - noDiscountPriceTotal - y); |
| | | if (y - thirdPartyEstimation_List_Price == 0) { |
| | | quo.Quote_Adjust_Calculate__c = toNumComma(0); |
| | | } else { |
| | | quo.Quote_Adjust_Calculate__c = toNumComma((x - noDiscountPriceTotal - y) / (y - thirdPartyEstimation_List_Price) * 100); |
| | | } |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function AgencyDiscountCalculation1Logic(quo,jzDataToBeproduct,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){ |
| | | var y = quo.OCM_Agent1_Price_Page__c; |
| | | if (y != '' && y.length != 0) { |
| | | var Estimation_List_Price = quo.Estimation_List_Price__c; |
| | | y = y + ''; |
| | | y = y.replace(/ /g, ""); |
| | | if (Estimation_List_Price.length != 0) { |
| | | y = localParseFloat(y); |
| | | Estimation_List_Price = localParseFloat(Estimation_List_Price); |
| | | // 第三方产品标准定价总额 |
| | | var thirdPartyEstimation_List_Price = 0; |
| | | var price = 0; |
| | | var Quantity = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName != '' && VenderName != 'OSH') { |
| | | price = jzdtbt.ListPrice_Page; |
| | | price = localParseFloat(price); |
| | | Quantity = jzdtbt.Quantity__c; |
| | | Quantity = localParseInt(Quantity); |
| | | thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity; |
| | | } |
| | | }); |
| | | thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price); |
| | | if (Estimation_List_Price - thirdPartyEstimation_List_Price == 0) { |
| | | quo.AgencyDiscount__c = toNumComma(0); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0)); |
| | | } else { |
| | | //no discount price 合计 |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | var t = (y - noDiscountPriceTotal - thirdPartyEstimation_List_Price) / (Estimation_List_Price - thirdPartyEstimation_List_Price) * 100; |
| | | quo.AgencyDiscount__c = toNumComma(t); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(t)); |
| | | } |
| | | } else { |
| | | quo.AgencyDiscount__c = toNumComma(0); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0)); |
| | | } |
| | | } else { |
| | | quo.AgencyDiscount__c = toNumComma(0); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0)); |
| | | } |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | //检查报价行的NMPA状态 |
| | | export function checkNMPA(jzDataToBeproduct) { |
| | | var cnt = 0; |
| | | var nmpa; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | nmpa = jzdtbt.SFDA_Status__c; |
| | | if (nmpa == '停止') { |
| | | cnt = cnt + 1; |
| | | return; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | export function AlertAuthorize(oppInfo) { |
| | | var Authorized_DB_No = oppInfo.Authorized_DB_No__c; |
| | | var If_Need_Authorize = oppInfo.If_Need_Authorize__c; |
| | | if (If_Need_Authorize) { |
| | | if (Authorized_DB_No == null || Authorized_DB_No == '') { |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | export function AlertForCFDA(jzDataToBeproduct) { |
| | | var SFDA_Status__c, cnt; |
| | | cnt = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | SFDA_Status__c = jzdtbt.SFDA_Status__c; |
| | | if (SFDA_Status__c == '失效-重新申请中' || SFDA_Status__c == '失効(再申請中)') { |
| | | cnt = cnt + 1; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | export function CheckForCost(jzDataToBeproduct) { |
| | | var Cost, cnt, name; |
| | | cnt = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | Cost = jzdtbt.Cost_c; |
| | | name = jzdtbt.pageObject.Name__c; |
| | | if (name && Cost <= 0) { |
| | | cnt = cnt + 1; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | //检查是否有标准定价为0的情况 |
| | | export function CheckForListPrice(jzDataToBeproduct) { |
| | | var ListPrice, name; |
| | | var cnt = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | ListPrice = jzdtbt.ListPrice_Page; |
| | | ListPrice = localParseFloat(ListPrice); |
| | | name = jzdtbt.pageObject.Name__c; |
| | | if (name && ListPrice <= 0) { |
| | | cnt = cnt + 1; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | export function SubtotalupdateLogic(jzDataToBeproduct){ |
| | | debugger |
| | | console.warn('Unit6'); |
| | | var x, y, z; |
| | | z = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.Quantity__c; |
| | | x = localParseInt(x); |
| | | y = jzdtbt.UnitPrice_Page__c; |
| | | y = localParseFloat(y); |
| | | z = x * y; |
| | | if (jzdtbt.UnitPrice_Page__c != "") { |
| | | // jzdtbt.Subtotal__c = toNumComma(z); |
| | | jzdtbt.Subtotal__c = z; |
| | | jzdtbt.pageObject.Subtotal__c = toNum(z); |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function quoteTotalPriceActionLogic(quo,jzDataToBeproduct,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){ |
| | | var s = 0; |
| | | var x = 0; |
| | | var l = 0; |
| | | // 非第三方产品标准定价总额 |
| | | var y = 0; |
| | | var yy = 0; |
| | | // 非第三方产品报价总额 |
| | | var z = quo.QuoteTotal_Page__c; |
| | | // 产品报价总额 |
| | | var zz = 0; |
| | | z = localParseFloat(z); |
| | | //no discount price 合计 |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | x = s * l; |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | // OSH 计算标准定价总额 |
| | | if (VenderName == 'OSH' || VenderName == '') { |
| | | y = y + x; |
| | | // 非OSH 将产品报价总额 减去 第三方产品 |
| | | } else { |
| | | z = z - x; |
| | | } |
| | | }); |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | //行项目 no discount price: |
| | | var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice = localParseFloat(noDiscountPrice); |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | // 行项目 标准定价小计 |
| | | x = s * l; |
| | | x = localParseFloat(x); |
| | | if ((s == 0) || (x == 0)) { |
| | | //不处理 |
| | | } else { |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName == 'OSH' || VenderName == '') { |
| | | yy = localParseFloat(x * (z - noDiscountPriceTotal) / y); |
| | | jzdtbt.pageObject.Subtotal__c = toNum(yy + s * noDiscountPrice); |
| | | // jzdtbt.Subtotal__c = toNumComma(yy + s * noDiscountPrice); |
| | | jzdtbt.Subtotal__c = yy + s * noDiscountPrice; |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(yy / s + noDiscountPrice); |
| | | jzdtbt.UnitPrice_Page__c = yy / s + noDiscountPrice; |
| | | } else { |
| | | yy = localParseFloat(x); |
| | | } |
| | | zz = zz + yy; |
| | | } |
| | | }); |
| | | quo.QuoteTotal_Page__c = toNumComma(zz + noDiscountPriceTotal); |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | //删除产品明细和待选产品 item是选中的产品明细对象 TypeName是选中的产品明细对对应的方案类型 |
| | | export function UnitPriceUpdateLogic(quo,jzDataToBeproduct,QuoteDecision_Button){ |
| | | debugger |
| | | var num; |
| | | num = quo.Quote_Adjust_Calculate__c; |
| | | num = localParseFloat(num); |
| | | quo.Quote_Adjust_Calculate__c = toNumComma(num); |
| | | num = (100 + num) / 100; |
| | | var price = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | price = jzdtbt.ListPrice_Page; |
| | | price = localParseFloat(price); |
| | | var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice = localParseFloat(noDiscountPrice); |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (price != '' && VenderName == 'OSH') { |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice); |
| | | jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice; |
| | | } else if (price != '' && VenderName == '') { |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice); |
| | | jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice; |
| | | } |
| | | }); |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function calGuranteePeriodLogic(jzDataToBeproduct,AllGurantee_Period){ |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | // 保修 |
| | | var multiYearWarranty = true; |
| | | if (jzdtbt.multiYearWarranty__c) { |
| | | multiYearWarranty = jzdtbt.multiYearWarranty__c; |
| | | } |
| | | // 保修类型 |
| | | var warrantyType = jzdtbt.warrantyType__c; |
| | | // 产品保修类型 |
| | | var GuranteeType = jzdtbt.pageObject.GuranteeType__c; |
| | | // 产品保修期 |
| | | var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c; |
| | | // 计提年限 |
| | | var provistonPeriod = 0; |
| | | // 根据产品信息设置保修年限 |
| | | if (GuranteeType == '服务') { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | } else if (GuranteeType == '市场') { |
| | | if (multiYearWarranty == true) { |
| | | if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = 1; |
| | | jzdtbt.GuaranteePeriod__c = 1; |
| | | } |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0; |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function PrintCustomerNameoptionsvlue(options_hp,selection_hp,quo,options_hpflg,accs){ |
| | | if (JSON.stringify(accs) != "{}") { |
| | | if (accs[0].Name) { |
| | | var options_hpvalue = {}; |
| | | options_hpvalue.label = accs[0].Name; |
| | | options_hpvalue.value = accs[0].Name; |
| | | options_hp.push(options_hpvalue); |
| | | } |
| | | if (accs[0].Site) { |
| | | var options_hpvalue = {}; |
| | | options_hpvalue.label = accs[0].Site; |
| | | options_hpvalue.value = accs[0].Site; |
| | | options_hp.push(options_hpvalue); |
| | | } |
| | | if (accs[0].Alias_Name2__c) { |
| | | var options_hpvalue = {}; |
| | | options_hpvalue.label = accs[0].Alias_Name2__c; |
| | | options_hpvalue.value = accs[0].Alias_Name2__c; |
| | | options_hp.push(options_hpvalue); |
| | | } |
| | | debugger |
| | | if (!quo.Print_HP_Name__c || |
| | | (quo.Print_HP_Name__c !== accs[0].Name && |
| | | quo.Print_HP_Name__c !== accs[0].Site && |
| | | quo.Print_HP_Name__c !== accs[0].Alias_Name2__c) |
| | | ) { |
| | | selection_hp = accs[0].Name; |
| | | } else { |
| | | selection_hp = quo.Print_HP_Name__c; |
| | | } |
| | | options_hpflg = false; |
| | | } |
| | | selection_hpExp = selection_hp; |
| | | options_hpflgExp = options_hpflg; |
| | | console.warn('selection_hp'+selection_hp); |
| | | return options_hp |
| | | } |
| | | export function initquoassignment(quote,quoc,it){ |
| | | var quo = quoc |
| | | var rtn = quo.Cancel_Decide__c; |
| | | quo.rtn = !rtn ? it : !rtn; |
| | | var CreatedDateTime = new Date(quote.CreatedDate); |
| | | var PriceRefreshDate = new Date(quote.PriceRefreshDate__c); |
| | | quo.PriceRefreshPeriod = dateDaysBetween(!PriceRefreshDate ? CreatedDateTime : PriceRefreshDate,new Date()); |
| | | quo.QuoteName__c = quote.Name; |
| | | quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c); |
| | | quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c); |
| | | quo.Quote_Adjust_Amount_Page__c = toNumComma(quote.Quote_Adjust_Amount__c); |
| | | if(quo.OCM_Agent1_Price__c){ |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c); |
| | | }else{ |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | } |
| | | quo.MultiYearWarrantyTotalPrice__c = toNumComma(quo.MultiYearWarrantyTotalPrice__c); |
| | | quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c); |
| | | quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c); |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c); |
| | | //预测金额修改 fy |
| | | if(!quote.QuotationChange__c){ |
| | | quo.QuotationChange__c = ''; |
| | | } |
| | | if(!quote.Installation_location__c){ |
| | | quo.Installation_location__c = ''; |
| | | } |
| | | |
| | | if(quote.Agent1_Agent2_Price__c){ |
| | | quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c); |
| | | }else{ |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | } |
| | | quo.hidden_Estimation_List = quote.Estimation_List_Price__c; |
| | | return quo; |
| | | } |
| | | export function initquoassignmentcopy(quote,quoc,it){ |
| | | debugger |
| | | var quo = quoc |
| | | let Name = quote.Name; |
| | | var QX = Name.indexOf('已取消:'); |
| | | if (QX >= 0) { |
| | | quo.Name = quo.Name.substring(QX + 4); |
| | | } |
| | | quo.QuoteName__c = quo.Name; |
| | | quo.IsQuoteTrial__c = false; |
| | | quo.Cancel_Decide__c = false; |
| | | quo.PriceRefreshDate__c = new Date(); |
| | | quo.Quote_Date__c = null; |
| | | quo.Quote_Print_Date__c = null; |
| | | quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c); |
| | | if(quo.OCM_Agent1_Price__c){ |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c); |
| | | }else{ |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | } |
| | | quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c); |
| | | quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c); |
| | | if(quote.Agent1_Agent2_Price__c){ |
| | | quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c); |
| | | }else{ |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | } |
| | | quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c); |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c); |
| | | //预测金额修改 fy |
| | | quo.Quote_Adjust_Calculate__c = ''; |
| | | quo.Quote_Adjust_Amount_Page__c = ''; |
| | | quo.hidden_Estimation_List = quote.Estimation_List_Price__c; |
| | | quo.PriceRefreshPeriod = null; |
| | | if(!quote.QuotationChange__c){ |
| | | quo.QuotationChange__c = ''; |
| | | } |
| | | if(!quote.Installation_location__c){ |
| | | quo.Installation_location__c = ''; |
| | | } |
| | | var rtn = quo.Cancel_Decide__c; |
| | | quo.rtn = !rtn ? it : !rtn; |
| | | return quo; |
| | | } |
| | | export function salesProfit1Logic(quo,Salesprofit1value){ |
| | | var x = quo.Dealer_Final_Price_Page__c; |
| | | var y = quo.OCM_Agent1_Price_Page__c; |
| | | debugger |
| | | y = y + ''; |
| | | y = y.replace(/ /g, ""); |
| | | if (y.length == 0) { |
| | | var z = quo.Agent1_Agent2_Price_Page__c; |
| | | z = z + ''; |
| | | z = z.replace(/ /g, ""); |
| | | if (z.length == 0) { |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | Salesprofit1value = ''; |
| | | quo.Agency1_Profit__c = ''; |
| | | } else { |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(0); |
| | | Salesprofit1value = toNum(0); |
| | | quo.Agency1_Profit__c = toNumComma(0); |
| | | } |
| | | } else { |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(y); |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | var t = quo.Agent1_Agent2_Price_Page__c; |
| | | if (t.length == 0) { |
| | | Salesprofit1value = toNum(x - y); |
| | | quo.Agency1_Profit__c = toNumComma(x - y); |
| | | } else { |
| | | t = localParseFloat(t); |
| | | Salesprofit1value = toNum(t - y); |
| | | quo.Agency1_Profit__c = toNumComma(t - y); |
| | | } |
| | | } |
| | | quoExp = quo; |
| | | return Salesprofit1value; |
| | | } |
| | | export function salesCalculation1Logic(quo,Salesprofit1value,SalesCalculation1value){ |
| | | var w = quo.OCM_Agent1_Price_Page__c; |
| | | w = w + ''; |
| | | w = w.replace(/ /g, ''); |
| | | var x = Salesprofit1value; |
| | | var y = quo.Dealer_Final_Price_Page__c; |
| | | var z = quo.Agent1_Agent2_Price_Page__c; |
| | | z = z + ''; |
| | | z = z.replace(/ /g, ''); |
| | | if (w.length == 0) { |
| | | SalesCalculation1value = ''; |
| | | quo.Agency1_Profit_Rate__c = ''; |
| | | } else { |
| | | x = localParseFloat(x); |
| | | var t = 0; |
| | | if (z.length == 0) { |
| | | y = localParseFloat(y); |
| | | if (y != 0) { |
| | | t = x / y * 100; |
| | | } else { |
| | | t = 0; |
| | | } |
| | | } else { |
| | | z = localParseFloat(z); |
| | | if (z != 0) { |
| | | t = x / z * 100; |
| | | } else { |
| | | t = 0; |
| | | } |
| | | } |
| | | SalesCalculation1value = toNum(t); |
| | | quo.Agency1_Profit_Rate__c = toNumComma(t); |
| | | } |
| | | quoExp = quo; |
| | | return SalesCalculation1value; |
| | | } |
| | | export function salesProfit2Logic(quo,Salesprofit2value){ |
| | | var x = quo.Dealer_Final_Price_Page__c; |
| | | var y = quo.Agent1_Agent2_Price_Page__c; |
| | | y = y + ''; |
| | | y = y.replace(/ /g, ""); |
| | | if (y.length == 0) { |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | Salesprofit2value =''; |
| | | quo.Agency2_Profit__c = ''; |
| | | } else { |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | quo.Agent1_Agent2_Price_Page__c = toNumComma(y); |
| | | Salesprofit2value = toNum(x - y); |
| | | quo.Agency2_Profit__c = toNumComma(x - y); |
| | | } |
| | | quoExp = quo; |
| | | return Salesprofit2value; |
| | | } |
| | | /* |
| | | 计算第二经销商栏最右边的百分比 2次販売店利益率_元 = 第二经销商利润除以医院的合同金额 |
| | | */ |
| | | export function salesCalculation2Logic(quo,Salesprofit2value,SalesCalculation2value){ |
| | | var w = quo.Agent1_Agent2_Price_Page__c; |
| | | w = w + ''; |
| | | w = w.replace(/ /g, ''); |
| | | var x = Salesprofit2value; |
| | | var y = quo.Dealer_Final_Price_Page__c; |
| | | if (w.length == 0) { |
| | | SalesCalculation2value = ''; |
| | | quo.Agency2_Profit_Rate__c = ''; |
| | | } else { |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | if ((y == 0)) { |
| | | SalesCalculation2value = toNum(0); |
| | | quo.Agency2_Profit_Rate__c = toNumComma(0); |
| | | } else { |
| | | var z = x / y * 100; |
| | | SalesCalculation2value = toNum(z); |
| | | quo.Agency2_Profit_Rate__c = toNumComma(z); |
| | | } |
| | | } |
| | | quoExp = quo; |
| | | return SalesCalculation2value; |
| | | } |
| | | export function additionabuttonLoc(SelectedNewsetProduct,quo,oppInfo,jzDataToBeproduct){ |
| | | var Str = SelectDone(SelectedNewsetProduct); |
| | | var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | StrExp = Str; |
| | | return {setProduct_text:Str, |
| | | activitiesCan:quoLineItemCan, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan}; |
| | | } |
| | | export function onsaveToBeproductLoc(data,jzDataToBeproduct){ |
| | | var dataMap = new Map(); |
| | | var fag = false; |
| | | data.forEach(item=>{ |
| | | var key = Number(item.lineNo); |
| | | var value = {Quantity__c:'',UnitPrice_Page__c:''} |
| | | if(item.Quantity__c != undefined){ |
| | | value.Quantity__c = item.Quantity__c; |
| | | fag = true; |
| | | } |
| | | if(item.UnitPrice_Page__c != undefined){ |
| | | value.UnitPrice_Page__c = item.UnitPrice_Page__c; |
| | | } |
| | | dataMap.set(key,value); |
| | | }); |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var x, y, z, c; |
| | | if(dataMap.has(jzdtbt.lineNo)){ |
| | | var datavaue = dataMap.get(jzdtbt.lineNo); |
| | | if(datavaue.Quantity__c){ |
| | | jzdtbt.Quantity__c = localParseInt(datavaue.Quantity__c); |
| | | } |
| | | if(datavaue.UnitPrice_Page__c){ |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(datavaue.UnitPrice_Page__c); |
| | | jzdtbt.UnitPrice_Page__c = datavaue.UnitPrice_Page__c; |
| | | } |
| | | x = localParseInt(jzdtbt.Quantity__c); |
| | | y = localParseFloat(jzdtbt.UnitPrice_Page__c); |
| | | c = localParseFloat(jzdtbt.Cost_c); |
| | | z = x * y; |
| | | // jzdtbt.Subtotal__c = toNumComma(z) |
| | | jzdtbt.Subtotal__c = z |
| | | // jzdtbt.pageObject.Subtotal__c = toNumComma(z) |
| | | jzdtbt.pageObject.Subtotal__c = z |
| | | z = x * y; |
| | | jzdtbt.Cost_Subtotal_c = toNum(z); |
| | | } |
| | | }); |
| | | fagExp = fag; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function PrintButtonLoc(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert, |
| | | productStatusUpdated,enableSales,oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period, |
| | | quotemultiYearWarranty,selection_hp,SkipQuotefilg,QuoteDecision){ |
| | | debugger |
| | | var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var CheckItemCan = JSON.stringify(CheckItem); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | var data ={activitiesCan:quoLineItemCan, |
| | | CheckItemCan:CheckItemCan, |
| | | WinOrDecideAlertc:WinOrDecideAlert, |
| | | productStatusUpdatedc:productStatusUpdated, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan, |
| | | enableSalesc:enableSales, |
| | | oppIdc:oppId, |
| | | quoIdc:quoId, |
| | | newQuoteFlagc:newQuoteFlag, |
| | | changedAfterPrintc:changedAfterPrint, |
| | | quoteGurantee_Periodc:quoteGurantee_Period, |
| | | quotemultiYearWarrantyc:quotemultiYearWarranty, |
| | | selection_hpc:selection_hp, |
| | | SkipQuotefilgc:SkipQuotefilg, |
| | | QuoteDecisionc:QuoteDecision |
| | | }; |
| | | return data; |
| | | } |
| | | export function saverebackloc(resaut,quoId,nafg){ |
| | | alertExp = '' |
| | | var Setmap = new Map() |
| | | var key = Object.keys(resaut) |
| | | key.forEach(item=>{ |
| | | Setmap.set(item,resaut[item]); |
| | | }); |
| | | if(Setmap.has('errormessage')){ |
| | | errorflg = true; |
| | | alertExp = Setmap.get('errormessage'); |
| | | }else{ |
| | | if(Setmap.has('quoId')){ |
| | | quoId = Setmap.get('quoId'); |
| | | } |
| | | if(Setmap.has('quoId')){ |
| | | window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_self'); |
| | | // window.location.href ='/lightning/n/lexNewQuoteEntry#Id='+Setmap.get('quoId'); |
| | | flg = true; |
| | | } |
| | | errorflg = false; |
| | | } |
| | | nafgExp = resultFlag(nafg,Setmap) |
| | | return quoId; |
| | | } |
| | | // 优惠折扣 = 优惠价格 / (报价总额 - No discount price 合计); |
| | | export function DisCalculationfunctionLoc(quo){ |
| | | var x = quo.Discount_Amount__c; |
| | | x = localParseFloat(x); |
| | | var y = quo.QuoteTotal_Page__c; |
| | | y = localParseFloat(y); |
| | | if ((y == 0)) { |
| | | quo.Discount_Amount_Calculate__c = ''; |
| | | } else { |
| | | var z = 0; |
| | | z = x / y * 100; |
| | | z = z.toFixed(2); |
| | | quo.Discount_Amount_Calculate__c = toNum(z); |
| | | } |
| | | return quo; |
| | | } |
| | | // 根据医院小计计算报价总额 |
| | | export function quoteTotalPriceLoc(jzDataToBeproduct,quo,quoId,oppInfo,Saleslet){ |
| | | debugger |
| | | var x = 0; |
| | | var y = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.pageObject.Subtotal__c; |
| | | x = localParseFloat(x); |
| | | y = y + localParseFloat(x); |
| | | }); |
| | | quo.QuoteTotal_Page__c = toNumComma(y); |
| | | var z = quo.Estimation_List_Price__c; |
| | | var id = quoId; |
| | | if(!id){ |
| | | var IsQuoteTrial =quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | var mp =quo.MultiYearWarrantyTotalPrice__c; |
| | | mp = localParseFloat(mp); |
| | | var num = quo.Quote_Adjust_Calculate__c; |
| | | num = localParseFloat(num); |
| | | quo.Quote_Adjust_Calculate__c = toNumComma(num); |
| | | num = (100 + num) / 100; |
| | | z=localParseFloat(z); |
| | | var rh = oppInfo.rate_hospital; |
| | | var ra = oppInfo.rate_agency1; |
| | | quo.Dealer_Final_Price_Page__c = toNumComma(z*rh); |
| | | quo.OCM_Agent1_Price_Page__c = Saleslet ? toNumComma(z*num*ra+mp) : ''; |
| | | } |
| | | } |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | //计算隐藏 listPirce 汇总 和 UnitPrice(医院单价) 汇总 |
| | | export function calUnitPriceTotalLoc(jzDataToBeproduct){ |
| | | var ListPriceTotal = 0.0, |
| | | listPrice = 0.0; |
| | | var unitPriceTotal = 0.0, |
| | | unitPrice = 0.0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | listPrice = jzdtbt.ListPrice_Page; |
| | | unitPrice = jzdtbt.UnitPrice_Page__c; |
| | | ListPriceTotal += localParseFloat(listPrice); |
| | | unitPriceTotal += localParseFloat(unitPrice); |
| | | }); |
| | | ListPriceTotalExp = ListPriceTotal; |
| | | unitPriceTotalExp = unitPriceTotal; |
| | | jzDataToBeproduct =[].concat(jzDataToBeproduct); |
| | | return jzDataToBeproduct; |
| | | } |
| | | //判断进销商1 和 2 清空 利润百分比显示 |
| | | export function pageArrangeLoc(quo){ |
| | | if (!quo.OCM_Agent1_Price_Page__c) { |
| | | quo.Agency1_Profit__c = ''; |
| | | quo.Agency1_Profit_Rate__c = ''; |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | } |
| | | if (!quo.Agent1_Agent2_Price_Page__c) { |
| | | quo.Agency2_Profit__c = ''; |
| | | quo.Agency2_Profit_Rate__c = ''; |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | } |
| | | return quo; |
| | | } |
| | | export function openQuotePage(b, b2, b3) { |
| | | var quoid = b3; |
| | | if (b2) { |
| | | } else { |
| | | if (b) { |
| | | //openPopup('/apex/contractdetailpdf?id=quoid'); |
| | | window.open('/apex/contractdetailpdf?id=' + quoid, 'Contract'); |
| | | } else { |
| | | //openPopup('/apex/quotepdf?id=quoid'); |
| | | window.open('/apex/quotepdf?id=' + quoid, 'Quote'); |
| | | } |
| | | } |
| | | } |
| | | export function quoteinit(quo){ |
| | | if (!quo.Gurantee_Period__c) { |
| | | quo.Gurantee_Period__c = '1'; |
| | | } |
| | | if (quo.Quote_Expiration_Date__c == null) { |
| | | quo.Quote_Expiration_Date__c = addDay(30,new Date()); |
| | | } |
| | | quo.Offer_Amount__c = true; |
| | | quo.TOTAL__c = true; |
| | | quo.Preferential_Gurantee_Period__c = true; |
| | | return quo; |
| | | } |
| | | /* |
| | | 如果询价是经销商贩卖,OCM预测额销售 = 第一经销商 |
| | | 如果询价是OCM直销,OCM预测额销售 = 医院的合同金额 |
| | | */ |
| | | export function setOCMAmountc(enableSales,quo,oppInfo){ |
| | | var s, t; |
| | | s = enableSales; |
| | | if (s) { |
| | | t = quo.OCM_Agent1_Price_Page__c; |
| | | } else { |
| | | t = quo.Dealer_Final_Price_Page__c; |
| | | } |
| | | t = localParseFloat(t); |
| | | oppInfo.hidden_Wholesale_Price = toNum(t); |
| | | oppInfo.Wholesale_Price__c = toNumComma(t); |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = toNumComma(t); |
| | | quoExp = quo; |
| | | //预测金额修改 fy |
| | | return oppInfo; |
| | | } |
| | | // 优惠价格 = 报价总额 - 医院的合同金额 |
| | | // 然后调用 DisCalculation |
| | | export function DisAmountfunctionc(quo){ |
| | | var x = quo.QuoteTotal_Page__c; |
| | | x = localParseFloat(x); |
| | | var y = quo.Dealer_Final_Price_Page__c; |
| | | y = localParseFloat(y); |
| | | quo.Discount_Amount__c = toNum(x - y); |
| | | return quo; |
| | | } |
| | | export function SFDAtranslate(key){ |
| | | var value = ''; |
| | | if(key == '準備中'){ |
| | | value = '准备中'; |
| | | }else if(key == '新製品申請中'){ |
| | | value = '新产品注册中'; |
| | | }else if(key == '有効'){ |
| | | value = '有效'; |
| | | }else if(key == '失効(期限内生産済在庫対応)'){ |
| | | value = '失效或停止(注册证有效期内生产的库存品对应)'; |
| | | }else if(key == '失効(再申請中)'){ |
| | | value = '失效-重新申请中'; |
| | | }else if(key == '失効(申請無)'){ |
| | | value = '失效-不再注册'; |
| | | }else if(key == '有効(再申請中)'){ |
| | | value = '有效-重新申请中'; |
| | | }else{ |
| | | value = key; |
| | | } |
| | | return value; |
| | | } |
| | | export function decisionlol(jzDataToBeproduct,oppInfo,QuotationCalculationFag){ |
| | | var ff = false; |
| | | alertExp = ''; |
| | | var Shut = AlertForCFDA(jzDataToBeproduct); |
| | | var ifAuth = AlertAuthorize(oppInfo); |
| | | var arr = []; |
| | | var Venderflag = false; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | var prdouctName = jzdtbt.pageObject.Name__c; |
| | | if (prdouctName) { |
| | | arr.push(VenderName); |
| | | } |
| | | }); |
| | | for (var i = 0; i < arr.length; i++) { |
| | | if (arr[0] != arr[i]) { |
| | | Venderflag = true; |
| | | } |
| | | } |
| | | var listPrice = CheckForListPrice(jzDataToBeproduct); |
| | | var cost = CheckForCost(jzDataToBeproduct); |
| | | if (Shut == true) { |
| | | ff = true; |
| | | alertExp = '提示:包含重新申请CFDA的产品,不可Decide。'; |
| | | } else if (ifAuth == false) { |
| | | ff = true; |
| | | alertExp = '提示:该询价未授权,不可Decide'; |
| | | } else if (Venderflag == true) { |
| | | ff = true; |
| | | alertExp = '提示:请按照不同供应商拆单,不允许decide。'; |
| | | }else if (listPrice == true || cost == true) { |
| | | ff = true; |
| | | alertExp = '产品定价/成本为0,请联系产品本部。'; |
| | | }else if(QuotationCalculationFag){ |
| | | ff = true; |
| | | alertExp = '产品配置发生变化,请再次进行报价计算'; |
| | | } |
| | | return ff; |
| | | } |
| | | export function saveQuotel(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert,productStatusUpdated,enableSales, |
| | | oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period,quotemultiYearWarranty,selection_hp,SkipQuotefilg,quoteflg){ |
| | | var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct); |
| | | debugger |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var CheckItemCan = JSON.stringify(CheckItem); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | var SaveQuotecan = {activitiesCan:quoLineItemCan, |
| | | CheckItemCan:CheckItemCan, |
| | | WinOrDecideAlertc:WinOrDecideAlert, |
| | | productStatusUpdatedc:productStatusUpdated, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan, |
| | | enableSalesc:enableSales, |
| | | oppIdc:oppId, |
| | | quoIdc:quoId, |
| | | newQuoteFlagc:newQuoteFlag, |
| | | changedAfterPrintc:changedAfterPrint, |
| | | quoteGurantee_Periodc:quoteGurantee_Period, |
| | | quotemultiYearWarrantyc:quotemultiYearWarranty, |
| | | selection_hpc:selection_hp, |
| | | SkipQuotefilgc:SkipQuotefilg, |
| | | quoteflg:quoteflg |
| | | } |
| | | return SaveQuotecan; |
| | | } |
| | | export function resultFlag(nafg,Setmap){ |
| | | debugger |
| | | if(!Setmap){ |
| | | nafg.dfpp = false; |
| | | nafg.qname = false; |
| | | nafg.qacc = false; |
| | | nafg.qaapc = false; |
| | | nafg.Agency1 = false; |
| | | nafg.nAgency1 = false; |
| | | nafg.oapp = false; |
| | | nafg.noapp = false; |
| | | nafg.Agency2 = false; |
| | | nafg.nAgency2 = false; |
| | | nafg.aapp = false; |
| | | nafg.naapp = false; |
| | | }else{ |
| | | if(Setmap.has('dfpp')){ |
| | | nafg.dfpp = true; |
| | | }else{ |
| | | nafg.dfpp = false; |
| | | } |
| | | if(Setmap.has('qname')){ |
| | | nafg.qname = true; |
| | | }else{ |
| | | nafg.qname = false; |
| | | } |
| | | if(Setmap.has('qacc')){ |
| | | nafg.qacc = true; |
| | | }else{ |
| | | nafg.qacc = false; |
| | | } |
| | | if(Setmap.has('qaapc')){ |
| | | nafg.qaapc = true; |
| | | }else{ |
| | | nafg.qaapc = false; |
| | | } |
| | | if(Setmap.has('Agency1')){ |
| | | nafg.Agency1 = true; |
| | | }else{ |
| | | nafg.Agency1 = false; |
| | | } |
| | | if(Setmap.has('nAgency1')){ |
| | | nafg.nAgency1 = true; |
| | | }else{ |
| | | nafg.nAgency1 = false; |
| | | } |
| | | if(Setmap.has('oapp')){ |
| | | nafg.oapp = true; |
| | | }else{ |
| | | nafg.oapp = false; |
| | | } |
| | | if(Setmap.has('noapp')){ |
| | | nafg.noapp = true; |
| | | }else{ |
| | | nafg.noapp = false; |
| | | } |
| | | if(Setmap.has('Agency2')){ |
| | | nafg.Agency2 = true; |
| | | }else{ |
| | | nafg.Agency2 = false; |
| | | } |
| | | if(Setmap.has('nAgency2')){ |
| | | nafg.nAgency2 = true; |
| | | }else{ |
| | | nafg.nAgency2 = false; |
| | | } |
| | | if(Setmap.has('aapp')){ |
| | | nafg.aapp = true; |
| | | }else{ |
| | | nafg.aapp = false; |
| | | } |
| | | if(Setmap.has('naapp')){ |
| | | nafg.naapp = true; |
| | | }else{ |
| | | nafg.naapp = false; |
| | | } |
| | | } |
| | | return nafg; |
| | | } |
| | | // 计算产品标准定价总额 |
| | | export function EstimationL(jzDataToBeproduct,quo){ |
| | | var x, y, z; |
| | | x = 0; |
| | | y = 0; |
| | | z = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.ListPrice_Page; |
| | | y = jzdtbt.Quantity__c; |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | z = z + (x * y); |
| | | }); |
| | | jzDataToBeproduct =[].concat(jzDataToBeproduct); |
| | | quo.hidden_Estimation_List = toNum(z); |
| | | quo.Estimation_List_Price__c = toNumComma(z); |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function checkch(jzDataToBeproduct){ |
| | | var activities = []; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var lineId = jzdtbt.pageObject.PricebookEntryId; |
| | | if (lineId) { |
| | | var item = new Object(); |
| | | item.PricebookEntryId = jzdtbt.pageObject.PricebookEntryId; |
| | | item.SFDA_Status__c = jzdtbt.pageObject.SFDA_Status__c; |
| | | item.UnitPrice__c = localParseFloat(jzdtbt.UnitPrice_Page__c); |
| | | item.ListPrice__c = localParseFloat(jzdtbt.ListPrice_Page); |
| | | item.Quantity = localParseInt(jzdtbt.Quantity__c); |
| | | item.Is_DangerousChemicals = jzdtbt.Is_DangerousChemicals; |
| | | item.Is_CanNotCancelFlag = jzdtbt.CanNotCancelledGurantee; |
| | | activities.push(item); |
| | | } |
| | | }); |
| | | return activities; |
| | | } |
| New file |
| | |
| | | const initSearchFormProduct = [{ |
| | | label: "产品型号", |
| | | type: "text", |
| | | name: "Asset_Model_No__c", |
| | | isInput: true |
| | | }, |
| | | { |
| | | label: "产品名称", |
| | | type: "text", |
| | | name: "Name__c", |
| | | isInput: true |
| | | } |
| | | ] |
| | | export var arrTempsss = []; |
| | | export var arrProductTempsss = []; |
| | | export var NewDefaultDatass = []; |
| | | export var AddProductDatass = []; |
| | | export var jzDataFixedPriceTemps = []; |
| | | export var jzDataDiscountTemps = []; |
| | | export var DeftCopyQtyLists = []; |
| | | export var jzDataDefaultExp = []; |
| | | export var jzDataProductExp = []; |
| | | export var jzDataFixedPriceExp = []; |
| | | export var jzDataDiscountExp = []; |
| | | export var jzDataDefaultCopyQuantityListExp = []; |
| | | export var newArrsTemp3Exp = []; |
| | | export var newArrsTemp4Exp = []; |
| | | export var jzDataDefaultCopyExp = []; |
| | | export var newArrsTempExp = []; |
| | | export var newArrsTemp2Exp = []; |
| | | export var booleanExp = 0; |
| | | export var boolean2Exp = false; |
| | | export var boolean3Exp = false; |
| | | export var dataExp = []; |
| | | export var newDataExp = []; |
| | | export var newData2Exp = []; |
| | | export var newData3Exp = []; |
| | | export var editnewDateExp = []; |
| | | export var GuaranteeDiscount__cZuiXiaoExp =0; |
| | | export var NormalDiscount__cZuiXiaoExp =0; |
| | | export var CompareFullDataExp =[]; |
| | | export var HeTongTotalExp =[]; |
| | | export var SelectedFnDataFixedPriceExp = []; |
| | | export var idsExp = []; |
| | | export var CompareFullDataTempExp = []; |
| | | export var jzDataDefaultNotChangeExp = []; |
| | | export var iflagExp = false; |
| | | export var falgExp = false; |
| | | export var newTempExp = []; |
| | | export var ifnullExp = true; |
| | | export var isChangeExp; |
| | | export var buttonIsShowE; |
| | | export var initDTFP; |
| | | export var initDTD; |
| | | export var initDTOD; |
| | | export var initDTC; |
| | | |
| | | |
| | | |
| | | |
| | | export function GetName() { |
| | | } |
| | | //=======更新促销方案次数数据逻辑 |
| | | export function updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData) { |
| | | CompareFullData.forEach(item => { |
| | | if (item.ListName == "价格政策") { |
| | | var filterTemp = jzDataFixedPriceTemp.filter(fItem => { |
| | | if (fItem.Id == item.Id) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }) |
| | | if (filterTemp != undefined || filterTemp.length > 0) { |
| | | var fileterTempObject = { |
| | | ...{}, |
| | | ...filterTemp[0] |
| | | }; |
| | | fileterTempObject.Counts = item.num; |
| | | jzDataFixedPriceTemp = jzDataFixedPriceTemp.map(element => { |
| | | if (element.Id == fileterTempObject.Id) { |
| | | element = fileterTempObject; |
| | | } else { |
| | | let elementTemp = { |
| | | ...{}, |
| | | ...element |
| | | }; |
| | | element = elementTemp; |
| | | } |
| | | return element; |
| | | }); |
| | | } |
| | | } |
| | | if (item.ListName == "折扣政策") { |
| | | var filterTemp = jzDataDiscountTemp.filter(fItem => { |
| | | if (fItem.Id == item.Id) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }) |
| | | if (filterTemp != undefined || filterTemp.length > 0) { |
| | | var fileterTempObject = { |
| | | ...{}, |
| | | ...filterTemp[0] |
| | | }; |
| | | fileterTempObject.Counts = item.num; |
| | | jzDataDiscountTemp = jzDataDiscountTemp.map(element => { |
| | | if (element.Id == fileterTempObject.Id) { |
| | | element = fileterTempObject; |
| | | } else { |
| | | let elementTemp = { |
| | | ...{}, |
| | | ...element |
| | | }; |
| | | element = elementTemp; |
| | | } |
| | | return element; |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | jzDataFixedPriceTemps = jzDataFixedPriceTemp; |
| | | jzDataDiscountTemps = jzDataDiscountTemp; |
| | | } |
| | | //反算折扣时修改折扣政策逻辑 |
| | | export function ReverseCalculationModifyDiscountLogic(arrTemp1,arrProductTemp,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item){ |
| | | //price和 |
| | | var sumListCount = 0; |
| | | //nod和 |
| | | var sumNodCount = 0; |
| | | //特约折扣nod和list合 |
| | | var sumListAndNod = 0; |
| | | //含多年保产品list |
| | | var ObjectProducList=[]; |
| | | //不含多年保产品list |
| | | var NotObjectProducList=[]; |
| | | //折扣 |
| | | var NormalDisN = 0; |
| | | var NormalDisG = 0; |
| | | var distinguish = 0; |
| | | var distinguish2 = 0; |
| | | arrProductTemp.forEach(itemss => { |
| | | if(itemss.recordTypeName__c=="Authorizer"){ |
| | | if (itemss.PromotionId==Id&& |
| | | itemss.NormalDiscount__c_Input == NormalDiscount__c_Input && |
| | | itemss.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input) { |
| | | if(itemss.warrantyType__c=="市场多年保修"){ |
| | | sumListAndNod +=itemss.Quantity *(itemss.ListPrice+itemss.ServicePrice__c); |
| | | ObjectProducList.push(itemss); |
| | | }else if(itemss.warrantyType__c!="市场多年保修"){ |
| | | sumListCount += itemss.Quantity * itemss.ListPrice; |
| | | sumNodCount += itemss.Quantity * itemss.ServicePrice__c; |
| | | NotObjectProducList.push(itemss); |
| | | } |
| | | } |
| | | }else{ |
| | | if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input && |
| | | itemss.Category__c == Category__c) { |
| | | sumListCount += itemss.Quantity * itemss.ListPrice; |
| | | sumNodCount += itemss.Quantity * itemss.ServicePrice__c; |
| | | } |
| | | } |
| | | }); |
| | | if (sumListCount != 0||sumListAndNod!=0) { |
| | | if(item.JxsType=='一般折扣'||NotObjectProducList.length!=0){ |
| | | NormalDisN = ((NormalDiscount_H_Money__c - sumNodCount) / sumListCount * 100).toFixed(2); |
| | | if(item.JxsType!='一般折扣'){ |
| | | if(item.NormalDiscount__c!=undefined&&item.NormalDiscount__c!=''){ |
| | | var NormalDiscount__cc=parseFloat(item.NormalDiscount__c); |
| | | if(NormalDisN<NormalDiscount__cc){ |
| | | distinguish=1; |
| | | } |
| | | } |
| | | }else if(NormalDisN<0){ |
| | | distinguish=3; |
| | | } |
| | | } |
| | | debugger |
| | | if(ObjectProducList.length!=0){ |
| | | NormalDisG =(GuaranteeDiscount_H_Money__c/sumListAndNod*100).toFixed(2); |
| | | if(item.GuaranteeDiscount__c!=undefined&&item.GuaranteeDiscount__c!=''){ |
| | | var GuaranteeDiscount__cc=parseFloat(item.GuaranteeDiscount__c); |
| | | if(NormalDisG<GuaranteeDiscount__cc){ |
| | | distinguish2 = 2; |
| | | } |
| | | } |
| | | } |
| | | arrTemp1.forEach(arrte => { |
| | | if (item.JxsType=="一般折扣") { |
| | | if(arrte.NormalDiscount__c_Input == NormalDiscount__c_Input && |
| | | arrte.Category__c == Category__c){ |
| | | if(distinguish==1||distinguish==3){ |
| | | arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan; |
| | | item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan; |
| | | }else{ |
| | | arrte.NormalDiscount__c_Input = NormalDisN+'%'; |
| | | item.NormalDiscount__c_Input = NormalDisN+'%'; |
| | | } |
| | | } |
| | | }else if(item.JxsType=="特约折扣"){ |
| | | if(arrte.Id==Id&& |
| | | arrte.NormalDiscount__c_Input == NormalDiscount__c_Input && |
| | | arrte.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){ |
| | | |
| | | if(distinguish2==2||distinguish==1||distinguish==3){ |
| | | arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan; |
| | | item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan; |
| | | arrte.GuaranteeDiscount_H_Money__c = arrte.GuaranteeDiscount_H_Money_yuan; |
| | | item.GuaranteeDiscount_H_Money__c = item.GuaranteeDiscount_H_Money_yuan; |
| | | }else{ |
| | | if(NormalDisN!=0){ |
| | | arrte.NormalDiscount__c_Input = NormalDisN+'%'; |
| | | item.NormalDiscount__c_Input = NormalDisN+'%'; |
| | | } |
| | | if(NormalDisG!=0){ |
| | | arrte.GuaranteeDiscount__c_Input = NormalDisG+'%'; |
| | | item.GuaranteeDiscount__c_Input = NormalDisG+'%'; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | if(distinguish!=1&&distinguish2!=2&&distinguish!=3){ |
| | | arrProductTemp.forEach(arrpt => { |
| | | if(arrpt.recordTypeName__c=="Authorizer"){ |
| | | if(arrpt.PromotionId==Id&& |
| | | arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input && |
| | | arrpt.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){ |
| | | if(NormalDisN!=0){ |
| | | arrpt.NormalDiscount__c_Input = NormalDisN+'%'; |
| | | } |
| | | if(NormalDisG!=0){ |
| | | arrpt.GuaranteeDiscount__c_Input = NormalDisG+'%'; |
| | | } |
| | | } |
| | | }else{ |
| | | if (arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input && |
| | | arrpt.Category__c == Category__c) { |
| | | arrpt.NormalDiscount__c_Input = NormalDisN+'%'; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | arrTempsss =arrTemp1; |
| | | arrProductTempsss = arrProductTemp; |
| | | } |
| | | debugger |
| | | if(distinguish==1&&distinguish2!=2){ |
| | | return 1; |
| | | }else if(distinguish!=1&&distinguish2==2){ |
| | | return 2; |
| | | }else if(distinguish==1&&distinguish2==2){ |
| | | return 12; |
| | | }else if(distinguish==3){ |
| | | return 3; |
| | | }else{ |
| | | return item; |
| | | } |
| | | } |
| | | //反算折扣提示信息 |
| | | export function InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao){ |
| | | if(ffgg==1){ |
| | | return "修改错误,非对象品折扣不得小于非对象品最低折扣:"+NormalDiscount__cZuiXiao+"%"; |
| | | }else if(ffgg==2){ |
| | | return "修改错误,对象品折扣不得小于对象品最低折扣:"+GuaranteeDiscount__cZuiXiao+"%"; |
| | | }else if(ffgg==12){ |
| | | return "修改错误,对象品折扣不得小于对象品最低折扣:"+GuaranteeDiscount__cZuiXiao+"%"+",且非对象品折扣不得小于非对象品最低折扣:"+NormalDiscount__cZuiXiao+"%"; |
| | | }else if(ffgg==3){ |
| | | return "修改错误,非对象品折扣不得小于0"; |
| | | }else{ |
| | | return "数据修改成功"; |
| | | } |
| | | } |
| | | //合同价格汇总逻辑 |
| | | export function ContractPriceComputeLogic(sum,jzDataProductList,jzDataDiscountList,jzDataFixedPriceList){ |
| | | var DataDiscount = []; //折扣政策产品明细 |
| | | jzDataProductList.forEach(jdpd => { |
| | | jzDataDiscountList.forEach(jddp => { |
| | | var PromotionHeadRecordId = jddp.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Authorizer") { |
| | | if (jdpd.PromotionId == jddp.Id && //方案Id |
| | | jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //对象品折扣录入 |
| | | DataDiscount.push(jdpd); |
| | | } |
| | | } else { |
| | | if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | jddp.Category__c == jdpd.Category__c) { //折扣政策分类 |
| | | DataDiscount.push(jdpd); |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | DataDiscount.forEach(jjc => { |
| | | jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) |
| | | sum = sum + jjc.AgencySubtotal__c; |
| | | }); |
| | | jzDataFixedPriceList.forEach(jzdfp => { |
| | | var HeTongTotals = parseFloat(jzdfp.HeTongTotal) |
| | | if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") { |
| | | HeTongTotals = 0; |
| | | } |
| | | sum = sum + HeTongTotals; |
| | | }); |
| | | sum = Math.round(sum * 100) / 100; |
| | | return sum; |
| | | } |
| | | //计算过后特约折扣的合同价格 |
| | | export function SpecialPriceComputeReverse(DataDiscount,fag){ |
| | | var sum=0; |
| | | var sum1=0 |
| | | DataDiscount.forEach(jjc => { |
| | | if(jjc.warrantyType__c=="市场多年保修"){ |
| | | jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) |
| | | sum = sum + jjc.AgencySubtotal__c; |
| | | sum=parseFloat(sum.toFixed(2)); |
| | | } |
| | | if(jjc.warrantyType__c!="市场多年保修"){ |
| | | jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) |
| | | sum1 = sum1 + jjc.AgencySubtotal__c; |
| | | sum1=parseFloat(sum1.toFixed(2)); |
| | | } |
| | | }); |
| | | if(fag){ |
| | | return sum; |
| | | }else{ |
| | | return sum1; |
| | | } |
| | | } |
| | | //更改一般折扣合同价格计算合同总价逻辑 |
| | | export function GeneralDiscountContractSummaryLogic(sum,jzDataDiscountList,jzDataFixedPriceList){ |
| | | jzDataDiscountList.forEach(jddp => { |
| | | var HeTongPrice = parseFloat(jddp.HeTongPrice) |
| | | if (jddp.HeTongPrice == undefined || jddp.HeTongPrice == "") { |
| | | HeTongPrice = 0; |
| | | } |
| | | sum =sum + HeTongPrice; |
| | | }); |
| | | jzDataFixedPriceList.forEach(jzdfp =>{ |
| | | var HeTongTotals = parseFloat(jzdfp.HeTongTotal) |
| | | if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") { |
| | | HeTongTotals = 0; |
| | | } |
| | | sum =sum + HeTongTotals; |
| | | }); |
| | | sum = Math.round(sum * 100) / 100; |
| | | return sum; |
| | | } |
| | | //折扣政策匹配规则部分逻辑 |
| | | //SelectedData 选中的数据 IdStr 选中的数据Id CompareId 方案中用到的uuid |
| | | export function SpecialSavesChangePartLogic(jzDataDefaultList,SaveName, SelectedData, IdStr, CompareId,DefalutQuantity,newDicountData,jzDataDiscountList){ |
| | | var NewDefaultData = []; |
| | | var AddProductData = []; |
| | | jzDataDefaultList.forEach(defaultItem => { //待选产品 |
| | | var defaultItemTemp = { |
| | | ...{}, |
| | | ...defaultItem |
| | | }; |
| | | var SelectedList = SelectedData.itemss.filter(items => { |
| | | if (items.Id == defaultItem.Id) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }) |
| | | if (SelectedList != undefined && SelectedList.length > 0) { |
| | | var SelectedListDataTemp = { |
| | | ...{}, |
| | | ...SelectedList[0] |
| | | }; |
| | | SelectedListDataTemp.PromotionNo__c = SelectedData.PromotionNo__c; |
| | | SelectedListDataTemp.Name = SelectedData.Name; |
| | | SelectedListDataTemp.TypeName = "折扣政策"; |
| | | SelectedListDataTemp.PromotionId = IdStr; |
| | | if (SaveName == "一般折扣") { |
| | | SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c_Input; |
| | | } else { |
| | | SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c; |
| | | } |
| | | SelectedListDataTemp.GuaranteeDiscount__c_Input = SelectedData.GuaranteeDiscount__c; |
| | | SelectedListDataTemp.Category__c = SelectedData.Category__c; |
| | | SelectedListDataTemp.CompareId = CompareId; |
| | | SelectedListDataTemp.Quantity = SelectedListDataTemp.SplitQuantity; |
| | | if (defaultItemTemp.Quantity != SelectedListDataTemp.Quantity) { |
| | | defaultItemTemp.Quantity = defaultItemTemp.Quantity - SelectedListDataTemp.Quantity; |
| | | DefalutQuantity += defaultItemTemp.Quantity; |
| | | NewDefaultData.push(defaultItemTemp); |
| | | AddProductData.push(SelectedListDataTemp); |
| | | } else { |
| | | DefalutQuantity += SelectedListDataTemp.Quantity; |
| | | AddProductData.push(SelectedListDataTemp); |
| | | return |
| | | } |
| | | } else { |
| | | NewDefaultData.push(defaultItemTemp); |
| | | } |
| | | }) |
| | | NewDefaultDatass=NewDefaultData; |
| | | AddProductDatass=AddProductData; |
| | | //添加数量 |
| | | jzDataDiscountList.forEach(disItem => { //折扣政策 |
| | | var newTemp = { |
| | | ...{}, |
| | | ...disItem |
| | | }; |
| | | if (newTemp.Id == IdStr) { |
| | | newTemp.Counts = DefalutQuantity; |
| | | } |
| | | newDicountData.push(newTemp); |
| | | }) |
| | | return newDicountData; |
| | | } |
| | | //折扣政策合同价格汇总逻辑 |
| | | export function HeTongPriceComputeLogic(jzdateList,jzDataProductList){ |
| | | var HeTongPriceList = []; |
| | | jzdateList.forEach(jddp => { |
| | | var sum = 0; |
| | | var sumNor = 0; |
| | | var sumGua = 0; |
| | | var PromotionHeadRecordId = jddp.recordTypeName__c; |
| | | jzDataProductList.forEach(jdpd => { |
| | | if (PromotionHeadRecordId == "Authorizer") { |
| | | if (jddp.Id == jdpd.PromotionId && //方案Id |
| | | jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //对象品折扣录入 |
| | | if(jdpd.warrantyType__c=="市场多年保修"){ |
| | | sumGua = sumGua +jdpd.AgencySubtotal__c; |
| | | }else if(jdpd.warrantyType__c!="市场多年保修"){ |
| | | sumNor = sumNor +jdpd.AgencySubtotal__c; |
| | | } |
| | | sum = sum + jdpd.AgencySubtotal__c; |
| | | } |
| | | } else { |
| | | if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | jddp.Category__c == jdpd.Category__c) { //折扣政策分类 |
| | | sum = sum + jdpd.AgencySubtotal__c; |
| | | } |
| | | } |
| | | }); |
| | | sum = Math.round(sum * 100) / 100; |
| | | sumGua = Math.round(sumGua * 100) / 100; |
| | | sumNor = Math.round(sumNor * 100) / 100; |
| | | jddp.HeTongPrice = sum; |
| | | if(PromotionHeadRecordId == "Authorizer"){ |
| | | jddp.GuaranteeDiscount_H_Money__c = sumGua; |
| | | jddp.NormalDiscount_H_Money__c = sumNor; |
| | | }else{ |
| | | jddp.NormalDiscount_H_Money__c = sum; |
| | | } |
| | | HeTongPriceList.push(jddp); |
| | | }); |
| | | return HeTongPriceList; |
| | | } |
| | | //价格策合并明细逻辑 |
| | | export function PriceConsolidation(arrSchemes,jzdataList){ |
| | | arrSchemes.forEach(arrsch=>{ |
| | | var Setmap=new Map(); |
| | | var arrList=[]; |
| | | jzdataList.forEach(jdpd=>{ |
| | | if(arrsch.Id==jdpd.PromotionId){ |
| | | var object={}; |
| | | if(Setmap.has(jdpd.Id)){ |
| | | object={...{},...Setmap.get(jdpd.Id)}; |
| | | object.Quantity=object.Quantity+jdpd.Quantity; |
| | | Setmap.set(jdpd.Id,object); |
| | | }else{ |
| | | Setmap.set(jdpd.Id,jdpd); |
| | | } |
| | | }else{ |
| | | arrList.push(jdpd); |
| | | } |
| | | }); |
| | | for (let [k, v] of Setmap) { |
| | | arrList.push(v); |
| | | } |
| | | // jzdataList=[...[],...arrList];//20230214 |
| | | jzdataList = [].concat(arrList);//20230214 |
| | | }); |
| | | return jzdataList; |
| | | } |
| | | //合并折扣政策重复方案逻辑 |
| | | export function ConsolidatedDiscountPolicyLogic(SchemeSet,arr){ |
| | | var Setmap=new Map(); |
| | | var arr2=SchemeSet; |
| | | arr2.forEach(arrs=>{ |
| | | var object={}; |
| | | var PromotionHeadRecordId = arrs.recordTypeName__c; |
| | | if(PromotionHeadRecordId == "Authorizer"){ |
| | | var key=arrs.Id+"_"+arrs.NormalDiscount__c_Input+"_"+arrs.GuaranteeDiscount__c_Input;//方案Id/非对象品折扣录入/对象品折扣录入 |
| | | if(Setmap.has(key)){ |
| | | object={...{},...Setmap.get(key)}; |
| | | object.determine=''; |
| | | arrs.HeTongPrice=Number(arrs.HeTongPrice); |
| | | object.HeTongPrice=Number(object.HeTongPrice); |
| | | object.HeTongPrice +=arrs.HeTongPrice; |
| | | arrs.GuaranteeDiscount_H_Money__c=Number(arrs.GuaranteeDiscount_H_Money__c); |
| | | object.GuaranteeDiscount_H_Money__c=Number(object.GuaranteeDiscount_H_Money__c); |
| | | object.GuaranteeDiscount_H_Money__c +=arrs.GuaranteeDiscount_H_Money__c; |
| | | arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c); |
| | | object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c); |
| | | object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c; |
| | | Setmap.set(key,object); |
| | | }else{ |
| | | Setmap.set(key,arrs); |
| | | } |
| | | }else{ |
| | | var key=arrs.NormalDiscount__c_Input+"_"+arrs.Category__c;//非对象品折扣录入、折扣政策分类 |
| | | if(Setmap.has(key)){ |
| | | object={...{},...Setmap.get(key)}; |
| | | object.determine=''; |
| | | arrs.HeTongPrice=Number(arrs.NormalDiscount_H_Money__c); |
| | | object.HeTongPrice=Number(object.HeTongPrice); |
| | | object.HeTongPrice +=arrs.HeTongPrice; |
| | | arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c); |
| | | object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c); |
| | | object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c; |
| | | |
| | | Setmap.set(key,object); |
| | | }else{ |
| | | Setmap.set(key,arrs); |
| | | } |
| | | } |
| | | }); |
| | | for (let [k, v] of Setmap) { |
| | | arr.push(v); |
| | | } |
| | | return arr; |
| | | } |
| | | //合并折扣政策产品明细逻辑 |
| | | export function ConsolidatedDiscountDetailsLogic(arrSchemes,jzdataList){ |
| | | arrSchemes.forEach(arrsch=>{ |
| | | var Setmap=new Map(); |
| | | var arrList=[]; |
| | | jzdataList.forEach(jdpd=>{ |
| | | var PromotionHeadRecordId = arrsch.recordTypeName__c; |
| | | if(PromotionHeadRecordId == "Authorizer"){ |
| | | if(arrsch.Id==jdpd.PromotionId&&//方案Id |
| | | arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//非对象品折扣录入 |
| | | arrsch.GuaranteeDiscount__c_Input==jdpd.GuaranteeDiscount__c_Input){//对象品折扣录入 |
| | | var object={}; |
| | | if(Setmap.has(jdpd.Id)){ |
| | | object={...{},...Setmap.get(jdpd.Id)}; |
| | | object.Quantity=object.Quantity+jdpd.Quantity; |
| | | Setmap.set(jdpd.Id,object); |
| | | }else{ |
| | | Setmap.set(jdpd.Id,jdpd); |
| | | } |
| | | }else{ |
| | | arrList.push(jdpd); |
| | | } |
| | | }else{ |
| | | if(arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//非对象品折扣录入 |
| | | arrsch.Category__c==jdpd.Category__c){//折扣政策分类 |
| | | var object={}; |
| | | if(Setmap.has(jdpd.Id)){ |
| | | object={...{},...Setmap.get(jdpd.Id)}; |
| | | object.Quantity=object.Quantity+jdpd.Quantity; |
| | | Setmap.set(jdpd.Id,object); |
| | | }else{ |
| | | Setmap.set(jdpd.Id,jdpd); |
| | | } |
| | | }else{ |
| | | arrList.push(jdpd); |
| | | } |
| | | } |
| | | }); |
| | | for (let [k, v] of Setmap) { |
| | | arrList.push(v); |
| | | } |
| | | // jzdataList=[...[],...arrList];//20230214 |
| | | jzdataList = [].concat(arrList);//20230214 |
| | | }); |
| | | return jzdataList; |
| | | } |
| | | //合并上一次的报价行的逻辑 |
| | | export function addOfferLogic(TrialLine){ |
| | | var Offermap=new Map(); |
| | | var arr=[]; |
| | | var arr2=TrialLine; |
| | | arr2.forEach(arrs=>{ |
| | | var object={}; |
| | | if(Offermap.has(arrs.Id)){ |
| | | object={...{},...Offermap.get(arrs.Id)}; |
| | | object.Quantity=object.Quantity+arrs.Quantity; |
| | | Offermap.set(arrs.Id,object); |
| | | }else{ |
| | | Offermap.set(arrs.Id,arrs); |
| | | } |
| | | }); |
| | | for (let [k, v] of Offermap) { |
| | | arr.push(v); |
| | | } |
| | | return arr; |
| | | } |
| | | // ==============生成UUID |
| | | export function GetUUID() { |
| | | var s = []; |
| | | var hexDigits = "0123456789abcdef"; |
| | | for (var i = 0; i < 36; i++) { |
| | | s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); |
| | | } |
| | | s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 |
| | | s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 |
| | | s[8] = s[13] = s[18] = s[23] = "-"; |
| | | var uuid = s.join(""); |
| | | return uuid; |
| | | } |
| | | //一般产品部分逻辑 |
| | | export function partGeneralDiscountLogical(itemsss,item){ |
| | | itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity; |
| | | itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100; |
| | | itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100; |
| | | itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity; |
| | | itemsss.UseCount__c = item.Counts; |
| | | itemsss.ifNecessary__c = item.ifNecessary__c; |
| | | itemsss.recordTypeName__c = item.recordTypeName__c; |
| | | return itemsss; |
| | | } |
| | | //促销方案部分逻辑 |
| | | export function partPromotionSchemeLogical(itemsss,item,multiYearWarranty__c){ |
| | | debugger |
| | | if(multiYearWarranty__c){ |
| | | itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice); |
| | | }else{ |
| | | itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c; |
| | | } |
| | | itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity; |
| | | itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100; |
| | | itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100; |
| | | itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity; |
| | | itemsss.UseCount__c = item.Counts; |
| | | itemsss.if_Fix__c = item.if_Fix__c; |
| | | itemsss.if_Contain_Nod__c = item.if_Contain_Nod__c; |
| | | itemsss.recordTypeName__c = item.recordTypeName__c; |
| | | return itemsss; |
| | | } |
| | | //一般折扣计算逻辑 |
| | | export function commonlyDiscountLogic(itemss,item){ |
| | | var Discount__c_Input = parseFloat(item.NormalDiscount__c_Input)*0.01; |
| | | debugger |
| | | itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input) + itemss.ServicePrice__c; |
| | | itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity; |
| | | itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100; |
| | | itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100; |
| | | itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity; |
| | | itemss.Discount__c_Input = item.NormalDiscount__c_Input; |
| | | itemss.Category__c=item.Category__c; |
| | | return itemss |
| | | } |
| | | //特约折扣计算逻辑 |
| | | export function contributingDiscountLogic(itemss,Discount__c_Input,item){ |
| | | if (itemss.warrantyType__c=="市场多年保修") { |
| | | itemss.AgencyUnitPrice__c = (itemss.ListPrice + itemss.ServicePrice__c) * (Discount__c_Input*0.01); |
| | | } else { |
| | | itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input*0.01) + itemss.ServicePrice__c; |
| | | } |
| | | itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity; |
| | | itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100; |
| | | itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100; |
| | | itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity; |
| | | debugger |
| | | itemss.Discount__c_Input = Discount__c_Input+"%"; |
| | | // itemss.Discount__c_Input = Discount__c_Input; |
| | | itemss.GuaranteeDiscount__c_Input=item.GuaranteeDiscount__c_Input; |
| | | itemss.NormalDiscount__c_Input=item.NormalDiscount__c_Input; |
| | | itemss.recordTypeName__c = item.recordTypeName__c; |
| | | return itemss |
| | | } |
| | | //计算价格政策的最大次数逻辑 |
| | | export function ComputationalLogic(Pricepolicy,b,selectproducts){ |
| | | var num=0; |
| | | var flag=true; |
| | | for(var j=0;j<b.length;j++){ |
| | | if(b[j].Id_H==Pricepolicy.PromotionNo__c){ |
| | | var fg=true; |
| | | for(var i=0;i<selectproducts.length;i++){ |
| | | if(b[j].Asset_Model_No__c==selectproducts[i].Product2.MDM_Model_No__c){ |
| | | var frequency = parseInt(selectproducts[i].Quantity/b[j].Quantity__c__c); |
| | | if(frequency<1){ |
| | | fg=true; |
| | | break; |
| | | }else{ |
| | | if(flag){ |
| | | num=frequency; |
| | | flag=false; |
| | | }else{ |
| | | if(num>frequency){ |
| | | num=frequency; |
| | | } |
| | | } |
| | | } |
| | | fg=false; |
| | | } |
| | | } |
| | | if(fg){ |
| | | num=0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | var Counts = Number(Pricepolicy.Counts); |
| | | return Counts+num; |
| | | } |
| | | //替换listprice单价逻辑 |
| | | export function ReplacementUnitPriceLogic(arr,ifTrade){ |
| | | arr.forEach(jdpct => { //产品明细 |
| | | if (ifTrade == "内貿") { |
| | | jdpct.ListPrice = jdpct.Product2.Intra_Trade_List_RMB__c; |
| | | if (jdpct.multiYearWarranty__c) { |
| | | jdpct.ServicePrice__c = jdpct.Product2.Intra_Trade_Service_RMB__c; |
| | | } else { |
| | | jdpct.ServicePrice__c = 0; |
| | | } |
| | | } else if (ifTrade == "外貿") { |
| | | jdpct.ListPrice = jdpct.Product2.Foreign_Trade_List_US__c; |
| | | if (jdpct.multiYearWarranty__c) { |
| | | jdpct.ServicePrice__c = jdpct.Product2.NoDiscount_Foreign__c; |
| | | } else { |
| | | jdpct.ServicePrice__c = 0; |
| | | } |
| | | } |
| | | }); |
| | | return arr |
| | | } |
| | | //合并方案 |
| | | export function ConsolidationScheme(data,ParamIdStr,Trade__c){ |
| | | var NewData = []; |
| | | data.forEach(itms => { //价格政策和折和折扣政策 |
| | | let Temp = {}; |
| | | Temp.itemCounts = itms.Counts + ""; |
| | | Temp.Id = itms.Id; |
| | | Temp.JxsType = itms.JxsType; |
| | | //促销方案 |
| | | if (itms.JxsType != "一般折扣") { |
| | | var PromotionHeadRecordId = itms.recordTypeName__c; |
| | | //tt |
| | | if (itms.JxsType == "特约折扣") { |
| | | Temp.GuaranteeDiscountcInput = parseFloat(itms.GuaranteeDiscount__c_Input); |
| | | Temp.GuaranteeDiscountc = parseFloat(itms.GuaranteeDiscount__c); |
| | | Temp.NormalDiscountc = parseFloat(itms.NormalDiscount__c); |
| | | Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input); |
| | | } |
| | | }else{ |
| | | //tt |
| | | Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input); |
| | | } |
| | | if (PromotionHeadRecordId == 'Promotion') { |
| | | Temp.Categoryc = '促销方案'; |
| | | } |
| | | //一般产品 |
| | | else if (PromotionHeadRecordId == 'NormalProduct') { |
| | | Temp.Categoryc = '一般产品'; |
| | | } |
| | | //特约固定 |
| | | else if (PromotionHeadRecordId == 'Authorizer') { |
| | | Temp.Categoryc = '经销商固定折扣'; |
| | | } else { |
| | | Temp.Categoryc = itms.Category__c; |
| | | } |
| | | Temp.PromotionNocEqual = itms.PromotionNo__cEqual; |
| | | Temp.typess = itms.typess; |
| | | Temp.PromotionNoc = itms.PromotionNo__c; |
| | | Temp.Name = itms.Name; |
| | | Temp.ParamIdStr = ParamIdStr; |
| | | Temp.Descriptionc = itms.Description__c; |
| | | Temp.ifContainNodc = itms.if_Contain_Nod__c; |
| | | Temp.ifFixc = itms.if_Fix__c; |
| | | Temp.PriceCNYc = itms.Price_CNY__c; |
| | | Temp.Total = itms.Total; |
| | | |
| | | Temp.ListPriceTotalc = itms.sumListPrice; |
| | | Temp.sumNod = itms.sumNoDiscount; |
| | | // Temp.sumNodUSD=itms.sumNodUSD; |
| | | Temp.HeTongTotal = itms.HeTongTotal; |
| | | Temp.ifNecessaryc = itms.ifNecessary__c; |
| | | Temp.Trade = Trade__c; |
| | | Temp.maxCounts = itms.maxCounts; |
| | | Temp.CompareId = itms.CompareId; |
| | | Temp.sumNoDiscountTotal = itms.sumNoDiscountTotal; |
| | | Temp.GuaranteeDiscountHMoneyc = itms.GuaranteeDiscount_H_Money__c; |
| | | Temp.NormalDiscountHMoneyc = itms.NormalDiscount_H_Money__c; |
| | | //...c/compent |
| | | NewData.push(Temp); |
| | | }); |
| | | return NewData; |
| | | } |
| | | //待选产品数据变化字段赋值 |
| | | export function ProductAssignmentSelect(item){ |
| | | item.Quantity = item.Quantity__c; |
| | | item.Name = item.Name__c; |
| | | item.Name__c = item.Name_c__c; |
| | | item.ListPrice = item.ListPrice__c; |
| | | item.Id = item.QuoteTrialKey__c; |
| | | item.PromotionId = item.Promotion_id__c; |
| | | item.TypeName = item.TypeName__c; |
| | | item.RecordTypeId = item.RecordTypeId__c; |
| | | item.ParamIdStr = item.QuantityId__c; |
| | | item.Product2Id = item.Product2__c; |
| | | item.QuiteLineitem__c = item.QuiteLineitem__c; |
| | | return item; |
| | | } |
| | | //已选产品数据变化字段赋值 |
| | | export function ProductSelected(item){ |
| | | item.Quantity = item.Quantity__c; |
| | | item.Name = item.Name__c; |
| | | item.Name__c = item.Name_c__c; |
| | | item.ListPrice = item.ListPrice__c; |
| | | item.Id = item.QuoteTrialKey__c; |
| | | item.Product2Id = item.Product2__c; |
| | | item.Product2 = item.Product2__r; |
| | | if (item.Name == "一般折扣") { |
| | | item.PromotionId = item.PromotionSales__c; |
| | | // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c; |
| | | // item.Discount__c_Input = item.DiscountRate__c; |
| | | item.Discount__c_Input = item.DiscountRate__c+'%'; |
| | | // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c |
| | | item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%'; |
| | | } else { |
| | | item.PromotionId = item.Promotion_id__c; |
| | | if(item.TypeName__c != "价格政策"){ |
| | | // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c; |
| | | item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c+'%'; |
| | | // item.Discount__c_Input = item.DiscountRate__c; |
| | | item.Discount__c_Input = item.DiscountRate__c+'%'; |
| | | // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c; |
| | | item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%'; |
| | | // item.GuaranteeDiscount__c_Input=Number(item.GuaranteeDiscount__c_Input.toFixed(2)); |
| | | } |
| | | } |
| | | item.warrantyType__c=item.GuranteeType__c; |
| | | item.TypeName = item.TypeName__c; |
| | | item.RecordTypeId = item.RecordTypeId__c; |
| | | item.ParamIdStr = item.QuantityId__c; |
| | | item.QuiteLineitem__c = item.QuiteLineitem__c; |
| | | item.CompareId = item.CompareId__c; |
| | | // item.Discount__c_Input=Number(item.Discount__c_Input.toFixed(2)); |
| | | // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c; |
| | | // item.NormalDiscount__c_Input=Number(item.NormalDiscount__c_Input.toFixed(2)); |
| | | return item; |
| | | } |
| | | //折扣方案数据变化字段赋值 |
| | | export function UnselectedScheme(items){ |
| | | items.JxsType = items.JxsType__c; |
| | | // items.NormalDiscount__c_Input = items.NormalDiscount_c_Input__c; |
| | | items.NormalDiscount__c_Input=items.NormalDiscount_c_Input__c+'%'; |
| | | // items.NormalDiscount__c_Input=Number(items.NormalDiscount__c_Input.toFixed(2)); |
| | | items.TypeName = items.TypeName__c; |
| | | if (items.JxsType__c != "一般折扣") { |
| | | items.Id = items.PromotionHead__c; |
| | | // items.NormalDiscount__c = items.NormalDiscountc__c; |
| | | items.NormalDiscount__c=items.NormalDiscountc__c+'%'; |
| | | // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2)); |
| | | // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c; |
| | | items.GuaranteeDiscount__c=items.GuaranteeDiscount__c+'%'; |
| | | // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2)); |
| | | // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c; |
| | | items.GuaranteeDiscount__c_Input=items.GuaranteeDiscount_c_Input__c+'%'; |
| | | // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2)); |
| | | |
| | | } |
| | | // else{ |
| | | // items.NormalDiscount__c = items.NormalDiscountc__c; |
| | | // items.NormalDiscount__c=items.NormalDiscountc__c+'%'; |
| | | // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2)); |
| | | // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c; |
| | | // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2)); |
| | | // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c; |
| | | // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2)); |
| | | // } |
| | | items.ParamIdStr = items.Quote__c; |
| | | items.sumNoDiscountTotal = items.sumNoDiscountTotal__c; |
| | | items.maxCounts = items.maxCounts__c; |
| | | items.CompareId = items.CompareId__c; |
| | | return items; |
| | | } |
| | | //循环判断空 |
| | | export function IfCopyProperties(x){ |
| | | debugger |
| | | if(x.Asset_Model_No__c==undefined){ |
| | | x.Asset_Model_No__c=''; |
| | | } |
| | | if(x.Name_c__c==undefined){ |
| | | x.Name_c__c=''; |
| | | } |
| | | if(x.Quantity__c==undefined){ |
| | | x.Quantity__c=''; |
| | | } |
| | | if(x.GuranteeType__c==undefined){ |
| | | x.GuranteeType__c=''; |
| | | } |
| | | if(x.PromotionNo__c==undefined){ |
| | | x.PromotionNo__c=''; |
| | | } |
| | | if(x.Name__c==undefined){ |
| | | x.Name__c=''; |
| | | } |
| | | if(x.ListPrice__c==undefined){ |
| | | x.ListPrice__c=''; |
| | | } |
| | | if(x.NoDiscountTotal__c==undefined){ |
| | | x.NoDiscountTotal__c=''; |
| | | } |
| | | if(x.DiscountRate__c==undefined){ |
| | | x.DiscountRate__c=''; |
| | | } |
| | | if(x.AgencyUnitPrice__c==undefined){ |
| | | x.AgencyUnitPrice__c=''; |
| | | } |
| | | if(x.AgencySubtotal__c==undefined){ |
| | | x.AgencySubtotal__c=''; |
| | | } |
| | | return x; |
| | | } |
| | | //价格方案数据变化字段赋值 |
| | | export function SelectedScheme(items){ |
| | | items.Counts = items.itemCounts__c; |
| | | items.Total = items.Price_total__c; |
| | | items.HeTongTotal = items.contractPrice__c; |
| | | items.TypeName = items.TypeName__c; |
| | | items.Id = items.PromotionHead__c; |
| | | items.ParamIdStr = items.Quote__c; |
| | | if (items.trade__c == "内貿") { |
| | | items.sumListPrice = items.ListPriceTotal__c; |
| | | items.sumNoDiscount = items.NodiscountTotal__c; |
| | | } else if (items.trade__c == "外貿") { |
| | | items.sumListPrice = items.ListPriceTotalUSD__c; |
| | | items.sumNoDiscount = items.NodiscountTotalUSD__c; |
| | | } |
| | | items.sumNoDiscountTotal = items.sumNoDiscountTotal__c; |
| | | items.maxCounts = items.maxCounts__c; |
| | | return items; |
| | | } |
| | | |
| | | //合并产品 |
| | | export function MergeProducts(arr3,arr4,data,ParamIdStr){ |
| | | var NewData1 = []; |
| | | var newTemp3 = []; |
| | | arr3.forEach(itmsss => { //产品明细 |
| | | var itemTemp = { |
| | | ...{}, |
| | | ...itmsss |
| | | }; |
| | | // itemTemp.分类名称(根据 产品状态 1) 0未匹配 2)1以匹配) |
| | | itemTemp.ismatch = '1'; |
| | | newTemp3.push(itemTemp); |
| | | }); |
| | | var newTemp4 = []; |
| | | arr4.forEach(itmsss => { //待选产品 |
| | | var itemTemp = { |
| | | ...{}, |
| | | ...itmsss |
| | | }; |
| | | // itemTemp.分类名称(根据 产品状态 1) 0未匹配 2)1以匹配) |
| | | itemTemp.ismatch = '0'; |
| | | newTemp4.push(itemTemp); |
| | | }); |
| | | // var data2 = [...newTemp3, ...newTemp4];//20230213 |
| | | var data2 = newTemp3.concat(newTemp4);//20230213 |
| | | data2.forEach(itmss => { //产品明细和待选产品 |
| | | let Temp1 = {}; |
| | | Temp1.Id = itmss.Id; |
| | | Temp1.AssetModelNoc = itmss.Asset_Model_No__c; |
| | | Temp1.Namec = itmss.Name__c; |
| | | Temp1.Quantity = itmss.Quantity; |
| | | Temp1.GuranteeTypec = itmss.warrantyType__c; |
| | | Temp1.PromotionNoc = itmss.PromotionNo__c; |
| | | Temp1.Name = itmss.Name; |
| | | Temp1.ListPrice = itmss.ListPrice; |
| | | Temp1.AgencyUnitPricec = itmss.AgencyUnitPrice__c; |
| | | Temp1.AgencySubtotalc = itmss.AgencySubtotal__c; |
| | | Temp1.NoDiscountTotalc = itmss.NoDiscountTotal__c; |
| | | Temp1.ParamIdStr =ParamIdStr; |
| | | Temp1.TypeName = itmss.TypeName; |
| | | Temp1.UseCountc = itmss.UseCount__c; |
| | | if (itmss.TypeName == "价格政策") { |
| | | data.forEach(itemsss => { |
| | | if (itemsss.PromotionNo__c == itemsss.PromotionNo__c) { |
| | | Temp1.fanan_id = itemsss.Id; |
| | | } |
| | | }); |
| | | } else if (itmss.TypeName == "折扣政策") { |
| | | data.forEach(itemss => { |
| | | if (itemss.PromotionNo__c == itemss.PromotionNo__c) { |
| | | Temp1.fanan_id = itemss.Id; |
| | | } |
| | | }); |
| | | |
| | | Temp1.DiscountcInput = parseFloat(itmss.Discount__c_Input); |
| | | if(itmss.Name=="一般折扣"){ |
| | | Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input); |
| | | }else{ |
| | | Temp1.GuaranteeDiscountcInput = parseFloat(itmss.GuaranteeDiscount__c_Input); |
| | | Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input); |
| | | } |
| | | } |
| | | Temp1.ismatch = itmss.ismatch; |
| | | Temp1.PromotionId = itmss.PromotionId; |
| | | Temp1.Product2c = itmss.Product2Id; |
| | | Temp1.ServicePricec = itmss.ServicePrice__c; |
| | | Temp1.ifFixc = itmss.if_Fix__c; |
| | | Temp1.ifNecessaryc = itmss.ifNecessary__c; |
| | | Temp1.CompareId = itmss.CompareId; |
| | | Temp1.multiYearWarrantyc = itmss.multiYearWarranty__c; |
| | | Temp1.Categoryc = itmss.Category__c; |
| | | |
| | | NewData1.push(Temp1); |
| | | }); |
| | | return NewData1; |
| | | } |
| | | // //方案需要更新的字段 |
| | | export function ChangeFiexedData(key) { |
| | | var keyArr = ['Status__c', 'ifNecessary__c', 'OrderNo__c', 'Price_CNY__c', 'Price_USD__c']; |
| | | var flag = false; |
| | | keyArr.forEach(item => { |
| | | if (item == key) { |
| | | flag = true; |
| | | } |
| | | }) |
| | | return flag; |
| | | } |
| | | export function getQueryVariable(variable,location) { //id字符串 |
| | | debugger |
| | | var query = window.location.search.substring(1); |
| | | if(!query){ |
| | | query = location; |
| | | } |
| | | var vars = query.split("&"); |
| | | for (var i = 0; i < vars.length; i++) { |
| | | var pair = vars[i].split("="); |
| | | if (pair[0] == variable) { |
| | | return pair[1]; |
| | | } |
| | | } |
| | | return ''; |
| | | } |
| | | //跳转路径 |
| | | export function PathJump(DeveloperName,ParamIdStr){ |
| | | if(DeveloperName=='Opportunity'){ |
| | | // 测试非完整路径是不是可以正确跳转 |
| | | window.open('/apex/NewQuoteEntry?id=' + ParamIdStr, '_self'); |
| | | }else if(DeveloperName=='SI_Oppor'){ |
| | | // 测试非完整路径是不是可以正确跳转 |
| | | window.open('/apex/SI_NewQuoteEntry?id=' + ParamIdStr, '_self'); |
| | | } |
| | | } |
| | | //计算过后一般折扣的合同价格 |
| | | export function ContractPriceComputeReverse(DataDiscount){ |
| | | var sum=0; |
| | | DataDiscount.forEach(jjc => { |
| | | jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) |
| | | sum = sum + jjc.AgencySubtotal__c; |
| | | }); |
| | | sum=sum.toFixed(2); |
| | | return sum; |
| | | } |
| | | //复制逻辑 |
| | | export function copyLogic(Check_Your_Clipboard,records,x,targetString,reslut){ |
| | | records=reslut; |
| | | for (var i = 0; i < records.length; i++) { |
| | | x = records[i]; |
| | | //判断空 |
| | | x=IfCopyProperties(x); |
| | | targetString += '\r\n' + x. Asset_Model_No__c + '\t' + x.Name_c__c + '\t' + x.Quantity__c + '\t' + x.GuranteeType__c + '\t' + x.PromotionNo__c +'\t' + x.Name__c + '\t' + x.ListPrice__c + '\t' + x.NoDiscountTotal__c + '\t' + x.DiscountRate__c + |
| | | '\t' + x.AgencyUnitPrice__c + '\t' + x.AgencySubtotal__c ; |
| | | console.warn(x.PromotionNo__c); |
| | | } |
| | | try { |
| | | console.warn(targetString); |
| | | var tag = document.createElement('textarea'); |
| | | tag.setAttribute('id', 'cp_hgz_textarea'); |
| | | var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length; |
| | | tag.maxLength=strlenght+666; |
| | | tag.value = targetString; |
| | | document.getElementsByTagName('body')[0].appendChild(tag); |
| | | document.getElementById('cp_hgz_textarea').select(); |
| | | document.execCommand('copy'); |
| | | document.getElementById('cp_hgz_textarea').remove(); |
| | | alert(Check_Your_Clipboard); |
| | | } catch (error) { |
| | | alert(error); |
| | | } |
| | | } |
| | | //一般折扣更改过合同价格计算逻辑 |
| | | export function updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,arrProductTemp){ |
| | | var newArrsTempplus1=[]; |
| | | var newArrsTempplus2=[]; |
| | | var jzDataProductlast=[]; |
| | | jzDataDiscount.forEach(item=>{ |
| | | if(JxsType=="特约折扣"){ |
| | | if(item.JxsType=="特约折扣"){ |
| | | if (Id == item.Id) { |
| | | if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) { //对象品折扣录入 |
| | | arrProductTemp.forEach(itemss => { //itemss产品明细 |
| | | var Discount__c_Input = 0; |
| | | if (itemss.warrantyType__c=="市场多年保修") { |
| | | Discount__c_Input = item.GuaranteeDiscount__c_Input; |
| | | Discount__c_Input = parseFloat(Discount__c_Input); |
| | | } else { |
| | | Discount__c_Input = item.NormalDiscount__c_Input; |
| | | Discount__c_Input = parseFloat(Discount__c_Input); |
| | | } |
| | | debugger |
| | | if (itemss.PromotionId == item.Id && //方案Id |
| | | itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //对象品折扣录入 |
| | | itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //非对象品折扣录入 |
| | | itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //特约折扣计算逻辑 |
| | | newArrsTempplus1.push(itemss); |
| | | } else if (itemss.PromotionId != item.Id || |
| | | itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input || |
| | | itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) { |
| | | newArrsTempplus2.push(itemss); |
| | | } |
| | | }); |
| | | var newArrsplusG=[]; |
| | | var newArrsplusN=[]; |
| | | newArrsTempplus1.forEach(ntp=>{ |
| | | if(ntp.warrantyType__c=="市场多年保修"){ |
| | | newArrsplusG.push(ntp); |
| | | }else if(ntp.warrantyType__c!="市场多年保修"){ |
| | | newArrsplusN.push(ntp); |
| | | } |
| | | }); |
| | | if(newArrsplusG.length!=0){ |
| | | var yibanSumG = SpecialPriceComputeReverse(newArrsTempplus1,true); |
| | | var chazhiG=(Number(item.GuaranteeDiscount_H_Money__c)*100-Number(yibanSumG)*100)/100; |
| | | var dangechazhiG=Math.round((chazhiG/newArrsplusG[0].Quantity) * 100) / 100; |
| | | newArrsplusG[0].AgencySubtotal__c =newArrsplusG[0].AgencySubtotal__c+chazhiG; |
| | | newArrsplusG[0].AgencyUnitPrice__c =newArrsplusG[0].AgencyUnitPrice__c+dangechazhiG; |
| | | } |
| | | if(newArrsplusN.length!=0){ |
| | | var yibanSumN = SpecialPriceComputeReverse(newArrsTempplus1,false); |
| | | var chazhiN=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSumN)*100)/100; |
| | | var dangechazhiN=Math.round((chazhiN/newArrsplusN[0].Quantity) * 100) / 100; |
| | | newArrsplusN[0].AgencySubtotal__c =newArrsplusN[0].AgencySubtotal__c+chazhiN; |
| | | newArrsplusN[0].AgencyUnitPrice__c =newArrsplusN[0].AgencyUnitPrice__c+dangechazhiN; |
| | | } |
| | | // newArrsTempplus1=[...newArrsplusG,...newArrsplusN];//20230213 |
| | | newArrsTempplus1=newArrsplusG.concat(newArrsplusN);//20230213 |
| | | // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213 |
| | | jzDataProductlast = newArrsTempplus1.concat(newArrsTempplus2);//20230213 |
| | | } |
| | | } |
| | | } |
| | | }else if(JxsType=="一般折扣"){ |
| | | if(item.JxsType=="一般折扣"){ |
| | | if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && |
| | | Category__c == item.Category__c){ |
| | | arrProductTemp.forEach(itemss => { //itemss产品明细 |
| | | if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input && |
| | | itemss.Category__c == Category__c) { |
| | | itemss = commonlyDiscountLogic(itemss, item); //一般折扣计算逻辑 |
| | | newArrsTempplus1.push(itemss); |
| | | } else if (itemss.Category__c != Category__c || |
| | | itemss.NormalDiscount__c_Input != NormalDiscount__c_Input) { |
| | | newArrsTempplus2.push(itemss); |
| | | } |
| | | }); |
| | | var yibanSum = ContractPriceComputeReverse(newArrsTempplus1);//计算过后一般折扣的合同价格 |
| | | var chazhi=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSum)*100)/100; |
| | | var dangechazhi=Math.round((chazhi/newArrsTempplus1[0].Quantity) * 100) / 100; |
| | | newArrsTempplus1[0].AgencySubtotal__c =newArrsTempplus1[0].AgencySubtotal__c+chazhi; |
| | | newArrsTempplus1[0].AgencyUnitPrice__c =newArrsTempplus1[0].AgencyUnitPrice__c+dangechazhi; |
| | | // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213 |
| | | jzDataProductlast =newArrsTempplus1.concat(newArrsTempplus2);//20230213 |
| | | console.warn('newArrsTempplus2'+newArrsTempplus2); |
| | | console.warn('jzDataProductlast'+jzDataProductlast); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | return jzDataProductlast; |
| | | } |
| | | |
| | | export function countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList){ |
| | | var ListPrices = 0; |
| | | var Nodiscounts = 0; |
| | | result.forEach(itemss => { //方案主数据关联的产品 |
| | | copydate.forEach(jddc => { //报价行项目主数据 |
| | | if (itemss.Asset_Model_No__c == jddc.Product2.MDM_Model_No__c) { |
| | | if (ifTrade == "内貿") { |
| | | ListPrices += itemss.Quantity__c * jddc.Product2.Intra_Trade_List_RMB__c; |
| | | Nodiscounts += itemss.Quantity__c * jddc.Product2.Intra_Trade_Service_RMB__c; |
| | | } else if (ifTrade == "外貿") { |
| | | ListPrices += itemss.Quantity__c * jddc.Product2.Foreign_Trade_List_US__c; |
| | | Nodiscounts += itemss.Quantity__c * jddc.Product2.NoDiscount_Foreign__c; |
| | | } |
| | | var fl = true; |
| | | if (DeftCopyQtyList.length == 0) { |
| | | DeftCopyQtyList.push({ |
| | | Asset_Model_No__c: itemss.Asset_Model_No__c, |
| | | Quantity__c__c: itemss.Quantity__c, |
| | | Id_H: item.PromotionNo__c |
| | | }); |
| | | } else { |
| | | DeftCopyQtyList.forEach(jdcql => { //保存方案关联产品数量 |
| | | if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) { |
| | | fl = false; |
| | | } |
| | | }); |
| | | if (fl) { |
| | | DeftCopyQtyList.push({ |
| | | Asset_Model_No__c: itemss.Asset_Model_No__c, |
| | | Quantity__c__c: itemss.Quantity__c, |
| | | Id_H: item.PromotionNo__c |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | item.sumListPrice = ListPrices; |
| | | item.sumNoDiscount = Nodiscounts; |
| | | DeftCopyQtyLists=DeftCopyQtyList; |
| | | return item; |
| | | } |
| | | //比对报价行项目改变后试算界面的变化 |
| | | //‘试算合成待选数据’是为了与现在报价行项目进行比对,用试算产品表数据合并出的上一次进行试算的报价行项目 |
| | | //试算之前已将报价行项目相同的产品进行了合并 |
| | | //1.‘报价行项目’条数少于‘试算合成待选数据’条数时将之前的试算清空,使用新的报价行项目 |
| | | //2.当‘报价行项目’条数大于或等于‘试算合成待选数据’条数将两组数据进行比对 |
| | | // 2-1)当‘报价行项目’条数等于‘试算合成待选数据’条数时先对比两组数据(根据产品Id进行匹配) |
| | | // (2-1-1)当数据匹配成功后判断其数量字段,当‘报价行项目’数量小于‘试算合成待选数据’数量时将之前的试算清空,使用新的报价行项目 |
| | | // (2-1-2)等于则删除‘试算合成待选数据’中匹配成功的数据 |
| | | // (2-1-3)大于则用‘报价行项目’数量减去‘试算合成待选数据’数量并将这条数据存入待选报价行项目集合 |
| | | // 2-2)当比对结束后如果‘试算合成待选数据’中有数据没有被匹配则将之前的试算清空,使用新的报价行项目 |
| | | // 2-3)当‘报价行项目’条数大于‘试算合成待选数据’条数,且‘试算合成待选数据’都已匹配则将‘报价行项目’中未被匹配的数据全部存入待选报价行项目集合 |
| | | export function comparisonUniqueKeyLogic(index,flagall,jzDataDefaultCopy,jzDataDefault,jzDataProduct,jzDataFixedPrice,jzDataDiscount,lastQuotationc){ |
| | | debugger |
| | | if (index == 0) { |
| | | if (flagall) { |
| | | if (jzDataDefaultCopy.length < lastQuotationc.length) { //1、条数小于 |
| | | jzDataDefault = [].concat(jzDataDefaultCopy); |
| | | jzDataProduct = []; |
| | | jzDataFixedPrice = []; |
| | | jzDataDiscount = []; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataProductExp = jzDataProduct; |
| | | jzDataFixedPriceExp = jzDataFixedPrice; |
| | | jzDataDiscountExp = jzDataDiscount; |
| | | return; |
| | | } else { //2、 |
| | | var lastQuotation = [].concat(lastQuotationc); |
| | | var DefaultCopy = [].concat(jzDataDefaultCopy); |
| | | var Default = []; |
| | | for (var j = 0; j < DefaultCopy.length; j++) { |
| | | var arrList = []; |
| | | var fag = true |
| | | if (lastQuotation.length != 0) { |
| | | for (var i = 0; i < lastQuotation.length; i++) { |
| | | if (DefaultCopy[j].Id == lastQuotation[i].Id) { |
| | | if (DefaultCopy[j].Quantity < lastQuotation[i].Quantity) { //2-1-1 数量小于 clear |
| | | jzDataDefault = [].concat(jzDataDefaultCopy); |
| | | jzDataProduct = []; |
| | | jzDataFixedPrice = []; |
| | | jzDataDiscount = []; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataProductExp = jzDataProduct; |
| | | jzDataFixedPriceExp = jzDataFixedPrice; |
| | | jzDataDiscountExp = jzDataDiscount; |
| | | return; |
| | | } else if (DefaultCopy[j].Quantity == lastQuotation[i].Quantity) { //2-1-2 |
| | | fag = false; |
| | | } else { //2-1-3 数量大于 塞到待选产品 |
| | | DefaultCopy[j].Quantity = DefaultCopy[j].Quantity - lastQuotation[i].Quantity; |
| | | Default.push(DefaultCopy[j]); |
| | | fag = false; |
| | | } |
| | | } else { |
| | | arrList.push(lastQuotation[i]); |
| | | } |
| | | } |
| | | lastQuotation = arrList; |
| | | if (fag) { |
| | | Default.push(DefaultCopy[j]); |
| | | } |
| | | |
| | | } else { //2-3 条数大于 将数据塞到待选产品 |
| | | Default.push(DefaultCopy[j]); |
| | | } |
| | | } |
| | | if (lastQuotation.length != 0) { //2-2 合成数据有剩余 |
| | | jzDataDefault = [].concat(jzDataDefaultCopy); |
| | | jzDataProduct = []; |
| | | jzDataFixedPrice = []; |
| | | jzDataDiscount = []; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataProductExp = jzDataProduct; |
| | | jzDataFixedPriceExp = jzDataFixedPrice; |
| | | jzDataDiscountExp = jzDataDiscount; |
| | | return; |
| | | } |
| | | jzDataDefault = [].concat(Default); |
| | | jzDataDefaultExp = jzDataDefault; |
| | | } |
| | | } |
| | | } |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataProductExp = jzDataProduct; |
| | | jzDataFixedPriceExp = jzDataFixedPrice; |
| | | jzDataDiscountExp = jzDataDiscount; |
| | | } |
| | | export function SearchProductByIdLogic(result,jzDataFixedPrice,jzDataDefaultCopyQuantityList,item){ |
| | | result.forEach(itemss => { //itemss方案关联的产品 |
| | | var fl = true; |
| | | if (jzDataDefaultCopyQuantityList.length == 0) { |
| | | jzDataDefaultCopyQuantityList.push({ |
| | | Asset_Model_No__c: itemss.Asset_Model_No__c, |
| | | Quantity__c__c: itemss.Quantity__c, |
| | | Id_H: item.PromotionNo__c |
| | | }); |
| | | } else { |
| | | jzDataDefaultCopyQuantityList.forEach(jdcql => { //保存方案关联产品的数量 |
| | | if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) { |
| | | fl = false; |
| | | } |
| | | }); |
| | | if (fl) { |
| | | jzDataDefaultCopyQuantityList.push({ |
| | | Asset_Model_No__c: itemss.Asset_Model_No__c, |
| | | Quantity__c__c: itemss.Quantity__c, |
| | | Id_H: item.PromotionNo__c |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | var iflag = true; |
| | | var newarrjdf = []; |
| | | jzDataFixedPrice.forEach(jdf => { //jdf价格政策 |
| | | if (jdf.Id == item.Id) { |
| | | iflag = false; |
| | | newarrjdf.push(jdf); |
| | | } else { |
| | | newarrjdf.push(jdf); |
| | | } |
| | | }); |
| | | jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList; |
| | | return newarrjdf; |
| | | } |
| | | export function ComputeDataPromotionLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopy,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){ |
| | | newArrsTemp3 = []; //需要计算的产品明细的数据 |
| | | newArrsTemp4 = []; //不需要计算的产品明细的数据 |
| | | var newArrsTemp5 = []; |
| | | var newArrsTemp6 = []; |
| | | arrProductTemp.forEach(itemsss => { //itemsss产品明细 |
| | | |
| | | if (itemsss.PromotionId == item.Id) { |
| | | if (item.determine == '改过') { |
| | | var flag = true; |
| | | var b = jzDataDefaultCopyQuantityList; //获取方案中的产品数量 |
| | | arrTemp2.forEach(datedefault => { //datedefault待选产品 |
| | | |
| | | var quantity = 0; |
| | | if (datedefault.Id == itemsss.Id) { |
| | | b.forEach(iem => { //iem方案中的产品数量 |
| | | if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) { |
| | | quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity; |
| | | datedefault.Quantity = quantity; |
| | | itemsss.Quantity = iem.Quantity__c__c * item.Counts; |
| | | } |
| | | }); |
| | | flag = false; |
| | | } |
| | | }); |
| | | if (flag) { |
| | | jzDataDefaultCopy.forEach(add => { //add报价行项目主数据 |
| | | var quantity = 0; |
| | | if (add.Id == itemsss.Id) { |
| | | b.forEach(iems => { //iems方案关联产品数量 |
| | | if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) { |
| | | quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts; |
| | | add.Quantity = quantity; |
| | | itemsss.Quantity = iems.Quantity__c__c * item.Counts; |
| | | arrTemp2.push(add); |
| | | } |
| | | }); |
| | | flag = true; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | itemsss = partPromotionSchemeLogical(itemsss, item,QuoteData[0].multiYearWarranty__c); |
| | | newArrsTemp3.push(itemsss); |
| | | } else if (itemsss.PromotionId != item.Id) { |
| | | newArrsTemp4.push(itemsss); |
| | | } |
| | | }); |
| | | if (item.determine == '改过') { |
| | | arrTemp2.forEach(itsss => { //itsss待选产品 |
| | | if (itsss.Quantity != 0) { |
| | | newArrsTemp6.push(itsss); |
| | | } |
| | | }); |
| | | newArrsTemp5 = [].concat(newArrsTemp6); |
| | | jzDataDefault = newArrsTemp5; |
| | | } |
| | | newArrsTemp3Exp = newArrsTemp3; |
| | | newArrsTemp4Exp = newArrsTemp4; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataDefaultCopyExp = jzDataDefaultCopy; |
| | | return arrProductTemp; |
| | | } |
| | | export function ComputeDataNormalProductLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopyc,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){ |
| | | newArrsTemp3 = []; //需要计算的产品明细的数据 |
| | | newArrsTemp4 = []; //不需要计算的产品明细的数据 |
| | | var newArrsTemp5 = []; |
| | | var newArrsTemp6 = []; |
| | | var jzDataDefaultCopy = jzDataDefaultCopyc; |
| | | arrProductTemp.forEach(itemsss => { //itemsss产品明细 |
| | | var flag = true; |
| | | if (itemsss.PromotionId == item.Id) { |
| | | if (item.determine == '改过') { |
| | | var b = jzDataDefaultCopyQuantityList; //获取方案中的产品数量 |
| | | jzDataDefaultCopy = jzDataDefaultCopyc; |
| | | arrTemp2.forEach(datedefault => { //datedefault待选产品 |
| | | var quantity = 0; |
| | | if (datedefault.Id == itemsss.Id) { |
| | | b.forEach(iem => { //iem方案中的产品数量 |
| | | if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) { |
| | | quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity; |
| | | datedefault.Quantity = quantity; |
| | | itemsss.Quantity = iem.Quantity__c__c * item.Counts; |
| | | } |
| | | }); |
| | | flag = false; |
| | | } |
| | | }); |
| | | if (flag) { |
| | | jzDataDefaultCopy.forEach(add => { //add报价行项目主数据 |
| | | var quantity = 0; |
| | | if (add.Id == itemsss.Id) { |
| | | b.forEach(iems => { //iems方案关联产品数量 |
| | | if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) { |
| | | quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts; |
| | | add.Quantity = quantity; |
| | | itemsss.Quantity = iems.Quantity__c__c * item.Counts; |
| | | arrTemp2.push(add); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | if(QuoteData[0].multiYearWarranty__c){ |
| | | itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice); |
| | | }else{ |
| | | itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c; |
| | | } |
| | | if (item.HeTongTotal == undefined || item.HeTongTotal == "") { |
| | | itemsss.AgencyUnitPrice__c = 0; |
| | | } |
| | | itemsss = partGeneralDiscountLogical(itemsss, item); |
| | | newArrsTemp3.push(itemsss); |
| | | } else if (itemsss.PromotionId != item.Id) { |
| | | newArrsTemp4.push(itemsss); |
| | | } |
| | | }); |
| | | if (item.determine == '改过') { |
| | | arrTemp2.forEach(itsss => { //待选产品 |
| | | if (itsss.Quantity != 0) { |
| | | newArrsTemp6.push(itsss); |
| | | } |
| | | }); |
| | | newArrsTemp5 = [].concat(newArrsTemp6); |
| | | jzDataDefault = newArrsTemp5; |
| | | } |
| | | newArrsTemp3Exp = newArrsTemp3; |
| | | newArrsTemp4Exp = newArrsTemp4; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataDefaultCopyExp = jzDataDefaultCopy; |
| | | return arrProductTemp; |
| | | } |
| | | export function ComputeDiscountAuthorizerLogic(newArrsTemp,newArrsTemp2,item,arrProductTemp){ |
| | | newArrsTemp = []; |
| | | newArrsTemp2 = []; |
| | | arrProductTemp.forEach(itemss => { //itemss产品明细 |
| | | var Discount__c_Input = 0; |
| | | if (itemss.warrantyType__c=="市场多年保修") { |
| | | Discount__c_Input = item.GuaranteeDiscount__c_Input; |
| | | Discount__c_Input = parseFloat(Discount__c_Input); |
| | | } else { |
| | | Discount__c_Input = item.NormalDiscount__c_Input; |
| | | Discount__c_Input = parseFloat(Discount__c_Input); |
| | | } |
| | | if (itemss.PromotionId == item.Id && //方案Id |
| | | itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //对象品折扣录入 |
| | | itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //非对象品折扣录入 |
| | | itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //特约折扣计算逻辑 |
| | | newArrsTemp.push(itemss); |
| | | } else if (itemss.PromotionId != item.Id || |
| | | itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input || |
| | | itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) { |
| | | newArrsTemp2.push(itemss); |
| | | } |
| | | }); |
| | | newArrsTempExp = newArrsTemp; |
| | | newArrsTemp2Exp = newArrsTemp2; |
| | | return arrProductTemp; |
| | | } |
| | | export function handleSaveDiscountLogic(jzDataDiscount,jzDataProduct,event){ |
| | | var boolean = 0; |
| | | var boolean2 = false; |
| | | var boolean3 = false; |
| | | var data = event.detail.rows; |
| | | let newData = []; |
| | | let newData2 = []; |
| | | var newMap3 = new Map(); |
| | | let newData3 = []; |
| | | var key=0; |
| | | let editnewDate = []; |
| | | var GuaranteeDiscount__cZuiXiao =0; |
| | | var NormalDiscount__cZuiXiao =0; |
| | | for (var i = 0; i < jzDataDiscount.length; i++) { |
| | | var editData = {}; |
| | | var flag = false; |
| | | for (var j = 0; j < data.length; j++) { |
| | | var id = data[j].DelectId.replace("row-", ""); |
| | | if (jzDataDiscount[i].DelectId == id) { |
| | | editData = { |
| | | GuaranteeDiscount__c_Input: '', |
| | | NormalDiscount__c_Input: '', |
| | | HeTongPrice: '', |
| | | GuaranteeDiscount_H_Money__c: '', |
| | | NormalDiscount_H_Money__c: '' |
| | | }; |
| | | //对象折扣 |
| | | editData.GuaranteeDiscount__c_Input = data[j].GuaranteeDiscount__c_Input; |
| | | //赋值 非对象折扣 |
| | | editData.NormalDiscount__c_Input = data[j].NormalDiscount__c_Input; |
| | | //一般折扣合同价格 |
| | | editData.HeTongPrice = data[j].HeTongPrice; |
| | | //对象品合同金额 |
| | | editData.GuaranteeDiscount_H_Money__c = data[j].GuaranteeDiscount_H_Money__c; |
| | | //非对象品合同金额 |
| | | editData.NormalDiscount_H_Money__c = data[j].NormalDiscount_H_Money__c; |
| | | // editData.id=id; |
| | | flag = true; |
| | | } |
| | | } |
| | | if (flag) { |
| | | var newItem = { |
| | | ...jzDataDiscount[i], |
| | | ...{} |
| | | }; |
| | | if (editData.GuaranteeDiscount__c_Input != undefined) { |
| | | if(newItem.JxsType == "特约折扣"){ |
| | | var GuaranteeDiscount__c_Input = parseFloat(editData.GuaranteeDiscount__c_Input); |
| | | editData.GuaranteeDiscount__c_Input=GuaranteeDiscount__c_Input+'%'; |
| | | var GuaranteeDiscount__c = parseFloat(newItem.GuaranteeDiscount__c); |
| | | if (GuaranteeDiscount__c_Input < GuaranteeDiscount__c) { |
| | | GuaranteeDiscount__cZuiXiao=GuaranteeDiscount__c; |
| | | boolean = 1; |
| | | break; |
| | | } else { |
| | | jzDataProduct.forEach(jdpt => { |
| | | if (newItem.Id == jdpt.PromotionId && |
| | | newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input && |
| | | newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) { |
| | | jdpt.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input; |
| | | } |
| | | }); |
| | | newItem.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input; |
| | | newItem.iftrue = "改过"; |
| | | } |
| | | }else{ |
| | | boolean = 3; |
| | | break; |
| | | } |
| | | } |
| | | if (editData.NormalDiscount__c_Input != undefined) { |
| | | if(editData.NormalDiscount__c_Input!=''&&editData.NormalDiscount__c_Input>=0){ |
| | | var NormalDiscount__c_Input = parseFloat(editData.NormalDiscount__c_Input); |
| | | editData.NormalDiscount__c_Input = NormalDiscount__c_Input+'%'; |
| | | var NormalDiscount__c = parseFloat(newItem.NormalDiscount__c); |
| | | if (NormalDiscount__c_Input < NormalDiscount__c) { |
| | | NormalDiscount__cZuiXiao=NormalDiscount__c; |
| | | boolean = 2; |
| | | break; |
| | | } else { |
| | | jzDataProduct.forEach(jdpt => { |
| | | if (newItem.Id == jdpt.PromotionId && |
| | | newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input && |
| | | newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) { |
| | | jdpt.NormalDiscount__c_Input = editData.NormalDiscount__c_Input; |
| | | } |
| | | }); |
| | | newItem.NormalDiscount__c_Input = editData.NormalDiscount__c_Input; |
| | | newItem.iftrue = "改过"; |
| | | } |
| | | }else{ |
| | | boolean = 5 |
| | | break; |
| | | } |
| | | } |
| | | newItem.GuaranteeDiscount_H_Money_yuan=newItem.GuaranteeDiscount_H_Money__c; |
| | | if (editData.GuaranteeDiscount_H_Money__c != undefined) { |
| | | if(newItem.JxsType == "特约折扣"){ |
| | | if(editData.GuaranteeDiscount_H_Money__c==""){ |
| | | editData.GuaranteeDiscount_H_Money__c=0; |
| | | } |
| | | newItem.GuaranteeDiscount_H_Money__c = editData.GuaranteeDiscount_H_Money__c; |
| | | newMap3.set(key,newItem); |
| | | boolean = 4; |
| | | boolean2 = true ; |
| | | }else{ |
| | | boolean = 3; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | newItem.NormalDiscount_H_Money_yuan=newItem.NormalDiscount_H_Money__c; |
| | | if (editData.NormalDiscount_H_Money__c != undefined) { |
| | | if(editData.NormalDiscount_H_Money__c==""){ |
| | | editData.NormalDiscount_H_Money__c=0; |
| | | } |
| | | newItem.NormalDiscount_H_Money__c = editData.NormalDiscount_H_Money__c; |
| | | if(newItem.JxsType == "一般折扣"){ |
| | | newData2.push(newItem); |
| | | boolean = 4; |
| | | boolean3 = true; |
| | | }else{ |
| | | newMap3.set(key,newItem); |
| | | boolean = 4; |
| | | boolean2 = true; |
| | | } |
| | | } |
| | | if (editData.NormalDiscount_H_Money__c != undefined||editData.GuaranteeDiscount_H_Money__c != undefined) { |
| | | if(newItem.JxsType == "一般折扣"){ |
| | | newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c) |
| | | }else{ |
| | | newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c)+parseFloat(newItem.GuaranteeDiscount_H_Money__c); |
| | | } |
| | | } |
| | | key++; |
| | | newData.push(newItem); |
| | | editnewDate.push(newItem); |
| | | } else { |
| | | newData.push({ |
| | | ...{}, |
| | | ...jzDataDiscount[i] |
| | | }); |
| | | } |
| | | } |
| | | for (let [k, v] of newMap3) { |
| | | newData3.push(v); |
| | | } |
| | | booleanExp = boolean; |
| | | boolean2Exp = boolean2; |
| | | boolean3Exp = boolean3; |
| | | newDataExp = newData; |
| | | newData2Exp = newData2; |
| | | newData3Exp = newData3; |
| | | editnewDateExp = editnewDate; |
| | | GuaranteeDiscount__cZuiXiaoExp = GuaranteeDiscount__cZuiXiao; |
| | | NormalDiscount__cZuiXiaoExp = NormalDiscount__cZuiXiao; |
| | | jzDataProductExp = jzDataProduct; |
| | | return jzDataDiscount; |
| | | } |
| | | export function AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,CompareFullData){ |
| | | var FilterList = CompareFullData.filter(item => { |
| | | if (item.ListName == ListName && item.Id == Id) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }) |
| | | if (FilterList == undefined || FilterList.length <= 0) { |
| | | var newTemp = { |
| | | ListName: ListName, |
| | | Asset_Model_No__c: Asset_Model_No__c, |
| | | Id: Id, |
| | | num: addNums |
| | | } |
| | | CompareFullData.push(newTemp); |
| | | } else { |
| | | FilterList[0].Asset_Model_No__c += Asset_Model_No__c + "||"; |
| | | FilterList[0].num = addNums; |
| | | } |
| | | return CompareFullData; |
| | | } |
| | | export function MergeDuplicateSchemesLogic(CompareFullData,SchemeSet){ |
| | | var a = CompareFullData; |
| | | var CompareFullDataedit = []; |
| | | var Setmap = new Map(); |
| | | var arr = []; |
| | | var arr2 = SchemeSet; |
| | | arr2.forEach(arrs => { |
| | | var object = {}; |
| | | if (Setmap.has(arrs.Id)) { |
| | | object = { |
| | | ...{}, |
| | | ...Setmap.get(arrs.Id) |
| | | }; |
| | | object.Counts = object.Counts + arrs.Counts; |
| | | object.determine = ''; |
| | | a.forEach(editnum => { |
| | | if (editnum.Id == object.Id) { |
| | | editnum.num = object.Counts; |
| | | CompareFullDataedit.push(editnum); |
| | | } else { |
| | | CompareFullDataedit.push(editnum); |
| | | } |
| | | }); |
| | | CompareFullData = [].concat(CompareFullDataedit); |
| | | Setmap.set(arrs.Id, object); |
| | | } else { |
| | | object = { |
| | | ...{}, |
| | | ...arrs |
| | | }; |
| | | Setmap.set(arrs.Id, object); |
| | | } |
| | | }); |
| | | for (let [k, v] of Setmap) { |
| | | arr.push(v); |
| | | } |
| | | CompareFullDataExp = CompareFullData; |
| | | return arr; |
| | | } |
| | | //计算价格政策的最大次数 |
| | | export function ComputeMaximumTimes(priceArr,jzDataDefaultCopyQuantityList,jzDataDefault) { |
| | | // var num=0; |
| | | var Pricepolicy = { |
| | | ...{}, |
| | | ...priceArr |
| | | }; |
| | | var b = jzDataDefaultCopyQuantityList; //查出的每个方案的明细的数量 |
| | | var selectproducts = jzDataDefault; //待选产品 |
| | | Pricepolicy.maxCounts = ComputationalLogic(Pricepolicy, b, selectproducts); |
| | | return Pricepolicy; |
| | | } |
| | | export function handleSaveFixedPriceLogic(CompareFullData,event,jzDataFixedPrice,jzDataDefaultCopyQuantityList,jzDataDefault){ |
| | | var a = CompareFullData; |
| | | var CompareFullDataedit = []; |
| | | var HeTongTotal = 0; |
| | | var data = event.detail.rows; |
| | | let newData = []; |
| | | let editnewDate = []; |
| | | var boolean = 1; |
| | | for (var i = 0; i < jzDataFixedPrice.length; i++) { |
| | | var editData = {}; |
| | | var flag = false; |
| | | for (var j = 0; j < data.length; j++) { |
| | | var id = data[j].DelectId.replace("row-", ""); |
| | | if (jzDataFixedPrice[i].DelectId == id) { |
| | | // editData=data[j]; |
| | | editData = { |
| | | Counts: '', |
| | | HeTongTotal: '' |
| | | }; |
| | | //对象折扣 |
| | | editData.Counts = data[j].Counts; |
| | | //赋值 非对象折扣 |
| | | editData.HeTongTotal = data[j].HeTongTotal; |
| | | // editData.id=id; |
| | | flag = true; |
| | | } |
| | | } |
| | | if (flag) { |
| | | var newItem = { |
| | | ...jzDataFixedPrice[i], |
| | | ...{} |
| | | }; //价格政策数据 |
| | | //计算最大次数 |
| | | newItem = ComputeMaximumTimes(newItem,jzDataDefaultCopyQuantityList,jzDataDefault); |
| | | console.warn('ceshi1'); |
| | | if (editData.Counts != undefined) { |
| | | var ifNec = true; |
| | | if (newItem.recordTypeName__c == "NormalProduct") { |
| | | if (newItem.ifNecessary__c) { |
| | | ifNec = false; |
| | | } |
| | | } |
| | | newItem.maxCounts = Number(newItem.maxCounts); |
| | | if (newItem.maxCounts >= editData.Counts && ifNec) { |
| | | if (editData.Counts == 0) { |
| | | boolean = 4; |
| | | } else { |
| | | if (newItem.if_Contain_Nod__c) { |
| | | HeTongTotal = newItem.Price_CNY__c * editData.Counts; |
| | | } else { |
| | | HeTongTotal = newItem.Price_CNY__c * editData.Counts + newItem.sumNoDiscount * editData.Counts; |
| | | } |
| | | newItem.Counts = editData.Counts; |
| | | if (newItem.recordTypeName__c == "Promotion") { |
| | | newItem.HeTongTotal = HeTongTotal; |
| | | } |
| | | newItem.determine = '改过'; |
| | | a.forEach(editnum => { |
| | | if (editnum.Id == newItem.Id) { |
| | | editnum.num = newItem.Counts; |
| | | CompareFullDataedit.push(editnum); |
| | | } else { |
| | | CompareFullDataedit.push(editnum); |
| | | } |
| | | }); |
| | | CompareFullData = [].concat(CompareFullDataedit);//20230214 |
| | | } |
| | | } else { |
| | | if (ifNec) { |
| | | boolean = 3; |
| | | } else { |
| | | boolean = 5; |
| | | } |
| | | } |
| | | } |
| | | console.warn('ceshi2'); |
| | | if (editData.HeTongTotal != undefined) { |
| | | if (newItem.if_Contain_Nod__c) { |
| | | HeTongTotal = newItem.Price_CNY__c * newItem.Counts; |
| | | } else { |
| | | HeTongTotal = newItem.Price_CNY__c * newItem.Counts + newItem.sumNoDiscount * newItem.Counts; |
| | | } |
| | | if (editData.HeTongTotal < HeTongTotal) { |
| | | boolean = 6; |
| | | } else { |
| | | newItem.HeTongTotal = editData.HeTongTotal; |
| | | newItem.determine = '改过'; |
| | | } |
| | | } |
| | | newData.push(newItem); |
| | | editnewDate.push(newItem); |
| | | } else { |
| | | newData.push({ |
| | | ...{}, |
| | | ...jzDataFixedPrice[i] |
| | | }); |
| | | } |
| | | } |
| | | CompareFullDataExp = CompareFullData; |
| | | booleanExp = boolean; |
| | | newDataExp = newData; |
| | | HeTongTotalExp = HeTongTotal; |
| | | return editnewDate; |
| | | } |
| | | export function deleteFixedPriceLogic(SelectedFnDataFixedPrice,CompareFullData){ |
| | | let ids = []; |
| | | var fag = true; |
| | | var select = []; |
| | | for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) { |
| | | fag = true; |
| | | var PromotionHeadRecordId = SelectedFnDataFixedPrice[j].recordTypeName__c; |
| | | if (PromotionHeadRecordId == "NormalProduct") { |
| | | if (SelectedFnDataFixedPrice[j].ifNecessary__c) { |
| | | fag = false; |
| | | } else { |
| | | select.push(SelectedFnDataFixedPrice[j]); |
| | | } |
| | | } else { |
| | | select.push(SelectedFnDataFixedPrice[j]); |
| | | } |
| | | if (fag) { |
| | | var a = CompareFullData; |
| | | var compareFu = []; |
| | | ids.push(SelectedFnDataFixedPrice[j].Id); |
| | | a.forEach(deletId => { |
| | | if (SelectedFnDataFixedPrice[j].Id != deletId.Id) { |
| | | compareFu.push(deletId); |
| | | } |
| | | }); |
| | | CompareFullData = [].concat(compareFu);//20230214 |
| | | } |
| | | } |
| | | SelectedFnDataFixedPrice = [].concat(select);//20230214 |
| | | CompareFullDataExp = CompareFullData; |
| | | SelectedFnDataFixedPriceExp = SelectedFnDataFixedPrice; |
| | | idsExp = ids; |
| | | return fag; |
| | | } |
| | | export function DeleteChangesFnLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){ |
| | | //删除 规则数量 |
| | | CompareFullData.forEach(cItem => { |
| | | if (cItem.Id == id && cItem.ListName == TypeName) { |
| | | } else { |
| | | CompareFullDataTemp.push(cItem); |
| | | } |
| | | }) |
| | | //删除 已选产品 |
| | | var CurrentTemp = {}; |
| | | if (TypeName == "价格政策") { |
| | | CurrentTemp = jzDataFixedPrice.filter(fItem => { |
| | | if (fItem.Id == id) { |
| | | return true; |
| | | } |
| | | return false; |
| | | })[0]; |
| | | } |
| | | if (TypeName == "折扣政策") { |
| | | CurrentTemp = jzDataDiscount.filter(fItem => { |
| | | if (fItem.Id == id) { |
| | | return true; |
| | | } |
| | | return false; |
| | | })[0]; |
| | | } |
| | | //匹配需要删除产品 |
| | | var ProductNumsTemp = []; |
| | | var NewjzDataProduct = [];; |
| | | if (TypeName == "价格政策") { |
| | | jzDataProduct.forEach(proItem => { |
| | | if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) { |
| | | ProductNumsTemp.push({ |
| | | Id: proItem.Id, |
| | | num: proItem.Quantity |
| | | }) |
| | | } else { |
| | | NewjzDataProduct.push(proItem); |
| | | } |
| | | }); |
| | | } else if (TypeName == "折扣政策") { |
| | | jzDataProduct.forEach(proItem => { |
| | | if (proItem.CompareId == CurrentTemp.CompareId) { |
| | | ProductNumsTemp.push({ |
| | | Id: proItem.Id, |
| | | num: proItem.Quantity |
| | | }) |
| | | } else { |
| | | NewjzDataProduct.push(proItem); |
| | | } |
| | | }); |
| | | } |
| | | // 执行删除 |
| | | jzDataProduct = NewjzDataProduct; |
| | | // 添加数量 |
| | | var newjzDataDefaults = []; |
| | | var AddnumsTemp = []; |
| | | jzDataDefault.forEach(defItem => { |
| | | var defItemTemp = { |
| | | ...{}, |
| | | ...defItem |
| | | }; |
| | | ProductNumsTemp.forEach(pTempItem => { |
| | | if (pTempItem.Id == defItem.Id) { |
| | | defItemTemp.Quantity += pTempItem.num; |
| | | AddnumsTemp.push(pTempItem.Id); |
| | | } |
| | | }); |
| | | newjzDataDefaults.push(defItemTemp); |
| | | }) |
| | | jzDataDefault = newjzDataDefaults; |
| | | //添加整条数据 |
| | | var PFTempArr = ProductNumsTemp.filter(pTempItem => { |
| | | var flag = true; |
| | | AddnumsTemp.filter(addItem => { |
| | | if (addItem == pTempItem.Id) { |
| | | flag = false; |
| | | } |
| | | }) |
| | | return flag; |
| | | }) |
| | | jzDataDefaultNotChange.forEach(noChangeItem => { |
| | | PFTempArr.forEach(pftItem => { |
| | | if (pftItem.Id == noChangeItem.Id) { |
| | | let newChangeItem = { |
| | | ...{}, |
| | | ...noChangeItem |
| | | }; |
| | | newChangeItem.Quantity = pftItem.num; |
| | | jzDataDefault.push(newChangeItem); |
| | | } |
| | | }) |
| | | }) |
| | | CompareFullDataTempExp = CompareFullDataTemp; |
| | | jzDataFixedPriceExp = jzDataFixedPrice; |
| | | jzDataDiscountExp = jzDataDiscount; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataDefaultNotChangeExp = jzDataDefaultNotChange; |
| | | return jzDataProduct; |
| | | } |
| | | export function deleteFixedPriceTempLogic(SelectedFnDataFixedPrice,jzDataFixedPrice,CompareFullData){ |
| | | let newarr = []; |
| | | for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) { |
| | | for (var i = 0; i < jzDataFixedPrice.length; i++) { |
| | | var a = CompareFullData; |
| | | var compareFu = []; |
| | | a.forEach(deletId => { |
| | | if (SelectedFnDataFixedPrice[j].Id != deletId.Id) { |
| | | compareFu.push(deletId); |
| | | } |
| | | }); |
| | | CompareFullData = [].concat(compareFu);//20230214 |
| | | if (SelectedFnDataFixedPrice[j].Id == jzDataFixedPrice[i].Id) { |
| | | jzDataFixedPrice.splice(i, 1); // 将使后面的元素依次前移,数组长度减1 |
| | | i--; |
| | | } |
| | | } |
| | | } |
| | | for (var i = 0; i < jzDataFixedPrice.length; i++) { |
| | | newarr.push(jzDataFixedPrice[i]); |
| | | } |
| | | CompareFullDataExp = CompareFullData; |
| | | return newarr; |
| | | } |
| | | export function GetSearchProductByIdLogic(item,results,jzDataDefaultCopyQuantityList,jzDataFixedPrice){ |
| | | results.forEach(itemss => { //方案关联的产品 |
| | | var fl = true; |
| | | if (jzDataDefaultCopyQuantityList.length == 0) { |
| | | jzDataDefaultCopyQuantityList.push({ |
| | | Asset_Model_No__c: itemss.Asset_Model_No__c, |
| | | Quantity__c__c: itemss.Quantity__c, |
| | | Id_H: item.PromotionNo__c |
| | | }); |
| | | } else { |
| | | jzDataDefaultCopyQuantityList.forEach(jdcql => { |
| | | if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) { |
| | | fl = false; |
| | | } |
| | | }); |
| | | if (fl) { |
| | | jzDataDefaultCopyQuantityList.push({ |
| | | Asset_Model_No__c: itemss.Asset_Model_No__c, |
| | | Quantity__c__c: itemss.Quantity__c, |
| | | Id_H: item.PromotionNo__c |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | var iflag = true; |
| | | var newarrjdf = []; |
| | | jzDataFixedPrice.forEach(jdf => { //价格政策 |
| | | if (jdf.Id == item.Id) { |
| | | iflag = false; |
| | | // jdf.sumListPrice = sumListPrice; |
| | | // jdf.sumNoDiscount = sumNoDiscount; |
| | | newarrjdf.push(jdf); |
| | | } else { |
| | | newarrjdf.push(jdf); |
| | | } |
| | | }); |
| | | iflagExp = iflag; |
| | | jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList; |
| | | return newarrjdf; |
| | | } |
| | | export function getTableDataCommonlyLogic(jzDataCommonly){ |
| | | var jzDataCommonlyTemp = []; |
| | | jzDataCommonly.forEach(items => { |
| | | var ItemsTemp = { |
| | | ...{}, |
| | | ...items |
| | | }; |
| | | ItemsTemp.JxsType = "一般折扣"; |
| | | ItemsTemp.SplitQuantity = ItemsTemp.Quantity; |
| | | jzDataCommonlyTemp.push(ItemsTemp); |
| | | }) |
| | | return jzDataCommonlyTemp; |
| | | } |
| | | export function ComputeListPrice(PromotionId,jzDataProduct) { |
| | | var sum = 0; |
| | | jzDataProduct.forEach(jzdp => { //jzdp产品明细 |
| | | if (jzdp.PromotionId == PromotionId) { |
| | | sum = sum + jzdp.ListPrice * jzdp.Quantity; |
| | | } |
| | | }); |
| | | return sum; |
| | | } |
| | | export function delectComputeData(item,jzDataProduct) { |
| | | var sum = ComputeListPrice(item.PromotionId,jzDataProduct); |
| | | var jzProductarry = [].concat(jzDataProduct); |
| | | jzProductarry.forEach(japdt => { |
| | | if (item.PromotionId == japdt.PromotionId) { |
| | | japdt.AgencySubtotal__c = japdt.AgencySubtotal__c + item.AgencySubtotal__c * (japdt.ListPrice * japdt.Quantity / sum); |
| | | japdt.AgencyUnitPrice__c = japdt.AgencySubtotal__c / japdt.Quantity; |
| | | japdt.AgencySubtotal__c = Math.round(japdt.AgencySubtotal__c * 100) / 100; |
| | | japdt.AgencyUnitPrice__c = Math.round(japdt.AgencyUnitPrice__c * 100) / 100; |
| | | } |
| | | }); |
| | | jzDataProduct = [].concat(jzProductarry);//20230214 |
| | | return jzDataProduct; |
| | | } |
| | | export function DeleteIsChangelogicExp(item,TypeName,jzDataProduct,jzDataDefault,jzDataDefaultCopy){ |
| | | var jzdatas = []; |
| | | var flg = true; |
| | | var booleanfag = 0; |
| | | jzDataProduct.forEach(proItem => { //proItem产品明细 |
| | | if (TypeName == "价格政策") { |
| | | var PromotionHeadRecordId = item.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Promotion") { |
| | | if (!item.if_Fix__c) { |
| | | if (proItem.Id == item.Id && item.PromotionId == proItem.PromotionId) {} else { |
| | | jzdatas.push(proItem); |
| | | } |
| | | } else { |
| | | flg = false; |
| | | booleanfag = 1; |
| | | |
| | | } |
| | | } else if (PromotionHeadRecordId == "NormalProduct") { |
| | | flg = false; |
| | | booleanfag = 2; |
| | | } else { |
| | | jzdatas.push(proItem); |
| | | } |
| | | } else if (TypeName == "折扣政策") { |
| | | var PromotionHeadRecordId = item.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Authorizer") { |
| | | if (proItem.Id == item.Id && |
| | | item.PromotionId == proItem.PromotionId && |
| | | item.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && |
| | | item.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) {} else { |
| | | jzdatas.push(proItem); |
| | | } |
| | | } else { |
| | | if (proItem.Id == item.Id && |
| | | item.Category__c == proItem.Category__c && |
| | | item.Discount__c_Input == proItem.Discount__c_Input) {} else { |
| | | jzdatas.push(proItem); |
| | | } |
| | | } |
| | | |
| | | } |
| | | }); |
| | | if (flg) { |
| | | jzDataProduct = [].concat(jzdatas);//20230214 |
| | | if (TypeName == "价格政策") { |
| | | //删除价格计算 |
| | | jzDataProduct = delectComputeData(item,jzDataProduct); |
| | | } |
| | | var fg = true; |
| | | var arr = jzDataDefault; |
| | | arr.forEach(jddf => { //jddf待选产品 |
| | | if (jddf.Id == item.Id) { |
| | | jddf.Quantity = jddf.Quantity + item.Quantity |
| | | fg = false; |
| | | } |
| | | }); |
| | | if (fg) { |
| | | jzDataDefaultCopy.forEach(itm => { //itm报价行项目主数据 |
| | | if (itm.Id == item.Id) { |
| | | itm.Quantity = item.Quantity |
| | | arr.push(itm); |
| | | fg = false; |
| | | } |
| | | }); |
| | | } |
| | | jzDataDefault = [].concat(arr);//20230214 |
| | | } |
| | | jzDataProductExp = jzDataProduct; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataDefaultCopyExp = jzDataDefaultCopy; |
| | | return booleanfag; |
| | | } |
| | | export function DeleteIsChangesFnjiage(jzDataFixedPrice,jzDataProduct,falg,item){ |
| | | console.warn('1111'); |
| | | var arrTemp = [].concat(jzDataFixedPrice);//20230214 |
| | | var TempItem = {}; |
| | | arrTemp.forEach(atItem => { |
| | | if (atItem.Id == item.PromotionId) { |
| | | TempItem = atItem; |
| | | return; |
| | | } |
| | | }) |
| | | console.warn('2222'); |
| | | jzDataProduct.forEach(ite => { //ite产品明细 |
| | | if (ite.PromotionId == TempItem.Id) { |
| | | falg = false; |
| | | } |
| | | }); |
| | | falgExp = falg; |
| | | console.warn('3333'); |
| | | return TempItem; |
| | | } |
| | | export function DeleteIsChangesFnzhekou(jzDataDiscount,jzDataProduct,falg,item){ |
| | | var arrTempTOName = [].concat(jzDataDiscount);//20230214 |
| | | var TempItemTOName = {}; |
| | | var PromotionHeadRecordId = item.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Authorizer") { |
| | | arrTempTOName.forEach(atItem => { |
| | | if (atItem.Id == item.PromotionId && //方案Id |
| | | item.NormalDiscount__c_Input == atItem.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | item.GuaranteeDiscount__c_Input == atItem.GuaranteeDiscount__c_Input) { //对象品折扣录入 |
| | | TempItemTOName = atItem; |
| | | return; |
| | | } |
| | | }) |
| | | jzDataProduct.forEach(ite => { |
| | | if (ite.PromotionId == TempItemTOName.Id && |
| | | ite.NormalDiscount__c_Input == TempItemTOName.NormalDiscount__c_Input && |
| | | ite.GuaranteeDiscount__c_Input == TempItemTOName.GuaranteeDiscount__c_Input) { |
| | | falg = false; |
| | | } |
| | | }); |
| | | } else { |
| | | arrTempTOName.forEach(atItem => { |
| | | if (item.Category__c == atItem.Category__c && |
| | | item.Discount__c_Input == atItem.NormalDiscount__c_Input) { |
| | | TempItemTOName = atItem; |
| | | return; |
| | | } |
| | | }) |
| | | jzDataProduct.forEach(ite => { |
| | | if (ite.Category__c == TempItemTOName.Category__c && |
| | | ite.Discount__c_Input == TempItemTOName.NormalDiscount__c_Input) { |
| | | falg = false; |
| | | } |
| | | }); |
| | | } |
| | | falgExp = falg; |
| | | return TempItemTOName; |
| | | } |
| | | export function delectTableDiscountTempLogic(SelectedFnDataDiscount,jzDataDiscount){ |
| | | let newarr = []; |
| | | for (var j = 0; j < SelectedFnDataDiscount.length; j++) { |
| | | for (var i = 0; i < jzDataDiscount.length; i++) { |
| | | var PromotionHeadRecordId = SelectedFnDataDiscount[j].recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Authorizer") { |
| | | if (SelectedFnDataDiscount[j].Id == jzDataDiscount[i].Id && |
| | | SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input && |
| | | SelectedFnDataDiscount[j].GuaranteeDiscount__c_Input == jzDataDiscount[i].GuaranteeDiscount__c_Input) { |
| | | jzDataDiscount.splice(i, 1); // 将使后面的元素依次前移,数组长度减1 |
| | | i--; |
| | | } |
| | | } else { |
| | | if (SelectedFnDataDiscount[j].Category__c == jzDataDiscount[i].Category__c && |
| | | SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input) { |
| | | jzDataDiscount.splice(i, 1); // 将使后面的元素依次前移,数组长度减1 |
| | | i--; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (var i = 0; i < jzDataDiscount.length; i++) { |
| | | newarr.push(jzDataDiscount[i]); |
| | | } |
| | | return newarr; |
| | | } |
| | | export function SelectedFnCommonlyLogic(arr){ |
| | | var newArr = []; |
| | | arr.forEach(item => { |
| | | var TempObject = { |
| | | ...{}, |
| | | ...item |
| | | }; |
| | | TempObject.JxsType = "一般折扣"; |
| | | newArr.push(TempObject); |
| | | }) |
| | | return newArr; |
| | | } |
| | | export function SaveGeneralDiscountLogic(data,jzDataCommonly){ |
| | | debugger; |
| | | let newData = []; |
| | | let editnewDate = []; |
| | | var boolean = 1; |
| | | for (var i = 0; i < jzDataCommonly.length; i++) { |
| | | var editData = {}; |
| | | var flag = false; |
| | | for (var j = 0; j < data.length; j++) { |
| | | var id = data[j].Id; |
| | | if (jzDataCommonly[i].Id == id) { |
| | | editData = { |
| | | SplitQuantity: '' |
| | | }; |
| | | editData.SplitQuantity = data[j].SplitQuantity; |
| | | flag = true; |
| | | } |
| | | } |
| | | if (flag) { |
| | | var newItem = { |
| | | ...jzDataCommonly[i], |
| | | ...{} |
| | | }; |
| | | if (editData.SplitQuantity != undefined) { |
| | | newItem.SplitQuantity = Number(editData.SplitQuantity); |
| | | } |
| | | newData.push(newItem); |
| | | editnewDate.push(newItem); |
| | | } else { |
| | | newData.push({ |
| | | ...{}, |
| | | ...jzDataCommonly[i] |
| | | }); |
| | | } |
| | | } |
| | | var newArrs = [].concat(editnewDate);//20230214 |
| | | newArrs.forEach(item => { |
| | | if (item.Quantity < item.SplitQuantity) { |
| | | boolean = 2; |
| | | } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') { |
| | | boolean = 3; |
| | | } |
| | | }); |
| | | booleanExp = boolean; |
| | | return newData; |
| | | } |
| | | export function DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){ |
| | | //删除 规则数量 |
| | | CompareFullData.forEach(cItem => { |
| | | if (cItem.Id == id.Id && cItem.ListName == TypeName) { |
| | | console.warn("CompareFullData 删除"); |
| | | } else { |
| | | CompareFullDataTemp.push(cItem); |
| | | } |
| | | }) |
| | | //删除 已选产品 |
| | | var CurrentTemp = {}; |
| | | if (TypeName == "价格政策") { |
| | | CurrentTemp = jzDataFixedPrice.filter(fItem => { |
| | | if (fItem.Id == id.Id) { |
| | | return true; |
| | | } |
| | | return false; |
| | | })[0]; |
| | | } |
| | | if (TypeName == "折扣政策") { |
| | | CurrentTemp = jzDataDiscount.filter(fItem => { |
| | | var PromotionHeadRecordId = id.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Authorizer") { |
| | | if (fItem.Id == id.Id && //方案Id |
| | | fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | fItem.GuaranteeDiscount__c_Input == id.GuaranteeDiscount__c_Input) { //对象品折扣录入 |
| | | return true; |
| | | } |
| | | } else { |
| | | if (fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input && |
| | | fItem.Category__c == id.Category__c) { //折扣政策分类 |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | })[0]; |
| | | } |
| | | //匹配需要删除产品 |
| | | var ProductNumsTemp = []; |
| | | var NewjzDataProduct = [];; |
| | | if (TypeName == "价格政策") { |
| | | jzDataProduct.forEach(proItem => { |
| | | if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) { |
| | | ProductNumsTemp.push({ |
| | | Id: proItem.Id, |
| | | num: proItem.Quantity |
| | | }) |
| | | } else { |
| | | NewjzDataProduct.push(proItem); |
| | | } |
| | | }); |
| | | } else if (TypeName == "折扣政策") { |
| | | jzDataProduct.forEach(proItem => { |
| | | var PromotionHeadRecordId = id.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Authorizer") { |
| | | if (CurrentTemp.Id == proItem.PromotionId && //方案Id |
| | | CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && //非对象品折扣录入 |
| | | CurrentTemp.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) { //对象品折扣录入 |
| | | ProductNumsTemp.push({ |
| | | Id: proItem.Id, |
| | | num: proItem.Quantity |
| | | }) |
| | | } else { |
| | | NewjzDataProduct.push(proItem); |
| | | } |
| | | } else { |
| | | if (CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && |
| | | CurrentTemp.Category__c == proItem.Category__c) { //折扣政策分类 |
| | | ProductNumsTemp.push({ |
| | | Id: proItem.Id, |
| | | num: proItem.Quantity |
| | | }) |
| | | } else { |
| | | NewjzDataProduct.push(proItem); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | jzDataProduct = NewjzDataProduct; |
| | | var newjzDataDefaults = []; |
| | | var AddnumsTemp = []; |
| | | jzDataDefault.forEach(defItem => { |
| | | var defItemTemp = { |
| | | ...{}, |
| | | ...defItem |
| | | }; |
| | | ProductNumsTemp.forEach(pTempItem => { |
| | | if (pTempItem.Id == defItem.Id) { |
| | | defItemTemp.Quantity += pTempItem.num; |
| | | AddnumsTemp.push(pTempItem.Id); |
| | | } |
| | | }); |
| | | newjzDataDefaults.push(defItemTemp); |
| | | }) |
| | | jzDataDefault = newjzDataDefaults; |
| | | //添加整条数据 |
| | | var PFTempArr = ProductNumsTemp.filter(pTempItem => { |
| | | var flag = true; |
| | | AddnumsTemp.filter(addItem => { |
| | | if (addItem == pTempItem.Id) { |
| | | flag = false; |
| | | } |
| | | }) |
| | | return flag; |
| | | }) |
| | | jzDataDefaultNotChange.forEach(noChangeItem => { |
| | | PFTempArr.forEach(pftItem => { |
| | | if (pftItem.Id == noChangeItem.Id) { |
| | | let newChangeItem = { |
| | | ...{}, |
| | | ...noChangeItem |
| | | }; |
| | | newChangeItem.Quantity = pftItem.num; |
| | | jzDataDefault.push(newChangeItem); |
| | | } |
| | | }) |
| | | }) |
| | | CompareFullDataTempExp = CompareFullDataTemp; |
| | | jzDataFixedPriceExp = jzDataFixedPrice; |
| | | jzDataDiscountExp = jzDataDiscount; |
| | | jzDataDefaultExp = jzDataDefault; |
| | | jzDataDefaultNotChangeExp = jzDataDefaultNotChange; |
| | | return jzDataProduct; |
| | | } |
| | | export function savecountLogic(jzDataFixedPrice,idStr){ |
| | | var arr = [] |
| | | jzDataFixedPrice.forEach(item => { //价格政策 |
| | | if (idStr == item.Id) { |
| | | item.maxCounts = item.Counts |
| | | arr.push(item); |
| | | } else { |
| | | arr.push(item); |
| | | } |
| | | }); |
| | | jzDataFixedPrice = arr; |
| | | return jzDataFixedPrice; |
| | | } |
| | | export function ComparePushDataLogic(jzDataDefault,jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num){ |
| | | let addArr = []; |
| | | var newss = [].concat(jzDataDefault); |
| | | var newDataDefault = newss.map(item => { |
| | | if (item == undefined) { |
| | | console.warn("undefined!!"); |
| | | } |
| | | if (item.Product2.MDM_Model_No__c == Asset_Model_No__c) { |
| | | let ItemTemp = { |
| | | ...{}, |
| | | ...item |
| | | }; |
| | | ItemTemp.Quantity = Quantity * num |
| | | ItemTemp.PromotionNo__c = jzDataProductParam.PromotionNo__c; |
| | | ItemTemp.Name = jzDataProductParam.Name; |
| | | ItemTemp.TypeName = TypeName; |
| | | ItemTemp.PromotionId = Id; |
| | | addArr.push(ItemTemp); |
| | | item.Quantity -= num * Quantity; |
| | | } |
| | | return item; |
| | | }) |
| | | jzDataProduct = jzDataProduct.concat(addArr); |
| | | jzDataProductExp = jzDataProduct; |
| | | return newDataDefault; |
| | | } |
| | | export function saveAllDataProductFnChuanshen(jzDataFixedPrice,jzDataDiscount,quoId,QuoteData,jzDataProduct,jzDataDefault,ContractPrice){ |
| | | var newTemp = []; |
| | | jzDataFixedPrice.forEach(item => { //价格政策 |
| | | var itemTemp = { |
| | | ...{}, |
| | | ...item |
| | | }; |
| | | itemTemp.typess = "价格政策 "; |
| | | newTemp.push(itemTemp); |
| | | }); |
| | | var newTemp2 = []; |
| | | jzDataDiscount.forEach(item => { //折扣政策 |
| | | var itemTemp = { |
| | | ...{}, |
| | | ...item |
| | | }; |
| | | itemTemp.typess = "折扣政策"; |
| | | newTemp2.push(itemTemp); |
| | | }); |
| | | var data = newTemp.concat(newTemp2);//20230213 |
| | | var ParamIdStr = quoId; |
| | | var Trade__c = QuoteData[0].Opportunity.Trade__c; |
| | | var NewData = ConsolidationScheme(data, ParamIdStr, Trade__c); |
| | | var NewData1 = MergeProducts(jzDataProduct, jzDataDefault, data, ParamIdStr); |
| | | var jsondatasss = JSON.stringify(NewData); |
| | | var jsondatassss = JSON.stringify(NewData1); |
| | | var Sales_Root__c = QuoteData[0].Opportunity.Sales_Root__c; |
| | | var QuoteId = QuoteData[0].Id; |
| | | var OpportunityId = QuoteData[0].OpportunityId; |
| | | var dataChunanshen = { |
| | | JsonStr: jsondatasss, |
| | | ParamIdStr: ParamIdStr, |
| | | JsonStr2: jsondatassss, |
| | | QuoteId: QuoteId, |
| | | SalesRootc: Sales_Root__c, |
| | | ContractPrice: ContractPrice, |
| | | OpportunityId: OpportunityId, |
| | | DealerFinalPriceFc: QuoteData[0].Dealer_Final_Price_F__c, |
| | | Agent1Agent2Pricec: QuoteData[0].Agent1_Agent2_Price__c |
| | | |
| | | }; |
| | | newTempExp = newTemp; |
| | | return dataChunanshen; |
| | | } |
| | | export function saveAllDataProductFnPanduan(jzDataProduct,newTemp){ |
| | | var ifnull = true; |
| | | var ifnunum=1; |
| | | newTemp.forEach(ntp => { //价格政策 |
| | | if (ntp.HeTongTotal == undefined || ntp.HeTongTotal == 0) { |
| | | ifnull = false; |
| | | } |
| | | }); |
| | | jzDataProduct.forEach(jzdp=>{ |
| | | if(jzdp.AgencyUnitPrice__c<0){ |
| | | ifnunum=2; |
| | | return; |
| | | } |
| | | }); |
| | | ifnullExp = ifnull; |
| | | return ifnunum; |
| | | } |
| | | export function QTcssE(pricePolicyflag){ |
| | | var QTcss = ''; |
| | | if(pricePolicyflag){ |
| | | QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder"; |
| | | }else{ |
| | | QTcss="slds-button slds-button_neutral slds-button_stretch quobutton"; |
| | | } |
| | | return QTcss; |
| | | } |
| | | export function CompareDataL(list,jzDataDefault){ |
| | | debugger |
| | | var isChange = false; |
| | | var TempsJzData = [] |
| | | TempsJzData = [].concat(jzDataDefault); //待选产品 |
| | | var TempsJzDataToCompare = [] |
| | | TempsJzData.forEach(item => { |
| | | list.forEach(element => { //促销方案主数据关联产品 |
| | | if (element.Asset_Model_No__c == item.Product2.MDM_Model_No__c) { |
| | | if (item.Quantity >= element.Quantity__c) { |
| | | isChange = true; |
| | | let CompareTemp = { |
| | | item: item, |
| | | element: element |
| | | } |
| | | TempsJzDataToCompare.push(CompareTemp); |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | //add 0602 |
| | | var CheckMinNum = 0; |
| | | var newTempsJzDataToCompare = [] |
| | | TempsJzDataToCompare.forEach(item => { //符合规则的产品 |
| | | var intNum = parseInt(item.item.Quantity / item.element.Quantity__c); |
| | | if (CheckMinNum == 0) { |
| | | CheckMinNum = intNum; |
| | | } |
| | | if (intNum < CheckMinNum) { |
| | | CheckMinNum = intNum; |
| | | } |
| | | }) |
| | | TempsJzDataToCompare.forEach(item => { |
| | | var newItem = { |
| | | ...{}, |
| | | ...item.item |
| | | }; |
| | | var newElement = { |
| | | ...{}, |
| | | ...item.element |
| | | }; |
| | | newItem.Quantity = item.element.Quantity__c * CheckMinNum; |
| | | var newObj = {}; |
| | | newObj.item = newItem; |
| | | newObj.element = newElement; |
| | | newTempsJzDataToCompare.push(newObj); |
| | | }) |
| | | TempsJzDataToCompare = [].concat(newTempsJzDataToCompare); |
| | | isChangeExp = isChange; |
| | | return TempsJzDataToCompare; |
| | | } |
| | | export function initquoT(responseObj,buttonIsShow,initDataTableFixedPrice,initDataTableDiscount,initDataTableOtherData,initDataTableCommonly){ |
| | | var QuoteData = responseObj; |
| | | if(QuoteData[0].Dealer_Final_Price_F__c==undefined||QuoteData[0].Dealer_Final_Price_F__c===''){ |
| | | QuoteData[0].Dealer_Final_Price_F__c=0 |
| | | } |
| | | if(QuoteData[0].Agent1_Agent2_Price__c==undefined||QuoteData[0].Agent1_Agent2_Price__c===''){ |
| | | QuoteData[0].Agent1_Agent2_Price__c=null; |
| | | } |
| | | debugger |
| | | if (QuoteData[0].Quote_Decision__c != "√") { |
| | | buttonIsShow = true; |
| | | initDataTableFixedPrice.columns[7].editable = true; |
| | | initDataTableFixedPrice.columns[10].editable = true; |
| | | initDataTableDiscount.columns[2].editable = true; |
| | | initDataTableDiscount.columns[3].editable = true; |
| | | initDataTableDiscount.columns[4].editable = true; |
| | | initDataTableDiscount.columns[5].editable = true; |
| | | initDataTableOtherData.columns[3].editable = true; |
| | | initDataTableCommonly.columns[3].editable = true; |
| | | }else{ |
| | | buttonIsShow = false; |
| | | } |
| | | buttonIsShowE = buttonIsShow; |
| | | initDTFP = initDataTableFixedPrice; |
| | | initDTD = initDataTableDiscount; |
| | | initDTOD = initDataTableOtherData; |
| | | initDTC = initDataTableCommonly; |
| | | return QuoteData; |
| | | } |
| | | //产品需要更新的字段 |
| | | export function ChangeProductData(key) { |
| | | var keyArr = ['']; |
| | | var flag = false; |
| | | keyArr.forEach(item => { |
| | | if (item == key) { |
| | | flag = true; |
| | | } |
| | | }) |
| | | return flag; |
| | | } |
| | | export const initDataTableProduct2 = { |
| | | columns: [{ |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model_No__c', |
| | | sortable: true, |
| | | typeAttributes: { |
| | | |
| | | }, |
| | | hideDefaultActions: true, |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 205, |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | initialWidth: 88 |
| | | }, |
| | | { |
| | | label: '保修类型', |
| | | fieldName: 'warrantyType__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | }, |
| | | { |
| | | label: '方案代码', |
| | | fieldName: 'PromotionNo__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | }, |
| | | { |
| | | label: '促销方案名称/产品系列', |
| | | fieldName: 'Name', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 124 |
| | | }, |
| | | { |
| | | label: '主报价', |
| | | fieldName: 'ListPrice', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '多年保价格小计', |
| | | fieldName: 'NoDiscountTotal__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '折扣', |
| | | fieldName: 'Discount__c_Input', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '合同单价', |
| | | fieldName: 'AgencyUnitPrice__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | } |
| | | }, |
| | | { |
| | | label: '合同总价', |
| | | fieldName: 'AgencySubtotal__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | } |
| | | }, |
| | | |
| | | |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns:initSearchFormProduct |
| | | } |
| | | |
| | | export const initSearchForm2 = [{ |
| | | label: "方案代码", |
| | | type: "text", |
| | | name: "PromotionNo__cEqual", |
| | | isInput: true |
| | | }, |
| | | { |
| | | label: "名称", |
| | | type: "text", |
| | | name: "NameLike", |
| | | isInput: true |
| | | } |
| | | ] |
| | | |
| | | export const initDataTable2 = { |
| | | columns: [{ |
| | | label: '方案代码', |
| | | fieldName: 'PromotionNo__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 100 |
| | | }, |
| | | { |
| | | label: '名称', |
| | | fieldName: 'Name', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 300 |
| | | }, |
| | | { |
| | | label: '描述', |
| | | fieldName: 'Description__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 300 |
| | | }, |
| | | { |
| | | label: '促销价格', |
| | | fieldName: 'Price_CNY__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | initialWidth: 140 |
| | | }, |
| | | { |
| | | label: '是否包含多年保修价格', |
| | | fieldName: 'if_Contain_Nod__c', |
| | | sortable: true, |
| | | type: 'boolean', |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | initialWidth: 170 |
| | | }, |
| | | { |
| | | label: '是否固定数量', |
| | | type: 'boolean', |
| | | fieldName: 'if_Fix__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | initialWidth: 130 |
| | | }, |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: initSearchForm2 |
| | | } |
| | | export const initSearchFormFix2 = [{ |
| | | label: "方案代码", |
| | | type: "text", |
| | | name: "PromotionNo__cEqual", |
| | | isInput: true |
| | | }, |
| | | { |
| | | label: "名称", |
| | | type: "text", |
| | | name: "NameLike", |
| | | isInput: true |
| | | } |
| | | ] |
| | | export const initDataTableFix2 = { |
| | | columns: [{ |
| | | label: '方案代码', |
| | | fieldName: 'PromotionNo__c', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '名称', |
| | | fieldName: 'Name', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 351 |
| | | }, |
| | | { |
| | | label: '描述', |
| | | fieldName: 'Description__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 327 |
| | | }, |
| | | { |
| | | label: '促销价格', |
| | | fieldName: 'Price_CNY__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '是否包含多年保修价格', |
| | | fieldName: 'if_Contain_Nod__c', |
| | | type: 'boolean', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | } |
| | | }, |
| | | { |
| | | label: '是否固定数量', |
| | | fieldName: 'if_Fix__c', |
| | | type: 'boolean', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | } |
| | | } |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: initSearchFormFix2 |
| | | } |
| | | export const initSearchFormDefalt2 = [{ |
| | | label: "产品型号", |
| | | type: "text", |
| | | name: "Asset_Model_No__c", |
| | | isInput: true |
| | | }, |
| | | { |
| | | label: "产品名称", |
| | | type: "text", |
| | | name: "Name__c", |
| | | isInput: true |
| | | } |
| | | ] |
| | | export const initDataTableDefault2 = { |
| | | columns: [{ |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model_No__c', |
| | | hideDefaultActions: true, |
| | | sortable: true |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 251 |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '保修类型', |
| | | fieldName: 'warrantyType__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | }, |
| | | { |
| | | label: '主报价', |
| | | fieldName: 'ListPrice', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '多年保价格小计', |
| | | fieldName: 'NoDiscountTotal__c', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: initSearchFormDefalt2 |
| | | } |
| | | export const initSearchFormFixedPrice2 = [{ |
| | | label: "产品型号", |
| | | type: "text", |
| | | name: "Asset_Model_No__c", |
| | | isInput: true |
| | | }, |
| | | { |
| | | label: "产品名称", |
| | | type: "text", |
| | | name: "Name__c", |
| | | isInput: true |
| | | } |
| | | ] |
| | | export const initDataTableFixedPrice2 = { |
| | | columns: [{ |
| | | label: '方案代码', |
| | | fieldName: 'PromotionNo__c', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '促销方案名称/产品系列', |
| | | fieldName: 'Name', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 196 |
| | | }, |
| | | { |
| | | label: '方案描述', |
| | | fieldName: 'Description__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 105 |
| | | }, |
| | | { |
| | | label: '分类', |
| | | fieldName: 'Category__c', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '是否包含多年保修价格', |
| | | fieldName: 'if_Contain_Nod__c', |
| | | type: 'boolean', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | } |
| | | }, |
| | | { |
| | | label: '是否固定数量', |
| | | fieldName: 'if_Fix__c', |
| | | type: 'boolean', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | } |
| | | }, |
| | | { |
| | | label: '促销单价', |
| | | fieldName: 'Price_CNY__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '次数', |
| | | fieldName: 'Counts', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | editable: false |
| | | }, |
| | | { |
| | | label: '多年保价格合计', |
| | | fieldName: 'sumNoDiscountTotal', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '促销总价', |
| | | fieldName: 'Total', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '合同价格', |
| | | fieldName: 'HeTongTotal', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | editable: false, |
| | | initialWidth: 100 |
| | | }, |
| | | |
| | | ], |
| | | sortInterfaces: [], |
| | | searchColumns: initSearchFormFixedPrice2 |
| | | } |
| | | export const initSearchFormDiscount2 = [] |
| | | export const initDataTableDiscount2 = { |
| | | columns: [{ |
| | | label: '经销商分类', |
| | | fieldName: 'JxsType', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '分类', |
| | | fieldName: 'Category__c', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | // { |
| | | // label: '对象品折扣', |
| | | // fieldName: 'GuaranteeDiscount__c', |
| | | // sortable: true, |
| | | // cellAttributes: { |
| | | // alignment: 'center' |
| | | // } |
| | | // }, |
| | | // { |
| | | // label: '非对象品折扣', |
| | | // fieldName: 'NormalDiscount__c', |
| | | // sortable: true, |
| | | // cellAttributes: { |
| | | // alignment: 'center' |
| | | // } |
| | | // }, |
| | | { |
| | | label: '对象品折扣', |
| | | fieldName: 'GuaranteeDiscount__c_Input', |
| | | editable: false, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | }, |
| | | { |
| | | label: '对象品合同金额', |
| | | fieldName: 'GuaranteeDiscount_H_Money__c', |
| | | type: 'number', |
| | | editable: false, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | } |
| | | }, |
| | | { |
| | | label: '非对象品折扣', |
| | | fieldName: 'NormalDiscount__c_Input', |
| | | editable: false, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | }, |
| | | { |
| | | label: '非对象品合同金额', |
| | | fieldName: 'NormalDiscount_H_Money__c', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | editable: false, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | } |
| | | }, |
| | | { |
| | | label: '合同价格', |
| | | fieldName: 'HeTongPrice', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | editable: false, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | } |
| | | } |
| | | ], |
| | | sortInterfaces: [], |
| | | searchColumns: initSearchFormDiscount2 |
| | | } |
| | | export const initSearchFormSpecial2 = [] |
| | | export const initDataTableSpecial2 = { |
| | | columns: [{ |
| | | label: '编码', |
| | | fieldName: 'PromotionNo__c', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '协议产品', |
| | | fieldName: 'Department__c', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '对象品折扣', |
| | | fieldName: 'GuaranteeDiscount__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '非对象品折扣', |
| | | fieldName: 'NormalDiscount__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '协议编码', |
| | | fieldName: 'Contract__c', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | { |
| | | label: '经销商', |
| | | fieldName: 'Agency__Name', |
| | | sortable: true, |
| | | hideDefaultActions: true |
| | | }, |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: initSearchFormSpecial2 |
| | | } |
| | | export const initSearchFormOtherData2 = [] |
| | | export const initDataTableOtherData2 = { |
| | | columns: [{ |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model_No__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | typeAttributes: { |
| | | }, |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name__c', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | |
| | | initialWidth: 268 |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '使用数量', |
| | | fieldName: 'SplitQuantity', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right', |
| | | class: {} |
| | | }, |
| | | editable: false |
| | | }, |
| | | { |
| | | label: '保修类型', |
| | | fieldName: 'warrantyType__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | }, |
| | | { |
| | | label: '主报价', |
| | | fieldName: 'ListPrice', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '多年保价格小计', |
| | | fieldName: 'NoDiscountTotal__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: initSearchFormOtherData2 |
| | | } |
| | | export const initSearchFormCommonly2 = [{ |
| | | label: "方案代码", |
| | | type: "text", |
| | | name: "PromotionNo__cEqual", |
| | | isInput: true |
| | | }, |
| | | { |
| | | label: "名称", |
| | | type: "text", |
| | | name: "NameLike", |
| | | isInput: true |
| | | } |
| | | ] |
| | | export const initDataTableCommonly2 = { |
| | | columns: [{ |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model_No__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | typeAttributes: { |
| | | }, |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | initialWidth: 268 |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity', |
| | | type: 'number', |
| | | hideDefaultActions: true, |
| | | sortable: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '使用数量', |
| | | fieldName: 'SplitQuantity', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right', |
| | | class: {} |
| | | }, |
| | | editable: false |
| | | }, |
| | | { |
| | | label: '保修类型', |
| | | fieldName: 'warrantyType__c', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | }, |
| | | { |
| | | label: '主报价', |
| | | fieldName: 'ListPrice', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | { |
| | | label: '多年保价格小计', |
| | | fieldName: 'NoDiscountTotal__c', |
| | | type: 'number', |
| | | sortable: true, |
| | | hideDefaultActions: true, |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | } |
| | | }, |
| | | |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: initSearchFormCommonly2 |
| | | } |
| New file |
| | |
| | | import { createElement } from 'lwc'; |
| | | import LexSINewQuoteEntry from 'c/lexSINewQuoteEntry'; |
| | | |
| | | describe('c-lex-si-new-quote-entry', () => { |
| | | afterEach(() => { |
| | | // The jsdom instance is shared across test cases in a single file so reset the DOM |
| | | while (document.body.firstChild) { |
| | | document.body.removeChild(document.body.firstChild); |
| | | } |
| | | }); |
| | | |
| | | it('TODO: test case generated by CLI command, please fill in test logic', () => { |
| | | // Arrange |
| | | const element = createElement('c-lex-si-new-quote-entry', { |
| | | is: LexSINewQuoteEntry |
| | | }); |
| | | |
| | | // Act |
| | | document.body.appendChild(element); |
| | | |
| | | // Assert |
| | | // const div = element.shadowRoot.querySelector('div'); |
| | | expect(1).toBe(1); |
| | | }); |
| | | }); |
| | |
| | | .diap{ |
| | | font-family: "宋体",sans-serif; |
| | | color: red; |
| | | opacity: 0.5; |
| | | @import 'c/lexCssUtility'; |
| | | :host { |
| | | --slds-c-textarea-sizing-min-height: 200px; |
| | | } |
| | | .my-icon { |
| | | --slds-c-icon-color-foreground-default: white; |
| | | } |
| | | .quobutton{ |
| | | font-size: 18px; |
| | | font-family: 'sans-serif'; |
| | | font-weight:500; |
| | | width: 160px; |
| | | height: 36px; |
| | | border-radius: 4px; |
| | | opacity: 1; |
| | | background:#0A81DF; |
| | | color:#FFFFFF; |
| | | } |
| | | /* .slds-scope .slds-alert_error { |
| | | --slds-c-alert-color-background: #ba0517 !important; |
| | | } */ |
| | | .my-icons{ |
| | | position: relative; |
| | | display: inline-flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 100%; |
| | | padding-top: var(--slds-c-alert-spacing-block-start, var(--sds-c-alert-spacing-block-start, var(--lwc-spacingXSmall,0.5rem))); |
| | | padding-right: var(--slds-c-alert-spacing-inline-end, var(--sds-c-alert-spacing-inline-end, var(--lwc-spacingXLarge,2rem))); |
| | | padding-bottom: var(--slds-c-alert-spacing-block-end, var(--sds-c-alert-spacing-block-end, var(--lwc-spacingXSmall,0.5rem))); |
| | | padding-left: var(--slds-c-alert-spacing-inline-start, var(--sds-c-alert-spacing-inline-start, var(--lwc-spacingXSmall,0.5rem))); |
| | | color: var(--slds-c-alert-text-color, var(--sds-c-alert-text-color, var(--slds-g-color-neutral-base-100, var(--lwc-colorTextInverse,rgb(255, 255, 255))))); |
| | | font-weight: var(--slds-c-alert-font-weight, var(--sds-c-alert-font-weight)); |
| | | text-align: center; |
| | | background-color: var(--slds-c-alert-color-background, var(--sds-c-alert-color-background, var(--slds-g-color-neutral-base-50, var(--lwc-colorBackgroundToast,rgb(116, 116, 116))))); |
| | | /* background-image: var(--slds-c-alert-image-background, var(--sds-c-alert-image-background, linear-gradient(45deg, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 25%, transparent 25%, transparent 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 50%, var(--slds-g-color-neutral-10-opacity-10, rgba(0, 0, 0, 0.025)) 75%, transparent 75%, transparent))); */ |
| | | background-size: var(--slds-c-alert-size-background, var(--sds-c-alert-size-background, 64px 64px)); |
| | | --slds-c-alert-color-background: #ba0517 !important; |
| | | } |
| | |
| | | <template></template> |
| | | <template> |
| | | <!-- 全局加载标识 --> |
| | | <div class="exampleHolder" if:true={IsLoading} > |
| | | <lightning-spinner alternative-text="Loading" size="large" style="height: 100%;top: 0%; z-index: 7"></lightning-spinner> |
| | | </div> |
| | | <div style="float:right; z-index: 8;" > |
| | | <div class="demo-only demo-only_viewport" style="height:4.5rem;" if:true = {Tongzhishow}> |
| | | <div class="slds-notification-container" style={IsLeftStyle}> |
| | | <div aria-live="assertive" aria-atomic="true" class="slds-assistive-text">提示</div> |
| | | <section class="slds-notification" role="dialog" aria-labelledby="noti77" aria-describedby="dialog-body-id-43" > |
| | | <div class="slds-notification__body" id="dialog-body-id-43" > |
| | | <a class="slds-notification__target slds-media" href="#" style={BgColorStyle}> |
| | | <div class="slds-media__body"> |
| | | <!-- <h2 class="slds-text-heading_small slds-m-bottom_xx-small" id="noti77" style="color:white;"> |
| | | <span class="slds-assistive-text" >task notification:</span> |
| | | 提示 |
| | | </h2> --> |
| | | <p style="color:white;" >{SaveShowText}</p> |
| | | </div> |
| | | </a> |
| | | <button class="slds-button slds-button_icon slds-button_icon-container slds-notification__close" title="close"> |
| | | <lightning-icon class="my-icon" icon-name="utility:close" alternative-text="close" title="close" size="x-small" onclick={CloseAlert}></lightning-icon> |
| | | </button> |
| | | </div> |
| | | </section> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 全局加载标识 --> |
| | | <!-- 基本信息 --> |
| | | <!-- 基本信息 --> |
| | | <div > |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>基本信息</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div > |
| | | <!-- 医院名 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {HPName}:</label> |
| | | <div class="slds-form-element__control" style="width:230px; display: inline-block;">{oppInfo.HP_Name__c}</div> |
| | | <!-- 医院名 --> |
| | | <!-- 科室名 --> |
| | | <label class="slds-form-element__label" style="width:50px;text-align:right;margin-left: 10px;"> {DepartmentName}:</label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Department_Name__c}</div> |
| | | <!-- 科室名 --> |
| | | <!-- 销售渠道 --> |
| | | <label class="slds-form-element__label" style="width:95px;text-align:right;margin-left: 52px;"> {SalesRoot}:</label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{oppInfo.Sales_Root__c}</div> |
| | | <!-- 销售渠道 --> |
| | | <!-- 货币 --> |
| | | <label class="slds-form-element__label" style="width:90px;text-align:right;margin-left: 80px;"> {Currency}:</label> |
| | | <div class="slds-form-element__control" style="width:60px; display: inline-block;">{oppInfo.CurrencyIsoCode}</div> |
| | | <!-- 货币 --> |
| | | </div> |
| | | <div > |
| | | <!-- 报价编码 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right; margin-left: 20px;"> {QuotoNo}:</label> |
| | | <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Quote_No__c}</div> |
| | | <!-- 报价编码 --> |
| | | <!-- 报价名称 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {QuotoName}:</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="text" value={quo.QuoteName__c} disabled ={Decisiontag} onblur={QuoteNameAssignment}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.qname}>请输入值!</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!-- 报价名称 --> |
| | | <!-- 报价总额 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;"> {TotalPrice}:</label> |
| | | <div class ="slds-form-element__control" style=" width:200px;display: inline-block;">{quo.QuoteTotal_Page__c}</div> |
| | | <!-- 报价总额 --> |
| | | <!-- 产品标准定价总额 --> |
| | | <label class="slds-form-element__label" style="width:110px;text-align:right; margin-left: 10px;">产品标准定价总额:</label> |
| | | <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.Estimation_List_Price__c}</div> |
| | | <!-- 产品标准定价总额 --> |
| | | </div> |
| | | <div > |
| | | <!-- OCM预测额销售 --> |
| | | <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ForecastAmounts}:</label> |
| | | <!-- <div class="slds-form-element__control" style="width:170px; display: inline-block;">{oppInfo.Wholesale_Price__c}</div> --> |
| | | <div class="slds-form-element__control" style="width:170px; display: inline-block;">{quo.OCM_Sales_Forecast__c}</div> |
| | | <!-- OCM预测额销售 --> |
| | | <!-- 最终客户成交价(仅OLY供货产品) --> |
| | | <label class="slds-form-element__label" style="width:110px;text-align:right;margin-left: 10px;"> {ContactPrice}:</label> |
| | | <div class ="slds-form-element__control" style=" width:177px;display: inline-block;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Dealer_Final_Price_Page__c} disabled ={Decisiontag} onblur={DealerFinalPricePageChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.dfpp}>请输入值!</div> |
| | | <!-- <div style="font-size:1px;color:#ba0517">请输入值!</div> --> |
| | | </div> |
| | | <!-- 最终客户成交价(仅OLY供货产品) --> |
| | | <!-- 主机装机地 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 20px;">主机装机地点:</label> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;"> |
| | | <lightning-combobox |
| | | name="progress" |
| | | value={quo.Installation_location__c} |
| | | options={HostInstallationLocationoptions} |
| | | onchange={HostInstallationLocationhandleChange} disabled ={Decisiontag}></lightning-combobox> |
| | | </div> |
| | | <!-- 主机装机地 --> |
| | | <!-- 成本 --> |
| | | <!-- <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 105px;"> {Cost} :</label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.Stocking_Price__c}</div> --> |
| | | <!-- 成本 --> |
| | | </div> |
| | | <div > |
| | | <!-- 合同保修期(年) --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right; margin-left: 0px;">合同保修期(年):</label> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:true={QuotCalfag}> |
| | | <lightning-combobox |
| | | data-parent-id="GuranteePeriodId" |
| | | name="progress" |
| | | value={quo.Gurantee_Period__c} |
| | | options={ContractWarrantyPeriodYearOptions} |
| | | onchange={ContractWarrantyPeriodYearHandleChange} disabled ={Decisiontag}></lightning-combobox> |
| | | </div> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;" if:false={QuotCalfag}> |
| | | {quo.Gurantee_Period__c} |
| | | </div> |
| | | <!-- 合同保修期(年) --> |
| | | <!-- 取消市场多年保修 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left:50px;">取消市场多年保修: </label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="checkbox" checked={quo.multiYearWarranty__c} disabled ={Decisiontag} onchange={multiYearWarrantyChange}> </lightning-input> |
| | | </div> |
| | | <!-- 取消市场多年保修 --> |
| | | <!-- 多年保价格合计 --> |
| | | <label class="slds-form-element__label" style="width:100px;text-align:right;margin-left: 165px;">多年保价格合计: </label> |
| | | <div class="slds-form-element__control" style="width:150px; display: inline-block;">{quo.MultiYearWarrantyTotalPrice__c}</div> |
| | | <!-- 多年保价格合计 --> |
| | | </div> |
| | | <div> |
| | | <!-- 报价变化 --> |
| | | <label class="slds-form-element__label" style="width:80px;text-align:right; margin-left: 40px;">报价变化: </label> |
| | | <div class ="slds-form-element__control" style="width:120px; display: inline-block;"> |
| | | <lightning-combobox |
| | | name="progress" |
| | | value={quo.QuotationChange__c} |
| | | options={QuotationChangesOptions} |
| | | onchange={QuotationChangesHandleChange} disabled ={Decisiontag}></lightning-combobox> |
| | | </div> |
| | | <!-- 报价变化 --> |
| | | |
| | | <!-- 主机不带监视器台车 --> |
| | | <label class="slds-form-element__label" style="width:130px;text-align:right;margin-left: 40px;">主机不带监视器台车: </label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="checkbox" checked={quo.MainEngineWithoutMonitor__c} disabled ={Decisiontag} onchange={MainEngineWithoutMonitorChange}> </lightning-input> |
| | | </div> |
| | | <!-- 主机不带监视器台车 --> |
| | | <!-- 跨科室 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 145px;">跨科室: </label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="checkbox" checked={quo.Interdepartmental__c} disabled ={Decisiontag} onchange={InterdepartmentalChange}> </lightning-input> |
| | | </div> |
| | | <!-- 跨科室 --> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 基本信息 --> |
| | | <!-- 经销商价格 --> |
| | | <div > |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>经销商价格</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <!-- style="background-color:#ffd6c1" --> |
| | | <div > |
| | | <div style="margin-bottom: 15px; "> |
| | | <!--报价调整折扣 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">报价调整折扣</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Calculate__c} disabled ={Decisiontag} onblur={QuoteAdjustCalculateChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.qacc}>请输入值!</div> |
| | | </div> |
| | | <!--报价调整折扣 --> |
| | | <!-- 百分比标签 --> |
| | | <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label> |
| | | <!-- 百分比标签 --> |
| | | <!--报价调整金额 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">报价调整金额</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block; margin-left: 15px;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Quote_Adjust_Amount_Page__c} disabled ={Decisiontag} onblur={QuoteAdjustAmountPageChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.qaapc}>请输入值!</div> |
| | | </div> |
| | | <!--报价调整金额 --> |
| | | <!--是否已报价计算标识 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;margin-left: 20px;">是否已报价计算:</label> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;"> |
| | | <lightning-input type="checkbox" checked={quo.IsQuoteTrial__c} disabled> </lightning-input> |
| | | </div> |
| | | <!--是否已报价计算标识 --> |
| | | </div> |
| | | <div style="margin-bottom: 5px; "> |
| | | <!--经销商一名称 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">{SalesName1}</label> |
| | | <div style="display: inline-block;"> |
| | | <c-jzlookuplightning2 data-parent-id="Agency1Id" recordid ={quoId} onsearchchange={onsearchchange1} objectname="Quote" fieldname="Agency1__c" variant = "label-hidden" lookupstyle="width:300px;"> </c-jzlookuplightning2> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency1}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency1}>请不要输入値。</div> |
| | | </div> |
| | | <!--经销商一名称 --> |
| | | <!-- 合同金额标签 --> |
| | | <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label> |
| | | <!-- 合同金额标签 --> |
| | | <!--经销商一合同金额 --> |
| | | <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:false={Decisiontag}> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={quo.IsQuoteTrial__c} onblur ={OCMAgent1PricePageonChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>请不要输入値。</div> |
| | | </div> |
| | | <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;" if:true={Decisiontag}> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.OCM_Agent1_Price_Page__c} disabled ={Decisiontag} onblur ={OCMAgent1PricePageonChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.oapp}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.noapp}>请不要输入値。</div> |
| | | </div> |
| | | <!--经销商一合同金额 --> |
| | | <!-- 利润标签 --> |
| | | <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}:</label> |
| | | <!-- 利润标签 --> |
| | | <!--经销商一利润显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency1_Profit__c}</div> |
| | | <!--经销商一利润显示 --> |
| | | <!--经销商一百分比显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency1_Profit_Rate__c}</div> |
| | | <!--经销商一百分比显示 --> |
| | | <!-- 百分比标签 --> |
| | | <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label> |
| | | <!-- 百分比标签 --> |
| | | </div> |
| | | <div style="margin-bottom: 15px; "> |
| | | <!--经销商二名称 --> |
| | | <label class="slds-form-element__label" style="width:120px;text-align:right;">{Sales_Name2}</label> |
| | | <div style="display: inline-block;"> |
| | | <c-jzlookuplightning2 data-parent-id="Agency2Id" recordid ={quoId} onsearchchange={onsearchchange2} objectname="Quote" fieldname="Agency2__c" variant = "label-hidden" lookupstyle="width:300px; display: inline-block;"> </c-jzlookuplightning2> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.Agency2}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.nAgency2}>请不要输入値。</div> |
| | | </div> |
| | | <!--经销商二名称 --> |
| | | <!-- 合同金额标签 --> |
| | | <label class="slds-form-element__label" style="width:60px; display: inline-block; margin-left: 100px;">{Amount}</label> |
| | | <!-- 合同金额标签 --> |
| | | <!--经销商二合同金额 --> |
| | | <div class ="slds-form-element__control" style="width:140px; display: inline-block; margin-left: 5px;"> |
| | | <lightning-input class="input-text-align_right" type="text" value={quo.Agent1_Agent2_Price_Page__c} disabled ={Decisiontag} onblur ={Agent1Agent2PricePageChange}> </lightning-input> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.aapp}>请输入值!</div> |
| | | <div style="font-size:12px;color:#ba0517" if:true={nafg.naapp}>请不要输入値。</div> |
| | | </div> |
| | | <!--经销商二合同金额 --> |
| | | <!-- 利润标签 --> |
| | | <label class="slds-form-element__label" style="width:45px; display: inline-block; margin-left: 100px;">{SalesProfit}:</label> |
| | | <!-- 利润标签 --> |
| | | <!--经销商二利润显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;margin-left: 5px;">{quo.Agency2_Profit__c}</div> |
| | | <!--经销商二利润显示 --> |
| | | <!--经销商二百分比显示 --> |
| | | <div class="slds-form-element__control" style="width:120px; display: inline-block;text-align:right;margin-left: 20px;">{quo.Agency2_Profit_Rate__c}</div> |
| | | <!--经销商二百分比显示 --> |
| | | <!-- 百分比标签 --> |
| | | <label class="slds-form-element__label" style="width:20px; display: inline-block; margin-left: 5px;">{Percent}</label> |
| | | <!-- 百分比标签 --> |
| | | </div> |
| | | <div style="margin-bottom: 15px; "> |
| | | <!-- 保存 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={savebuttonClick} if:true={hidden}>保存</button> |
| | | <!-- 保存 --> |
| | | <!-- 保存并关闭 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={Saveandback} if:true={hidden}>{Opp_Button}</button> |
| | | <!-- 保存并关闭 --> |
| | | <!-- 报价计算 --> |
| | | <button class={QTcss} style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={showQuotationCalculation} if:true={QuotCalfag}>报价计算</button> |
| | | <!-- 报价计算 --> |
| | | <!-- Decide --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decision_button} onclick={decisionbuttonClick} if:true={hidden}>{QuoteDecision_Button}</button> |
| | | <!-- Decide --> |
| | | <!-- 复制 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" onclick={copyToClipboardNewQuoteEntry} if:true={hidden}>{Copy_Detail}</button> |
| | | <!-- 复制 --> |
| | | <!-- 不保存(返回) --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" onclick={noSaveback}>不保存(返回)</button> |
| | | <!-- 不保存(返回) --> |
| | | </div> |
| | | <div style="margin-bottom: 15px;" if:true={hidden}> |
| | | <!-- 备货确认申请保存 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Save_button} onclick={submitOppoApplyStockJs}>备货确认申请</button> |
| | | <!-- 备货确认申请 --> |
| | | <!-- CSV下载 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={CSVflag} onclick={DownloadCsvGet}>CSV下载</button> |
| | | <!-- CSV下载 --> |
| | | <!-- 确认报价 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" if:true={UnConfirmQuote} onclick={QuoteConfirmJs}>确认报价</button> |
| | | <!-- 确认报价 --> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 经销商价格 --> |
| | | <!-- 选择报价产品 --> |
| | | <!-- <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct}></c-jz-data-table> |
| | | </div> --> |
| | | <div if:false={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>选择报价产品</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div style="margin-bottom: 15px; "> |
| | | <!-- 选择产品 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:125px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={NewQuotationProducts}>选择产品</button> |
| | | <!-- 选择产品 --> |
| | | <!-- 产品配套搜索 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openSetProduct}>{SetProduct}</button> |
| | | <!-- 产品配套搜索 --> |
| | | <!-- Excel导入 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={openQuoteExcelImport}>{ExcelImport}</button> |
| | | <!-- Excel导入 --> |
| | | <!-- 删除 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={deletejzDataToBeproduct}>删除产品</button> |
| | | <!-- 删除 --> |
| | | <!-- 更新价格状态 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick ={productCompare}>{StatusUpdate}</button> |
| | | <!-- 更新价格状态 --> |
| | | <!-- 替换产品otcode --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:130px;text-align:right; margin-left: 52px; font-size:small;" disabled ={Decisiontag} onclick={updateOtcode}>替换产品otcode</button> |
| | | <!-- 替换产品otcode --> |
| | | </div> |
| | | <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table idkey="lineNo" miniheight="min-height: 60px" onrowselection={SelectedToBeproduct} name="jzDataTableToBeproduct" ongettabledata={getTableDataToBeproduct} table-data={jzDataToBeproduct} table-is-loding={tableIsLodingToBeproduct} options={initDataTableToBeproduct} onrowaction={handleRowAction} onsave={onsaveToBeproduct} if:true={tobeflag}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 选择报价产品 --> |
| | | <!-- 测试报价计算组件 --> |
| | | <!-- <div if:true={pricePolicyflag1}> |
| | | <c-quote-trial paramid={quoId}></c-quote-trial> |
| | | </div> --> |
| | | <!-- 报价计算待选产品 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>报价计算待选产品</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div style="min-height: 60px;"> |
| | | <c-jz-data-table miniheight="min-height: 60px" onrowselection={SelectedFnDefault} name="jzDataTableDefault" ongettabledata={getTableDataDefault} table-data={jzDataDefault} table-is-loding={tableIsLodingDefault} options={initDataTableDefault}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 报价计算待选产品 --> |
| | | <!-- 报价计算使用价格政策 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>报价计算使用价格政策</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div if:true={buttonIsShow}> |
| | | <!-- <button class="slds-button slds-button_brand" onclick={showModal}>选择促销方案固定价格</button> --> |
| | | <!-- 选择促销方案 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:170px;text-align:right; font-size:small;" onclick={showModal}>选择促销方案固定价格</button> |
| | | <!-- 选择促销方案 --> |
| | | <!-- 选择一般产品固定价格 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalFix}>选择一般产品固定价格</button> |
| | | <!-- 选择一般产品固定价格 --> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={deleteFixedPrice}>删除</button> |
| | | </div> |
| | | <div if:true={jzDataTableFixedPriceIsShow}> |
| | | <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnFixedPrice} name="jzDataTableFixedPrice" ongettabledata={getTableDataFixedPrice} table-data={jzDataFixedPrice} table-is-loding={tableIsLodingFixedPrice} options={initDataTableFixedPrice} onsave={handleSaveFixedPrice} if:true={jzshows3}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 报价计算使用价格政策 --> |
| | | <!-- 报价计算使用折扣政策 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>报价计算使用折扣政策</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div if:true={buttonIsShow}> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalSpecial} >选择特约折扣</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={showModalCommonly}>选择一般折扣</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableDiscount}>删除</button> |
| | | </div> |
| | | <div if:true={jzDataTableDiscountIsShow}></div> |
| | | <div style="min-height: 60px;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table class="jzdtdis" miniheight="min-height: 60px" idkey="DelectId" onrowselection={SelectedFnDiscount} name="jzDataTableDiscount" ongettabledata={getTableDataDiscount} table-data={jzDataDiscount} table-is-loding={tableIsLodingDiscount} options={initDataTableDiscount} onsave={handleSaveDiscount} if:true={jzshows2}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 报价计算使用折扣政策 --> |
| | | <!-- 产品明细 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>产品明细</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div if:true={buttonIsShow}> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small; width:170px;margin-bottom: 15px;" onclick={delectTableProduct}>删除</button> |
| | | </div> |
| | | <div style="min-height: 60px;max-height: 400px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table data-parent-id="chuxiao" idkey="DelectId" miniheight="min-height: 60px" onrowselection={SelectedFnProduct} name="jzDataTableProduct" ongettabledata={getTableDataProduct} table-data={jzDataProduct} table-is-loding={tableIsLodingProduct} options={initDataTableProduct} if:true={jzshows}></c-jz-data-table> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 产品明细 --> |
| | | <!-- 报价计算底部 --> |
| | | <div if:true={pricePolicyflag}> |
| | | <!-- 合同总价 --> |
| | | <p align="center" ><b>合同总价:{ContractPrice}</b></p> |
| | | <!-- 合同总价 --> |
| | | <!-- 保存报价计算结果按钮 --> |
| | | <div align="right" style="margin-bottom: 15px;margin-right: 15px; "> |
| | | <button if:true={buttonIsShow} style="font-size:small;" class="slds-button slds-button_neutral slds-button_stretch lexBorder" onclick={saveAllDataProductFn}>保存报价计算结果</button> |
| | | </div> |
| | | <!-- 保存报价计算结果按钮 --> |
| | | </div> |
| | | <!-- 报价计算底部 --> |
| | | <!-- 文件打印 --> |
| | | <div > |
| | | <article class="slds-card" > |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__header slds-grid" > |
| | | <header class="slds-media slds-media_center slds-has-flexi-truncate"> |
| | | <div class="slds-media__body"> |
| | | <h2 class="slds-card__header-title"> |
| | | <a href="#" class="slds-card__header-link slds-truncate" title="Accounts"> |
| | | <span>文件打印</span> |
| | | </a> |
| | | </h2> |
| | | </div> |
| | | </header> |
| | | </div> |
| | | <!-- 样式头 --> |
| | | <div class="slds-card__body slds-card__body_inner"> |
| | | <div> |
| | | <!-- 打印报价 --> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Quote_Print}</label> |
| | | <!-- 打印报价 --> |
| | | <!-- 单价 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Unit_Price__c} onchange={UnitPriceChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">单价</label> |
| | | <!-- 单价 --> |
| | | <!-- 报价金额 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Offer_Amount__c} onchange={OfferAmountChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">报价金额</label> |
| | | <!-- 报价金额 --> |
| | | <!-- 报价总额 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.TOTAL__c} onchange={TOTALChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{TotalPrice}</label> |
| | | <!-- 报价总额 --> |
| | | <!-- 优惠折扣 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Discount__c} onchange={DiscountChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Total_Discount_Percent}</label> |
| | | <!-- 优惠折扣 --> |
| | | <!-- 优惠价格 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Pricing__c} onchange={PricingChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">优惠价格</label> |
| | | <!-- 优惠价格 --> |
| | | <!-- 优惠成交价 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Preferential_Trading_Price__c} onchange={PreferentialTradingPriceChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;;margin-left: 5px;">{Row_Total_Sum}</label> |
| | | <!-- 优惠成交价 --> |
| | | <!-- 保修年限 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 30px;"> |
| | | <lightning-input type="checkbox" checked={quo.Preferential_Gurantee_Period__c} onchange={PreferentialGuranteePeriodChange}> </lightning-input> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left: 5px;">保修年限 </label> |
| | | <!-- 保修年限 --> |
| | | <!-- 合同配置 --> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px; " if:true={enableContract}> |
| | | <lightning-input type="checkbox" checked={quo.Contract__c} onchange={ContractcChange} > </lightning-input> |
| | | </div> |
| | | <div class ="slds-form-element__control" style=" display: inline-block;margin-left: 81px;" if:false={enableContract}> |
| | | </div> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left:5px;">{Contract_Breakdown}</label> |
| | | <!-- 合同配置 --> |
| | | </div> |
| | | <div> |
| | | <!-- 打印客户名称 --> |
| | | <label class="slds-form-element__label" style="text-align:right;margin-left: 15px;">{Print_HPName}</label> |
| | | <div class ="slds-form-element__control" style="width:400px; display: inline-block;"> |
| | | <lightning-combobox |
| | | name="progress" |
| | | value={selection_hp} |
| | | options={PrintCustomerNameoptions} |
| | | onchange={PrintCustomerNamehandleChange} ></lightning-combobox> |
| | | </div> |
| | | <!-- 打印客户名称 --> |
| | | <!-- 打印按钮 --> |
| | | <div style="display: inline-block;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style="width:120px;text-align:right; margin-left: 380px; font-size:small;" disabled={print_buttonflg} onclick={PrintButton} if:true={hidden}>{Print_Button}</button> |
| | | </div> |
| | | <!-- 打印按钮 --> |
| | | </div> |
| | | </div> |
| | | </article> |
| | | </div> |
| | | <!-- 文件打印 --> |
| | | <!-- 新增报价产品模态框 --> |
| | | <div if:true = {showproductfalg} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-5"> |
| | | <!-- 报价产品搜索框 --> |
| | | <div class="exampleHolder" if:true={IsLoadingjdpt} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <!-- <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataProduct} options={initSearchFormProduct}></c-jz-search-form> --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label="产品型号:" style="width:150px" onblur={jzProductsearchChange}></lightning-input> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={jzProductsearchbutton}>搜索</button> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={additionaljzProductbutton}>追加</button> |
| | | </div> |
| | | <!-- 报价产品搜索框 --> |
| | | <!-- 报价产品列表 --> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedProductFn} data-parent-id="parent-div-productid" name="jzDataproductTable" ongettabledata={getTableProductData} table-data={jzProductData} table-is-loding={tableIsproductLoding} options={initDataProductTable} ></c-jz-data-table> |
| | | </div> |
| | | <!-- 报价产品列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelProduct}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 新增报价产品模态框 --> |
| | | <!-- 新增产品配套模态框 --> |
| | | <div if:true = {showSetProductfalg} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-10"> |
| | | <!-- 产品配套搜索框 --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label=" 产品配套名:" style="width:150px;margin-left: 20px;" onblur={jzSearchNameChange}></lightning-input> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label=" 产品配套编码:" style="width:150px;margin-left: 20px;" onblur={jzSearchCodeChange}></lightning-input> |
| | | </div> |
| | | <div class ="slds-form-element__control" style="width:150px; display: inline-block;;margin-left: 20px;"> |
| | | <lightning-combobox |
| | | label = '适用科室 :' |
| | | name="setpro" |
| | | options={listViewOptions} |
| | | onchange={filterNameChange} ></lightning-combobox> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 100px; font-size:small;" onclick={jzsetProductsearchbutton}>搜索</button> |
| | | </div> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" margin-left: 20px; font-size:small;" onclick={additionaljzsetProductbutton}>追加</button> |
| | | </div> |
| | | <!--产品配套搜索框 --> |
| | | <!-- 产品配套列表 --> |
| | | <div class="exampleHolder" if:true={IsLoadingjdspt} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table data-parent-id="parent-div-setid" onrowselection={SelectedSetProductFn} name="jzDataSetProductTable" ongettabledata={getTableSetProductData} table-data={jzSetProductData} table-is-loding={tableIsSetProductLoding} options={initDataSetProductTable} ></c-jz-data-table> |
| | | </div> |
| | | <!-- 产品配套列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelsetProduct}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 新增产品配套模态框 --> |
| | | <!-- 新增Excel导入模态框 --> |
| | | <div if:true = {showQuoteExcelImport} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-9"> |
| | | <!-- 产品配套搜索框 --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{ImportText}</div> |
| | | <div class ="form-group" > |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;">{Tab_Text}</div> |
| | | </div> |
| | | <lightning-textarea class="inputFont" name="exceltext" onchange={exceltextChange} value={exceltextvalue}></lightning-textarea> |
| | | |
| | | <!--产品配套搜索框 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelQuoteExcelImport}>关闭</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSQuoteExcelImport} >保存</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 新增Excel导入模态框 --> |
| | | <!-- 选择促销方案模态框 --> |
| | | <div if:true = {show} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1"> |
| | | <!-- 促销方案搜索框 --> |
| | | <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchData} options={initSearchForm}></c-jz-search-form> |
| | | <!-- 促销方案搜索框 --> |
| | | <!-- 促销方案列表 --> |
| | | <div class="exampleHolder" if:true={IsLoading6} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFn} data-parent-id="parent-div-id" name="jzDataTable1" ongettabledata={getTableData} table-data={jzData} table-is-loding={tableIsLoding} options={initDataTable} onsave={savejzData} if:true={jzdateflag}></c-jz-data-table> |
| | | </div> |
| | | <!-- 促销方案列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancel}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择促销方案模态框 --> |
| | | <!-- 选择一般产品固定价格模态框 --> |
| | | <div if:true = {ShowFix} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2"> |
| | | <c-jz-search-form name="jzSearchForm1" searchdataclass ="slds-button slds-button_neutral slds-button_stretch lexBorder" ongetsearchparams={searchDataFix} options={initSearchFormFix}></c-jz-search-form> |
| | | <c-jz-data-table onrowselection={SelectedFnFix} data-parent-id="parent-div-idFix" name="jzDataTableFix" ongettabledata={getTableDataFix} table-data={jzDataFix} table-is-loding={tableIsLodingFix} options={initDataTableFix}></c-jz-data-table> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelFix}>关闭</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择一般产品固定价格模态框 --> |
| | | <!-- 选择特约折扣模态框 --> |
| | | <div if:true = {ShowSpecial} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <!-- 特约折扣模态框错误提示 --> |
| | | <div if:true = {ShowSpecialIsError}> |
| | | <div class="my-icons" role="alert"> |
| | | <span class="slds-assistive-text">error</span> |
| | | <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed"> |
| | | <svg class="slds-icon slds-icon_x-small" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use> |
| | | </svg> |
| | | </span> |
| | | <h2>{ShowSpecialError} |
| | | </h2> |
| | | <div class="slds-notify__close"> |
| | | <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close"> |
| | | <svg class="slds-button__icon" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use> |
| | | </svg> |
| | | <span class="slds-assistive-text">Close</span> |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 特约折扣模态框错误提示 --> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-3"> |
| | | <!-- 特约折扣待选方案列表 --> |
| | | <div style="height:335px;overflow:auto;border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFnSpecial} data-parent-id="parent-div-idSpecial" name="jzDataTableSpecial" ongettabledata={getTableDataSpecial} table-data={jzDataSpecial} table-is-loding={tableIsLodingSpecial} options={initDataTableSpecial}></c-jz-data-table> |
| | | </div> |
| | | <!-- 特约折扣待选方案列表 --> |
| | | <!-- 特约折扣待选产品列表 --> |
| | | <div class="exampleHolder" if:true={IsLoading5} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFnOtherData} data-parent-id="parent-div-idOtherData" name="jzDataTableOtherData" ongettabledata={getTableDataOtherData} table-data={jzDataOtherData} table-is-loding={tableIsLodingOtherData} options={initDataTableOtherData} onsave={SaveSpecialDiscount} if:true={jzshows5}></c-jz-data-table> |
| | | </div> |
| | | <!-- 特约折扣待选产品列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSpecial}>关闭</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={SavesSpecial} >确定</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择特约折扣模态框 --> |
| | | <!-- 选择一般折扣模态框 --> |
| | | <div if:true = {ShowCommonly} > |
| | | <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1"> |
| | | <div class="slds-modal__container"> |
| | | <!-- 一般折扣模态框错误提示 --> |
| | | <div if:true = {ShowCommonlyIsError}> |
| | | <div class="my-icons" role="alert"> |
| | | <span class="slds-assistive-text">error</span> |
| | | <span class="slds-icon_container slds-icon-utility-error slds-m-right_x-small" title="Description of icon when needed"> |
| | | <svg class="slds-icon slds-icon_x-small" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#error"></use> |
| | | </svg> |
| | | </span> |
| | | <h2>{ShowCommonlyError} |
| | | <a href="#"></a> |
| | | </h2> |
| | | <div class="slds-notify__close"> |
| | | <button class="slds-button slds-button_icon slds-button_icon-small slds-button_icon-inverse" style=" font-size:small;" title="Close"> |
| | | <svg class="slds-button__icon" aria-hidden="true"> |
| | | <use xlink:href="/assets/icons/utility-sprite/svg/symbols.svg#close"></use> |
| | | </svg> |
| | | <span class="slds-assistive-text">Close</span> |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 一般折扣模态框错误提示 --> |
| | | <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-4"> |
| | | <!-- 产品系列 --> |
| | | <div class ="form-group"> |
| | | <div class ="form-group" style=" display: inline-block; margin-right: 20px;margin-bottom: 15px;"> |
| | | <div class="slds-form-element"> |
| | | <label class="slds-form-element__label" for="select-01">产品系列:</label> |
| | | <div class="slds-form-element__control"> |
| | | <div class="slds-select_container"> |
| | | <select class="slds-select" style="width:150px" onchange={handleChangeLb}> |
| | | <option value="">选择</option> |
| | | <option>GI分野</option> |
| | | <option>SP分野</option> |
| | | <option>ET分野</option> |
| | | <option>能量刀头</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 产品系列 --> |
| | | <!-- 使用折扣 --> |
| | | <div class ="form-group" style=" display: inline-block;margin-bottom: 15px;"> |
| | | <lightning-input type="text" name="input2" label="使用折扣:" style="width:150px" onblur={handleChangeZk}></lightning-input> |
| | | </div> |
| | | <!-- 使用折扣 --> |
| | | </div> |
| | | <!-- 一般折扣待选产品列表 --> |
| | | <div class="exampleHolder" if:true={IsLoading4} > |
| | | <lightning-spinner alternative-text="Loading" style="height: 100%;top: 0%;" size="medium"></lightning-spinner> |
| | | </div> |
| | | <div style="border-top: 1px solid rgb(201, 201, 201);"> |
| | | <c-jz-data-table onrowselection={SelectedFnCommonly} data-parent-id="parent-div-idCommonly" name="jzDataTableCommonly" ongettabledata={getTableDataCommonly} table-data={jzDataCommonly} table-is-loding={tableIsLodingCommonly} options={initDataTableCommonly} onsave={SaveGeneralDiscount} if:true={jzshows4}></c-jz-data-table> |
| | | </div> |
| | | <!-- 一般折扣待选产品列表 --> |
| | | </div> |
| | | <footer class="slds-modal__footer"> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelCommonly}>关闭</button> |
| | | <button class="slds-button slds-button_neutral slds-button_stretch lexBorder" style=" font-size:small;" onclick={cancelSaveCommonly}>确定</button> |
| | | </footer> |
| | | </div> |
| | | </section> |
| | | <div class="slds-backdrop slds-backdrop_open"></div> |
| | | </div> |
| | | <!-- 选择一般折扣模态框 --> |
| | | </template> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSINewQuoteEntry"> |
| | | <apiVersion>51.0</apiVersion> |
| | | <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>58.0</apiVersion> |
| | | <isExposed>true</isExposed> |
| | | <targets> |
| | | <target>lightning__Tab</target> |
| | | <target>lightning__AppPage</target> |
| | | <target>lightning__RecordPage</target> |
| | | <target>lightning__HomePage</target> |
| New file |
| | |
| | | export var bflag; |
| | | export var oppInfosave; |
| | | export var quoLineItemsave; |
| | | export var DataStatus; |
| | | export var newQuoteFlagex; |
| | | export var MultiYearWarrantyTotalPriceExport; |
| | | export var newQuoteFlagExp; |
| | | export var productStatusUpdatedExp; |
| | | export var quoExp; |
| | | export var selection_hpExp; |
| | | export var options_hpflgExp; |
| | | export var fagExp; |
| | | export var ListPriceTotalExp; |
| | | export var unitPriceTotalExp; |
| | | export var errorflg; |
| | | export var StrExp; |
| | | export var IsQuoteTrialExp; |
| | | export var alertExp = ''; |
| | | export var alfExp = 0; |
| | | export var enableSalesExp; |
| | | export var enableContractExp; |
| | | export var displayFlgExp; |
| | | export var SbuttonExp; |
| | | export var sapbuttonExp; |
| | | export var pbuttonflgExp; |
| | | export var lookMapE; |
| | | export var nafgExp = {}; |
| | | export var flg = false; |
| | | export var Saleslet = false; |
| | | var addproductList = []; |
| | | var trade; |
| | | //选择报价产品配置列 |
| | | export var initDataTableToBeproductConfig = { |
| | | columns: [ |
| | | { |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model', |
| | | editable: false, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: 'NMPA状态', |
| | | fieldName: 'SFDA_Status__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'SFDAStatuclass' |
| | | }, |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '供应商名称', |
| | | fieldName: 'VenderName', |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '主报价价格', |
| | | fieldName: 'ListPrice_Page', |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | }, |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'ListPricePageclass' |
| | | }, |
| | | alignment: 'right' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity__c', |
| | | type: 'number', |
| | | editable: false, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '规格', |
| | | fieldName: 'Specifications', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '医院单价', |
| | | fieldName: 'UnitPrice_Page__c', |
| | | // editable: true, |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'right' |
| | | }, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '医院小计', |
| | | fieldName: 'Subtotal__c', |
| | | cellAttributes: { |
| | | alignment: 'right' |
| | | }, |
| | | type: 'number', |
| | | typeAttributes: { |
| | | minimumFractionDigits: '2', |
| | | maximumFractionDigits: '2' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '多年保修', |
| | | fieldName: 'multiYearWarranty__c', |
| | | type: 'boolean', |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '保修', |
| | | fieldName: 'warrantyType__c', |
| | | type: 'text', |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '保修年限', |
| | | fieldName: 'GuaranteePeriod__c', |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '预计消耗至', |
| | | fieldName: 'Estimated_ConsumptionDueDate', |
| | | type: 'date', |
| | | typeAttributes:{ |
| | | // weekday: "long", |
| | | year: "numeric", |
| | | month: "long", |
| | | day: "2-digit" |
| | | }, |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'EstimatedConsumptionDueDateclass' |
| | | }, |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '库存状态', |
| | | fieldName: 'StorageStatus', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'center' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '产品配套', |
| | | fieldName: 'Product_Set_Name', |
| | | type: 'text', |
| | | hideDefaultActions: true, |
| | | initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name', |
| | | type: 'url', |
| | | typeAttributes: { |
| | | label: { |
| | | fieldName: 'Name__c' |
| | | }, |
| | | tooltip: { |
| | | fieldName: 'website' |
| | | }, |
| | | target: '_blank' |
| | | }, |
| | | cellAttributes: { |
| | | class:{ |
| | | fieldName:'Nameclass' |
| | | }, |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 300 |
| | | }, |
| | | |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: [] |
| | | }; |
| | | //产品配套配置列 |
| | | export var initDataSetProductTablefig = { |
| | | columns: [ |
| | | { |
| | | label: '产品配套名', |
| | | fieldName: 'Name', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '产品配套编码', |
| | | fieldName: 'Product_Set_CD__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '数量', |
| | | fieldName: 'Quantity__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '补足信息', |
| | | fieldName: 'Quote_Select_Info__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | class: {}, |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | { |
| | | label: '有効', |
| | | fieldName: 'Valid_Status__c', |
| | | type: 'boolean', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | // initialWidth: 150 |
| | | }, |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns: [] |
| | | }; |
| | | //新增产品产品配置列 |
| | | export var initDataProductTablefig = { |
| | | columns: [{ |
| | | label: '产品型号', |
| | | fieldName: 'Asset_Model_No__c', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 110 |
| | | }, |
| | | { |
| | | label: '产品编码', |
| | | fieldName: 'OT_CODE_no_link__c', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 120 |
| | | }, |
| | | { |
| | | label: '产品名称', |
| | | fieldName: 'Name', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 270 |
| | | }, |
| | | { |
| | | label: '适用科室', |
| | | fieldName: 'suitDepartment__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: '代替产品', |
| | | fieldName: 'Alternative_Products__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 100 |
| | | }, |
| | | { |
| | | label: 'NMPA状态', |
| | | fieldName: 'SFDA_Status__c', |
| | | type: 'text', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 115 |
| | | }, |
| | | { |
| | | label: 'ListPrice(内贸)', |
| | | fieldName: 'Intra_Trade_List_RMB__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 130 |
| | | }, |
| | | { |
| | | label: 'ListPrice(外贸)', |
| | | fieldName: 'Foreign_Trade_List_US__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 130 |
| | | }, |
| | | { |
| | | label: '规格', |
| | | fieldName: 'Packing_list_manual__c', |
| | | type: 'number', |
| | | cellAttributes: { |
| | | alignment: 'left' |
| | | }, |
| | | hideDefaultActions: true, |
| | | initialWidth: 60 |
| | | }, |
| | | |
| | | ], |
| | | sortInterfaces: false, |
| | | searchColumns:[] |
| | | }; |
| | | export function localParseInt( input) { |
| | | input += ""; |
| | | input = input.split(" "); |
| | | if (input.length > 1) { |
| | | input = input[1]; |
| | | } else { |
| | | input = input[0]; |
| | | } |
| | | input = input.replace(/,/g, ""); |
| | | input = input.replace(/ /g, ""); |
| | | if ( input == '' || isNaN( input)) { |
| | | input = 0; |
| | | } |
| | | input = parseInt(input); |
| | | if (isNaN( input)) input = 0.00; |
| | | return input; |
| | | } |
| | | export function number_format_common (number, decimals, dec_point, thousands_sep) { |
| | | number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); |
| | | var n = !isFinite(+number) ? 0 : +number, |
| | | prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), |
| | | sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, |
| | | dec = (typeof dec_point === 'undefined') ? '.' : dec_point, |
| | | s = '', |
| | | toFixedFix = function (n, prec) { |
| | | var k = Math.pow(10, prec); |
| | | return '' + Math.round(n * k) / k; |
| | | }; |
| | | // Fix for IE parseFloat(0.55).toFixed(0) = 0; |
| | | s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); |
| | | if (s[0].length > 3) { |
| | | s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); |
| | | } |
| | | if ((s[1] || '').length < prec) { |
| | | s[1] = s[1] || ''; |
| | | s[1] += new Array(prec - s[1].length + 1).join('0'); |
| | | } |
| | | return ( s.join(dec)); |
| | | } |
| | | export function toNum( input) { |
| | | return number_format_common( input, 2, ".", ""); |
| | | } |
| | | export function toNumComma( input) { |
| | | return number_format_common( input, 2, ".", ","); |
| | | } |
| | | export function toNumComma_One_digit(input) { |
| | | return number_format_common( input, 1, ".", ","); |
| | | } |
| | | export function localParseFloat( input) { |
| | | input += ""; |
| | | input = input.split(" "); |
| | | if (input.length > 1) { |
| | | input = input[1]; |
| | | } else { |
| | | input = input[0]; |
| | | } |
| | | input = input.replace(/,/g, ""); |
| | | input = input.replace(/ /g, ""); |
| | | if ( input == '' || isNaN( input)) { |
| | | input = 0.00; |
| | | } |
| | | input = parseFloat(input); |
| | | if (isNaN( input)) input = 0.00; |
| | | return input; |
| | | } |
| | | export function NewQcopyLogic(Check_Your_Clipboard,records,x,targetString,reslut,displayCost,CurrencyIsoCode){ |
| | | records=reslut; |
| | | alfExp = false; |
| | | alertExp = ''; |
| | | for (var i = 0; i < records.length; i++) { |
| | | x = records[i]; |
| | | //判断空 |
| | | // x=IfCopyProperties(x); |
| | | targetString += '\r\n' + (i + 1) + '\t' + '=MID(( "_" & "' + x.ProductCode__c + '"),2,LEN("' + '_' + x.ProductCode__c + '")-1)' + '\t' + x.SFDA_Status__c + '\t' + x.Name__c + '\t' + toNumComma(x.ListPrice__c) + '\t' + x.Quantity + '\t' + (x.Qty_Unit__c == null ? '' : x.Qty_Unit__c) + '\t' + toNumComma(x.UnitPrice__c) + '\t' + toNumComma(x.UnitPrice__c * x.Quantity) + |
| | | '\t' + x.Present__c + '\t' + toNumComma_One_digit(x.AgencyUnitPrice__c) + '\t' + toNumComma_One_digit(x.AgencySubtotal__c); |
| | | if (!x.warrantyType__c) { |
| | | x.warrantyType__c = ''; |
| | | } |
| | | targetString += '\t' + x.multiYearWarranty__c + '\t' + x.warrantyType__c + |
| | | '\t' + toNumComma(x.NoDiscountTotal__c); |
| | | targetString += '\t' + x.GuaranteePeriod__c; |
| | | ; |
| | | if (displayCost) { |
| | | targetString += '\t' + toNumComma(x.Cost__c) + '\t' + CurrencyIsoCode; |
| | | } |
| | | } |
| | | try { |
| | | console.warn(targetString); |
| | | var tag = document.createElement('textarea'); |
| | | tag.setAttribute('id', 'cp_hgz_textarea'); |
| | | var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length; |
| | | tag.maxLength=strlenght+666; |
| | | tag.value = targetString; |
| | | document.getElementsByTagName('body')[0].appendChild(tag); |
| | | document.getElementById('cp_hgz_textarea').select(); |
| | | document.execCommand('copy'); |
| | | document.getElementById('cp_hgz_textarea').remove(); |
| | | alfExp = true; |
| | | alertExp = Check_Your_Clipboard; |
| | | } catch (error) { |
| | | alfExp = false; |
| | | alertExp = error; |
| | | } |
| | | } |
| | | export function productCompareLogic(jzDataToBeproduct,id2Product,t,b){ |
| | | debugger |
| | | bflag = b; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var a = jzdtbt.pageObject.Id__c; |
| | | if (a != '') { |
| | | var newProductGuranteePrice = 0; |
| | | var newProductServicePrice = 0; |
| | | var newMaintenance_Price_Year = 0; |
| | | if (t == '外貿') { |
| | | var recordTypeRecord = id2Product[a]; |
| | | var y1 = recordTypeRecord.Name; |
| | | var y2 = recordTypeRecord.Foreign_Trade_List_US__c; |
| | | var y3 = recordTypeRecord.Foreign_Trade_Cost_US__c; |
| | | newProductGuranteePrice = recordTypeRecord.Intra_Trade_Foreign_RMB__c; |
| | | newProductServicePrice = recordTypeRecord.NoDiscount_Foreign__c; |
| | | newMaintenance_Price_Year = recordTypeRecord.Repair_Contract_USD__c; |
| | | } else { |
| | | var recordTypeRecord = id2Product[a]; |
| | | var y1 = recordTypeRecord.Name; |
| | | var y2 = recordTypeRecord.Intra_Trade_List_RMB__c; |
| | | var y3 = recordTypeRecord.Intra_Trade_Cost_RMB__c; |
| | | newProductGuranteePrice = recordTypeRecord.Intra_Trade_Gurantee_RMB__c; |
| | | newProductServicePrice = recordTypeRecord.Intra_Trade_Service_RMB__c; |
| | | newMaintenance_Price_Year = recordTypeRecord.Maintenance_Price_Year__c; |
| | | } |
| | | // 保修类型 |
| | | var newGuranteeType = recordTypeRecord.GuranteeType__c; |
| | | if (!newGuranteeType) { |
| | | var newGuranteeType = ''; |
| | | } |
| | | var newProductEntend_gurantee_period_all = recordTypeRecord.Entend_gurantee_period_all__c; |
| | | var oldGuranteeType = jzdtbt.pageObject.GuranteeType__c; |
| | | var oldProductEntend_gurantee_period_all = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c; |
| | | var oldProductGuranteePrice = jzdtbt.ProductGuranteePrice; |
| | | var oldProductServicePrice = jzdtbt.pageObject.productServicePrice__c; |
| | | var oldMaintenance_Price_Year = jzdtbt.Maintenance_Price_Year; |
| | | oldProductServicePrice = localParseFloat(oldProductServicePrice); |
| | | newProductServicePrice = localParseFloat(newProductServicePrice); |
| | | oldProductGuranteePrice = localParseFloat(oldProductGuranteePrice); |
| | | newProductGuranteePrice = localParseFloat(newProductGuranteePrice); |
| | | newProductEntend_gurantee_period_all = localParseFloat(newProductEntend_gurantee_period_all); |
| | | oldMaintenance_Price_Year = localParseFloat(oldMaintenance_Price_Year); |
| | | newMaintenance_Price_Year = localParseFloat(newMaintenance_Price_Year); |
| | | var y4 = recordTypeRecord.SFDA_Status__c; |
| | | var s1 = recordTypeRecord.StorageStatus__c; |
| | | var x1 = jzdtbt.pageObject.Name__c; |
| | | var x2 = jzdtbt.ListPrice_Page; |
| | | var x3 = jzdtbt.Cost_c; |
| | | var x4 = jzdtbt.pageObject.SFDA_Status__c; |
| | | //連続半角スペース対応 |
| | | y1 = y1 + ''; |
| | | // y1 = y1.replace(/\s+/g, " "); |
| | | x2 = localParseFloat(x2); |
| | | x3 = localParseFloat(x3); |
| | | y2 = localParseFloat(y2); |
| | | y3 = localParseFloat(y3); |
| | | if ((x1 === y1) && (x2 === y2) && (x3 === y3) && (x4 === y4) |
| | | && |
| | | (oldGuranteeType === newGuranteeType) && |
| | | (oldProductEntend_gurantee_period_all === newProductEntend_gurantee_period_all) && |
| | | (oldProductGuranteePrice === newProductGuranteePrice) && |
| | | (oldProductServicePrice === newProductServicePrice) && |
| | | (oldMaintenance_Price_Year === newMaintenance_Price_Year) |
| | | ) {} else { |
| | | bflag = false; |
| | | } |
| | | jzdtbt.latestInfo.GuranteeType = newGuranteeType; |
| | | jzdtbt.latestInfo.ProductEntend_gurantee_period_all = newProductEntend_gurantee_period_all; |
| | | jzdtbt.latestInfo.Intra_Trade_Gurantee = localParseFloat(recordTypeRecord.Intra_Trade_Gurantee_RMB__c); |
| | | jzdtbt.latestInfo.Intra_Trade_Service = localParseFloat(recordTypeRecord.Intra_Trade_Service_RMB__c); |
| | | jzdtbt.latestInfo.Maintenance_Price_Year = localParseFloat(recordTypeRecord.Maintenance_Price_Year__c); |
| | | jzdtbt.latestInfo.ProductName = recordTypeRecord.Name; |
| | | jzdtbt.latestInfo.ListPrice = y2; |
| | | jzdtbt.latestInfo.Cost = y3; |
| | | jzdtbt.latestInfo.SFDA_Status = y4; |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function TimeToString(newDate){ |
| | | var value=newDate.toLocaleDateString(); |
| | | var value2=value.split('/'); |
| | | if(value2[1].length == 1){ |
| | | value2[1]='0'+value2[1]; |
| | | } |
| | | if(value2[2].length == 1){ |
| | | value2[2]='0'+value2[2]; |
| | | } |
| | | value=value2[0]+'-'+value2[1]+'-'+value2[2]; |
| | | return value; |
| | | } |
| | | export function saveEvoluationLogic(quoin,oppInfoIn,quoLineItemIn){ |
| | | debugger |
| | | var quo ={...{},...quoin}; |
| | | quo.Dealer_Final_Price_Page__c = quoin.Dealer_Final_Price_Page__c!=undefined&&quoin.Dealer_Final_Price_Page__c!=='' ?localParseFloat(quoin.Dealer_Final_Price_Page__c):null; |
| | | quo.OCM_Agent1_Price_Page__c = quoin.OCM_Agent1_Price_Page__c!=undefined &&quoin.OCM_Agent1_Price_Page__c!==''? localParseFloat(quoin.OCM_Agent1_Price_Page__c):null; |
| | | quo.MultiYearWarrantyTotalPrice__c = quoin.MultiYearWarrantyTotalPrice__c!=undefined? localParseFloat(quoin.MultiYearWarrantyTotalPrice__c):null; |
| | | quo.Estimation_List_Price__c = quoin.Estimation_List_Price__c!=undefined? localParseFloat(quoin.Estimation_List_Price__c):null; |
| | | quo.QuoteTotal_Page__c = quoin.QuoteTotal_Page__c !=undefined?localParseFloat(quoin.QuoteTotal_Page__c):null; |
| | | quo.Agency1_Profit__c = quoin.Agency1_Profit__c !=undefined?localParseFloat(quoin.Agency1_Profit__c):null; |
| | | quo.Agency1_Profit_Rate__c = quoin.Agency1_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency1_Profit_Rate__c):null; |
| | | quo.Agent1_Agent2_Price_Page__c = quoin.Agent1_Agent2_Price_Page__c!=undefined &&quoin.Agent1_Agent2_Price_Page__c!=='' ?localParseFloat(quoin.Agent1_Agent2_Price_Page__c):null; |
| | | quo.Agency2_Profit__c = quoin.Agency2_Profit__c !=undefined?localParseFloat(quoin.Agency2_Profit__c):null; |
| | | quo.Agency2_Profit_Rate__c = quoin.Agency2_Profit_Rate__c!=undefined? localParseFloat(quoin.Agency2_Profit_Rate__c):null; |
| | | quo.Quote_Adjust_Amount_Page__c = quoin.Quote_Adjust_Amount_Page__c !=undefined&&quoin.Quote_Adjust_Amount_Page__c!==''?localParseFloat(quoin.Quote_Adjust_Amount_Page__c):null; |
| | | quo.Quote_Adjust_Calculate__c = quoin.Quote_Adjust_Calculate__c !=undefined&&quoin.Quote_Adjust_Calculate__c!==''?localParseFloat(quoin.Quote_Adjust_Calculate__c):null; |
| | | quo.Stocking_Price__c = quoin.Stocking_Price__c!=undefined? localParseFloat(quoin.Stocking_Price__c):null; |
| | | quo.Discount_Amount__c = quoin.Discount_Amount__c !=undefined?localParseFloat(quoin.Discount_Amount__c):null; |
| | | quo.AgencyDiscount__c = quoin.AgencyDiscount__c !=undefined?localParseFloat(quoin.AgencyDiscount__c):null; |
| | | quo.Discount_Amount_Calculate__c = quoin.Discount_Amount_Calculate__c !=undefined?localParseFloat(quoin.Discount_Amount_Calculate__c):null; |
| | | debugger |
| | | quo.PriceRefreshDate__c =quoin.PriceRefreshDate__c? TimeToString(new Date(quoin.PriceRefreshDate__c)):null; |
| | | quo.CreatedDate =quoin.CreatedDate? TimeToString(new Date(quoin.CreatedDate)):null; |
| | | quo.Quote_Expiration_Date__c =quoin.Quote_Expiration_Date__c? TimeToString(new Date(quoin.Quote_Expiration_Date__c)):null; |
| | | quo.Agency1__c =quoin.Agency1__c? quoin.Agency1__c:null; |
| | | quo.Agency2__c =quoin.Agency2__c? quoin.Agency2__c:null; |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = quoin.OCM_Sales_Forecast__c!=undefined? localParseFloat(quoin.OCM_Sales_Forecast__c):null; |
| | | //预测金额修改 fy |
| | | |
| | | var oppInfo ={...{},...oppInfoIn}; |
| | | oppInfo.Wholesale_Price__c =oppInfoIn.Wholesale_Price__c!=undefined? localParseFloat(oppInfoIn.Wholesale_Price__c):null; |
| | | oppInfosave = oppInfo; |
| | | |
| | | var quoitemList = [...[],...quoLineItemIn]; |
| | | quoitemList.forEach(quoitem=>{ |
| | | debugger |
| | | quoitem.pageObject.Quantity__c = quoitem.Quantity__c; |
| | | quoitem.pageObject.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c); |
| | | quoitem.pageObject.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c); |
| | | quoitem.pageObject.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c); |
| | | quoitem.pageObject.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page); |
| | | quoitem.UnitPrice_Page__c = localParseFloat(quoitem.UnitPrice_Page__c); |
| | | quoitem.AgencySubtotal__c = localParseFloat(quoitem.AgencySubtotal__c); |
| | | quoitem.AgencyUnitPrice__c = localParseFloat(quoitem.AgencyUnitPrice__c); |
| | | quoitem.ListPrice_Page = localParseFloat(quoitem.ListPrice_Page); |
| | | quoitem.pageObject.multiYearWarranty__c = quoitem.multiYearWarranty__c; |
| | | quoitem.pageObject.GuaranteePeriod__c = quoitem.GuaranteePeriod__c; |
| | | quoitem.pageObject.warrantyType__c = quoitem.warrantyType__c; |
| | | quoitem.pageObject.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c); |
| | | quoitem.NoDiscountTotal__c = localParseFloat(quoitem.NoDiscountTotal__c); |
| | | // quoitem.pageObject.SFDA_Status__c = quoitem.SFDA_Status__c; |
| | | quoitem.pageObject.Name__c = quoitem.Name__c; |
| | | quoitem.pageObject.Subtotal__c = localParseFloat(quoitem.Subtotal__c); |
| | | quoitem.Subtotal__c = localParseFloat(quoitem.Subtotal__c); |
| | | quoitem.Cost_Subtotal_c = localParseFloat(quoitem.Cost_Subtotal_c); |
| | | }); |
| | | quoLineItemsave = quoitemList; |
| | | |
| | | return quo; |
| | | } |
| | | export function jzProductsearchLogic(result){ |
| | | debugger |
| | | var jzProductData =[...[],...result]; |
| | | jzProductData.forEach(izpd=>{ |
| | | izpd.Asset_Model_No__c = izpd.Product2.Asset_Model_No__c; |
| | | izpd.OT_CODE_no_link__c = izpd.Product2.OT_CODE_no_link__c; |
| | | izpd.Name = izpd.Product2.Name; |
| | | izpd.suitDepartment__c = izpd.Product2.suitDepartment__c; |
| | | izpd.Alternative_Products__c = izpd.Product2.Alternative_Products__c; |
| | | izpd.SFDA_Status__c = izpd.Product2.SFDA_Status__c; |
| | | izpd.SFDA_Status__c = SFDAtranslate(izpd.SFDA_Status__c); |
| | | izpd.Intra_Trade_List_RMB__c = izpd.Product2.Intra_Trade_List_RMB__c; |
| | | izpd.Foreign_Trade_List_US__c = izpd.Product2.Foreign_Trade_List_US__c; |
| | | izpd.Packing_list_manual__c = izpd.Product2.Packing_list_manual__c; |
| | | }); |
| | | return jzProductData; |
| | | } |
| | | export function additionaljzProductLogic(selectvlue,Listvalue,tradec,IsQuoteTrial){ |
| | | IsQuoteTrialExp = IsQuoteTrial; |
| | | debugger |
| | | var LineNoList = []; |
| | | Listvalue.forEach(lsv=>{ |
| | | lsv.lineNo = localParseInt(lsv.lineNo); |
| | | if(lsv.lineNo){ |
| | | LineNoList.push(lsv.lineNo); |
| | | } |
| | | }); |
| | | var maxLineNo = FindMaximumMalue(LineNoList); |
| | | maxLineNo += 1; |
| | | // var newvalueList = []; |
| | | selectvlue.forEach(selectv=>{ |
| | | debugger |
| | | alertExp = ''; |
| | | // var newvalue = {...{},...selectv}; |
| | | // var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c; |
| | | // var GuranteeType = selectv.Product2.GuranteeType__c; |
| | | //是否登录报价 |
| | | if(selectv.Product2.Estimation_Entry_Possibility__c=='×' ){ |
| | | var Estimation_Entry_Possibility = true; |
| | | }else{ |
| | | var Estimation_Entry_Possibility = false; |
| | | } |
| | | //内贸成本 |
| | | if(selectv.Product2.Intra_Trade_Cost_RMB__c > 0 ){ |
| | | var CostFlag= false; |
| | | }else{ |
| | | var CostFlag = true; |
| | | } |
| | | //内外贸 |
| | | trade = tradec; |
| | | //内贸报价金额 |
| | | var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c; |
| | | //外贸报价金额 |
| | | var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c; |
| | | //外贸成本 |
| | | var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c; |
| | | //外贸多年保 取产品主数据上的金额以及报价 精琢技术 wql start |
| | | // var Intra_Trade_Gurantee_USD = selectv.Product2.Intra_Trade_Foreign_RMB__c; |
| | | // var Intra_Trade_Service_USD = selectv.Product2.NoDiscount_Foreign__c; |
| | | // var Maintenance_Price_Year_USD = selectv.Product2.Repair_Contract_USD__c; |
| | | if(trade == "CNY") { |
| | | if(Estimation_Entry_Possibility){ |
| | | alertExp = '产品未登录报价时不可报价!'; |
| | | }else if(CostFlag){ |
| | | alertExp = '产品的成本为空时不可报价!'; |
| | | }else if(!Intra_Trade_List_RMB__c||Intra_Trade_List_RMB__c<0){ |
| | | alertExp = '产品的报价金额为空时不可报价!'; |
| | | }else{ |
| | | SetProductId(maxLineNo, selectv); |
| | | } |
| | | //外贸 |
| | | }else if(trade == "USD"){ |
| | | if(Estimation_Entry_Possibility){ |
| | | alertExp = '产品未登录报价时不可报价!'; |
| | | } |
| | | else if(!Foreign_Trade_List_US__c||Foreign_Trade_List_US__c<0 ){ |
| | | alertExp = '产品的报价金额为空时不可报价!'; |
| | | }else if(!Foreign_Trade_Cost_US__c||Foreign_Trade_Cost_US__c<0){ |
| | | alertExp = '产品的成本为空时不可报价!'; |
| | | }else{ |
| | | SetProductId(maxLineNo, selectv); |
| | | } |
| | | } |
| | | maxLineNo++; |
| | | }); |
| | | Listvalue = Listvalue.concat(addproductList); |
| | | addproductList = [] |
| | | return Listvalue; |
| | | } |
| | | export function FindMaximumMalue(value){ |
| | | if(value.length!=0){ |
| | | var max = getMaximin(value,"max"); |
| | | }else{ |
| | | var max = 0; |
| | | } |
| | | |
| | | return max; |
| | | } |
| | | function getMaximin(arr,maximin) { |
| | | if(maximin=="max") { |
| | | return Math.max.apply(Math,arr); |
| | | } |
| | | else if(maximin=="min") { |
| | | return Math.min.apply(Math, arr); |
| | | } |
| | | } |
| | | function SetProductId(lineno,selectv){ |
| | | var Product2 = {}; |
| | | var PricebookEntry = {Product2:Product2}; |
| | | var latestInfo = {}; |
| | | var pageObject = {}; |
| | | var addobj = {PricebookEntry:PricebookEntry, |
| | | latestInfo:latestInfo, |
| | | pageObject:pageObject}; |
| | | var Asset_Model_No__c = selectv.Product2.Asset_Model_No__c; |
| | | var Product2Id = selectv.Product2Id; |
| | | var SFDA_Status__c = selectv.Product2.SFDA_Status__c |
| | | var SFDA_Status = selectv.Product2.SFDA_Status__c; |
| | | var Estimated_ConsumptionDueDate__c = selectv.Product2.Estimated_ConsumptionDueDate__c; |
| | | var name = selectv.Product2.Name; |
| | | var Intra_Trade_List_RMB__c = selectv.Product2.Intra_Trade_List_RMB__c; |
| | | var Foreign_Trade_List_US__c = selectv.Product2.Foreign_Trade_List_US__c; |
| | | var NameCode = selectv.Product2.ProductCode; |
| | | var Sales_Possibility = selectv.Product2.Sales_Possibility__c; |
| | | var Intra_Trade_Cost_RMB__c = selectv.Product2.Intra_Trade_Cost_RMB__c; |
| | | var Foreign_Trade_Cost_US__c = selectv.Product2.Foreign_Trade_Cost_US__c; |
| | | var Packing_list_manual__c = selectv.Product2.Packing_list_manual__c; |
| | | var Bsscategory = selectv.Product2.BSSCategory__c; |
| | | var PricebookEntryId = selectv.Id; |
| | | var StorageStatus__c = selectv.Product2.StorageStatus__c; |
| | | var Intra_Trade_Gurantee_USD = selectv.Product2.Intra_Trade_Foreign_RMB__c; |
| | | var Intra_Trade_Service_USD = selectv.Product2.NoDiscount_Foreign__c; |
| | | var Maintenance_Price_Year_USD = selectv.Product2.Repair_Contract_USD__c; |
| | | |
| | | addobj.PricebookEntry.Product2.StorageStatus__c = StorageStatus__c; |
| | | addobj.StorageStatus = StorageStatus__c; |
| | | addobj.lineNo = parseInt(lineno); |
| | | addobj.Asset_Model = Asset_Model_No__c; |
| | | addobj.SFDA_Status__c= SFDA_Status__c; |
| | | addobj.SFDA_Status__c = SFDAtranslate(addobj.SFDA_Status__c); |
| | | addobj.Estimated_ConsumptionDueDate = Estimated_ConsumptionDueDate__c; |
| | | addobj.Estimated_ConsumptionDueDate1 = Estimated_ConsumptionDueDate__c; |
| | | addobj.pageObject.SFDA_Status__c = SFDA_Status; |
| | | addobj.latestInfo.Specifications = Packing_list_manual__c; |
| | | addobj.Specifications = Packing_list_manual__c; |
| | | addobj.Name = '/'+Product2Id; |
| | | addobj.Name__c = name; |
| | | addobj.pageObject.Name__c = name; |
| | | var ListPrice = 0; |
| | | var Cost_c = 0; |
| | | // var Extend_new_product_gurantee = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee__c")).val(); |
| | | |
| | | // var Extend_new_product_gurantee_MD = j$(escapeVfId("Page:mainForm:idSearchSetProduct:idRezultVisitor:"+ i +":Extend_new_product_gurantee_MD__c")).val(); |
| | | |
| | | var GuranteeType = selectv.Product2.GuranteeType__c; |
| | | var Entend_gurantee_period_all = selectv.Product2.Entend_gurantee_period_all__c; |
| | | var Intra_Trade_Gurantee_RMB = selectv.Product2.Intra_Trade_Gurantee_RMB__c; |
| | | var Intra_Trade_Service_RMB = selectv.Product2.Intra_Trade_Service_RMB__c; |
| | | var Maintenance_Price_Year = selectv.Product2.Maintenance_Price_Year__c; |
| | | if(selectv.Product2.VenderName__c==null||selectv.Product2.VenderName__c==null){ |
| | | var VenderName =' 无 '; |
| | | }else{ |
| | | var VenderName = selectv.Product2.VenderName__c; |
| | | } |
| | | var CanNotCancelledGurantee = selectv.Product2.CanNotCancelledGurantee__c; |
| | | var Is_DangerousChemicals = selectv.Product2.Is_DangerousChemicals__c; |
| | | var ProductGuranteePrice = 0; |
| | | var ProductServicePrice = 0; |
| | | var productMaintenance_Price_Year = 0; |
| | | if(trade == "CNY") { |
| | | ProductGuranteePrice = Intra_Trade_Gurantee_RMB; |
| | | ProductServicePrice = Intra_Trade_Service_RMB; |
| | | productMaintenance_Price_Year = Maintenance_Price_Year; |
| | | ListPrice = Intra_Trade_List_RMB__c; |
| | | Cost_c = Intra_Trade_Cost_RMB__c; |
| | | } else if(trade == "USD"){ |
| | | ProductGuranteePrice = Intra_Trade_Gurantee_USD; |
| | | ProductServicePrice = Intra_Trade_Service_USD; |
| | | productMaintenance_Price_Year = Maintenance_Price_Year_USD; |
| | | ListPrice = Foreign_Trade_List_US__c; |
| | | Cost_c = Foreign_Trade_Cost_US__c; |
| | | } |
| | | Cost_c = toNum(Cost_c); |
| | | // ListPrice = toNum(ListPrice); |
| | | // addobj.ListPrice_Page = toNumComma(ListPrice); |
| | | addobj.ListPrice_Page = ListPrice; |
| | | addobj.pageObject.ListPrice_Page = ListPrice; |
| | | addobj.Quantity__c = 1; |
| | | // addobj.UnitPrice_Page__c = toNumComma(ListPrice); |
| | | addobj.UnitPrice_Page__c = ListPrice; |
| | | // addobj.Subtotal__c = toNumComma(ListPrice); |
| | | addobj.Subtotal__c = ListPrice; |
| | | addobj.pageObject.Subtotal__c = ListPrice; |
| | | addobj.latestInfo.ProductCode = NameCode; |
| | | addobj.latestInfo.ProductName = name; |
| | | addobj = MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c); |
| | | addobj.latestInfo.SFDA_Status = SFDA_Status__c; |
| | | addobj.latestInfo.Sales_Possibility = Sales_Possibility; |
| | | addobj.latestInfo.ListPrice = ListPrice; |
| | | addobj.latestInfo.Cost = Cost_c; |
| | | addobj.Cost_c = Cost_c; |
| | | addobj.Cost_Subtotal_c = Cost_c; |
| | | addobj.pageObject.BSS_Category__c = Bsscategory; |
| | | addobj.pageObject.Id__c = Product2Id; |
| | | addobj.pageObject.PricebookEntryId = PricebookEntryId; |
| | | addobj.pageObject.ProductEntend_gurantee_period_all__c = Entend_gurantee_period_all; |
| | | addobj.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | addobj.latestInfo.Maintenance_Price_Year = productMaintenance_Price_Year; |
| | | addobj.pageObject.GuranteeType__c = GuranteeType; |
| | | addobj.VenderName = VenderName; |
| | | addobj.CanNotCancelledGurantee = CanNotCancelledGurantee; |
| | | addobj.Is_DangerousChemicals = Is_DangerousChemicals; |
| | | addobj.ProductGuranteePrice = ProductGuranteePrice; |
| | | addobj.pageObject.productServicePrice__c = ProductServicePrice; |
| | | //chenjingwu DB202308355043 2023.8.25 start |
| | | addobj.Category5 = selectv.Product2.Category5__c; |
| | | //chenjingwu DB202308355043 2023.8.25 end |
| | | addproductList.push(addobj); |
| | | // if(VenderName != 'OSH'&&VenderName != ''){ |
| | | // window.opener.j$(escapeVfId('Page:mainForm:block:lists:'+lineno+':UnitPrice')).attr('disabled','disabled'); |
| | | // } |
| | | IsQuoteTrialExp = false; |
| | | } |
| | | function MarkRedFLG(addobj,Estimated_ConsumptionDueDate__c){ |
| | | |
| | | var date1 = new Date(); |
| | | var seperator = "/"; |
| | | var year = date1.getFullYear(); |
| | | var month = date1.getMonth() + 1; |
| | | var day = date1.getDate(); |
| | | if (month >= 1 && month <= 9) { |
| | | month = "0" + month; |
| | | } |
| | | if (day >= 0 && day <= 9) { |
| | | day = "0" + day; |
| | | } |
| | | var currentdate = year + seperator + month + seperator + day; |
| | | |
| | | //预计消耗到期日 - 当前日 相差天数(difDate) |
| | | var ndate = new Date(currentdate); |
| | | var nowDate = ndate.getTime(); |
| | | var edate = new Date(Estimated_ConsumptionDueDate__c); |
| | | var endDate = edate.getTime(); |
| | | var difDate = (endDate - nowDate)/((1000 * 60 * 60 * 24)); |
| | | |
| | | //判断 |
| | | if(difDate < 90){ |
| | | addobj.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | return addobj; |
| | | } |
| | | export function MarkRed(quoitemList) { |
| | | quoitemList.forEach(item=>{ |
| | | var a = item.Asset_Model; |
| | | var b = item.Estimated_ConsumptionDueDate; |
| | | if (a != '') { |
| | | var date1 = new Date(); |
| | | var seperator = "/"; |
| | | var year = date1.getFullYear(); |
| | | var month = date1.getMonth() + 1; |
| | | var day = date1.getDate(); |
| | | if (month >= 1 && month <= 9) { |
| | | month = "0" + month; |
| | | } |
| | | if (day >= 0 && day <= 9) { |
| | | day = "0" + day; |
| | | } |
| | | var currentdate = year + seperator + month + seperator + day; |
| | | |
| | | //预计消耗到期日 - 当前日 相差天数(difDate) |
| | | var ndate = new Date(currentdate); |
| | | var nowDate = ndate.getTime(); |
| | | var edate = new Date(b); |
| | | var endDate = edate.getTime(); |
| | | var difDate = (endDate - nowDate) / ((1000 * 60 * 60 * 24)); |
| | | |
| | | //判断 |
| | | if (difDate < 90) { |
| | | item.EstimatedConsumptionDueDateclass = 'slds-text-color_error slds-text-title_caps'; |
| | | }else{ |
| | | item.EstimatedConsumptionDueDateclass = ''; |
| | | } |
| | | } |
| | | }); |
| | | return quoitemList; |
| | | } |
| | | export function filterNameoptionList(){ |
| | | var optionList = [{label:'--无--',value: ''}, |
| | | {label:'消化科',value: '消化科'}, |
| | | {label:'呼吸科',value: '呼吸科'}, |
| | | {label:'普外科',value: '普外科'}, |
| | | {label:'泌尿科',value: '泌尿科'}, |
| | | {label:'妇科',value: '妇科'}, |
| | | {label:'耳鼻喉科',value: '耳鼻喉科'}, |
| | | {label:'能量',value: '能量'}, |
| | | {label:'SI',value: 'SI'}, |
| | | {label:'外科通用',value: '外科通用'}]; |
| | | return optionList; |
| | | } |
| | | export function SelectDone(activities){ |
| | | debugger |
| | | var setPFString = ''; |
| | | activities.forEach(arc=>{ |
| | | if(!setPFString){ |
| | | setPFString = arc.Id; |
| | | }else{ |
| | | setPFString = setPFString+','+arc.Id; |
| | | } |
| | | }); |
| | | DataStatus = 'Fin'; |
| | | return setPFString; |
| | | } |
| | | //初始化产品赋值 |
| | | export function InitializeProductAssignment(quoteLineItem){ |
| | | debugger |
| | | console.warn(JSON.stringify(quoteLineItem)); |
| | | quoteLineItem.forEach(quotltiem=>{ |
| | | quotltiem.Quantity__c = quotltiem.pageObject.Quantity__c; |
| | | quotltiem.UnitPrice_Page__c = quotltiem.pageObject.UnitPrice_Page__c; |
| | | // quotltiem.UnitPrice_Page__c = toNumComma(quotltiem.UnitPrice_Page__c); |
| | | quotltiem.AgencySubtotal__c = quotltiem.pageObject.AgencySubtotal__c; |
| | | quotltiem.AgencyUnitPrice__c = quotltiem.pageObject.AgencyUnitPrice__c; |
| | | // quotltiem.ListPrice_Page = toNumComma(quotltiem.ListPrice_Page); |
| | | quotltiem.multiYearWarranty__c = quotltiem.pageObject.multiYearWarranty__c; |
| | | quotltiem.GuaranteePeriod__c = quotltiem.pageObject.GuaranteePeriod__c; |
| | | // if(!quotltiem.pageObject.GuranteeType__c){ |
| | | // quotltiem.pageObject.GuranteeType__c = ''; |
| | | // } |
| | | quotltiem.warrantyType__c = quotltiem.pageObject.warrantyType__c; |
| | | quotltiem.NoDiscountTotal__c = quotltiem.pageObject.NoDiscountTotal__c; |
| | | quotltiem.SFDA_Status__c = quotltiem.pageObject.SFDA_Status__c; |
| | | quotltiem.SFDA_Status__c = SFDAtranslate(quotltiem.SFDA_Status__c); |
| | | quotltiem.Name__c = quotltiem.pageObject.Name__c; |
| | | quotltiem.Subtotal__c = quotltiem.pageObject.Subtotal__c; |
| | | // quotltiem.Subtotal__c = toNumComma(quotltiem.Subtotal__c); |
| | | quotltiem.Name = '/'+quotltiem.pageObject.Id__c; |
| | | if((!(!quotltiem.pageObject.Product_Sales_Possibility__c || quotltiem.pageObject.Product_Sales_Possibility__c == '○') && !quotltiem.changed_sfda)){ |
| | | quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(quotltiem.haveno_Register){ |
| | | quotltiem.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(quotltiem.changed_list){ |
| | | quotltiem.ListPricePageclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(quotltiem.changed_name == true || quotltiem.wrong_Register == true){ |
| | | quotltiem.Nameclass = 'slds-text-color_red'; |
| | | } |
| | | |
| | | //产品Id |
| | | }); |
| | | const inputAlignright = document.createElement('style'); |
| | | inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`; |
| | | document.body.appendChild(inputAlignright); |
| | | quoteLineItem = MarkRed(quoteLineItem); |
| | | return quoteLineItem; |
| | | } |
| | | export function actState(reslut,list){ |
| | | var reslutList = JSON.parse(reslut); |
| | | var reMap = new Map(); |
| | | reslutList.forEach(itm=>{ |
| | | var val = { |
| | | haveno_Register:itm.haveno_Register, |
| | | wrong_Register:itm.wrong_Register |
| | | }; |
| | | reMap.set(itm.pageObject.Id__c,val); |
| | | }); |
| | | list.forEach(ac=>{ |
| | | if(reMap.has(ac.pageObject.Id__c)){ |
| | | var vlu = reMap.get(ac.pageObject.Id__c); |
| | | ac.haveno_Register = vlu.haveno_Register; |
| | | ac.wrong_Register = vlu.wrong_Register; |
| | | } |
| | | if((!(!ac.pageObject.Product_Sales_Possibility__c || ac.pageObject.Product_Sales_Possibility__c == '○') && !ac.changed_sfda)){ |
| | | ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(ac.haveno_Register){ |
| | | ac.SFDAStatuclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(ac.changed_list){ |
| | | ac.ListPricePageclass = 'slds-text-color_error slds-text-title_caps'; |
| | | } |
| | | if(ac.changed_name == true || ac.wrong_Register == true){ |
| | | ac.Nameclass = 'slds-text-color_red'; |
| | | } |
| | | }); |
| | | const inputAlignright = document.createElement('style'); |
| | | inputAlignright .innerText = `.slds-text-color_red a{ color:#ba0517;!important; }`; |
| | | document.body.appendChild(inputAlignright); |
| | | return list; |
| | | } |
| | | export function PriceStatusUpdateLogic(jzDataToBeproduct,newQuoteFlag){ |
| | | newQuoteFlagex = newQuoteFlag; |
| | | debugger |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | if ((jzdtbt.Asset_Model != null) && (jzdtbt.Asset_Model != '')) { |
| | | // TODO katsu SFDAステータスの確認などいらないですか(最新商品XXXの項目も) |
| | | jzdtbt.pageObject.SFDA_Status__c = jzdtbt.latestInfo.SFDA_Status; |
| | | jzdtbt.SFDA_Status__c = SFDAtranslate(jzdtbt.pageObject.SFDA_Status__c); |
| | | jzdtbt.pageObject.Name__c = jzdtbt.latestInfo.ProductName; |
| | | jzdtbt.Name__c = jzdtbt.pageObject.Name__c; |
| | | jzdtbt.ListPrice_Page = jzdtbt.latestInfo.ListPrice; |
| | | jzdtbt.pageObject.Cost__c = jzdtbt.latestInfo.Cost; |
| | | jzdtbt.Cost_c = jzdtbt.latestInfo.Cost; |
| | | jzdtbt.pageObject.ProductGuranteePrice__c = jzdtbt.latestInfo.Intra_Trade_Gurantee; |
| | | jzdtbt.pageObject.productServicePrice__c = jzdtbt.latestInfo.Intra_Trade_Service; |
| | | jzdtbt.pageObject.GuranteeType__c = jzdtbt.latestInfo.GuranteeType; |
| | | // 计提金额 |
| | | jzdtbt.pageObject.productServicePrice__c = jzdtbt.latestInfo.Intra_Trade_Service; |
| | | // 多年保修年限 |
| | | jzdtbt.pageObject.ProductEntend_gurantee_period_all__c |
| | | = jzdtbt.latestInfo.ProductEntend_gurantee_period_all; |
| | | // 维修合同报价 |
| | | jzdtbt.Maintenance_Price_Year = jzdtbt.latestInfo.Maintenance_Price_Year; |
| | | // jzdtbt.ListPrice_Page = toNumComma(jzdtbt.ListPrice_Page); |
| | | jzdtbt.ListPrice_Page = jzdtbt.ListPrice_Page; |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function calGuranteeAllFieldsLogic(jzDataToBeproduct,quo){ |
| | | debugger |
| | | var AllGurantee_Period = quo.Gurantee_Period__c; |
| | | var contractmultiYearWarranty = true; |
| | | if (quo.multiYearWarranty__c != null) { |
| | | contractmultiYearWarranty = quo.multiYearWarranty__c; |
| | | } |
| | | var MultiYearWarrantyTotalPrice__c = 0.00; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var GuranteeType =jzdtbt.pageObject.GuranteeType__c; |
| | | // 保修类型 |
| | | var warrantyType = ''; |
| | | // 产品保修期 |
| | | var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c; |
| | | // 产品计提金额 |
| | | var ProductGuranteePrice__c = jzdtbt.ProductGuranteePrice; |
| | | // 产品 service Price |
| | | var ServicePrice = jzdtbt.pageObject.productServicePrice__c; |
| | | // 保修 |
| | | var multiYearWarranty = false; |
| | | // 是否取消保修 |
| | | var If_Cancel_Guarantee = false; |
| | | //产品主数据增加“不可取消多年保” 2020/08/28 精琢技术 wql start |
| | | var CanNotCancelledGurantee = jzdtbt.CanNotCancelledGurantee; |
| | | //产品主数据增加“不可取消多年保” 2020/08/28 精琢技术 wql end |
| | | // 老 no discount price |
| | | var oldServicePrice =jzdtbt.pageObject.ServicePrice__c; |
| | | jzdtbt.pageObject.ServicePrice__c = 0; |
| | | jzdtbt.warrantyType__c = ''; |
| | | var NoDiscountTotal = 0; |
| | | if (GuranteeType == '服务') { |
| | | multiYearWarranty = true; |
| | | jzdtbt.warrantyType__c = '服务多年保修'; |
| | | warrantyType = '服务多年保修'; |
| | | } else if (GuranteeType == '市场' && contractmultiYearWarranty == false) { |
| | | multiYearWarranty = true; |
| | | jzdtbt.pageObject.ServicePrice__c = ServicePrice; |
| | | jzdtbt.warrantyType__c = '市场多年保修'; |
| | | warrantyType = '市场多年保修'; |
| | | var Quantity =jzdtbt.Quantity__c; |
| | | MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | } |
| | | else if (GuranteeType == '市场' && contractmultiYearWarranty && CanNotCancelledGurantee) { |
| | | multiYearWarranty = true; |
| | | jzdtbt.pageObject.ServicePrice__c = ServicePrice; |
| | | jzdtbt.warrantyType__c = '市场多年保修'; |
| | | warrantyType = '市场多年保修'; |
| | | // 数量 |
| | | var Quantity = jzdtbt.Quantity__c; |
| | | MultiYearWarrantyTotalPrice__c = MultiYearWarrantyTotalPrice__c + localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | NoDiscountTotal = localParseFloat(ServicePrice) * localParseFloat(Quantity); |
| | | } |
| | | else if (GuranteeType == '市场') { |
| | | If_Cancel_Guarantee = true; |
| | | } |
| | | // if (jzdtbt.NoDiscountTotal__c != null) { |
| | | jzdtbt.NoDiscountTotal__c = toNumComma(NoDiscountTotal); |
| | | // } |
| | | |
| | | // 更新后的 no discount price |
| | | var newServicePrice = jzdtbt.pageObject.ServicePrice__c; |
| | | newServicePrice = localParseFloat(newServicePrice); |
| | | oldServicePrice = localParseFloat(oldServicePrice); |
| | | if (newServicePrice != oldServicePrice) { |
| | | var unitPrice = jzdtbt.UnitPrice_Page__c; |
| | | unitPrice = localParseFloat(unitPrice); |
| | | // jzdtbt.UnitPrice_Page__c = toNum(unitPrice + newServicePrice - oldServicePrice); |
| | | jzdtbt.UnitPrice_Page__c = unitPrice + newServicePrice - oldServicePrice; |
| | | } |
| | | jzdtbt.pageObject.If_Cancel_Guarantee__c = If_Cancel_Guarantee; |
| | | // 设置保修 |
| | | // if (jzdtbt.multiYearWarranty__c != null) { |
| | | jzdtbt.multiYearWarranty__c = multiYearWarranty; |
| | | // } |
| | | var GuranteePrice = 0; |
| | | // 计提年限 |
| | | var provistonPeriod = 0; |
| | | // 根据产品信息设置保修年限 和计提金额 |
| | | if (GuranteeType == '服务') { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | GuranteePrice = ProductGuranteePrice__c; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | } else if (GuranteeType == '市场') { |
| | | if (contractmultiYearWarranty == false) { |
| | | if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | GuranteePrice = ProductGuranteePrice__c; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | }else if (contractmultiYearWarranty && CanNotCancelledGurantee) { |
| | | if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | GuranteePrice = ProductGuranteePrice__c; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | } |
| | | else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = 1; |
| | | jzdtbt.GuaranteePeriod__c = 1; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | } |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuranteePrice = GuranteePrice; |
| | | } |
| | | jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0; |
| | | |
| | | }); |
| | | MultiYearWarrantyTotalPriceExport = MultiYearWarrantyTotalPrice__c; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function initQuoteLineItemcheck(quoteLineItem,productStatusUpdated){ |
| | | debugger |
| | | newQuoteFlagExp = false; |
| | | productStatusUpdatedExp = productStatusUpdated; |
| | | quoteLineItem.forEach(a=>{ |
| | | if(!a.Maintenance_Price_Year){ |
| | | a.Maintenance_Price_Year = 0; |
| | | } |
| | | if(!a.latestInfo.Maintenance_Price_Year){ |
| | | a.latestInfo.Maintenance_Price_Year = 0; |
| | | } |
| | | if(!a.pageObject.GuranteeType__c){ |
| | | a.pageObject.GuranteeType__c = ''; |
| | | } |
| | | if(!a.latestInfo.GuranteeType){ |
| | | a.latestInfo.GuranteeType = ''; |
| | | } |
| | | if (a.Asset_Model) { |
| | | if(a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status |
| | | ||a.pageObject.Name__c != a.latestInfo.ProductName |
| | | ||a.ListPrice_Page != a.latestInfo.ListPrice |
| | | ||a.pageObject.Cost__c != a.latestInfo.Cost |
| | | ||a.Cost_c != a.latestInfo.Cost |
| | | ||a.ProductGuranteePrice != a.latestInfo.Intra_Trade_Gurantee |
| | | ||a.pageObject.productServicePrice__c != a.latestInfo.Intra_Trade_Service |
| | | ||a.Maintenance_Price_Year != a.latestInfo.Maintenance_Price_Year |
| | | ||a.pageObject.GuranteeType__c != a.latestInfo.GuranteeType |
| | | ||a.pageObject.ProductEntend_gurantee_period_all__c != a.latestInfo.ProductEntend_gurantee_period_all |
| | | ||a.pageObject.PricebookEntry.Product2.CanNotCancelledGurantee__c != a.latestInfo.CanNotCancelledGurantee |
| | | ) { |
| | | newQuoteFlagExp = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.pageObject.Name__c != a.latestInfo.ProductName) { |
| | | a.changed_name = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.pageObject.SFDA_Status__c != a.latestInfo.SFDA_Status) { |
| | | a.changed_sfda = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.ListPrice_Page != a.latestInfo.ListPrice) { |
| | | a.changed_list = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | if (a.pageObject.Cost__c != a.latestInfo.Cost) { |
| | | a.changed_cost = true; |
| | | productStatusUpdatedExp = true; |
| | | } |
| | | a.pageObject.SFDA_Status__c = a.latestInfo.SFDA_Status; |
| | | a.pageObject.Name__c = a.latestInfo.ProductName; |
| | | a.ListPrice_Page = a.latestInfo.ListPrice; |
| | | a.pageObject.Cost__c = a.latestInfo.Cost; |
| | | a.Cost_c = a.latestInfo.Cost; |
| | | a.ProductGuranteePrice = a.latestInfo.Intra_Trade_Gurantee; |
| | | a.pageObject.productServicePrice__c = a.latestInfo.Intra_Trade_Service; |
| | | a.Maintenance_Price_Year = a.latestInfo.Maintenance_Price_Year; |
| | | a.pageObject.ProductEntend_gurantee_period_all__c= a.latestInfo.ProductEntend_gurantee_period_all; |
| | | a.pageObject.GuranteeType__c = a.latestInfo.GuranteeType; |
| | | } |
| | | }); |
| | | return quoteLineItem; |
| | | } |
| | | export function initquocheck(quoteLineItem,CheckItem){ |
| | | var product2Ids = []; |
| | | if(quoteLineItem.length > 0){ |
| | | quoteLineItem.forEach(a=>{ |
| | | if (a.pageObject.Id__c) { |
| | | product2Ids.push(a.pageObject.Id__c); |
| | | } |
| | | }); |
| | | } |
| | | var loopMap = new Map(); |
| | | if(CheckItem.length>0){ |
| | | CheckItem.forEach(qli=>{ |
| | | loopMap.set(qli.PricebookEntry.Product2Id,qli.SFDA_Status__c); |
| | | }); |
| | | } |
| | | lookMapE = loopMap; |
| | | return product2Ids; |
| | | } |
| | | //加天数 |
| | | export function addDay(dayNumber, date) { |
| | | var ms = dayNumber * (1000 * 60 * 60 * 24) |
| | | var newDate = new Date(date.getTime() + ms); |
| | | return newDate; |
| | | } |
| | | //计算两个日期之间的天数 |
| | | export function dateDaysBetween(dateStrBegin, dateStrEnd) { |
| | | if (!dateStrBegin || !dateStrEnd) return 0; |
| | | var s1 = dateStrBegin.getTime(), |
| | | s2 = dateStrEnd.getTime(); |
| | | var total = (s2 - s1) / 1000; |
| | | var day = parseInt(total / (24 * 60 * 60)); |
| | | return day; |
| | | } |
| | | /* |
| | | 计算经销商单价和经销商小计 |
| | | */ |
| | | // CHAN-B4YAB8 2018/9/28 计算经销商单价和小计 start |
| | | // 如果是OCSM直销,则更改医院合同价格时会计算经销商单价和小计 |
| | | // 如果是 经销商销售,则更改 第一经销商总价是会计算经销商单价和小计 |
| | | export function quoteAgencyTotalPriceActionLogic(jzDataToBeproduct,quo,oppInfo,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){ |
| | | var s,l; |
| | | var SalesAmount1 = quo.OCM_Agent1_Price_Page__c; |
| | | var Estimation_List_Price = 0; |
| | | var thirdPartyEstimation_List_Price = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName == '' || VenderName == 'OSH') { |
| | | Estimation_List_Price = Estimation_List_Price + s * l; |
| | | } else { |
| | | thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + s * l; |
| | | } |
| | | }); |
| | | // 医院的合同金额 |
| | | var Dealer_Final_Price = quo.Dealer_Final_Price_Page__c; |
| | | // 销售渠道 |
| | | var Sales_Root = oppInfo.Sales_Root__c; |
| | | var TotalPrice = 0; |
| | | var StardardPrice = 0; |
| | | var totalAgencyPrice = 0; |
| | | var AgencySubtotal = 0; |
| | | var LastAgencySubtotal = 0; |
| | | var j = 0; |
| | | var i = -1; |
| | | var lastQuantity = 0; |
| | | Sales_Root = Sales_Root + ''; |
| | | Sales_Root = Sales_Root.replace(/\s+/g, ""); |
| | | if (Sales_Root == '经销商') { |
| | | TotalPrice = SalesAmount1; |
| | | } else { |
| | | TotalPrice = Dealer_Final_Price; |
| | | } |
| | | TotalPrice = localParseFloat(TotalPrice); |
| | | var oldTotalPrice = TotalPrice; |
| | | totalAgencyPrice = TotalPrice; |
| | | //no discount price 合计 |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | TotalPrice = TotalPrice - noDiscountPriceTotal; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | if ((s == 0) || (l == 0)) { |
| | | //処理なし |
| | | } else if (oldTotalPrice == 0) { |
| | | jzdtbt.pageObject.AgencySubtotal__c = 0; |
| | | jzdtbt.AgencySubtotal__c = toNumComma_One_digit(0); |
| | | jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(0); |
| | | } else { |
| | | StardardPrice = s * l; |
| | | StardardPrice = localParseFloat(StardardPrice); |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | //行项目 no discount price: |
| | | var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice = localParseFloat(noDiscountPrice); |
| | | var Agency_UnitPrice = (l).toFixed(1); |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName == '' || VenderName == 'OSH') { |
| | | var Agency_UnitPrice = (StardardPrice * (TotalPrice - thirdPartyEstimation_List_Price) / (Estimation_List_Price * s) + noDiscountPrice ).toFixed(1); |
| | | } |
| | | AgencySubtotal = Agency_UnitPrice * s; |
| | | jzdtbt.pageObject.AgencySubtotal__c = AgencySubtotal; |
| | | jzdtbt.AgencySubtotal__c = toNumComma_One_digit(AgencySubtotal); |
| | | jzdtbt.AgencyUnitPrice__c = toNumComma_One_digit(Agency_UnitPrice); |
| | | totalAgencyPrice = totalAgencyPrice - toNum(AgencySubtotal); |
| | | i++; |
| | | j=i; |
| | | lastQuantity = s; |
| | | LastAgencySubtotal = AgencySubtotal; |
| | | } |
| | | }); |
| | | if (oldTotalPrice != 0){ |
| | | LastAgencySubtotal = LastAgencySubtotal + totalAgencyPrice; |
| | | if(jzDataToBeproduct.length>0){ |
| | | jzDataToBeproduct[j].pageObject.AgencySubtotal__c = toNum(LastAgencySubtotal); |
| | | jzDataToBeproduct[j].AgencySubtotal__c = toNumComma_One_digit(LastAgencySubtotal); |
| | | jzDataToBeproduct[j].AgencyUnitPrice__c = toNumComma_One_digit(LastAgencySubtotal / lastQuantity); |
| | | } |
| | | } |
| | | return jzDataToBeproduct; |
| | | } |
| | | //根据行项目上产品的信息 更新多年保修行项目所有字段, 并且更新No Discount Price合计 |
| | | export function calPriceAllLogic(jzDataToBeproduct){ |
| | | var x, y, z, c; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.Quantity__c; |
| | | x = localParseInt(x); |
| | | if (x > 0) { |
| | | y = jzdtbt.UnitPrice_Page__c; |
| | | c = jzdtbt.Cost_c; |
| | | y = localParseFloat(y); |
| | | c = localParseFloat(c); |
| | | z = x * y; |
| | | // jzdtbt.Subtotal__c = toNumComma(z); |
| | | jzdtbt.Subtotal__c = z; |
| | | jzdtbt.pageObject.Subtotal__c = toNum(z); |
| | | z = x * c; |
| | | jzdtbt.Cost_Subtotal_c = toNum(z); |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function QuoteAdjustLogic(jzDataToBeproduct,quo,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){ |
| | | var x = quo.QuoteTotal_Page__c; |
| | | x = localParseFloat(x); |
| | | var y = quo.hidden_Estimation_List; |
| | | y = localParseFloat(y); |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | var thirdPartyEstimation_List_Price = 0; |
| | | var price = 0; |
| | | var Quantity = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName != '' && VenderName != 'OSH') { |
| | | price = jzdtbt.ListPrice_Page; |
| | | price = localParseFloat(price); |
| | | Quantity = jzdtbt.Quantity__c; |
| | | Quantity = localParseInt(Quantity); |
| | | thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity; |
| | | } |
| | | }); |
| | | thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price); |
| | | quo.Quote_Adjust_Amount_Page__c = toNumComma(x - noDiscountPriceTotal - y); |
| | | if (y - thirdPartyEstimation_List_Price == 0) { |
| | | quo.Quote_Adjust_Calculate__c = toNumComma(0); |
| | | } else { |
| | | quo.Quote_Adjust_Calculate__c = toNumComma((x - noDiscountPriceTotal - y) / (y - thirdPartyEstimation_List_Price) * 100); |
| | | } |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function AgencyDiscountCalculation1Logic(quo,jzDataToBeproduct,QuoteDecision_Button,hidden_MultiYearWarrantyTotalPrice){ |
| | | var y = quo.OCM_Agent1_Price_Page__c; |
| | | if (y != '' && y.length != 0) { |
| | | var Estimation_List_Price = quo.Estimation_List_Price__c; |
| | | y = y + ''; |
| | | y = y.replace(/ /g, ""); |
| | | if (Estimation_List_Price.length != 0) { |
| | | y = localParseFloat(y); |
| | | Estimation_List_Price = localParseFloat(Estimation_List_Price); |
| | | // 第三方产品标准定价总额 |
| | | var thirdPartyEstimation_List_Price = 0; |
| | | var price = 0; |
| | | var Quantity = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName != '' && VenderName != 'OSH') { |
| | | price = jzdtbt.ListPrice_Page; |
| | | price = localParseFloat(price); |
| | | Quantity = jzdtbt.Quantity__c; |
| | | Quantity = localParseInt(Quantity); |
| | | thirdPartyEstimation_List_Price = thirdPartyEstimation_List_Price + price * Quantity; |
| | | } |
| | | }); |
| | | thirdPartyEstimation_List_Price = localParseFloat(thirdPartyEstimation_List_Price); |
| | | if (Estimation_List_Price - thirdPartyEstimation_List_Price == 0) { |
| | | quo.AgencyDiscount__c = toNumComma(0); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0)); |
| | | } else { |
| | | //no discount price 合计 |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | var t = (y - noDiscountPriceTotal - thirdPartyEstimation_List_Price) / (Estimation_List_Price - thirdPartyEstimation_List_Price) * 100; |
| | | quo.AgencyDiscount__c = toNumComma(t); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(t)); |
| | | } |
| | | } else { |
| | | quo.AgencyDiscount__c = toNumComma(0); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0)); |
| | | } |
| | | } else { |
| | | quo.AgencyDiscount__c = toNumComma(0); |
| | | // j$(escapeVfId('Page:mainForm:block:AgencyDiscount')).val(toNumComma(0)); |
| | | } |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | //检查报价行的NMPA状态 |
| | | export function checkNMPA(jzDataToBeproduct) { |
| | | var cnt = 0; |
| | | var nmpa; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | nmpa = jzdtbt.SFDA_Status__c; |
| | | if (nmpa == '停止') { |
| | | cnt = cnt + 1; |
| | | return; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | export function AlertAuthorize(oppInfo) { |
| | | var Authorized_DB_No = oppInfo.Authorized_DB_No__c; |
| | | var If_Need_Authorize = oppInfo.If_Need_Authorize__c; |
| | | if (If_Need_Authorize) { |
| | | if (Authorized_DB_No == null || Authorized_DB_No == '') { |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | export function AlertForCFDA(jzDataToBeproduct) { |
| | | var SFDA_Status__c, cnt; |
| | | cnt = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | SFDA_Status__c = jzdtbt.SFDA_Status__c; |
| | | if (SFDA_Status__c == '失效-重新申请中' || SFDA_Status__c == '失効(再申請中)') { |
| | | cnt = cnt + 1; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | export function CheckForCost(jzDataToBeproduct) { |
| | | var Cost, cnt, name; |
| | | cnt = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | Cost = jzdtbt.Cost_c; |
| | | name = jzdtbt.pageObject.Name__c; |
| | | if (name && Cost <= 0) { |
| | | cnt = cnt + 1; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | //检查是否有标准定价为0的情况 |
| | | export function CheckForListPrice(jzDataToBeproduct) { |
| | | var ListPrice, name; |
| | | var cnt = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | ListPrice = jzdtbt.ListPrice_Page; |
| | | ListPrice = localParseFloat(ListPrice); |
| | | name = jzdtbt.pageObject.Name__c; |
| | | if (name && ListPrice <= 0) { |
| | | cnt = cnt + 1; |
| | | } |
| | | }); |
| | | if (cnt > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | export function SubtotalupdateLogic(jzDataToBeproduct){ |
| | | debugger |
| | | console.warn('Unit6'); |
| | | var x, y, z; |
| | | z = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.Quantity__c; |
| | | x = localParseInt(x); |
| | | y = jzdtbt.UnitPrice_Page__c; |
| | | y = localParseFloat(y); |
| | | z = x * y; |
| | | if (jzdtbt.UnitPrice_Page__c != "") { |
| | | // jzdtbt.Subtotal__c = toNumComma(z); |
| | | jzdtbt.Subtotal__c = z; |
| | | jzdtbt.pageObject.Subtotal__c = toNum(z); |
| | | } |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function quoteTotalPriceActionLogic(quo,jzDataToBeproduct,hidden_MultiYearWarrantyTotalPrice,QuoteDecision_Button){ |
| | | var s = 0; |
| | | var x = 0; |
| | | var l = 0; |
| | | // 非第三方产品标准定价总额 |
| | | var y = 0; |
| | | var yy = 0; |
| | | // 非第三方产品报价总额 |
| | | var z = quo.QuoteTotal_Page__c; |
| | | // 产品报价总额 |
| | | var zz = 0; |
| | | z = localParseFloat(z); |
| | | //no discount price 合计 |
| | | var noDiscountPriceTotal = hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal = localParseFloat(noDiscountPriceTotal); |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | x = s * l; |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | // OSH 计算标准定价总额 |
| | | if (VenderName == 'OSH' || VenderName == '') { |
| | | y = y + x; |
| | | // 非OSH 将产品报价总额 减去 第三方产品 |
| | | } else { |
| | | z = z - x; |
| | | } |
| | | }); |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | //行项目 no discount price: |
| | | var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice = localParseFloat(noDiscountPrice); |
| | | // 供应商名称 |
| | | var VenderName = jzdtbt.VenderName; |
| | | s = jzdtbt.Quantity__c; |
| | | s = localParseInt(s); |
| | | l = jzdtbt.ListPrice_Page; |
| | | l = localParseInt(l); |
| | | // 行项目 标准定价小计 |
| | | x = s * l; |
| | | x = localParseFloat(x); |
| | | if ((s == 0) || (x == 0)) { |
| | | //不处理 |
| | | } else { |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (VenderName == 'OSH' || VenderName == '') { |
| | | yy = localParseFloat(x * (z - noDiscountPriceTotal) / y); |
| | | jzdtbt.pageObject.Subtotal__c = toNum(yy + s * noDiscountPrice); |
| | | // jzdtbt.Subtotal__c = toNumComma(yy + s * noDiscountPrice); |
| | | jzdtbt.Subtotal__c = yy + s * noDiscountPrice; |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(yy / s + noDiscountPrice); |
| | | jzdtbt.UnitPrice_Page__c = yy / s + noDiscountPrice; |
| | | } else { |
| | | yy = localParseFloat(x); |
| | | } |
| | | zz = zz + yy; |
| | | } |
| | | }); |
| | | quo.QuoteTotal_Page__c = toNumComma(zz + noDiscountPriceTotal); |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function UnitPriceUpdateLogic(quo,jzDataToBeproduct,QuoteDecision_Button){ |
| | | var num; |
| | | num = quo.Quote_Adjust_Calculate__c; |
| | | num = localParseFloat(num); |
| | | quo.Quote_Adjust_Calculate__c = toNumComma(num); |
| | | num = (100 + num) / 100; |
| | | var price = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | price = jzdtbt.ListPrice_Page; |
| | | price = localParseFloat(price); |
| | | var noDiscountPrice = jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice = localParseFloat(noDiscountPrice); |
| | | var backbutton = QuoteDecision_Button; |
| | | if (backbutton == '') { |
| | | VenderName = ''; |
| | | } |
| | | if (price != '' && VenderName == 'OSH') { |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice); |
| | | jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice; |
| | | } else if (price != '' && VenderName == '') { |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(price * num + noDiscountPrice); |
| | | jzdtbt.UnitPrice_Page__c = price * num + noDiscountPrice; |
| | | } |
| | | }); |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function calGuranteePeriodLogic(jzDataToBeproduct,AllGurantee_Period){ |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | // 保修 |
| | | var multiYearWarranty = true; |
| | | if (jzdtbt.multiYearWarranty__c) { |
| | | multiYearWarranty = jzdtbt.multiYearWarranty__c; |
| | | } |
| | | // 保修类型 |
| | | var warrantyType = jzdtbt.warrantyType__c; |
| | | // 产品保修类型 |
| | | var GuranteeType = jzdtbt.pageObject.GuranteeType__c; |
| | | // 产品保修期 |
| | | var ProductEntend_gurantee_period = jzdtbt.pageObject.ProductEntend_gurantee_period_all__c; |
| | | // 计提年限 |
| | | var provistonPeriod = 0; |
| | | // 根据产品信息设置保修年限 |
| | | if (GuranteeType == '服务') { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | } else if (GuranteeType == '市场') { |
| | | if (multiYearWarranty == true) { |
| | | if (localParseFloat(ProductEntend_gurantee_period) >= localParseFloat(AllGurantee_Period)) { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | jzdtbt.GuaranteePeriod__c = ProductEntend_gurantee_period | 0; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | provistonPeriod = ProductEntend_gurantee_period; |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = 1; |
| | | jzdtbt.GuaranteePeriod__c = 1; |
| | | } |
| | | } else { |
| | | jzdtbt.pageObject.GuaranteePeriod__c = AllGurantee_Period; |
| | | jzdtbt.GuaranteePeriod__c = AllGurantee_Period; |
| | | } |
| | | jzdtbt.pageObject.provistonPeriod__c = provistonPeriod | 0; |
| | | }); |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function PrintCustomerNameoptionsvlue(options_hp,selection_hp,quo,options_hpflg,accs){ |
| | | if (JSON.stringify(accs) != "{}") { |
| | | if (accs[0].Name) { |
| | | var options_hpvalue = {}; |
| | | options_hpvalue.label = accs[0].Name; |
| | | options_hpvalue.value = accs[0].Name; |
| | | options_hp.push(options_hpvalue); |
| | | } |
| | | if (accs[0].Site) { |
| | | var options_hpvalue = {}; |
| | | options_hpvalue.label = accs[0].Site; |
| | | options_hpvalue.value = accs[0].Site; |
| | | options_hp.push(options_hpvalue); |
| | | } |
| | | if (accs[0].Alias_Name2__c) { |
| | | var options_hpvalue = {}; |
| | | options_hpvalue.label = accs[0].Alias_Name2__c; |
| | | options_hpvalue.value = accs[0].Alias_Name2__c; |
| | | options_hp.push(options_hpvalue); |
| | | } |
| | | if (!quo.Print_HP_Name__c || |
| | | (quo.Print_HP_Name__c !== accs[0].Name && |
| | | quo.Print_HP_Name__c !== accs[0].Site && |
| | | quo.Print_HP_Name__c !== accs[0].Alias_Name2__c) |
| | | ) { |
| | | selection_hp = accs[0].Name; |
| | | } else { |
| | | selection_hp = quo.Print_HP_Name__c; |
| | | } |
| | | options_hpflg = false; |
| | | } |
| | | selection_hpExp = selection_hp; |
| | | options_hpflgExp = options_hpflg; |
| | | return options_hp |
| | | } |
| | | export function initquoassignment(quote,quoc,it){ |
| | | var quo = quoc |
| | | var rtn = quo.Cancel_Decide__c; |
| | | quo.rtn = !rtn ? it : !rtn; |
| | | var CreatedDateTime = new Date(quote.CreatedDate); |
| | | var PriceRefreshDate = new Date(quote.PriceRefreshDate__c); |
| | | quo.PriceRefreshPeriod = dateDaysBetween(!PriceRefreshDate ? CreatedDateTime : PriceRefreshDate,new Date()); |
| | | quo.QuoteName__c = quote.Name; |
| | | quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c); |
| | | quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c); |
| | | quo.Quote_Adjust_Amount_Page__c = toNumComma(quote.Quote_Adjust_Amount__c); |
| | | if(quo.OCM_Agent1_Price__c){ |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c); |
| | | }else{ |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | } |
| | | quo.MultiYearWarrantyTotalPrice__c = toNumComma(quo.MultiYearWarrantyTotalPrice__c); |
| | | quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c); |
| | | quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c); |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c); |
| | | //预测金额修改 fy |
| | | if(!quote.QuotationChange__c){ |
| | | quo.QuotationChange__c = ''; |
| | | } |
| | | if(!quote.Installation_location__c){ |
| | | quo.Installation_location__c = ''; |
| | | } |
| | | if(quote.Agent1_Agent2_Price__c){ |
| | | quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c); |
| | | }else{ |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | } |
| | | quo.hidden_Estimation_List = quote.Estimation_List_Price__c; |
| | | return quo; |
| | | } |
| | | export function initquoassignmentcopy(quote,quoc,it){ |
| | | debugger |
| | | var quo = quoc |
| | | let Name = quote.Name; |
| | | var QX = Name.indexOf('已取消:'); |
| | | if (QX >= 0) { |
| | | quo.Name = quo.Name.substring(QX + 4); |
| | | } |
| | | quo.QuoteName__c = quo.Name; |
| | | quo.IsQuoteTrial__c = false; |
| | | quo.Cancel_Decide__c = false; |
| | | quo.PriceRefreshDate__c = new Date(); |
| | | quo.Quote_Date__c = null; |
| | | quo.Quote_Print_Date__c = null; |
| | | quo.QuoteTotal_Page__c = toNumComma(quote.TotalPrice__c); |
| | | if(quo.OCM_Agent1_Price__c){ |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(quote.OCM_Agent1_Price__c); |
| | | }else{ |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | } |
| | | quo.Agency1_Profit__c = toNumComma(quo.Agency1_Profit__c); |
| | | quo.Agency2_Profit__c = toNumComma(quo.Agency2_Profit__c); |
| | | if(!quote.QuotationChange__c){ |
| | | quo.QuotationChange__c = ''; |
| | | } |
| | | if(!quote.Installation_location__c){ |
| | | quo.Installation_location__c = ''; |
| | | } |
| | | if(quote.Agent1_Agent2_Price__c){ |
| | | quo.Agent1_Agent2_Price_Page__c = toNumComma(quote.Agent1_Agent2_Price__c); |
| | | }else{ |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | } |
| | | quo.Dealer_Final_Price_Page__c = toNumComma(quote.Dealer_Final_Price__c); |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = toNumComma(quo.OCM_Sales_Forecast__c); |
| | | //预测金额修改 fy |
| | | quo.Quote_Adjust_Calculate__c = ''; |
| | | quo.Quote_Adjust_Amount_Page__c = ''; |
| | | quo.hidden_Estimation_List = quote.Estimation_List_Price__c; |
| | | quo.PriceRefreshPeriod = null; |
| | | var rtn = quo.Cancel_Decide__c; |
| | | quo.rtn = !rtn ? it : !rtn; |
| | | return quo; |
| | | } |
| | | export function salesProfit1Logic(quo,Salesprofit1value){ |
| | | var x = quo.Dealer_Final_Price_Page__c; |
| | | var y = quo.OCM_Agent1_Price_Page__c; |
| | | debugger |
| | | y = y + ''; |
| | | y = y.replace(/ /g, ""); |
| | | if (y.length == 0) { |
| | | var z = quo.Agent1_Agent2_Price_Page__c; |
| | | z = z + ''; |
| | | z = z.replace(/ /g, ""); |
| | | if (z.length == 0) { |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | Salesprofit1value = ''; |
| | | quo.Agency1_Profit__c = ''; |
| | | } else { |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(0); |
| | | Salesprofit1value = toNum(0); |
| | | quo.Agency1_Profit__c = toNumComma(0); |
| | | } |
| | | } else { |
| | | quo.OCM_Agent1_Price_Page__c = toNumComma(y); |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | var t = quo.Agent1_Agent2_Price_Page__c; |
| | | if (t.length == 0) { |
| | | Salesprofit1value = toNum(x - y); |
| | | quo.Agency1_Profit__c = toNumComma(x - y); |
| | | } else { |
| | | t = localParseFloat(t); |
| | | Salesprofit1value = toNum(t - y); |
| | | quo.Agency1_Profit__c = toNumComma(t - y); |
| | | } |
| | | } |
| | | quoExp = quo; |
| | | return Salesprofit1value; |
| | | } |
| | | export function salesCalculation1Logic(quo,Salesprofit1value,SalesCalculation1value){ |
| | | var w = quo.OCM_Agent1_Price_Page__c; |
| | | w = w + ''; |
| | | w = w.replace(/ /g, ''); |
| | | var x = Salesprofit1value; |
| | | var y = quo.Dealer_Final_Price_Page__c; |
| | | var z = quo.Agent1_Agent2_Price_Page__c; |
| | | z = z + ''; |
| | | z = z.replace(/ /g, ''); |
| | | if (w.length == 0) { |
| | | SalesCalculation1value = ''; |
| | | quo.Agency1_Profit_Rate__c = ''; |
| | | } else { |
| | | x = localParseFloat(x); |
| | | var t = 0; |
| | | if (z.length == 0) { |
| | | y = localParseFloat(y); |
| | | if (y != 0) { |
| | | t = x / y * 100; |
| | | } else { |
| | | t = 0; |
| | | } |
| | | } else { |
| | | z = localParseFloat(z); |
| | | if (z != 0) { |
| | | t = x / z * 100; |
| | | } else { |
| | | t = 0; |
| | | } |
| | | } |
| | | SalesCalculation1value = toNum(t); |
| | | quo.Agency1_Profit_Rate__c = toNumComma(t); |
| | | } |
| | | quoExp = quo; |
| | | return SalesCalculation1value; |
| | | } |
| | | export function salesProfit2Logic(quo,Salesprofit2value){ |
| | | var x = quo.Dealer_Final_Price_Page__c; |
| | | var y = quo.Agent1_Agent2_Price_Page__c; |
| | | y = y + ''; |
| | | y = y.replace(/ /g, ""); |
| | | if (y.length == 0) { |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | Salesprofit2value =''; |
| | | quo.Agency2_Profit__c = ''; |
| | | } else { |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | quo.Agent1_Agent2_Price_Page__c = toNumComma(y); |
| | | Salesprofit2value = toNum(x - y); |
| | | quo.Agency2_Profit__c = toNumComma(x - y); |
| | | } |
| | | quoExp = quo; |
| | | return Salesprofit2value; |
| | | } |
| | | /* |
| | | 计算第二经销商栏最右边的百分比 2次販売店利益率_元 = 第二经销商利润除以医院的合同金额 |
| | | */ |
| | | export function salesCalculation2Logic(quo,Salesprofit2value,SalesCalculation2value){ |
| | | var w = quo.Agent1_Agent2_Price_Page__c; |
| | | w = w + ''; |
| | | w = w.replace(/ /g, ''); |
| | | var x = Salesprofit2value; |
| | | var y = quo.Dealer_Final_Price_Page__c; |
| | | if (w.length == 0) { |
| | | SalesCalculation2value = ''; |
| | | quo.Agency2_Profit_Rate__c = ''; |
| | | } else { |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | if ((y == 0)) { |
| | | SalesCalculation2value = toNum(0); |
| | | quo.Agency2_Profit_Rate__c = toNumComma(0); |
| | | } else { |
| | | var z = x / y * 100; |
| | | SalesCalculation2value = toNum(z); |
| | | quo.Agency2_Profit_Rate__c = toNumComma(z); |
| | | } |
| | | } |
| | | quoExp = quo; |
| | | return SalesCalculation2value; |
| | | } |
| | | export function additionabuttonLoc(SelectedNewsetProduct,quo,oppInfo,jzDataToBeproduct){ |
| | | var Str = SelectDone(SelectedNewsetProduct); |
| | | var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | StrExp = Str; |
| | | return {setProduct_text:Str, |
| | | activitiesCan:quoLineItemCan, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan}; |
| | | } |
| | | export function onsaveToBeproductLoc(data,jzDataToBeproduct){ |
| | | var dataMap = new Map(); |
| | | var fag = false; |
| | | data.forEach(item=>{ |
| | | var key = Number(item.lineNo); |
| | | var value = {Quantity__c:'',UnitPrice_Page__c:''} |
| | | if(item.Quantity__c != undefined){ |
| | | value.Quantity__c = item.Quantity__c; |
| | | fag = true; |
| | | } |
| | | if(item.UnitPrice_Page__c != undefined){ |
| | | value.UnitPrice_Page__c = item.UnitPrice_Page__c; |
| | | } |
| | | dataMap.set(key,value); |
| | | }); |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var x, y, z, c; |
| | | if(dataMap.has(jzdtbt.lineNo)){ |
| | | var datavaue = dataMap.get(jzdtbt.lineNo); |
| | | if(datavaue.Quantity__c){ |
| | | jzdtbt.Quantity__c = localParseInt(datavaue.Quantity__c); |
| | | } |
| | | if(datavaue.UnitPrice_Page__c){ |
| | | // jzdtbt.UnitPrice_Page__c = toNumComma(datavaue.UnitPrice_Page__c); |
| | | jzdtbt.UnitPrice_Page__c = datavaue.UnitPrice_Page__c; |
| | | } |
| | | x = localParseInt(jzdtbt.Quantity__c); |
| | | y = localParseFloat(jzdtbt.UnitPrice_Page__c); |
| | | c = localParseFloat(jzdtbt.Cost_c); |
| | | z = x * y; |
| | | // jzdtbt.Subtotal__c = toNumComma(z) |
| | | jzdtbt.Subtotal__c = z |
| | | // jzdtbt.pageObject.Subtotal__c = toNumComma(z) |
| | | jzdtbt.pageObject.Subtotal__c = z |
| | | z = x * y; |
| | | jzdtbt.Cost_Subtotal_c = toNum(z); |
| | | } |
| | | }); |
| | | fagExp = fag; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function PrintButtonLoc(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert, |
| | | productStatusUpdated,enableSales,oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period, |
| | | quotemultiYearWarranty,selection_hp,SkipQuotefilg,QuoteDecision){ |
| | | var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var CheckItemCan = JSON.stringify(CheckItem); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | var data ={activitiesCan:quoLineItemCan, |
| | | CheckItemCan:CheckItemCan, |
| | | WinOrDecideAlertc:WinOrDecideAlert, |
| | | productStatusUpdatedc:productStatusUpdated, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan, |
| | | enableSalesc:enableSales, |
| | | oppIdc:oppId, |
| | | quoIdc:quoId, |
| | | newQuoteFlagc:newQuoteFlag, |
| | | changedAfterPrintc:changedAfterPrint, |
| | | quoteGurantee_Periodc:quoteGurantee_Period, |
| | | quotemultiYearWarrantyc:quotemultiYearWarranty, |
| | | selection_hpc:selection_hp, |
| | | SkipQuotefilgc:SkipQuotefilg, |
| | | QuoteDecisionc:QuoteDecision |
| | | }; |
| | | return data; |
| | | } |
| | | export function saverebackloc(resaut,quoId,nafg){ |
| | | alertExp = '' |
| | | var Setmap = new Map() |
| | | var key = Object.keys(resaut) |
| | | key.forEach(item=>{ |
| | | Setmap.set(item,resaut[item]); |
| | | }); |
| | | if(Setmap.has('errormessage')){ |
| | | errorflg = true; |
| | | alertExp = Setmap.get('errormessage'); |
| | | }else{ |
| | | if(Setmap.has('quoId')){ |
| | | quoId = Setmap.get('quoId'); |
| | | } |
| | | if(Setmap.has('quoId')){ |
| | | window.open('/lightning/n/lexSINewQuoteEntry#Id=' + Setmap.get('quoId'), '_self'); |
| | | flg = true; |
| | | } |
| | | errorflg = false; |
| | | } |
| | | nafgExp = resultFlag(nafg,Setmap) |
| | | return quoId; |
| | | } |
| | | // 优惠折扣 = 优惠价格 / (报价总额 - No discount price 合计); |
| | | export function DisCalculationfunctionLoc(quo){ |
| | | var x = quo.Discount_Amount__c; |
| | | x = localParseFloat(x); |
| | | var y = quo.QuoteTotal_Page__c; |
| | | y = localParseFloat(y); |
| | | if ((y == 0)) { |
| | | quo.Discount_Amount_Calculate__c = ''; |
| | | } else { |
| | | var z = 0; |
| | | z = x / y * 100; |
| | | z = z.toFixed(2); |
| | | quo.Discount_Amount_Calculate__c = toNum(z); |
| | | } |
| | | return quo; |
| | | } |
| | | // 根据医院小计计算报价总额 |
| | | export function quoteTotalPriceLoc(jzDataToBeproduct,quo,quoId,oppInfo,Saleslets){ |
| | | debugger |
| | | var x = 0; |
| | | var y = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.pageObject.Subtotal__c; |
| | | x = localParseFloat(x); |
| | | y = y + localParseFloat(x); |
| | | }); |
| | | quo.QuoteTotal_Page__c = toNumComma(y); |
| | | var z = quo.Estimation_List_Price__c; |
| | | var id = quoId; |
| | | if(!id){ |
| | | var IsQuoteTrial =quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | var mp =quo.MultiYearWarrantyTotalPrice__c; |
| | | mp = localParseFloat(mp); |
| | | var num = quo.Quote_Adjust_Calculate__c; |
| | | num = localParseFloat(num); |
| | | quo.Quote_Adjust_Calculate__c = toNumComma(num); |
| | | num = (100 + num) / 100; |
| | | z=localParseFloat(z); |
| | | var rh = oppInfo.rate_hospital; |
| | | var ra = oppInfo.rate_agency1; |
| | | quo.Dealer_Final_Price_Page__c = toNumComma(z*rh); |
| | | quo.OCM_Agent1_Price_Page__c = Saleslets ? toNumComma(z*num*ra+mp) : ''; |
| | | } |
| | | } |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | //计算隐藏 listPirce 汇总 和 UnitPrice(医院单价) 汇总 |
| | | export function calUnitPriceTotalLoc(jzDataToBeproduct){ |
| | | var ListPriceTotal = 0.0, |
| | | listPrice = 0.0; |
| | | var unitPriceTotal = 0.0, |
| | | unitPrice = 0.0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | listPrice = jzdtbt.ListPrice_Page; |
| | | unitPrice = jzdtbt.UnitPrice_Page__c; |
| | | ListPriceTotal += localParseFloat(listPrice); |
| | | unitPriceTotal += localParseFloat(unitPrice); |
| | | }); |
| | | ListPriceTotalExp = ListPriceTotal; |
| | | unitPriceTotalExp = unitPriceTotal; |
| | | jzDataToBeproduct =[].concat(jzDataToBeproduct); |
| | | return jzDataToBeproduct; |
| | | } |
| | | //判断进销商1 和 2 清空 利润百分比显示 |
| | | export function pageArrangeLoc(quo){ |
| | | if (!quo.OCM_Agent1_Price_Page__c) { |
| | | quo.Agency1_Profit__c = ''; |
| | | quo.Agency1_Profit_Rate__c = ''; |
| | | quo.OCM_Agent1_Price_Page__c = ''; |
| | | } |
| | | if (!quo.Agent1_Agent2_Price_Page__c) { |
| | | quo.Agency2_Profit__c = ''; |
| | | quo.Agency2_Profit_Rate__c = ''; |
| | | quo.Agent1_Agent2_Price_Page__c = ''; |
| | | } |
| | | return quo; |
| | | } |
| | | export function openQuotePage(b, b2, b3) { |
| | | var quoid = b3; |
| | | if (b2) { |
| | | } else { |
| | | if (b) { |
| | | //openPopup('/apex/contractdetailpdf?id=quoid'); |
| | | window.open('/apex/contractdetailpdf?id=' + quoid, 'Contract'); |
| | | } else { |
| | | //openPopup('/apex/quotepdf?id=quoid'); |
| | | window.open('/apex/quotepdf?id=' + quoid, 'Quote'); |
| | | } |
| | | } |
| | | } |
| | | export function quoteinit(quo){ |
| | | if (!quo.Gurantee_Period__c) { |
| | | quo.Gurantee_Period__c = '1'; |
| | | } |
| | | if (quo.Quote_Expiration_Date__c == null) { |
| | | quo.Quote_Expiration_Date__c = addDay(30,new Date()); |
| | | } |
| | | quo.Offer_Amount__c = true; |
| | | quo.TOTAL__c = true; |
| | | quo.Preferential_Gurantee_Period__c = true; |
| | | return quo; |
| | | } |
| | | /* |
| | | 如果询价是经销商贩卖,OCM预测额销售 = 第一经销商 |
| | | 如果询价是OCM直销,OCM预测额销售 = 医院的合同金额 |
| | | */ |
| | | export function setOCMAmountc(enableSales,quo,oppInfo){ |
| | | var s, t; |
| | | s = enableSales; |
| | | if (s) { |
| | | t = quo.OCM_Agent1_Price_Page__c; |
| | | } else { |
| | | t = quo.Dealer_Final_Price_Page__c; |
| | | } |
| | | t = localParseFloat(t); |
| | | oppInfo.hidden_Wholesale_Price = toNum(t); |
| | | oppInfo.Wholesale_Price__c = toNumComma(t); |
| | | //预测金额修改 fy |
| | | quo.OCM_Sales_Forecast__c = toNumComma(t); |
| | | quoExp = quo; |
| | | //预测金额修改 fy |
| | | return oppInfo; |
| | | } |
| | | // 优惠价格 = 报价总额 - 医院的合同金额 |
| | | // 然后调用 DisCalculation |
| | | export function DisAmountfunctionc(quo){ |
| | | var x = quo.QuoteTotal_Page__c; |
| | | x = localParseFloat(x); |
| | | var y = quo.Dealer_Final_Price_Page__c; |
| | | y = localParseFloat(y); |
| | | quo.Discount_Amount__c = toNum(x - y); |
| | | return quo; |
| | | } |
| | | export function Savebuttondetermine(opp,Save_button1){ |
| | | var QuoteBusiness = opp.BusinessFileArchived__c; |
| | | var Configuration_Suggestion = opp.Configuration_Suggestion__c; |
| | | var Configuration_Suggestion_Feedback = opp.Configuration_Suggestion_Feedback__c; |
| | | if(!Configuration_Suggestion && !Configuration_Suggestion_Feedback && !QuoteBusiness){ |
| | | Save_button1 = 111; |
| | | } |
| | | if(Configuration_Suggestion == '有建议' && !Configuration_Suggestion_Feedback && QuoteBusiness == false){ |
| | | Save_button1 = 211; |
| | | } |
| | | if(Configuration_Suggestion == '有建议' && Configuration_Suggestion_Feedback && QuoteBusiness == false){ |
| | | Save_button1 = 221; |
| | | } |
| | | if(!Configuration_Suggestion && !Configuration_Suggestion_Feedback && QuoteBusiness == true){ |
| | | Save_button1 = 112; |
| | | } |
| | | if(Configuration_Suggestion == '有建议' && !Configuration_Suggestion_Feedback && QuoteBusiness == true){ |
| | | Save_button1 = 212; |
| | | } |
| | | if(Configuration_Suggestion == '无建议' && QuoteBusiness == false){ |
| | | Save_button1 = 1; |
| | | } |
| | | return Save_button1; |
| | | } |
| | | export function submitOppoApplyStockJsLogic(Savebutton){ |
| | | alertExp = ''; |
| | | var Save_button1 = Savebutton; |
| | | var flag = false; |
| | | if(Save_button1 == 111){ |
| | | alertExp = '1、联系SI本部做配置建议。\n2、请营业本部做配置建议反馈。\n3、请SI本部做配置文件检查。'; |
| | | }else if(Save_button1 == 211){ |
| | | alertExp = '1、请营业本部做配置建议反馈。\n2、请SI本部做配置文件检查。'; |
| | | }else if(Save_button1 == 221){ |
| | | alertExp = '1、请SI本部做配置文件检查。'; |
| | | }else if(Save_button1 == 1){ |
| | | alertExp = '1、请SI本部做配置文件检查。'; |
| | | }else if(Save_button1 == 112){ |
| | | alertExp = '1、联系SI本部做配置建议。\n2、请营业本部做配置建议反馈。'; |
| | | }else if(Save_button1 == 212){ |
| | | alertExp = '1、请营业本部做配置建议反馈。'; |
| | | }else{ |
| | | flag = true; |
| | | } |
| | | return flag; |
| | | } |
| | | export function initOpportunityById(oppInfo,oppobj,enableSales,QuoteDecision,enableContract,displayFlg,viewSpecialAgencyAmout,Sales_Outlet,OCM_Direct){ |
| | | if (oppInfo.Sales_Root__c != null) { |
| | | if (oppobj.Sales_Root__c == '販売店') { |
| | | enableSales = true; |
| | | oppInfo.Sales_Root__c = Sales_Outlet; |
| | | Saleslet = true; |
| | | } else { |
| | | enableSales = false; |
| | | oppInfo.Sales_Root__c = OCM_Direct; |
| | | } |
| | | } |
| | | |
| | | if (QuoteDecision) { |
| | | enableContract = true; |
| | | } else { |
| | | enableContract = false; |
| | | } |
| | | oppInfo.SAP_Send_OK__c = true; |
| | | if (!oppInfo.SAP_Send_OK__c) { |
| | | displayFlg = true; |
| | | } else { |
| | | if(oppInfo.Agency1__r == undefined){ |
| | | oppInfo.Agency1__r = {}; |
| | | } |
| | | if(oppInfo.Agency2__r == undefined){ |
| | | oppInfo.Agency2__r = {}; |
| | | } |
| | | if(oppInfo.Account == undefined){ |
| | | oppInfo.Account = {}; |
| | | }else{ |
| | | if(oppInfo.Account.Parent == undefined){ |
| | | oppInfo.Account.Parent = {}; |
| | | } |
| | | } |
| | | if (oppInfo.Agency1__r.Special__c || oppInfo.Agency2__r.Special__c || oppInfo.Account.Parent.Special__c) { |
| | | // 特別販売店の引合い |
| | | if (viewSpecialAgencyAmout) { |
| | | displayFlg = true; |
| | | } else { |
| | | displayFlg = false; |
| | | } |
| | | } else { |
| | | displayFlg = true; |
| | | } |
| | | } |
| | | enableSalesExp = enableSales; |
| | | enableContractExp = enableContract; |
| | | displayFlgExp = displayFlg; |
| | | return oppInfo; |
| | | } |
| | | export function QuoteConfirmJsExp(User,Admin,Admin2){ |
| | | debugger |
| | | alertExp = ''; |
| | | var profileId = User.ProfileId; |
| | | var adminId = Admin; |
| | | var adminId2 = Admin2; |
| | | var flag=true; |
| | | var profileId15=profileId; |
| | | var flg; |
| | | if(profileId&&profileId.length>15){ |
| | | profileId15=profileId.substring(0,15); |
| | | } |
| | | if(adminId2.includes(profileId15)){ |
| | | flag=false; |
| | | }else{ |
| | | flag=true; |
| | | } |
| | | if(profileId!=adminId&&flag){ |
| | | alertExp = '只有系统管理员和营业助理有权限确认报价!'; |
| | | flg = true; |
| | | }else{ |
| | | flg = false; |
| | | } |
| | | return flg |
| | | } |
| | | export function initOpportunityById2(QuoteCorrect,User,QuoteDecision,QuoteSapSented,print_buttonflg,sap_button,Decision_button,Save_button){ |
| | | var verified =User.Quote_Correct__c; |
| | | var specialAuthority = User.Quote_Special_Operation__c; |
| | | if (!QuoteCorrect) { |
| | | print_buttonflg = true; |
| | | } else if (!verified) { |
| | | print_buttonflg = true; |
| | | } else { |
| | | print_buttonflg = false; |
| | | } |
| | | if (QuoteDecision == false) { |
| | | sap_button = true; |
| | | } else if (specialAuthority == false) { |
| | | sap_button = true; |
| | | } else { |
| | | sap_button = false; |
| | | } |
| | | if (verified) { |
| | | Decision_button = false; |
| | | } else if (!QuoteCorrect) { |
| | | Decision_button = true; |
| | | } else if (QuoteDecision) { |
| | | Decision_button = true; |
| | | } else { |
| | | Decision_button = false; |
| | | } |
| | | if (QuoteSapSented || QuoteDecision) { |
| | | Decision_button = true; |
| | | } |
| | | if (QuoteDecision) { |
| | | Save_button = true; |
| | | } else { |
| | | Save_button = false; |
| | | } |
| | | SbuttonExp = Save_button; |
| | | sapbuttonExp = sap_button; |
| | | pbuttonflgExp = print_buttonflg; |
| | | return Decision_button; |
| | | } |
| | | export function selectQuoteLineExp(quote,User,SI2M3ID,ProfSystAdmin,UnConfirmQuote){ |
| | | alertExp = ''; |
| | | debugger |
| | | var quo=quote; |
| | | var quoteOwner = quo.CreatedById; |
| | | var ProfileIDStr = User.ProfileId; |
| | | if(quo.Queto_Confirm_Date__c || |
| | | (!quo.Queto_Confirm_Date__c && (ProfileIDStr == SI2M3ID||ProfileIDStr == ProfSystAdmin||quoteOwner == User.Id))){ |
| | | quo.QuoteName__c = quo.Name; |
| | | if(!quo.Queto_Confirm_Date__c){ |
| | | UnConfirmQuote = true; |
| | | }else if(quo.Queto_Confirm_Date__c){ |
| | | }else{ |
| | | // Message = '请及时确认报价'; |
| | | alertExp = '请及时确认报价'; |
| | | } |
| | | }else{ |
| | | quo = {}; |
| | | UnConfirmQuote = false; |
| | | // errorMessage = '该报价尚未确认,不能查看'; |
| | | alertExp = '该报价尚未确认,不能查看'; |
| | | } |
| | | quoExp = quo; |
| | | return UnConfirmQuote; |
| | | } |
| | | export function SFDAtranslate(key){ |
| | | var value = ''; |
| | | if(key == '準備中'){ |
| | | value = '准备中'; |
| | | }else if(key == '新製品申請中'){ |
| | | value = '新产品注册中'; |
| | | }else if(key == '有効'){ |
| | | value = '有效'; |
| | | }else if(key == '失効(期限内生産済在庫対応)'){ |
| | | value = '失效或停止(注册证有效期内生产的库存品对应)'; |
| | | }else if(key == '失効(再申請中)'){ |
| | | value = '失效-重新申请中'; |
| | | }else if(key == '失効(申請無)'){ |
| | | value = '失效-不再注册'; |
| | | }else if(key == '有効(再申請中)'){ |
| | | value = '有效-重新申请中'; |
| | | }else{ |
| | | value = key; |
| | | } |
| | | return value; |
| | | } |
| | | export function decisionlol(jzDataToBeproduct,oppInfo,QuotationCalculationFag){ |
| | | var ff = false; |
| | | alertExp = ''; |
| | | var Shut = AlertForCFDA(jzDataToBeproduct); |
| | | var ifAuth = AlertAuthorize(oppInfo); |
| | | var arr = []; |
| | | var Venderflag = false; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var VenderName = jzdtbt.VenderName; |
| | | var prdouctName = jzdtbt.pageObject.Name__c; |
| | | if (prdouctName) { |
| | | arr.push(VenderName); |
| | | } |
| | | }); |
| | | for (var i = 0; i < arr.length; i++) { |
| | | if (arr[0] != arr[i]) { |
| | | Venderflag = true; |
| | | } |
| | | } |
| | | var listPrice = CheckForListPrice(jzDataToBeproduct); |
| | | var cost = CheckForCost(jzDataToBeproduct); |
| | | if (Shut == true) { |
| | | ff = true; |
| | | alertExp = '提示:包含重新申请CFDA的产品,不可Decide。'; |
| | | } else if (ifAuth == false) { |
| | | ff = true; |
| | | alertExp = '提示:该询价未授权,不可Decide'; |
| | | } else if (Venderflag == true) { |
| | | ff = true; |
| | | alertExp = '提示:请按照不同供应商拆单,不允许decide。'; |
| | | }else if (listPrice == true || cost == true) { |
| | | ff = true; |
| | | alertExp = '产品定价/成本为0,请联系产品本部。'; |
| | | }else if(QuotationCalculationFag){ |
| | | ff = true; |
| | | alertExp = '产品配置发生变化,请再次进行报价计算'; |
| | | } |
| | | return ff; |
| | | } |
| | | export function saveQuotel(quo,oppInfo,jzDataToBeproduct,CheckItem,WinOrDecideAlert,productStatusUpdated,enableSales, |
| | | oppId,quoId,newQuoteFlag,changedAfterPrint,quoteGurantee_Period,quotemultiYearWarranty,selection_hp,SkipQuotefilg,quoteflg){ |
| | | var quoc = saveEvoluationLogic(quo,oppInfo,jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var CheckItemCan = JSON.stringify(CheckItem); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | var SaveQuotecan = {activitiesCan:quoLineItemCan, |
| | | CheckItemCan:CheckItemCan, |
| | | WinOrDecideAlertc:WinOrDecideAlert, |
| | | productStatusUpdatedc:productStatusUpdated, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan, |
| | | enableSalesc:enableSales, |
| | | oppIdc:oppId, |
| | | quoIdc:quoId, |
| | | newQuoteFlagc:newQuoteFlag, |
| | | changedAfterPrintc:changedAfterPrint, |
| | | quoteGurantee_Periodc:quoteGurantee_Period, |
| | | quotemultiYearWarrantyc:quotemultiYearWarranty, |
| | | selection_hpc:selection_hp, |
| | | SkipQuotefilgc:SkipQuotefilg, |
| | | quoteflg:quoteflg |
| | | } |
| | | return SaveQuotecan; |
| | | } |
| | | export function resultFlag(nafg,Setmap){ |
| | | debugger |
| | | if(!Setmap){ |
| | | nafg.dfpp = false; |
| | | nafg.qname = false; |
| | | nafg.qacc = false; |
| | | nafg.qaapc = false; |
| | | nafg.Agency1 = false; |
| | | nafg.nAgency1 = false; |
| | | nafg.oapp = false; |
| | | nafg.noapp = false; |
| | | nafg.Agency2 = false; |
| | | nafg.nAgency2 = false; |
| | | nafg.aapp = false; |
| | | nafg.naapp = false; |
| | | }else{ |
| | | if(Setmap.has('dfpp')){ |
| | | nafg.dfpp = true; |
| | | }else{ |
| | | nafg.dfpp = false; |
| | | } |
| | | if(Setmap.has('qname')){ |
| | | nafg.qname = true; |
| | | }else{ |
| | | nafg.qname = false; |
| | | } |
| | | if(Setmap.has('qacc')){ |
| | | nafg.qacc = true; |
| | | }else{ |
| | | nafg.qacc = false; |
| | | } |
| | | if(Setmap.has('qaapc')){ |
| | | nafg.qaapc = true; |
| | | }else{ |
| | | nafg.qaapc = false; |
| | | } |
| | | if(Setmap.has('Agency1')){ |
| | | nafg.Agency1 = true; |
| | | }else{ |
| | | nafg.Agency1 = false; |
| | | } |
| | | if(Setmap.has('nAgency1')){ |
| | | nafg.nAgency1 = true; |
| | | }else{ |
| | | nafg.nAgency1 = false; |
| | | } |
| | | if(Setmap.has('oapp')){ |
| | | nafg.oapp = true; |
| | | }else{ |
| | | nafg.oapp = false; |
| | | } |
| | | if(Setmap.has('noapp')){ |
| | | nafg.noapp = true; |
| | | }else{ |
| | | nafg.noapp = false; |
| | | } |
| | | if(Setmap.has('Agency2')){ |
| | | nafg.Agency2 = true; |
| | | }else{ |
| | | nafg.Agency2 = false; |
| | | } |
| | | if(Setmap.has('nAgency2')){ |
| | | nafg.nAgency2 = true; |
| | | }else{ |
| | | nafg.nAgency2 = false; |
| | | } |
| | | if(Setmap.has('aapp')){ |
| | | nafg.aapp = true; |
| | | }else{ |
| | | nafg.aapp = false; |
| | | } |
| | | if(Setmap.has('naapp')){ |
| | | nafg.naapp = true; |
| | | }else{ |
| | | nafg.naapp = false; |
| | | } |
| | | } |
| | | return nafg; |
| | | } |
| | | // 计算产品标准定价总额 |
| | | export function EstimationL(jzDataToBeproduct,quo){ |
| | | var x, y, z; |
| | | x = 0; |
| | | y = 0; |
| | | z = 0; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | x = jzdtbt.ListPrice_Page; |
| | | y = jzdtbt.Quantity__c; |
| | | x = localParseFloat(x); |
| | | y = localParseFloat(y); |
| | | z = z + (x * y); |
| | | }); |
| | | jzDataToBeproduct =[].concat(jzDataToBeproduct); |
| | | quo.hidden_Estimation_List = toNum(z); |
| | | quo.Estimation_List_Price__c = toNumComma(z); |
| | | quoExp = quo; |
| | | return jzDataToBeproduct; |
| | | } |
| | | export function checkch(jzDataToBeproduct){ |
| | | var activities = []; |
| | | jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var lineId = jzdtbt.pageObject.PricebookEntryId; |
| | | if (lineId) { |
| | | var item = new Object(); |
| | | item.PricebookEntryId = jzdtbt.pageObject.PricebookEntryId; |
| | | item.SFDA_Status__c = jzdtbt.pageObject.SFDA_Status__c; |
| | | item.UnitPrice__c = localParseFloat(jzdtbt.UnitPrice_Page__c); |
| | | item.ListPrice__c = localParseFloat(jzdtbt.ListPrice_Page); |
| | | item.Quantity = localParseInt(jzdtbt.Quantity__c); |
| | | item.Is_DangerousChemicals = jzdtbt.Is_DangerousChemicals; |
| | | item.Is_CanNotCancelFlag = jzdtbt.CanNotCancelledGurantee; |
| | | activities.push(item); |
| | | } |
| | | }); |
| | | return activities; |
| | | } |
| force-app/main/default/lwc/lexSINewQuoteEntry/lexSIquoteTrialUtil.js |