| | |
| | | public String tableDataStr{ get; set; } |
| | | public String staticResource {get; set;} |
| | | public String staticResourceContact {get; set;} |
| | | public String staticResourceRepair {get; set;} |
| | | public Contact newCon{get; set;} |
| | | |
| | | /***************底部 编辑和新增的 对象*******************/ |
| | |
| | | public String contactNameValue{set;get;} |
| | | public String contactIdValue{set;get;} |
| | | public String addressDataIds{set;get;} |
| | | public String sfRecordId{set;get;} |
| | | // Add by Li Jun for PIPL 20220308 End |
| | | |
| | | public String accRecordTypeId {set;get;}//当前 记录类型id |
| | | |
| | | public String accOfficeTypeId {set;get;}//记录类型id 办事处 |
| | | public String accAgencyTypeId {set;get;}//记录类型id 販売店 |
| | | public String accAgencyContactTypeId {set;get;}//记录类型id 经销商联系人 |
| | | |
| | | public StraightBackAddressController() { |
| | | //获取url数据 |
| | |
| | | |
| | | staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Address__c')); |
| | | staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); |
| | | staticResourceRepair = JSON.serialize(PIHelper.getPIIntegrationInfo('Repair__c')); |
| | | } |
| | | |
| | | /** |
| | | * 开始方法 |
| | | */ |
| | | public PageReference init(){ |
| | | accOfficeTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Office').getRecordTypeId(); |
| | | accAgencyTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | accAgencyContactTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('AgencyContact').getRecordTypeId(); |
| | | String RepairSql = makeTextRepairSql(RepairId); |
| | | try{ |
| | | pc = Database.query(RepairSql); |
| | |
| | | newCon = new Contact(); |
| | | return null; |
| | | } |
| | | |
| | | //查询客户记录类型 |
| | | public PageReference queryRecordType(){ |
| | | if(insUpdData.Customer__c!=null){ |
| | | String accid = insUpdData.Customer__c; |
| | | Account acc = [SELECT id,name,RecordTypeId FROM Account WHERE id =: accid]; |
| | | System.debug('acc---'+acc); |
| | | System.debug('insUpdData---'+insUpdData); |
| | | if(acc!=null&&acc.RecordTypeId!=null&&insUpdData.Customer__c!=null){ |
| | | accRecordTypeId = acc.RecordTypeId; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | //编辑获取数据 |
| | | public PageReference onEditor(){ |
| | | if(!String.isBlank(UpdId)){ |
| | |
| | | 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); |
| | | 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); |
| | |
| | | try{ |
| | | //新增或修改数据 |
| | | upsert insUpdData; |
| | | |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存成功!')); |
| | | isSearchBtn = true; |
| | | //保存成功,需要初始化一下此对象,防止再次点击此按钮保存一个条同样的数据 |
| | |
| | | |
| | | //查询修理表数据 |
| | | private String makeTextRepairSql(String uuid){ |
| | | String RepairSql = 'SELECT ID,NAME,HP_ID__c,HP_Name__c,Delivered_Product__c,FSE_ApplyForRepair_time__c,SAP_Transfer_time__c,Dealer__c,Dealer__r.Name,Returns_Product_way__c,Address_Type_Index__c FROM Repair__c where id = \''+RepairId+'\''; |
| | | String RepairSql = 'SELECT ID,NAME,HP_ID__c,HP_Name__c,Delivered_Product__c,FSE_ApplyForRepair_time__c,SAP_Transfer_time__c,Dealer__c,Dealer__r.Name,Returns_Product_way__c,Address_Type_Index__c,AWS_Data_Id__c FROM Repair__c where id = \''+RepairId+'\''; |
| | | return RepairSql; |
| | | } |
| | | //查询地址表数据 |
| | | private String makeTextAddressSql(String typeSearchId) { |
| | | String AddressSql = 'SELECT AWS_Data_Id__c,ID,Address_Classification__c,Customer__c,Customer__r.Name,Contacts__c,Contacts__r.Name,Contacts__r.AWS_Data_Id__c,Telephone__c' |
| | | 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' |
| | | + ' FROM Address__c where id != null'; |
| | | //类型筛选 |
| | |
| | | class AddressData { |
| | | //数据 |
| | | public Address__c address { get; set; } |
| | | |
| | | public string addressJson { get{ |
| | | if (address == null) { |
| | | return null; |
| | | } |
| | | return JSON.serialize(address); |
| | | } } |
| | | |
| | | //编辑按钮是否展示 |
| | | public String canEdit { get; private set; } |
| | | //编辑按钮是否展示 |