| | |
| | | public RepairPart__c repairPart{get;set;} |
| | | |
| | | private String SwoStatus; |
| | | public String staticResource { get; private set; }// 20220313 PI改造 by Chen Yanan |
| | | public String contactstaticResource { get; private set; }// 20220313 PI改造 by Chen Yanan |
| | | public String contactAWSDataId { get; private set; }// 20220313 PI改造 by Chen Yanan |
| | | public Boolean isNew { get; set; }// 20220313 PI改造 by Chen Yanan |
| | | //ASSIGNEDTO__c |
| | | public SWOController() { |
| | | |
| | | } |
| | | |
| | | public SWOController(ApexPages.StandardController stdController) { |
| | | isNew = true; |
| | | swoid = System.currentPageReference().getParameters().get('id'); |
| | | caseId = System.currentPageReference().getParameters().get('caseId'); |
| | | accId = System.currentPageReference().getParameters().get('accId'); |
| | | conId = System.currentPageReference().getParameters().get('conId'); |
| | | type = System.currentPageReference().getParameters().get('type'); |
| | | System.debug(caseId); |
| | | staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('SWO__c'));// 20220313 PI改造 by Chen Yanan |
| | | contactstaticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));// 20220313 PI改造 by Chen Yanan |
| | | } |
| | | |
| | | public void init() { |
| | | |
| | | lineCount = 0; |
| | | //获取初始URL |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | |
| | | User_FaultInfo__c ca = new User_FaultInfo__c(); |
| | | List<SWO__c> temp = new List<SWO__c>(); |
| | | if (caseId != null) { |
| | | ca = [select id, NUMBER__c,COMPANY__c,CONTACT__c,SUBJECT__c from User_FaultInfo__c where id = : caseId]; |
| | | // ca = [select id, NUMBER__c,COMPANY__c,CONTACT__c,SUBJECT__c from User_FaultInfo__c where id = : caseId]; |
| | | ca = [select id, NUMBER__c,COMPANY__c,CONTACT__c,SUBJECT__c, CONTACT__r.AWS_Data_Id__c, CONTACT__r.Name, CONTACT__r.Email from User_FaultInfo__c where id = : caseId];// 20220313 PI改造 by Chen Yanan |
| | | temp = [select id from SWO__c where CASE_NUMBER__c = :caseId]; |
| | | contactAWSDataId = String.isNotBlank(ca.CONTACT__r.AWS_Data_Id__c)?ca.CONTACT__r.AWS_Data_Id__c:''; |
| | | } |
| | | System.debug('ca' + ca.NUMBER__c); |
| | | System.debug('temp' + temp.size()); |
| | | if (swoid != null) { |
| | | isNew = false;// 20220313 PI改造 by Chen Yanan |
| | | //初始化SWO |
| | | Schema.DescribeSobjectResult d_swo = SWO__c.sObjectType.getDescribe(); |
| | | Map<String, Schema.SObjectField> d_swo_map = d_swo.fields.getMap(); |
| | |
| | | } |
| | | fields_odr += field; |
| | | } |
| | | soql_swo += fields_odr; |
| | | // soql_swo += fields_odr; |
| | | soql_swo += fields_odr + ', CONTACT__r.AWS_Data_Id__c, CONTACT__r.Name, CONTACT__r.Email ';// 20220313 PI改造 by Chen Yanan |
| | | soql_swo += ' from SWO__c where Id = \'' + swoid + '\''; |
| | | System.debug('soql_swo: ' + soql_swo);// 20220313 PI改造 by Chen Yanan |
| | | List<SWO__c> swoList = Database.query(soql_swo); |
| | | System.debug('swoList: ' + swoList);// 20220313 PI改造 by Chen Yanan |
| | | if (swoList.size() > 0) { |
| | | swo = swoList[0]; |
| | | contactAWSDataId = String.isNotBlank(swo.CONTACT__r.AWS_Data_Id__c)?swo.CONTACT__r.AWS_Data_Id__c:''; |
| | | } |
| | | //初始化记录SWO 原始ASSIGNED TO,保存时判断用户是否变更,如果变更给用户发送邮件 |
| | | assignedUser = swo.ASSIGNEDTO__c; |
| | |
| | | swo.CONTACT__c = conId; |
| | | } |
| | | swo.SWO_STATUS__c = 'Not Started'; |
| | | System.debug('SWO: ' + swo); |
| | | } |
| | | SwoStatus = swo.SWO_STATUS__c; |
| | | } |
| | |
| | | // SWOSTATUS_Closed_AddAttachment();//SWOSTATUS_Closed_AddAttachment |
| | | // } |
| | | } |
| | | System.debug('swo save:' + swo); // Update By Yanan |
| | | if (swoid == null) { |
| | | swo.CASE_NUMBER__c = caseId; |
| | | insert swo; |