| | |
| | | system.debug('2222222'+getModelQuantityMap); |
| | | String accountDealerErrorMessage = RadiationUtil.updateCertificationDetails(oliList[0].Opportunity.DealerId__c, null, getModelQuantityMap, false); |
| | | String olympusDealerErrorMessage = RadiationUtil.updateCertificationDetails(olympusAccountId, null, getModelQuantityMap, false) == '' ? '' : '仪景通可销售数量不足'; |
| | | //result = accountDealerErrorMessage + (olympusDealerErrorMessage == '' ? '' : '奥林巴斯可销售数量不足') ; |
| | | //result = accountDealerErrorMessage + (olympusDealerErrorMessage == '' ? '' : '仪景通可销售数量不足') ; |
| | | Boolean temp = accountDealerErrorMessage.startsWith('你不能'); |
| | | String strOly = LicenseCheckUtil.LicenseCheckOly(); |
| | | if(temp){ |
| | |
| | | }*/ |
| | | } |
| | | |
| | | |
| | | |
| | | List<AggregateResult> orderCnt = [select Count(Id) ocnt, OpportunityId from Order where OpportunityId = :oppIdList and Status__c = 'Active' group by OpportunityId]; |
| | | Map<String, Integer> orderCntMap = new Map<String, Integer>(); |
| | | for (AggregateResult temp : orderCnt) { |
| | |
| | | } |
| | | //王鹏伟 新建和同时,和询价对比客户、最终用户 |
| | | //戴宇,添加合同关联逻辑 |
| | | List<Opportunity> oppList = [select id,Association_Opportunity__c,CrossCooperativeProject__c,HeadOfCooperationArea__c,CrossCooperativeDealer__r.ManagementCode_F__c,CrossCooperativeDealer__r.Name,SyncedQuoteId, SyncedQuote.PaymentTerms__c, TradeType__c, Quote_PaymentTerms__c,AccountId,customerType__c,useing__c,compo_opp__c,RecordTypeId from Opportunity where id = :oppidList]; |
| | | List<Opportunity> oppList = [select id,Association_Opportunity__c,CrossCooperativeProject__c,HeadOfCooperationArea__c,CrossCooperativeDealer__r.ManagementCode_F__c,CrossCooperativeDealer__r.Name,SyncedQuoteId, SyncedQuote.PaymentTerms__c, TradeType__c, Quote_PaymentTerms__c,AccountId,customerType__c,useing__c,compo_opp__c from Opportunity where id = :oppidList]; |
| | | Map<String, String> syncedQuoteIdMap = new Map<String, String>(); |
| | | Map<String, String> paymentTermsMap = new Map<String, String>(); |
| | | Map<String, String> tradeTypeMap = new Map<String, String>(); |
| | | Map<String,String> oppAccountMap = new Map<String,String>(); |
| | | Map<String,Opportunity> oppMap = new Map<String,Opportunity>(); |
| | | |
| | | |
| | | |
| | | for (Opportunity opp : oppList) { |
| | | syncedQuoteIdMap.put(opp.id, opp.SyncedQuoteId); |
| | |
| | | if(newOrd.ProductSegment__c == 'IE' && newOrd.IE_SP8_D__c != oppMap.get(newOrd.OpportunityId).compo_opp__c){ |
| | | newOrd.addError('不能修改特殊条件COMPO'); |
| | | } |
| | | |
| | | |
| | | |
| | | /*if(newOrd.ProductSegment__c == 'BS'){ |
| | | String temp = oppMap.get(newOrd.OpportunityId).useing__c; |
| | | if(newOrd.SP_61D__c != (temp == ''?false:true)){ |
| | |
| | | newOrd.CrossCooperativeDealerCode__c = oppMap.get(newOrd.OpportunityId) == null ? '' :oppMap.get(newOrd.OpportunityId).CrossCooperativeDealer__r.ManagementCode_F__c; |
| | | newOrd.HeadOfCooperationArea__c = oppMap.get(newOrd.OpportunityId) == null ? null :oppMap.get(newOrd.OpportunityId).HeadOfCooperationArea__c; |
| | | newOrd.CrossCooperativeDealerText__c = oppMap.get(newOrd.OpportunityId) == null ? null :oppMap.get(newOrd.OpportunityId).CrossCooperativeDealer__r.Name; |
| | | newOrd.is_Direct__c = oppMap.get(newOrd.OpportunityId) == null ? false : (oppMap.get(newOrd.OpportunityId).RecordTypeId == '0120T0000003Ser' ? true : false); |
| | | |
| | | |
| | | //王鹏伟新加,合同中带入 询价 贸易管理客户分类 开始 |
| | | newOrd.TradeMagCategory__c = oppMap.get(newOrd.OpportunityId) == null ? '' :oppMap.get(newOrd.OpportunityId).customerType__c; |
| | |
| | | newOrd.RecordTypeId == System.Label.RT_Contract_IndividualCase_NDT || |
| | | newOrd.RecordTypeId == System.Label.RT_Contract_IndividualCase_RVI; |
| | | |
| | | if (UserInfo.getUserType() == 'PowerPartner' || newOrd.RecordTypeId == System.Label.RT_ServiceContract || newOrd.RecordTypeId == '0120T0000003nka' |
| | | if (UserInfo.getUserType() == 'PowerPartner' || newOrd.RecordTypeId == System.Label.RT_ServiceContract |
| | | || newOrd.RecordTypeId == System.Label.RT_ServiceContractIE || newOrd.RecordTypeId == System.Label.RT_ServiceContractRVI || individualCase) { |
| | | // 外贸送达方默认为外贸公司 |
| | | if (tradeTypeMap.get(newOrd.OpportunityId) == System.Label.Trade_Type) { |
| | |
| | | newOrd.SpecialDeliveryContact_D__c = newOrd.SpecialDeliveryContact__c; |
| | | newOrd.SpecialDeliveryPhone_D__c = newOrd.SpecialDeliveryPhone__c; |
| | | newOrd.SpecialDeliveryAddress_D__c = newOrd.SpecialDeliveryAddress__c; |
| | | // PIPL Update 20220420 By Chen Yanan Start |
| | | newOrd.SpecialDeliveryContact_D_Encrypted__c = newOrd.SpecialDeliveryContact_Encrypted__c; |
| | | newOrd.SpecialDeliveryPhone_D_Encrypted__c = newOrd.SpecialDeliveryPhone_Encrypted__c; |
| | | newOrd.SpecialDeliveryAddress_D_Encrypted__c = newOrd.SpecialDeliveryAddress_Encrypted__c; |
| | | // PIPL Update 20220420 By Chen Yanan End |
| | | newOrd.SpecialParkage_D__c = newOrd.SpecialParkage__c; |
| | | newOrd.SpecialWarranty_D__c = newOrd.SpecialWarranty__c; |
| | | newOrd.DealerProfit_D__c = newOrd.DealerProfit__c; |
| | |
| | | } |
| | | |
| | | public static void setPriceBook(List<Order> newList, Map<Id, Order> newMap, List<Order> oldList, Map<Id, Order> oldMap) { |
| | | |
| | | List<String> oppidList = new List<String>(); |
| | | for (Order o : newList) { |
| | | oppidList.add(o.OpportunityId); |
| | |
| | | |
| | | public static void addItem(List<Order> newList, Map<Id, Order> newMap, List<Order> oldList, Map<Id, Order> oldMap) { |
| | | List<String> oppidList = new List<String>(); |
| | | // Map<String, String> order2oppMap = new Map<String, String>(); |
| | | Boolean hasBS = false; |
| | | List<OrderShare> salesOwnershareList = new List<OrderShare>(); |
| | | for (Order o : newList) { |
| | | oppidList.add(o.OpportunityId); |
| | | // 跨省份合作项目 为真 并且 合同审批人不是空,将合同共享给审批人 Start |
| | | if (o.CrossCooperativeProject__c && String.isNotBlank(o.SalesOwner_BS__c)) { |
| | | salesOwnershareList.add(DataAssembly(o.Id,o.SalesOwner_BS__c)); |
| | | } |
| | | // 跨省份合作项目 为真 并且 合同审批人不是空,将合同共享给审批人 End |
| | | } |
| | | if (salesOwnershareList.size() > 0) { |
| | | insert salesOwnershareList; |
| | | // order2oppMap.put(o.Id, o.OpportunityId); |
| | | } |
| | | // XHL20210830 |
| | | List<OpportunityTeamMember> oppTM = new List<OpportunityTeamMember>(); |
| | |
| | | //新的获取简档ID calendarUtil.getMemberProfileID 这里用到的人员ID 和获取到的简档ID都是15位的 |
| | | //String new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15)); |
| | | String new_profileId = calendarUtil.getMemberProfileID(UserInfo.getUserId().subString(0,15)); |
| | | |
| | | for (Order newOrd : newList) { |
| | | Order oldOrd = oldMap.get(newOrd.Id); |
| | | if(newOrd.CrossCooperativeProject__c && CherkCrossComperativeChanged(newOrd,oldOrd)){ |
| | | newOrd.addError('创建合同后不能修改A代理商和B代理商'); |
| | | } |
| | | /* if(newOrd.SubDealer__c == '无'){ |
| | | newOrd.SubDealer__c = ''; |
| | | }*/ |
| | |
| | | } |
| | | if (newOrd.SpecialDeliveryContact__c != oldOrd.SpecialDeliveryContact__c) { |
| | | newOrd.SpecialDeliveryContact_D__c = newOrd.SpecialDeliveryContact__c; |
| | | // PIPL Update 20220420 By Chen Yanan Start |
| | | newOrd.SpecialDeliveryContact_D_Encrypted__c = newOrd.SpecialDeliveryContact_Encrypted__c; |
| | | // PIPL Update 20220420 By Chen Yanan End |
| | | } |
| | | if (newOrd.SpecialDeliveryPhone__c != oldOrd.SpecialDeliveryPhone__c) { |
| | | newOrd.SpecialDeliveryPhone_D__c = newOrd.SpecialDeliveryPhone__c; |
| | | // PIPL Update 20220420 By Chen Yanan Start |
| | | newOrd.SpecialDeliveryPhone_D_Encrypted__c = newOrd.SpecialDeliveryPhone_Encrypted__c; |
| | | // PIPL Update 20220420 By Chen Yanan End |
| | | } |
| | | if (newOrd.SpecialDeliveryAddress__c != oldOrd.SpecialDeliveryAddress__c) { |
| | | newOrd.SpecialDeliveryAddress_D__c = newOrd.SpecialDeliveryAddress__c; |
| | | // PIPL Update 20220420 By Chen Yanan Start |
| | | newOrd.SpecialDeliveryAddress_D_Encrypted__c = newOrd.SpecialDeliveryAddress_Encrypted__c; |
| | | // PIPL Update 20220420 By Chen Yanan End |
| | | } |
| | | if (newOrd.SpecialParkage__c != oldOrd.SpecialParkage__c) { |
| | | newOrd.SpecialParkage_D__c = newOrd.SpecialParkage__c; |
| | |
| | | */ |
| | | public static void setOrderShare (List<Order> newList, Map<Id, Order> newMap, List<Order> oldList, Map<Id, Order> oldMap) { |
| | | List<OrderShare> insertOrderShareList = new List<OrderShare>(); |
| | | BatchIF_Log__c iflog = new BatchIF_Log__c(); |
| | | /*BatchIF_Log__c iflog = new BatchIF_Log__c(); |
| | | iflog.Type__c = 'OrderShare'; |
| | | String datetimeStr = String.valueOf(Datetime.now()).replace('-','').replace(' ','').replace(':',''); |
| | | iflog.MessageGroupNumber__c = datetimeStr; |
| | | iflog.Log__c = ''; |
| | | Boolean errrorFlag = false; |
| | | Boolean errrorFlag = false;*/ |
| | | |
| | | for (Order newOrd : newList) { |
| | | Order oldOrd = oldMap == null ? new Order() : oldMap.get(newOrd.Id); |
| | |
| | | if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c && newOrd.OwnerId != oldOrd.OwnerId) { |
| | | String userId = oldOrd.OwnerId; |
| | | insertOrderShareList.add(DataAssembly(newOrd.Id,userId)); |
| | | } else { |
| | | } /*else { |
| | | |
| | | if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c) { |
| | | iflog.Log__c += 'Order Id --->'+ newOrd.Id + '\n'; |
| | |
| | | iflog.Log__c += 'oldOrd.OwnerId--->'+oldOrd.OwnerId + '\n'; |
| | | errrorFlag = true; |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | } |
| | | if (insertOrderShareList.size() > 0) { |
| | |
| | | insert insertOrderShareList; |
| | | } |
| | | |
| | | if (errrorFlag) { |
| | | /*if (errrorFlag) { |
| | | insert iflog; |
| | | } |
| | | }*/ |
| | | |
| | | |
| | | } |
| | |
| | | // } |
| | | // XHL20210830 |
| | | if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c && newOrd.OwnerId != newOrd.OpportunityOwnerId__c && newOrd.OpportunityOwnerId__c <> null && newOrd.OpportunityOwnerId__c <> '') { |
| | | newOrd.OwnerId = newOrd.OpportunityOwnerId__c; |
| | | newOrd.OwnerId = newOrd.OpportunityOwnerId__c; |
| | | } |
| | | |
| | | if (newOrd.SharedFlag__c != oldOrd.SharedFlag__c && newOrd.SharedFlag__c){ |
| | | // 跨省份合作项目 为真 并且 合同审批人不是空,将审批人赋值给所有人 Start |
| | | if (newOrd.CrossCooperativeProject__c && String.isNotBlank(newOrd.SalesOwner_BS__c)) { |
| | | newOrd.OwnerId = newOrd.SalesOwner_BS__c; |
| | | } |
| | | // 跨省份合作项目 为真 并且 合同审批人不是空,将审批人赋值给所有人 End |
| | | } |
| | | |
| | | // |
| | | if (newOrd.ApproveStatus__c != oldOrd.ApproveStatus__c) { |
| | | if (newOrd.ApproveStatus__c == 'Pass' && newOrd.IsCopy__c == false) { |
| | | newOrd.IsSpPassed__c = true; |
| | |
| | | newOrd.SpecialDeliveryContact__c = newOrd.SpecialDeliveryContact_D__c; |
| | | newOrd.SpecialDeliveryPhone__c = newOrd.SpecialDeliveryPhone_D__c; |
| | | newOrd.SpecialDeliveryAddress__c = newOrd.SpecialDeliveryAddress_D__c; |
| | | // PIPL Update 20220420 By Chen Yanan Start |
| | | newOrd.SpecialDeliveryContact_Encrypted__c = newOrd.SpecialDeliveryContact_D_Encrypted__c; |
| | | newOrd.SpecialDeliveryPhone_Encrypted__c = newOrd.SpecialDeliveryPhone_D_Encrypted__c; |
| | | newOrd.SpecialDeliveryAddress_Encrypted__c = newOrd.SpecialDeliveryAddress_D_Encrypted__c; |
| | | // PIPL Update 20220420 By Chen Yanan End |
| | | newOrd.SpecialParkage__c = newOrd.SpecialParkage_D__c; |
| | | newOrd.SpecialWarranty__c = newOrd.SpecialWarranty_D__c; |
| | | newOrd.DealerProfit__c = newOrd.DealerProfit_D__c; |
| | |
| | | newOrd.SpecialDeliveryContact_D__c = newOrd.SpecialDeliveryContact__c; |
| | | newOrd.SpecialDeliveryPhone_D__c = newOrd.SpecialDeliveryPhone__c; |
| | | newOrd.SpecialDeliveryAddress_D__c = newOrd.SpecialDeliveryAddress__c; |
| | | // PIPL Update 20220420 By Chen Yanan Start |
| | | newOrd.SpecialDeliveryContact_D_Encrypted__c = newOrd.SpecialDeliveryContact_Encrypted__c; |
| | | newOrd.SpecialDeliveryPhone_D_Encrypted__c = newOrd.SpecialDeliveryPhone_Encrypted__c; |
| | | newOrd.SpecialDeliveryAddress_D_Encrypted__c = newOrd.SpecialDeliveryAddress_Encrypted__c; |
| | | // PIPL Update 20220420 By Chen Yanan End |
| | | newOrd.SpecialParkage_D__c = newOrd.SpecialParkage__c; |
| | | newOrd.SpecialWarranty_D__c = newOrd.SpecialWarranty__c; |
| | | newOrd.DealerProfit_D__c = newOrd.DealerProfit__c; |
| | |
| | | |
| | | newOrd.Contract_StatusD__c = newOrd.Contract_Status__c; |
| | | newOrd.ProductConfig_D__c = newOrd.ProductConfig__c; |
| | | // PIPL Update 20220420 By Chen Yanan Start |
| | | newOrd.SpecialDeliveryPhone_Encrypted__c = newOrd.SpecialDeliveryPhone_D_Encrypted__c; |
| | | // PIPL Update 20220420 By Chen Yanan End |
| | | |
| | | if (newOrd.Upload_IsChanged__c == true) { |
| | | newOrd.Upload_IsChanged__c = false; |
| | |
| | | |
| | | if (oldOrder.ApproveStatus__c != newOrder.ApproveStatus__c && (newOrder.ApproveStatus__c == 'Completed' || newOrder.ApproveStatus__c == 'Completed2' || newOrder.ApproveStatus__c == 'CompletedC' || newOrder.ApproveStatus__c == 'CompletedS' )) { |
| | | ownerIdList.add(newOrder.OpportunityOwnerId__c); |
| | | ownerIdList.add(newOrder.SalesOwner_BS__c); |
| | | if(newOrder.CrossCooperativeProject__c){ |
| | | orderToOwner.put(newOrder.Id, newOrder.SalesOwner_BS__c); |
| | | }else{ |
| | | orderToOwner.put(newOrder.Id, newOrder.OpportunityOwnerId__c); |
| | | } |
| | | orderToOwner.put(newOrder.Id, newOrder.OpportunityOwnerId__c); |
| | | } |
| | | |
| | | if (newOrder.Description != null && newOrder.Description.length() > 0) { |
| | |
| | | } |
| | | |
| | | //显微镜降级 |
| | | levelMap = levelCheck(ordIdList); |
| | | if(OrderDivisionController.OrderDivision == false){ |
| | | levelMap = levelCheck(ordIdList); |
| | | } |
| | | //for() |
| | | |
| | | Map<Id, User> copyUserMap = new Map<Id, User>([ |
| | | SELECT Id, Name, SalesAsistManager__c, BusinessDepOwner_Tax__c, BusinessDepOwner_WithoutTax__c, SalesManager__c, AsistGenManger__c, CRM_Owner__c, |
| | | BS_AsistGenManger__c,BS_AsistBGenManger__c,Department__c,BS_BDepartment__c,BS_GeneralManager__c,BS_INDepartment__c,BS_Department__c,BS_Manager__c |
| | | BS_AsistGenManger__c,BS_AsistBGenManger__c,BS_BDepartment__c,BS_GeneralManager__c,BS_INDepartment__c,BS_Department__c,BS_Manager__c |
| | | FROM User WHERE Id IN :ownerIdList |
| | | ]); |
| | | |
| | |
| | | |
| | | |
| | | User u = copyUserMap.get(orderToOwner.get(newOrder.Id)); |
| | | if (u != null && (u.SalesAsistManager__c != null || u.Department__c != null || u.BusinessDepOwner_Tax__c != null || u.BusinessDepOwner_WithoutTax__c != null || u.SalesManager__c != null || u.AsistGenManger__c != null)) { |
| | | if(newOrder.CrossCooperativeProject__c == false){ |
| | | newOrder.SalesOwner_BS__c = newOrder.OpportunityOwnerId__c; |
| | | } |
| | | |
| | | if (u != null && (u.SalesAsistManager__c != null || u.BusinessDepOwner_Tax__c != null || u.BusinessDepOwner_WithoutTax__c != null || u.SalesManager__c != null || u.AsistGenManger__c != null)) { |
| | | newOrder.SalesOwner_BS__c = newOrder.OpportunityOwnerId__c; |
| | | newOrder.SalesAsistManager_BS__c = u.SalesAsistManager__c == null ? u.Id : u.SalesAsistManager__c; |
| | | // 当黄平江的IE完税合同,以下省份业务部审批人为郑轶盈 2018/11/30 |
| | | if (newOrder.ProductSegment__c == 'IE' && u.Id == '00528000000YVFs' && (newOrder.Province__c == '河南' || newOrder.Province__c == '山东' |
| | |
| | | newOrder.OrderUpdateUser__c = UserInfo.getUserId(); |
| | | } |
| | | //if (newOrder.RecordTypeId == '01228000000NJt8') { |
| | | if (newOrder.ProductSegment__c == 'BS' && newOrder.Is_TAX__c == true && newOrder.AccoutMatketD__c == 'Clinical') { |
| | | if ((newOrder.ProductSegment__c == 'BS' && newOrder.Is_TAX__c == true && newOrder.AccoutMatketD__c == 'Clinical') && |
| | | (newOrder.confirm__c == false || (newOrder.confirm__c && String.isNotBlank(newOrder.original_order__c) && !'OrderPass'.equals(newOrder.ApproveStatus__c)))) { |
| | | //显微镜降级 |
| | | newOrder.Level_Category__c = levelMap.get(newOrder.id); |
| | | } |
| | | if(OrderDivisionController.OrderDivision == false){ |
| | | newOrder.Level_Category__c = levelMap.get(newOrder.id); |
| | | } |
| | | } |
| | | //} |
| | | } |
| | | } |
| | |
| | | hasBS = true; |
| | | } |
| | | } |
| | | if (updateOrderAccount) { |
| | | if (updateOrderAccount && OrderDivisionController.OrderDivision == false) { |
| | | // WLIG-C3M68P XHL 20210607 Start |
| | | // 新建与变更合同客户、最终用户时,和询价对比客户、最终用户,若不相同直接报错提醒 |
| | | CustomerConsistency(oppidList,oppAccountMap,newList); |
| | |
| | | (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_kua || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval_kua || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_kua || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval_kua )) { |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval)) { |
| | | odrIds.add(odr.Id); |
| | | } |
| | | } |
| | | system.debug('111111+' + odrIds.size()); |
| | | if (odrIds.size() == 0) return; |
| | | |
| | | Map<String, boolean> hiddenFlagMap = new Map<String, boolean>(); |
| | |
| | | system.debug('hiddenFlagMap'+hiddenFlagMap); |
| | | for (Order odr : newList) { |
| | | Order oldOrd = oldMap == null ? new Order() : oldMap.get(odr.Id); |
| | | system.debug(odr.RecordTypeId + '@@@' + oldOrd.RecordTypeId); |
| | | system.debug(odr.CrossCooperativeProject__c + '!!!!!' + hiddenFlagMap.get(odr.Id)); |
| | | //如果合同的记录类型是LS相关的记录类型,需要根据隐藏标记确认是否修改为对应的记录类型 |
| | | if (odr.RecordTypeId != oldOrd.RecordTypeId && |
| | | (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax || |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval || |
| | |
| | | odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval)) { |
| | | if (hiddenFlagMap.get(odr.Id) == true) { |
| | | if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_hidden_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_hidden; |
| | | } |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_hidden; |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_hidden_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_hidden; |
| | | } |
| | | |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_hidden; |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden; |
| | | } |
| | | |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden; |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_Approval_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_Approval; |
| | | } |
| | | |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden_Approval; |
| | | } |
| | | } else if (hiddenFlagMap.get(odr.Id) == false) { |
| | | if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_hidden) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax; |
| | | } |
| | | |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax; |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval_hidden) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval; |
| | | } |
| | | |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval; |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_hidden) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax; |
| | | } |
| | | |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax; |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_hidden_Approval) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_Approval_kua; |
| | | }else{ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden; |
| | | } |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_kua; |
| | | } |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_Tax_Approval) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_Tax_Approval_kua; |
| | | } |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_kua; |
| | | } |
| | | } else if (odr.RecordTypeId == System.Label.RT_Contract_BS_WithoutTax_Approval) { |
| | | if(odr.CrossCooperativeProject__c == true){ |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_Approval_kua; |
| | | } |
| | | odr.RecordTypeId = System.Label.RT_Contract_BS_WithoutTax_hidden; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | // 合同-变更申请-原合同无效或者手动修改导致合同无效 |
| | | if (!approveStatus && status) { |
| | | if(newOrd.oldOrder__c){ |
| | | RadiationUtil.oldOrder = true; |
| | | if (updateFlag) { |
| | | newOrd.oldOrder__c = false; |
| | | } |
| | | |
| | | } |
| | | RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'无效或变更无效',newOrd.LastModifiedById ); |
| | | } |
| | | |
| | |
| | | |
| | | if (RadiationUtil.EscapeOrderTriggerHandler) { |
| | | RadiationUtil.EscapeOrderTriggerHandler = false; |
| | | if(newOrd.oldOrder__c){ |
| | | RadiationUtil.oldOrder = true; |
| | | if (updateFlag) { |
| | | newOrd.oldOrder__c = false; |
| | | } |
| | | } |
| | | RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同变更草案中',newOrd.LastModifiedById ); |
| | | |
| | | } |
| | |
| | | Boolean status = newOrd.Status__c != oldOrd.Status__c && newOrd.Status__c == 'Inactive'; |
| | | // 合同提交状态变成无效 |
| | | if ( status ) { |
| | | if(newOrd.oldOrder__c){ |
| | | RadiationUtil.oldOrder = true; |
| | | if (updateFlag) { |
| | | newOrd.oldOrder__c = false; |
| | | } |
| | | } |
| | | RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同提交变无效',newOrd.LastModifiedById ); |
| | | } |
| | | } else if (newOrd.ApproveStatus__c == 'CancelPass' && newOrd.Status__c == 'Active') { |
| | | // 合同-合同批准→→→合同取消 |
| | | if ( approveStatus && newOrd.BeforeSubmitStatus__c == 'OrderPass') { |
| | | |
| | | if(newOrd.oldOrder__c){ |
| | | RadiationUtil.oldOrder = true; |
| | | if (updateFlag) { |
| | | newOrd.oldOrder__c = false; |
| | | } |
| | | } |
| | | RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同取消',newOrd.LastModifiedById ); |
| | | } |
| | | |
| | | } else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderReject' && newOrd.Status__c == 'Active') { |
| | | // 合同提交→→→合同驳回 |
| | | if(newOrd.oldOrder__c){ |
| | | RadiationUtil.oldOrder = true; |
| | | if (updateFlag) { |
| | | newOrd.oldOrder__c = false; |
| | | } |
| | | } |
| | | RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同驳回',newOrd.LastModifiedById ); |
| | | } else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderDraft' && newOrd.Status__c == 'Active') { |
| | | // 合同提交→→→合同调回 |
| | | if(newOrd.oldOrder__c){ |
| | | RadiationUtil.oldOrder = true; |
| | | if (updateFlag) { |
| | | newOrd.oldOrder__c = false; |
| | | } |
| | | } |
| | | RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同调回',newOrd.LastModifiedById ); |
| | | } |
| | | |
| | |
| | | for(OpportunityContactRole oppor:role_list){ |
| | | roleMap.put(oppor.OpportunityId,oppor.ContactId); |
| | | } |
| | | System.debug('oppidList: ' + oppidList);//Nancy 2022-04-25 |
| | | System.debug('role_list: ' + role_list);//Nancy 2022-04-25 |
| | | // 获取系统管理员Id |
| | | String getUserId = System.label.SystemAdmin1_2_GPI; |
| | | String errMessage = '客户名或最终用户与询价不一致!'; |
| | | for(Order orOne:newList){ |
| | | if (oppAccountMap.containsKey(orOne.OpportunityId)) { |
| | | System.debug(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId); |
| | | System.debug( !roleMap.containsKey(orOne.OpportunityId)); |
| | | System.debug(orOne.EndUserD__c + '++'+ roleMap.get(orOne.OpportunityId)); |
| | | //zhj 2022-04-22 start |
| | | System.debug('oppAccountMap.get(orOne.OpportunityId) = ' + oppAccountMap.get(orOne.OpportunityId)); |
| | | System.debug('orOne.AccountId = ' + orOne.AccountId); |
| | | System.debug('roleMap.containsKey(orOne.OpportunityId) = ' + roleMap.containsKey(orOne.OpportunityId)); |
| | | System.debug('orOne.EndUserD__c = ' + orOne.EndUserD__c); |
| | | System.debug('roleMap.get(orOne.OpportunityId) = ' + roleMap.get(orOne.OpportunityId)); |
| | | //zhj 2022-04-22 end |
| | | if(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId || !roleMap.containsKey(orOne.OpportunityId) || orOne.EndUserD__c != roleMap.get(orOne.OpportunityId)){ |
| | | // 获取用户Id |
| | | String userId = UserInfo.getUserId().subString(0,15); |
| | |
| | | throw new ControllerUtil.myException('合同Id:'+orOne.Id+'_'+errMessage); |
| | | } else { |
| | | //订单ID没有取到 |
| | | orOne.addError(errMessage); |
| | | orOne.addError(errMessage+'1'+orOne.Id); |
| | | } |
| | | } else { |
| | | //自定义标签里面没有当前用户的ID |
| | | orOne.addError(errMessage); |
| | | orOne.addError(errMessage + '2'); |
| | | } |
| | | |
| | | } else { |
| | | //自定义标签没有内容 |
| | | orOne.addError(errMessage); |
| | | orOne.addError(errMessage + '3'); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //检查合同上的等级类别是二类,一类,非监管(等级由高到底),单独一条记录里面的所有产品,放到一个list里面。 |
| | |
| | | } |
| | | } |
| | | |
| | | //开始逻辑判断,订单产品对应的产品的等级类别只要有一类,订单上的等级类别赋值一类(一类>二类>非监管,依此类推) |
| | | //开始逻辑判断,订单产品对应的产品的等级类别只要有二类,订单上的等级类别赋值二类(二类>一类>非监管,依此类推) |
| | | for (String oe : newList) { |
| | | if (orditemMap.containsKey(oe)) { |
| | | if (orditemMap.get(oe).contains('二类')) { |
| | |
| | | return returnMap; |
| | | } |
| | | */ |
| | | |
| | | |
| | | |
| | | /** |
| | | * 检查合同审批人是否填写完整 |
| | | * @author Dai Y |
| | | * @date 2022-01-12 |
| | | * @param ordList 待检查合同List |
| | | * @return 填写完整返回true,不完整返回false |
| | | */ |
| | | private static Boolean CheckSalesOwner(List<Order> ordList){ |
| | | Boolean flag = true; |
| | | for (Order order : ordList) { |
| | | //判断合同审批人是否为空, |
| | | if(String.isBlank(order.SalesOwner_BS__c)){ |
| | | //order.SalesOwner_BS__c.addError('请填写审批人'); |
| | | flag = false; |
| | | } |
| | | } |
| | | return flag; |
| | | } |
| | | /** |
| | | * 检查跨区销售相关数据是否填写完整 |
| | | * @author Dai Y |
| | | * @date 2022-01-12 |
| | | * @param ordList 待检查合同List |
| | | * @return 填写完整返回true,不完整返回false |
| | | */ |
| | | |
| | | private static Boolean CheckCrossComperativeData(List<Order> ordList){ |
| | | Boolean flag = true; |
| | | for (Order order : ordList) { |
| | | //判断合作区域代理商,主代理商和合作区域负责人 |
| | | if(String.isBlank(order.CrossCooperativeDealerText__c) || String.isBlank(order.HeadOfCooperationArea__c) || false){ |
| | | flag = false; |
| | | } |
| | | } |
| | | return flag; |
| | | } |
| | | /** |
| | | * 判断AB代理商是否修改 |
| | | * @author Dai Y |
| | | * @date 2022-01-20 |
| | | * @param newOrd 修改后合同 |
| | | * @param oldOrd 修改前合同 |
| | | * @return 如果进行修改返回true,没修过饭后false |
| | | */ |
| | | public static Boolean CherkCrossComperativeChanged(Order newOrd ,Order oldOrd){ |
| | | Boolean flag = false; |
| | | if(newOrd.Dealer_A__c != oldOrd.Dealer_A__c || newOrd.Dealer_B__c != oldOrd.Dealer_B__c ){ |
| | | flag = true; |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * 必填选项检查 |
| | | * @author Dai Y |
| | | * @date 2022-01-13 |
| | | * @param ordList 待检查合同List |
| | | * @return 检查通过返回true,不通过返回false |
| | | */ |
| | | private static Boolean Check(List<Order> ordList){ |
| | | Boolean flag = true; |
| | | |
| | | |
| | | return flag; |
| | | } |
| | | |
| | | public static void asd() { |
| | | Integer i = 1; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |