| | |
| | | public without sharing class StraightBackAddressController { |
| | | global without sharing class StraightBackAddressController { |
| | | /** |
| | | * 页面顶部检索数据 |
| | | */ |
| | |
| | | } |
| | | }else if('返送办事处'.equals(pc.Returns_Product_way__c)){ |
| | | optionAddressClassification.Address_Classification__c = '办事处'; |
| | | // |
| | | }else if ('备品中心'.equals(pc.Returns_Product_way__c)) { |
| | | optionAddressClassification.Address_Classification__c = '备品'; |
| | | // |
| | | |
| | | |
| | | }else{ |
| | | //获取当前修理的返送经销商 |
| | | if(!String.isBlank(pc.Dealer__c) && '返送经销商'.equals(pc.Returns_Product_way__c)){ |
| | |
| | | ref.setRedirect(true); |
| | | return ref; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 检索数据查询 |
| | |
| | | tableData.add(new AddressData(accoutList[0],'none','inline','none','医院')); |
| | | } |
| | | } |
| | | //办事处 |
| | | /*if('办事处'.equals(typeText)){ |
| | | String AccountOfficeSql = makeTextAccOfficeSql(); |
| | | //获取地址信息 |
| | | List<Account> accDataList = Database.query(AccountOfficeSql); |
| | | if(accDataList != null && accDataList.size() > 0){ |
| | | for(Integer i = 0;i<accDataList.size();i++){ |
| | | indexCou++; |
| | | tableData.add(new AddressData(accDataList[i],'none','办事处')); |
| | | } |
| | | } |
| | | }*/ |
| | | //经销商: |
| | | //1:如果查到多条经销商,并且在地址中查到有数据,只显示地址数据,如果地址数据没查不到,就不显示, |
| | | //2:如果查到有一条经销商,那么第一行就是此经销商数据,从第二行开始为地址数据 |
| | |
| | | |
| | | if(dataList[i].Address_Classification__c == '办事处'){ |
| | | tableData.add(new AddressData(dataList[i],'none','none','inline')); |
| | | }else{ |
| | | }else if (dataList[i].Address_Classification__c == '备品'){ |
| | | tableData.add(new AddressData(dataList[i],'none','none','inline')); |
| | | } else{ |
| | | //只能改自己创建的地址数据,系统管理员、GPI_系统管理员New 没限制 |
| | | if(loginPerson == createId ||loginPerson == '00e10000000dzzG' ||loginPerson == '00e10000000Y3o5'){ |
| | | tableData.add(new AddressData(dataList[i],'inline','inline','inline')); |
| | |
| | | */ |
| | | public PageReference save(){ |
| | | system.debug('Address value:'+JSON.serialize(insUpdData)); |
| | | if(String.isNotBlank(contactIdValue)&&String.isNotEmpty(contactIdValue)){ |
| | | system.debug('Contact Value:'+contactIdValue); |
| | | insUpdData.Contacts__c = contactIdValue; |
| | | } |
| | | // WLIG-CCX4BB 【委托】修理直返收货地址功能改造 thh 20220513 start |
| | | // if(String.isNotBlank(contactIdValue)&&String.isNotEmpty(contactIdValue)){ |
| | | // system.debug('Contact Value:'+contactIdValue); |
| | | // insUpdData.Contacts__c = contactIdValue; |
| | | // } |
| | | // WLIG-CCX4BB 【委托】修理直返收货地址功能改造 thh 20220513 end |
| | | system.debug('Address value:'+JSON.serialize(insUpdData)); |
| | | savepoint sp = Database.setsavepoint(); |
| | | if(insUpdData != null){ |
| | |
| | | this.insUpdData.Telephone__c.addError('不能为空!'); |
| | | } |
| | | //详细地址不能为空 |
| | | System.debug('insUpdData.Detailed_Address__c1:' + insUpdData.Detailed_Address__c); |
| | | if(String.isBlank(insUpdData.Detailed_Address__c)){ |
| | | flag = false; |
| | | this.insUpdData.Detailed_Address__c.addError('详细地址不能为空!'); |
| | |
| | | } |
| | | } |
| | | } |
| | | //判断联系人是否都为空 |
| | | if(insUpdData.Contacts__c == null || String.isBlank(insUpdData.Contacts__c)){ |
| | | //WLIG-CCX4BB 【委托】修理直返收货地址功能改造 thh 20220513 start |
| | | //判断联系人是否为空 |
| | | System.debug('insUpdData.ContactName__c1:' + insUpdData.ContactName__c); |
| | | if(String.isBlank(insUpdData.ContactName__c)){ |
| | | this.insUpdData.ContactName__c.addError('【联系人】不能为空!'); |
| | | //判断新建联系人是否为空 |
| | | if(insUpdData.Create_Contacts__c == null || String.isBlank(insUpdData.Create_Contacts__c)){ |
| | | flag = false; |
| | | this.insUpdData.Create_Contacts__c.addError('【联系人】和【联系人(新建)】不能同时为空!'); |
| | | }else{//如果联系人为空,但是新建联系人不为空,那么新增一条联系人数据 |
| | | if(flag){ |
| | | String typeL = '';//类型 |
| | | if(insUpdData.Address_Classification__c == '医院'){ |
| | | typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();//医師 |
| | | }else if(insUpdData.Address_Classification__c == '经销商'){ |
| | | typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();//販売店 |
| | | }else if(insUpdData.Address_Classification__c == '办事处'){ |
| | | typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Internal_staff').getRecordTypeId();//社内员工 |
| | | } |
| | | String surname = String.valueOf(insUpdData.Create_Contacts__c);//姓 |
| | | String monicker = '';//名 |
| | | if(surname.length() >= 2){ |
| | | monicker = surname.substring(1,surname.length()); |
| | | surname = surname.substring(0,1); |
| | | } |
| | | System.debug('newCon = '+newCon); |
| | | addContact = new Contact(LastName = surname, |
| | | FirstName = monicker, |
| | | AccountId = insUpdData.Customer__c, |
| | | RecordTypeId = typeL, |
| | | AWS_Data_Id__c = newCon.AWS_Data_Id__c, |
| | | LastName_Encrypted__c = newCon.LastName_Encrypted__c); |
| | | try{ |
| | | //新增一条联系人数据 |
| | | insert addContact; |
| | | sfRecordId = addContact.id; |
| | | insUpdData.Create_Contacts__c = ''; |
| | | }catch(Exception e){ |
| | | //ApexPages.addMessages(e); |
| | | Database.rollback(sp); |
| | | //失败提示 |
| | | System.debug('myException caught when save or submit: ' + e.getMessage() + e.getStackTraceString()); |
| | | ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); |
| | | isSearchBtn = false; |
| | | return null; |
| | | } |
| | | insUpdData.Contacts__c = addContact.id; |
| | | //name赋值 |
| | | /*if(insUpdData.Contacts__c == null){ |
| | | insUpdData.name = insUpdData.Customer__r.Name+'_'+insUpdData.Contacts__r.Name; |
| | | }else{ |
| | | insUpdData.name = insUpdData.Customer__r.Name+'_'+insUpdData.Create_Contacts__c; |
| | | }*/ |
| | | } |
| | | } |
| | | }else{//联系人和新建联系人不能都有值 |
| | | //判断新建联系人是否为空 |
| | | if(!String.isBlank(insUpdData.Create_Contacts__c)){ |
| | | flag = false; |
| | | this.insUpdData.Create_Contacts__c.addError('【联系人】和【联系人(新建)】不能同时都有值!'); |
| | | } |
| | | // if(insUpdData.Create_Contacts__c == null || String.isBlank(insUpdData.Create_Contacts__c)){ |
| | | // flag = false; |
| | | // this.insUpdData.Create_Contacts__c.addError('【联系人】和【联系人(新建)】不能同时为空!'); |
| | | // }else{//如果联系人为空,但是新建联系人不为空,那么新增一条联系人数据 |
| | | // if(flag){ |
| | | // String typeL = '';//类型 |
| | | // if(insUpdData.Address_Classification__c == '医院'){ |
| | | // typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Doctor').getRecordTypeId();//医師 |
| | | // }else if(insUpdData.Address_Classification__c == '经销商'){ |
| | | // typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId();//販売店 |
| | | // }else if(insUpdData.Address_Classification__c == '办事处'){ |
| | | // typeL = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Internal_staff').getRecordTypeId();//社内员工 |
| | | // } |
| | | // String surname = String.valueOf(insUpdData.Create_Contacts__c);//姓 |
| | | // String monicker = '';//名 |
| | | // if(surname.length() >= 2){ |
| | | // monicker = surname.substring(1,surname.length()); |
| | | // surname = surname.substring(0,1); |
| | | // } |
| | | // System.debug('newCon = '+newCon); |
| | | // addContact = new Contact(LastName = surname, |
| | | // FirstName = monicker, |
| | | // AccountId = insUpdData.Customer__c, |
| | | // RecordTypeId = typeL, |
| | | // AWS_Data_Id__c = newCon.AWS_Data_Id__c, |
| | | // LastName_Encrypted__c = newCon.LastName_Encrypted__c); |
| | | // try{ |
| | | // //新增一条联系人数据 |
| | | // insert addContact; |
| | | // sfRecordId = addContact.id; |
| | | // insUpdData.Create_Contacts__c = ''; |
| | | // }catch(Exception e){ |
| | | // //ApexPages.addMessages(e); |
| | | // Database.rollback(sp); |
| | | // //失败提示 |
| | | // System.debug('myException caught when save or submit: ' + e.getMessage() + e.getStackTraceString()); |
| | | // ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, e.getMessage())); |
| | | // isSearchBtn = false; |
| | | // return null; |
| | | // } |
| | | // insUpdData.Contacts__c = addContact.id; |
| | | // //name赋值 |
| | | // /*if(insUpdData.Contacts__c == null){ |
| | | // insUpdData.name = insUpdData.Customer__r.Name+'_'+insUpdData.Contacts__r.Name; |
| | | // }else{ |
| | | // insUpdData.name = insUpdData.Customer__r.Name+'_'+insUpdData.Create_Contacts__c; |
| | | // }*/ |
| | | // } |
| | | // } |
| | | } |
| | | // else{//联系人和新建联系人不能都有值 |
| | | // //判断新建联系人是否为空 |
| | | // if(!String.isBlank(insUpdData.Create_Contacts__c)){ |
| | | // flag = false; |
| | | // this.insUpdData.Create_Contacts__c.addError('【联系人】和【联系人(新建)】不能同时都有值!'); |
| | | // } |
| | | // } |
| | | //WLIG-CCX4BB 【委托】修理直返收货地址功能改造 thh 20220513 end |
| | | if(flag){ |
| | | try{ |
| | | //新增或修改数据 |
| | |
| | | } |
| | | //查询地址表数据 |
| | | private String makeTextAddressSql(String typeSearchId) { |
| | | String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,Telephone__c' |
| | | +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid,Detailed_Address_Encrypted__c,Telephone_Encrypted__c,ZipCode_Encrypted__c,Contacts__r.LastName_Encrypted__c' |
| | | // WLIG-CCX4BB 【委托】修理直返收货地址功能改造 thh 20220513 start |
| | | // String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,ContactName__c,Telephone__c,ContactName_Encrypted__c' //zhj 新方案改造 去除Encrypted__c 2022-12-05 |
| | | // +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid,Detailed_Address_Encrypted__c,Telephone_Encrypted__c,ZipCode_Encrypted__c,Contacts__r.LastName_Encrypted__c' |
| | | // + ' FROM Address__c where id != null'; |
| | | String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Customer__r.Type,Customer__r.RecordTypeId,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,ContactName__c,Telephone__c' //zhj 新方案改造 去除Encrypted__c 2022-12-05 |
| | | +',Province__c,Province__r.Name,City__c,City__r.name,Detailed_Address__c,Create_Contacts__c,ZipCode__c,CreatedByid' |
| | | + ' FROM Address__c where id != null'; |
| | | // WLIG-CCX4BB 【委托】修理直返收货地址功能改造 thh 20220513 end |
| | | //类型筛选 |
| | | if(!String.isBlank(typeText)){ |
| | | if('医院'.equals(typeText)){ |
| | |
| | | } |
| | | |
| | | @RemoteAction |
| | | public static string SaveEx(string repaire_json,string asset_json, string address_id){ |
| | | global static string SaveEx(string repaire_json,string asset_json, string address_id){ |
| | | return SaveExCore(repaire_json,asset_json,address_id); |
| | | } |
| | | |
| | |
| | | System.debug(e.getDmlMessage(index)); |
| | | System.debug(e.getDmlStatusCode(index)); |
| | | System.debug(e.getDmlType(index)); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | |
| | | System.debug('into catch'+e.getMessage()); |