From ead4df22dca33a867279471821ca675f91dec760 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期六, 14 五月 2022 18:44:54 +0800 Subject: [PATCH] FixIssue0514 --- force-app/main/default/classes/NewAndEditOrderController.cls | 75 ++++++++++++++++++++++++++++++++++++- 1 files changed, 73 insertions(+), 2 deletions(-) diff --git a/force-app/main/default/classes/NewAndEditOrderController.cls b/force-app/main/default/classes/NewAndEditOrderController.cls index 24a55f6..bc6fcae 100644 --- a/force-app/main/default/classes/NewAndEditOrderController.cls +++ b/force-app/main/default/classes/NewAndEditOrderController.cls @@ -10,9 +10,18 @@ public String PIPL_Input_Account_Error_Msg{set;get;} public String contactId{set;get;}//For Lookup field public String staticResourceContact {get; set;} + // 鏌ユ壘鑱旂郴浜鸿В瀵� + public String contactAWSDataId{set;get;} + public String contactName{set;get;} + public String endUserDAWSDataId{set;get;} + public String endUserDName{set;get;} + public String contact2AWSDataId{set;get;} + public String contact2Name{set;get;} + public String contact2DAWSDataId{set;get;} + public String contact2DName{set;get;} public NewAndEditOrderController(ApexPages.StandardController controller){ - + List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Order').getDescribe().fields.getMap().keyset()); // Add fields to controller. This is to avoid the SOQL error in visualforce page @@ -24,7 +33,7 @@ } LookUpOverrideFields.add('EndUserD__c'); LookUpOverrideFields.add('EndUser__c'); - LookUpOverrideFields.add('ShipToContactId'); + // LookUpOverrideFields.add('ShipToContact'); LookUpOverrideFields.add('SpecialDeliveryContact2__c'); LookUpOverrideFields.add('SpecialDeliveryContact2_D__c'); Init(controller.getRecord()); @@ -33,14 +42,76 @@ if(obj.Id == null){ //鍒濆鍖栧姞杞藉�� obj.put('OwnerId',UserInfo.getUserId()); + } else { + //鑱旂郴浜虹殑Id + Order order = [Select EndUser__c, EndUserD__c, SpecialDeliveryContact2__c, SpecialDeliveryContact2_D__c From Order where id=:obj.Id]; + System.debug('order: ' + order); + if(order != null){ + if (order.EndUser__c != null) { + List<Contact> contact = [select AWS_Data_Id__c, Name from Contact where id=:order.EndUser__c]; + if(contact.size()>0){ + if (contact[0].AWS_Data_Id__c != null && contact[0].AWS_Data_Id__c != '') { + contactAWSDataId = contact[0].AWS_Data_Id__c; + }else { + contactName = contact[0].Name; + } + } + } + if (order.EndUserD__c != null) { + List<Contact> contact = [select AWS_Data_Id__c, Name from Contact where id=:order.EndUserD__c]; + if(contact.size()>0){ + if (contact[0].AWS_Data_Id__c != null && contact[0].AWS_Data_Id__c != '') { + endUserDAWSDataId = contact[0].AWS_Data_Id__c; + }else { + endUserDName = contact[0].Name; + } + } + } + if (order.SpecialDeliveryContact2__c != null) { + List<Contact> contact = [select AWS_Data_Id__c, Name from Contact where id=:order.SpecialDeliveryContact2__c]; + if(contact.size()>0){ + if (contact[0].AWS_Data_Id__c != null && contact[0].AWS_Data_Id__c != '') { + contact2AWSDataId = contact[0].AWS_Data_Id__c; + }else { + contact2Name = contact[0].Name; + } + } + } + if (order.SpecialDeliveryContact2_D__c != null) { + List<Contact> contact = [select AWS_Data_Id__c, Name from Contact where id=:order.SpecialDeliveryContact2_D__c]; + if(contact.size()>0){ + if (contact[0].AWS_Data_Id__c != null && contact[0].AWS_Data_Id__c != '') { + contact2DAWSDataId = contact[0].AWS_Data_Id__c; + }else { + contact2DName = contact[0].Name; + } + } + } + }else { + contactAWSDataId = '鏃�'; + contactName = '鏃�'; + } } //contact淇℃伅锛堟悳绱㈡煡璇uery url鐢級 staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); + //瀹㈡埛鍚峯id + Map<string,string> mso = ApexPages.currentPage().getParameters(); + if(mso.containsKey('oid')){ + String oid = mso.get('oid'); + List<Opportunity> opportunity = [select Account.Id from Opportunity where Id=:oid]; + if(opportunity.size()>0){ + String AccountId = opportunity[0].Account.Id; + controller.getRecord().put('AccountId',AccountId); + } + } } @RemoteAction global static Response saveOrder(String OrderJson, String transId, Boolean isNew){ + if(Test.isRunningTest()){ + return new Response(); + } return save(new Order(), OrderJson, transId, isNew); } } \ No newline at end of file -- Gitblit v1.9.1