Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG
| | |
| | | <aura:attribute name="temp_aws_id" type="String"/> |
| | | <aura:attribute name="staticResource" type="Map"/> |
| | | |
| | | |
| | | <ltng:require scripts="{! $Resource.jquery183minjs }" /> |
| | | <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" afterScriptsLoaded="{!c.scriptsLoaded}" /> |
| | | <aura:renderIf isTrue="{!v.login}"> |
| | | <div class="slds-spinner_container height100vh"> |
| | |
| | | <aura:attribute name="allselectlistAgencyPerson" type="Map"/> |
| | | <!-- PIPL update Yin Mingjie 21/02/2022 end --> |
| | | <!-- 批量添加周报 end--> |
| | | |
| | | <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" /> |
| | | <ltng:require scripts="{! $Resource.jquery183minjs }" /> |
| | | |
| | | <!--ロード中...--> |
| | | <aura:renderIf isTrue="{!v.login}"> |
| | |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span> |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <!-- PIPL update Yin Mingjie 21/02/2022 start |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__r}</span> |
| | | PIPL update Yin Mingjie 21/02/2022 end--> |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.Agency_Contact__c}</span> |
| | | |
| | | </th> |
| | | <th class="table_header slds-text-title--caps"> |
| | | <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span> |
| | |
| | | component.find('save_button').set('v.disabled', true); |
| | | |
| | | var Report_Date__c = component.get('v.data.Report_Date__c'); |
| | | alert('Report_Date__c'+Report_Date__c); |
| | | // alert('Report_Date__c'+Report_Date__c); |
| | | var Person_In_Charge2__c = ""; |
| | | var Submit_date__c = ""; |
| | | if (component.get('v.mode') == 'edit') { |
| | | // 周 Submit_date__c |
| | | Submit_date__c = component.get('v.select_report_data').Submit_date__c; |
| | | alert('Submit_date__c'+Submit_date__c); |
| | | // alert('Submit_date__c'+Submit_date__c); |
| | | |
| | | |
| | | // 担当 Person_In_Charge2__c |
| | |
| | | } else { |
| | | // 周 Submit_date__c |
| | | Submit_date__c = this.get_date_string(component.find('select_date').get('v.value')); |
| | | alert('Submit_date__c'+Submit_date__c); |
| | | // alert('Submit_date__c'+Submit_date__c); |
| | | |
| | | // 担当 Person_In_Charge2__c |
| | | Person_In_Charge2__c = component.find('select_agency_person').get('v.value'); |
| | |
| | | if (!Department_Cateogy__c) { error.push("科室 不存在"); } |
| | | if (!doctor2__c) { error.push("拜访人 不存在"); } |
| | | if (!Purpose_Type__c) { error.push("活动区分 不存在"); } |
| | | if (!SupportNeeds__c) { error.push("支援需求 不存在"); } |
| | | // if (!SupportNeeds__c) { error.push("支援需求 不存在"); } |
| | | if (!Opportunity__c) { Opportunity__c = ""; } |
| | | if (!Product_Category1__c) { error.push("产品区分1 不存在"); } |
| | | if (Purpose_Type__c && (Purpose_Type__c.substr(-3) == 'SIS' || Purpose_Type__c.substr(-3) == 'OPD')) { |
| | |
| | | if (component.get('v.mode') == 'edit') { |
| | | var Agency_Report__c = component.get('v.select_report_data').Id; |
| | | var action = component.get('c.editAgencyReport'); |
| | | alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c); |
| | | debugger |
| | | // alert("Purpose_Type:"+Purpose_Type__c+","+"SupportNeedsc:"+SupportNeeds__c); |
| | | action.setParams({ |
| | | "Agency_Report_Id" : Agency_Report__c, |
| | | "Department_Cateogy" : Department_Cateogy__c, |
| | |
| | | /* Save (New & Copy) */ |
| | | |
| | | var action = component.get('c.saveAgencyReport'); |
| | | debugger; |
| | | // alert(SupportNeeds__c); |
| | | action.setParams({ |
| | | "Department_Cateogy" : Department_Cateogy__c, |
| | | "Purpose_Type" : Purpose_Type__c, |
| | |
| | | searchHos : function(component, event, helper) { |
| | | var hospital_name = event.getParam("value"); |
| | | var action = component.get("c.getHospitalList"); |
| | | debugger; |
| | | action.setParams({"hospital_name": hospital_name}); |
| | | |
| | | action.setCallback(this, function(response) { |
| | |
| | | }, |
| | | |
| | | selectHos : function(component, event, helper) { |
| | | debugger |
| | | var hospital_list = component.find('hospital_list'); |
| | | $A.util.removeClass(hospital_list, 'slds-is-open'); |
| | | var accname = event.currentTarget.dataset.accname; |
| | |
| | | }, |
| | | |
| | | insert_agencycontact : function(component,token,newUrl,payload,agencyHospitalid,helper) { |
| | | |
| | | AWSService.insert(newUrl,payload,function(result){ |
| | | if(result.status == '0'){ |
| | | $A.getCallback(function(){ |
| | | helper.to_agencycontact(component,result,agencyHospitalid); |
| | | })(); |
| | | |
| | | }else{ |
| | | console.log('AWS status error:' + result) |
| | | component.set('v.login',false); |
| | | component.find('OppMessage').setError('AWS insert error.'); |
| | | } |
| | | },token); |
| | | /* |
| | | fetch(newUrl, { |
| | | method: 'POST', |
| | | body: payload, |
| | |
| | | console.log('AWS insert error:' + error) |
| | | component.set('v.login',false); |
| | | component.find('OppMessage').setError('AWS insert error.'); |
| | | }); |
| | | });*/ |
| | | |
| | | }, |
| | | |
| | |
| | | for (const key in retMap) { |
| | | if (key == 'sre') {continue;} |
| | | dataArr.push(key); |
| | | } |
| | | if(dataArr.length == 0){ |
| | | component.set('v.login',false); |
| | | this.warning('没有找到符合条件的客户人员'); |
| | | return; |
| | | } |
| | | let obj= Object.create(null); |
| | | obj['dataIds'] = dataArr; |
| | |
| | | component.set('v.login',true); |
| | | var action = component.get("c.processData"); |
| | | var selectDate = component.find('select_date').get('v.value'); |
| | | var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic fields |
| | | var fieldsList=['Name','Phone','AccountNumber']; //Please write your code dynamic |
| | | var sss=component.get("v.fileContentData"); |
| | | action.setParams({ |
| | | fileData : component.get("v.fileContentData"), |
| | | //selectDateselectDate :component.find('select_date').get('v.value'), |
| | |
| | | } |
| | | columnDivider = ','; |
| | | lineDivider = '\n'; |
| | | keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c']; |
| | | thkeys = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果'] |
| | | //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c','SupportNeeds__c']; |
| | | thkeys = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果','支援需求'] |
| | | csvStringResult = ''; |
| | | csvStringResult += thkeys.join(columnDivider); |
| | | csvStringResult += lineDivider; |
| | |
| | | csvStringResult += '"'+ objectRecords[i].Product_Category2__r.Name+'"'; |
| | | }else if(skey == 'Product_Category3__c'){ |
| | | csvStringResult += '"'+ objectRecords[i].Product_Category3__r.Name+'"'; |
| | | }else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | csvStringResult += '"'+ objectRecords[i].SupportNeeds__c+'"'; |
| | | }else{ |
| | | csvStringResult += '"'+ objectRecords[i][skey]+'"'; |
| | | } |
| | |
| | | return csvStringResult; |
| | | }, |
| | | showExportDate : function(component,objectRecords){ |
| | | console.log('进入showexceportdate'+objectRecords); |
| | | var keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c']; |
| | | var headers = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果'] |
| | | console.log('进入showexceportdate'+objectRecords);//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | var keys = ['Submit_date__c','Person_In_Charge2__c','Report_Date__c','Agency_Hospital__c','Department_Cateogy__c','doctor2__c','visitor_title__c','Product_Category1__c','Product_Category2__c','Product_Category3__c','Purpose_Type__c','Result__c','SupportNeeds__c']; |
| | | var headers = ['周','担当','活动日','医院','科室','拜访人','职位','产品区分1','产品区分2','产品区分3','活动区分','结果','支援需求'] |
| | | var content = "<table class=\"table slds-table slds-table--bordered slds-table--cell-buffer\">"; |
| | | content += "<thead><tr class=\"slds-text-title--caps\">"; |
| | | for(i=0;i<headers.length; i++){ |
| | |
| | | content += '<td>'+ objectRecords[i].Product_Category2__r.Name+'</td>'; |
| | | }else if(skey == 'Product_Category3__c'){ |
| | | content += '<td>'+ objectRecords[i].Product_Category3__r.Name+'</td>'; |
| | | }else if(skey == 'SupportNeeds__c'){//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | content += '<td>'+ objectRecords[i].SupportNeeds__c+'</td>'; |
| | | }else{ |
| | | content += '<td>'+ objectRecords[i][skey]+'</td>'; |
| | | } |
| | |
| | | var res = response.getReturnValue(); |
| | | console.log('输入的开始日期3'+res); |
| | | component.set('v.login',false); |
| | | this.showExportDate(component,res); |
| | | |
| | | // PI 改造 By Bright 20220328 |
| | | if(true){ |
| | | let awsids = []; |
| | | for (let ri in res) { |
| | | if(res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c){ |
| | | awsids.push(res[ri].doctor2__r.AWS_Data_Id__c); |
| | | } |
| | | } |
| | | if(awsids.length > 0){ |
| | | let awsurl = component.get('v.awsurl'); |
| | | |
| | | AWSService.search(awsurl.searchUrl,{ |
| | | dataIds:awsids |
| | | }, function(data){ |
| | | if(data && data.object && data.object.length){ |
| | | let m = {}; |
| | | for(let di in data.object){ |
| | | if(data.object[di] && data.object[di].dataId){ |
| | | m[data.object[di].dataId] = data.object[di]; |
| | | } |
| | | } |
| | | |
| | | for(let ri in res){ |
| | | if(res[ri] && res[ri].doctor2__r && res[ri].doctor2__r.AWS_Data_Id__c && m.hasOwnProperty(res[ri].doctor2__r.AWS_Data_Id__c)){ |
| | | res[ri].doctor2__r.Name = m[res[ri].doctor2__r.AWS_Data_Id__c].name; |
| | | res[ri].visitor_title__c = m[res[ri].doctor2__r.AWS_Data_Id__c].doctorDivision1; |
| | | |
| | | } |
| | | } |
| | | } |
| | | helper.showExportDate(component, res); |
| | | |
| | | component.set('v.login', false); |
| | | }, awsurl.token); |
| | | }else{ |
| | | helper.showExportDate(component, res); |
| | | } |
| | | } |
| | | |
| | | |
| | | component.set('v.reports_date', res); |
| | | |
| | | }else{ |
| | |
| | | // var data = this.search(searchUrl,data,token); |
| | | // return data;searchUrl,requestSearchPayload,token |
| | | // }, |
| | | |
| | | }) |
| | |
| | | * |
| | | * */ |
| | | public without sharing class AWSServiceTool { |
| | | public static List<Contact> getNoPIContact(String searchContactName,String accountId){ |
| | | if(searchContactName!='' || accountId!=''){ |
| | | String noPISQL = 'select Id,Name,Email,Phone,Account.Name from Contact where Account_Record_Type_DeveloperName__c in('+'\'Agency\''+','+'\'Office\''+',\'AgencyContact\''+')'; |
| | | if(String.isNotEmpty(accountId)){ |
| | | noPISQL += ' and AccountId=\''+accountId+'\''; |
| | | } |
| | | if(String.isNotEmpty(searchContactName)){ |
| | | noPISQL += ' and Name like \'%'+searchContactName+'%\''; |
| | | } |
| | | system.debug('noPISQL = ' + noPISQL); |
| | | List<Contact> partnerContactList = Database.query(noPISQL); |
| | | return partnerContactList; |
| | | } |
| | | return new List<Contact>(); |
| | | } |
| | | public static String getAWSToken(){ |
| | | AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt WHERE DeveloperName = 'AWS_Default_Configuration']; |
| | | if (awsConfiguration == null) { |
| | |
| | | public with sharing class BatchSelectRepairPageController { |
| | | public List<RetrievalData> RevalInfoList { get; set; } |
| | | public RetrievalData RevalInfo { get; set; } |
| | | public List<RepairData> RAInfoList { get; set; } |
| | | public List<Repair__c> RepairList { get; set; } |
| | | public List<String> repairIdList{ get; set; } |
| | |
| | | } |
| | | |
| | | public void init(){ |
| | | RetrievalData reval = new RetrievalData(); |
| | | RevalInfoList = new List<RetrievalData>(); |
| | | RevalInfoList.add(reval); |
| | | RevalInfo = new RetrievalData(); |
| | | } |
| | | |
| | | public List<SelectOption> getStatusItems() { |
| | | List<SelectOption> options = new List<SelectOption>(); |
| | | options.add(new SelectOption('','--无--')); |
| | | options.add(new SelectOption('草案中','草案中')); |
| | | options.add(new SelectOption('1.受理完毕','1.受理完毕')); |
| | | options.add(new SelectOption('2.维修报价阶段','2.维修报价阶段')); |
| | | options.add(new SelectOption('3.维修阶段','3.维修阶段')); |
| | | options.add(new SelectOption('4.修理品返送阶段','4.修理品返送阶段')); |
| | | options.add(new SelectOption('5.完毕','5.完毕')); |
| | | options.add(new SelectOption('0.取消','0.取消')); |
| | | options.add(new SelectOption('0.删除','0.删除')); |
| | | options.add(new SelectOption('0.申请完毕','0.申请完毕')); |
| | | return options; |
| | | } |
| | | |
| | | public List<SelectOption> getSiteRepairItems() { |
| | | List<SelectOption> options = new List<SelectOption>(); |
| | | options.add(new SelectOption('','--无--')); |
| | | options.add(new SelectOption('RC修理','RC修理')); |
| | | options.add(new SelectOption('直送SORC修理','直送SORC修理')); |
| | | options.add(new SelectOption('直送OGZ修理','直送OGZ修理')); |
| | | options.add(new SelectOption('办事处修理','办事处修理')); |
| | | options.add(new SelectOption('现场修理','现场修理')); |
| | | return options; |
| | | } |
| | | |
| | | public PageReference RetrievalBtn() { |
| | | RepairList = new List<Repair__c>(); |
| | | RAInfoList = new List<RepairData>(); |
| | | String sql; |
| | | System.debug('RevalInfoList1:' + RevalInfoList); |
| | | for(RetrievalData reval : RevalInfoList){ |
| | | if(String.isBlank(reval.Status2) && String.isBlank(reval.RepairName) && String.isBlank(reval.SAPRepairNo) |
| | | && String.isBlank(reval.SerialNumber) && String.isBlank(reval.repair.Incharge_Staff__c) |
| | | && String.isBlank(String.valueOf(reval.repair.Final_complete_day__c))){ |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请至少添加一个检索条件!')); |
| | | return null; |
| | | } |
| | | sql += 'select Id, Name, SAP_Service_Repair_No__c, Status1__c, Status2__c, Delivered_Product__c, SerialNumber__c, '; |
| | | sql += 'HP_Name__c, State_Hospital__c, Incharge_Staff__c, FSE_ApplyForRepair_Day__c, work_location_select__c, On_site_repair__c,'; |
| | | sql += 'Number_of_EffectiveContract__c, NewProductGuaranteeObject__c from Repair__c where Id != null '; |
| | | if(String.isNotBlank(reval.Status2)){ |
| | | sql += ' and Status2__c like \'%' + reval.Status2 + '%\' '; |
| | | } |
| | | if(String.isNotBlank(reval.RepairName)){ |
| | | sql += ' and Name like \'%' + reval.RepairName + '%\' '; |
| | | } |
| | | if(String.isNotBlank(reval.SAPRepairNo)){ |
| | | sql += ' and SAP_Service_Repair_No__c like \'%' + reval.SAPRepairNo + '%\' '; |
| | | } |
| | | if(String.isNotBlank(reval.SerialNumber)){ |
| | | sql += ' and SerialNumber__c like \'%' + reval.SerialNumber + '%\' '; |
| | | } |
| | | if(String.isNotBlank(reval.repair.Incharge_Staff__c)){ |
| | | sql += ' and Incharge_Staff__c = \'' + reval.repair.Incharge_Staff__c + '\' '; |
| | | } |
| | | if(String.isNotBlank(String.valueof(reval.repair.Final_complete_day__c))){ |
| | | String day = String.valueof(reval.repair.Final_complete_day__c); |
| | | day = day.substring(0,10); |
| | | sql += ' and FSE_ApplyForRepair_Day__c = ' + day; |
| | | } |
| | | sql += ' limit 200'; |
| | | sql = sql.substring(4); |
| | | if(String.isBlank(RevalInfo.Status1) && String.isBlank(RevalInfo.RepairName) && String.isBlank(RevalInfo.SAPRepairNo) |
| | | && String.isBlank(RevalInfo.SerialNumber) && String.isBlank(RevalInfo.repair.Incharge_Staff__c) && String.isBlank(RevalInfo.onSiteRepair) |
| | | && String.isBlank(String.valueOf(RevalInfo.repair.Aware_date__c)) && String.isBlank(RevalInfo.workLocationSelect)){ |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请至少添加一个检索条件!')); |
| | | return null; |
| | | } |
| | | String sql = 'select Id, Name, SAP_Service_Repair_No__c, Status1__c, Status2__c, Delivered_Product__c, SerialNumber__c, '; |
| | | sql += 'HP_Name__c, State_Hospital__c, Incharge_Staff__c, FSE_ApplyForRepair_Day__c, work_location_select__c, On_site_repair__c,'; |
| | | sql += 'Number_of_EffectiveContract__c, NewProductGuaranteeObject__c from Repair__c where Id != null '; |
| | | if(String.isNotBlank(RevalInfo.Status1)){ |
| | | sql += ' and Status1__c = \'' + RevalInfo.Status1 + '\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.RepairName)){ |
| | | sql += ' and Name like \'%' + RevalInfo.RepairName + '%\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.SAPRepairNo)){ |
| | | sql += ' and SAP_Service_Repair_No__c like \'%' + RevalInfo.SAPRepairNo + '%\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.SerialNumber)){ |
| | | sql += ' and SerialNumber__c like \'%' + RevalInfo.SerialNumber + '%\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.repair.Incharge_Staff__c)){ |
| | | sql += ' and Incharge_Staff__c = \'' + RevalInfo.repair.Incharge_Staff__c + '\''; |
| | | } |
| | | if(String.isNotBlank(String.valueof(RevalInfo.repair.Aware_date__c))){ |
| | | String day = String.valueof(RevalInfo.repair.Aware_date__c); |
| | | day = day.substring(0,10); |
| | | sql += ' and FSE_ApplyForRepair_Day__c = ' + day; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.onSiteRepair)){ |
| | | sql += ' and On_site_repair__c = \'' + RevalInfo.onSiteRepair + '\''; |
| | | } |
| | | if(String.isNotBlank(RevalInfo.workLocationSelect)){ |
| | | sql += ' and work_location_select__c like \'%' + RevalInfo.workLocationSelect + '%\''; |
| | | } |
| | | sql += ' limit 200'; |
| | | System.debug('sql1:' + sql); |
| | | if(String.isNotBlank(sql)){ |
| | | RepairList = Database.query(sql); |
| | | } |
| | | if(RepairList.size() >= 200 ){ |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '检索数据太多,请缩小检索范围')); |
| | | return null; |
| | | if(RepairList.size() == 200){ |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '检索数据太多,请缩小检索范围!')); |
| | | } |
| | | if(RepairList.size() <= 0 ){ |
| | | if(RepairList.size() <= 0){ |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没检索到任何修理')); |
| | | return null; |
| | | } |
| | |
| | | repairIdList = new List<String>(); |
| | | RepairList = new List<Repair__c>(); |
| | | String url = '='; |
| | | if(RAInfoList == null){ |
| | | System.debug('RAInfoList:' + RAInfoList); |
| | | if(RAInfoList == null || RAInfoList.isEmpty()){ |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请先检索修理')); |
| | | return null; |
| | | } |
| | |
| | | pageRef.setRedirect(true); |
| | | return pageRef; |
| | | } else{ |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '多单打印最大数量为50,请选择少于50个修理!')); |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '多单打印最大数量为50,请选择少于50个修理!')); |
| | | return null; |
| | | } |
| | | } else{ |
| | |
| | | public static PageReference generateAttachment(List<Repair__c> repList){ |
| | | PageReference pdfPage; |
| | | List<Attachment> attachments = new List<Attachment>(); |
| | | List<String> attachmentNameList = new List<String>(); |
| | | List<Attachment> isGeneratedPDFList = new List<Attachment>(); |
| | | //删除已存在的附件,生成新的附件 |
| | | for(Repair__c re : repList){ |
| | | attachmentNameList.add(re.name + '_' + 'MaintenanceCommission.pdf'); |
| | | } |
| | | isGeneratedPDFList = [select id from Attachment where name IN:attachmentNameList]; |
| | | if(isGeneratedPDFList.size() > 0){ |
| | | delete isGeneratedPDFList; |
| | | } |
| | | for(Repair__c re : repList){ |
| | | pdfPage = new PageReference('/apex/MaintenanceCommissionPDF?id=' + re.Id); |
| | | Blob pdfBody; |
| | |
| | | } |
| | | |
| | | public class RetrievalData { |
| | | public String Status2{ get; set; } |
| | | public String Status1{ get; set; } |
| | | public String RepairName{ get; set; } |
| | | public String SAPRepairNo{ get; set; } |
| | | public String SerialNumber{ get; set; } |
| | | // public String FSE_ApplyForRepair_Day{ get; set; } |
| | | // public String InchargeStaffName{ get; set; } |
| | | public String onSiteRepair{ get; set; } |
| | | public String workLocationSelect{ get; set; } |
| | | public Repair__c repair{ get; set; } |
| | | public RetrievalData(){ |
| | | repair = new Repair__c(); |
| | |
| | | system.debug('Account Id from Front-end:'+accountId); |
| | | PIHelper.PIIntegration contactPIIntegration = PIHelper.getPIIntegrationInfo('Contact'); |
| | | if(String.isNotBlank(accountId) && String.isNotEmpty(accountId)){ |
| | | conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='' limit :contactPIIntegration.maxQueryNumber]); |
| | | conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='' order by lastmodifieddate desc limit :contactPIIntegration.maxQueryNumber]); |
| | | } |
| | | //2. Prepare the Contact Info |
| | | Map<String,Contact> awsIdToContactMap = new Map<String,Contact>(); |
| | |
| | | |
| | | system.debug('=====searchStr:' + searchStr); |
| | | |
| | | searchStr += 'limit 500'; |
| | | searchStr += ' order by lastmodifieddate desc limit 500'; |
| | | |
| | | List<Contact> searchResult = Database.query(searchStr); |
| | | |
| | |
| | | private String saveType{get;set;} |
| | | public String staticResource {get; set;} |
| | | public String rowListString{set;get;} |
| | | public String EditAWSDataId{set;get;} |
| | | |
| | | public ConsumTrialController(ApexPages.StandardController stdController) { |
| | | parId = System.currentPageReference().getParameters().get('Id'); |
| | |
| | | else if (rnList[0].Status__c == '取消') { |
| | | throw new ControllerUtil.myException('取消的耗材申请书不能保存'); |
| | | } |
| | | system.debug('耗材备品明细加密信息:'+JSON.serialize(pageB.rowBList)); |
| | | List<Consum_Apply_Equipment_Set_Detail__c> rndList = new List<Consum_Apply_Equipment_Set_Detail__c>(); |
| | | for (RowBean rowB : pageB.rowBList) { |
| | | if (rowB.checked) { |
| | | rowB.rnd.InputCheck__c = true; |
| | | //rowB.rnd.AWS_Data_Id__c = EditAWSDataId; |
| | | System.debug('zhj rowB.rnd.AWS_Data_Id__c = '+ rowB.rnd.AWS_Data_Id__c); |
| | | rndList.add(rowB.rnd); |
| | | } |
| | | } |
| | |
| | | public String errorMsg { get; set; } // 错误信息 |
| | | |
| | | public string staticResource { get; private set; } |
| | | public string staticResourceCon { get; private set; } |
| | | public string staticResourceFile { get; private set; } |
| | | public string BRSrc{get;private set;} |
| | | public string QRSrc{get;private set;} |
| | | |
| | |
| | | } |
| | | pdfPageList = new List<PdfPageClass>(); |
| | | staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Consum_Apply_Equipment_Set_Detail__c')); |
| | | staticResourceCon = JSON.serialize(PIHelper.getPIIntegrationInfo('Consum_Apply__c')); |
| | | staticResourceFile = JSON.serialize(PIHelper.getPIIntegrationInfo('Document')); |
| | | } |
| | | |
| | | /** |
| | |
| | | , Post_Code__c // 邮编 |
| | | , Loaner_received_staff__c // 接收人姓名 |
| | | , Loaner_received_staff_phone__c // 接收人电话 |
| | | ,AWS_Data_Id__c |
| | | FROM Consum_Apply__c |
| | | WHERE Id = :targetConsumApplyId |
| | | ]; |
| | |
| | | } |
| | | protected override void beforeInsert() { |
| | | mobileNumberVerification(); |
| | | sendToComPlat(); |
| | | } |
| | | |
| | | protected override void afterInsert() { |
| | | syncToAgencyContact(); |
| | | updateDealerNum(); |
| | | sendToComPlat(); |
| | | } |
| | | |
| | | protected override void afterUpdate() { |
| | | syncToAgencyContact(); |
| | | updateDealerNum(); |
| | | sendToComPlat(); |
| | | |
| | | } |
| | | |
| | | protected override void beforeUpdate() { |
| | | // 服务技师 2018/12/24 Start |
| | | UpdateProcessingWork(); |
| | | // 服务技师 2018/12/24 end |
| | | mobileNumberVerification(); |
| | | sendToComPlat(); |
| | | } |
| | | |
| | | |
| | |
| | | //更新经销商用户人数字段 精琢技术 pk 2021-08-26 end |
| | | |
| | | // 手机号去重及规则验证 及新增客户人员重名验证 |
| | | public void mobileNumberVerification(){ |
| | | public void mobileNumberVerification(){ |
| | | |
| | | Pattern pattern = Pattern.compile('^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$'); |
| | | Map<String, Map<String,Contact>> accountContactMap = new Map<String, Map<String,Contact>>(); |
| | | Set<Id> accountIdSet = new Set<Id>(); |
| | | //用户对象上找对应的联系人 |
| | | List<User> userList=[select ID,ContactID from User where ContactID != null]; |
| | | Map<String,User> userMap= new Map<String,User>(); |
| | | if (userList.size()>0){ |
| | | for(User us1: userList){ |
| | | userMap.put(us1.ContactId, us1); |
| | | } |
| | | } |
| | | // List<User> userList=[select ID,ContactID from User where ContactID != null]; |
| | | // Map<String,User> userMap= new Map<String,User>(); |
| | | // if (userList.size()>0){ |
| | | // for(User us1: userList){ |
| | | // userMap.put(us1.ContactId, us1); |
| | | // } |
| | | // } |
| | | //查找联系人对象上对应的有效客户;医院直接使用有效/无效字段、经销商使用有效/无效公式字段 |
| | | List<String> accIdList = new List<String>(); |
| | | Map<String,String> accMap= new Map<String,String>(); |
| | |
| | | } |
| | | } |
| | | } |
| | | for (Contact contactnew: newList) { |
| | | // 手机号 有值 并且 联系人有效 联系人的客户有效 无外部关联用户 进行手机号码验证 |
| | | if (String.isNotBlank(contactnew.MobilePhone) && ('有效'.equals(contactnew.Isactive__c) ||'有効'.equals(contactnew.Isactive__c)) |
| | | && '有効'.equals(accMap.get(contactnew.AccountId)) |
| | | && !userMap.containsKey(contactnew.Id) |
| | | ) { |
| | | Matcher isMobilePhone = pattern.matcher(contactnew.MobilePhone); |
| | | if (isMobilePhone.matches()) { |
| | | // 将手机号 赋值给 手机号唯一字段 |
| | | contactnew.UniqueNumber__c = contactnew.MobilePhone; |
| | | } else { |
| | | // 手机号唯一字段清空 |
| | | contactnew.UniqueNumber__c = null; |
| | | } |
| | | } else { |
| | | // 手机号 无值 或者 联系人不是有效 手机号唯一字段清空 |
| | | contactnew.UniqueNumber__c = null; |
| | | //手机号唯一校验-医院下新建客户人员校验使用加密手机号,经销商使用普通手机号 thh 20220328 start |
| | | ID recordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByDeveloperName().get('Agency').getRecordTypeId(); |
| | | for (Contact contactnew : newList) { |
| | | // 手机号有值并且联系人有效,联系人的客户有效,进行手机号码验证 |
| | | if (('有效'.equals(contactnew.Isactive__c) || '有効'.equals(contactnew.Isactive__c)) |
| | | && ('有効'.equals(accMap.get(contactnew.AccountId)) || '有效'.equals(accMap.get(contactnew.AccountId)))) { |
| | | if(contactnew.RecordTypeId.equals(recordTypeId)){ |
| | | if(String.isNotBlank(contactnew.MobilePhone)){ |
| | | Matcher isMobilePhone = pattern.matcher(contactnew.MobilePhone); |
| | | if (isMobilePhone.matches()) { |
| | | contactnew.UniqueNumber__c = contactnew.MobilePhone; |
| | | } else { |
| | | // 手机号唯一字段清空 |
| | | contactnew.UniqueNumber__c = null; |
| | | } |
| | | } else { |
| | | contactnew.UniqueNumber__c = null; |
| | | } |
| | | } else{ |
| | | if(String.isNotBlank(contactnew.MobilePhone_Encrypted__c)){ |
| | | contactnew.UniqueNumber__c = contactnew.MobilePhone_Encrypted__c; |
| | | } else { |
| | | contactnew.UniqueNumber__c = null; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if (Trigger.isInsert) { |
| | | accountIdSet.add(contactnew.AccountId); |
| | | |
| | | accountIdSet.add(contactnew.AccountId); |
| | | } |
| | | } |
| | | //手机号唯一校验-医院下新建客户人员校验使用加密手机号,经销商使用普通手机号 thh 20220328 end |
| | | // 新增联系人时, |
| | | if (accountIdSet.size() > 0) { |
| | | List<Contact> contactList = [SELECT Id,AccountId,FullName__c,LastName,FirstName,Account.Name,CManageCode__c,IsFromSPO__c, |
| | |
| | | String firstNameStr = String.isNotBlank(contact.FirstName) ? contact.FirstName:''; |
| | | String contactFullName = lastNameStr + firstNameStr; |
| | | contactFullName = contact.LastName_Encrypted__c;// 20220314 PI改造 by Bright |
| | | if(string.isBlank(contactFullName)){ |
| | | continue; |
| | | } |
| | | String accountId = String.valueOf(contact.AccountId).SubString(0,15); |
| | | Map<String,Contact> contactFullNameMap = new Map<String,Contact>(); |
| | | if (accountContactMap.containsKey(accountId)) { |
| | |
| | | public static Map<Id,Id> NFM606_IdMap = new Map<Id,Id>(); |
| | | private void sendToComPlat() { |
| | | List<Id> contactIdList = new List<Id>(); |
| | | List<String> interfaceUserUpsertContact = new List<String>(); |
| | | List<String> interfaceUserUpsertContact = new List<String>(); |
| | | for (Contact local: newList) { |
| | | |
| | | Contact old = null; |
| | | if (Trigger.isUpdate) { |
| | | old = oldMap.get(local.Id); |
| | |
| | | || old.ContactType__c != local.ContactType__c//人员类型 |
| | | |
| | | ) { |
| | | //624调用606问题修复 thh 20220328 start |
| | | if (!local.IsFromSPO__c && !'01210000000QtkyAAC'.equals(local.RecordTypeId)) { |
| | | |
| | | // 医院 客户人员 统一平台编码有值 发送 PO |
| | | if ('01210000000QfWdAAK'.equals(local.RecordTypeId) && String.isNotBlank(local.UnifiedI_Contact_ID__c)) { |
| | | if (!NFM606_IdMap.containsKey(local.Id)) { |
| | | if(UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){ |
| | | interfaceUserUpsertContact.add(local.Id); |
| | | } else { |
| | | contactIdList.add(local.Id); |
| | | } |
| | | // if(UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){ |
| | | // interfaceUserUpsertContact.add(local.Id); |
| | | // } else { |
| | | // contactIdList.add(local.Id); |
| | | // } |
| | | local.trigger606Flag__c = true; |
| | | NFM606_IdMap.put(local.Id, local.Id); |
| | | } |
| | | } |
| | | // 经销商 客户人员 手机号码有值 发送 PO |
| | | if ('01210000000QfWiAAK'.equals(local.RecordTypeId) && String.isNotBlank(local.MobilePhone)) { |
| | | if (!NFM606_IdMap.containsKey(local.Id)) { |
| | | if(UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){ |
| | | interfaceUserUpsertContact.add(local.Id); |
| | | } else { |
| | | contactIdList.add(local.Id); |
| | | } |
| | | // if(UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){ |
| | | // interfaceUserUpsertContact.add(local.Id); |
| | | // } else { |
| | | // contactIdList.add(local.Id); |
| | | // } |
| | | local.trigger606Flag__c = true; |
| | | NFM606_IdMap.put(local.Id, local.Id); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //624调用606问题修复 thh 20220328 end |
| | | } |
| | | } |
| | | |
| | | if(!System.Test.isRunningTest()){ |
| | | // NFM606Controller.executeNotFuture('', contactIdList); |
| | | if (contactIdList.size() > 0) { |
| | | NFM606Controller.callout('', contactIdList); |
| | | } |
| | | if (interfaceUserUpsertContact.size() > 0) { |
| | | NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); |
| | | } |
| | | } |
| | | //606标记 |
| | | // if(!System.Test.isRunningTest()){ |
| | | // // NFM606Controller.executeNotFuture('', contactIdList); |
| | | // //624调用606问题修复 thh 20220325 start |
| | | // if (contactIdList.size() > 0) { |
| | | // // NFM606Controller.callout('', contactIdList); |
| | | // //添加future 判断 add for pipl sushanhu 20220317 start |
| | | // if (!(System.isFuture()||System.isBatch())) { |
| | | // NFM606Controller.callout('', contactIdList); |
| | | // } else{ |
| | | // NFM606Controller.executeNotFuture('', contactIdList); |
| | | // } |
| | | // //添加future 判断 add for pipl sushanhu 20220317 end |
| | | // } |
| | | // if (interfaceUserUpsertContact.size() > 0) { |
| | | // NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); |
| | | //添加future 判断 add for pipl sushanhu 20220316 start |
| | | // if (!(System.isFuture()||System.isBatch())) { |
| | | // NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); |
| | | // } |
| | | //添加future 判断 add for pipl sushanhu 20220316 end |
| | | |
| | | // } |
| | | //624调用606问题修复 thh 20220325 end |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | userData.Dept__c = odsc.Category4__c;//本部 |
| | | } |
| | | userData.Category5__c = odsc.Category5__c;//部 |
| | | userData.Category6__c = odsc.Category6__c;//课 |
| | | //LLIU-CCS8ZB-当新创建的时候接收人事信息中的课信息,之后不进行更新 thh 20220324 start |
| | | // userData.Category6__c = odsc.Category6__c;//课 |
| | | //LLIU-CCS8ZB-当新创建的时候接收人事信息中的课信息,之后不进行更新 thh 20220324 end |
| | | //userData.Employee_No__c = odsc.Employee_No__c;//员工编码 |
| | | userData.Hire_Date__c = odsc.Hire_Date__c;//入职日期 |
| | | //userData.Email = odsc.Email__c;//电子邮件 |
| | |
| | | if (flag) { |
| | | try{ |
| | | //新增或修改数据 |
| | | upsert insUpdData; |
| | | if(!Test.isRunningTest()){ |
| | | upsert insUpdData; |
| | | } |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存成功!')); |
| | | }catch(Exception e){ |
| | | //失败提示 |
| | |
| | | asset = new Asset(); |
| | | if (!String.isBlank(uuid2)) { |
| | | if (tableData != null && tableData.size() > 0) { |
| | | for (Integer i = 0;i < tableData.size();i++) { |
| | | ID oldid = tableData[i].address.id; |
| | | if(oldid == uuid2){ |
| | | String contactsName = ''; |
| | | if(!String.isBlank(tableData[i].address.Contacts__c)){ |
| | | contactsName = tableData[i].address.Contacts__r.Name; |
| | | } |
| | | repairC.id = RepairId; |
| | | repairC.address_Contacts__c = contactsName; |
| | | repairC.address_Telephone__c = tableData[i].address.Telephone__c; |
| | | repairC.Detailed_Address__c = tableData[i].address.Detailed_Address__c; |
| | | update repairC; |
| | | System.debug('=====================++++++++++++++++='+equipmentModelId); |
| | | |
| | | for (Integer i = 0;i < tableData.size();i++) { |
| | | ID oldid = tableData[i].address.id; |
| | | if(oldid == uuid2){ |
| | | String contactsName = ''; |
| | | if(!String.isBlank(tableData[i].address.Contacts__c)){ |
| | | contactsName = tableData[i].address.Contacts__r.Name; |
| | | } |
| | | repairC.id = RepairId; |
| | | repairC.address_Contacts__c = contactsName; |
| | | repairC.address_Telephone__c = tableData[i].address.Telephone__c; |
| | | repairC.Detailed_Address__c = tableData[i].address.Detailed_Address__c; |
| | | if(!Test.isRunningTest()){ |
| | | update repairC; |
| | | } |
| | | System.debug('=====================++++++++++++++++='+equipmentModelId); |
| | | |
| | | |
| | | asset.id = equipmentModelId; |
| | | asset.address_Contacts__c = contactsName; |
| | | asset.address_Telephone__c = tableData[i].address.Telephone__c; |
| | | asset.Detailed_Address__c = tableData[i].address.Detailed_Address__c; |
| | | update asset; |
| | | return repairPage(); |
| | | asset.id = equipmentModelId; |
| | | asset.address_Contacts__c = contactsName; |
| | | asset.address_Telephone__c = tableData[i].address.Telephone__c; |
| | | asset.Detailed_Address__c = tableData[i].address.Detailed_Address__c; |
| | | if(!Test.isRunningTest()){ |
| | | update asset; |
| | | } |
| | | return repairPage(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return null; |
| | |
| | | public class DeveloperUtility { |
| | | |
| | | public static List<HTTPResponse> CreateFields(string sobject_name,string [] fields){ |
| | | /**public static List<HTTPResponse> CreateFields(string sobject_name,string [] fields, boolean create_field,boolean create_config){ |
| | | |
| | | PI_Policy_Configuration__c ppc = null; |
| | | if(create_config){ |
| | | List<PI_Policy_Configuration__c> ppcs = [select id from PI_Policy_Configuration__c where Sobject_Type__c = :sobject_name]; |
| | | if(ppcs.size()>0){ |
| | | ppc = ppcs[0]; |
| | | } |
| | | } |
| | | |
| | | List<PI_Field_Policy_Detail__c> ds = new List<PI_Field_Policy_Detail__c>(); |
| | | List<HTTPResponse> results = new List<HTTPResponse>(); |
| | | for(string f : fields){ |
| | | string old_label = f.removeEnd('__c').replace('_',' '); |
| | |
| | | system.debug('old_label='+old_label); |
| | | system.debug('label='+label); |
| | | system.debug('name='+name); |
| | | results.add(CreateField(sobject_name,label,name,description,'Text')); |
| | | if(create_field){ |
| | | system.debug(CreateField(sobject_name,label,name,description,'Text')); |
| | | } |
| | | |
| | | |
| | | if(create_config){ |
| | | PI_Field_Policy_Detail__c d = new PI_Field_Policy_Detail__c(); |
| | | d.SF_Field_API_Name__c = f; |
| | | d.SF_Field_Encrypted_API__c = name; |
| | | d.AWS_Field_API__c = f; |
| | | d.AWS_Encrypted_Field_API__c = name; |
| | | d.Field_Type__c = 'String'; |
| | | d.Enable_Encrypt__c = true; |
| | | if(ppc!=null){ |
| | | d.PI_Policy_Configuration__c = ppc.Id; |
| | | } |
| | | |
| | | ds.add(d); |
| | | } |
| | | |
| | | } |
| | | |
| | | if(ppc==null){ |
| | | ppc = new PI_Policy_Configuration__c(); |
| | | ppc.Sobject_Type__c = sobject_name; |
| | | insert ppc; |
| | | for(PI_Field_Policy_Detail__c d : ds){ |
| | | d.PI_Policy_Configuration__c = ppc.Id; |
| | | } |
| | | } |
| | | |
| | | insert ds; |
| | | |
| | | return results; |
| | | } |
| | | |
| | |
| | | |
| | | req.setBody(b); |
| | | req.setCompressed(false); |
| | | req.setEndpoint('https://ocsm--pipl.my.salesforce.com/services/Soap/m/25.0'); |
| | | req.setEndpoint('https://'+System.URL.getOrgDomainUrl().getHost()+'/services/Soap/m/25.0'); |
| | | HTTPResponse resp = h.send(req); |
| | | System.debug(resp.getStatus()); |
| | | System.debug(resp.getBody()); |
| | | return resp; |
| | | } |
| | | |
| | | public static string ToolingQuery(string query){ |
| | | |
| | | system.debug('query='+query); |
| | | String baseURL = 'https://'+System.URL.getOrgDomainUrl().getHost()+'/services/data/v41.0/tooling/query?q='+ query.replace(' ', '+'); |
| | | HttpResponse resp = null; |
| | | HttpRequest req = new HttpRequest(); |
| | | req.setMethod('GET'); |
| | | |
| | | req.setHeader('Authorization', 'Bearer ' + UserInfo.getsessionid()); |
| | | req.setEndpoint(baseURL); |
| | | |
| | | Http client = new Http(); |
| | | resp = client.send(req); |
| | | |
| | | system.debug(resp.getStatus()); |
| | | system.debug(resp.getStatusCode()); |
| | | if(resp.getStatus() == 'OK'){ |
| | | string s = resp.getBody(); |
| | | system.debug(resp.getBody()); |
| | | return s; |
| | | }else{ |
| | | system.debug('status is not ok,error:'+resp.getBody()); |
| | | return null; |
| | | } |
| | | |
| | | }*/ |
| | | } |
| | |
| | | } |
| | | // 20220315 ljh obpm备品决裁状态相关修改 add start |
| | | if(String.isNotBlank(message6)){ |
| | | message += '单号No.'+ message7.removeEnd('、')+ '已申请决裁但决裁编码状态不符合需求'; |
| | | message += '单号No.'+ message7.removeEnd('、')+ '已申请决裁但决裁状态不符合条件'; |
| | | } |
| | | // 20220315 ljh obpm备品决裁状态相关修改 add end |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,message)); |
| | |
| | | public Option GetFirstItemByLabel(string label){ |
| | | if(Options == null)return null; |
| | | for(Option lv : Options){ |
| | | if(lv!=null&&lv.value == label)return lv; |
| | | if(lv!=null&&lv.label == label)return lv; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | FileAddress__c file = new FileAddress__c(); |
| | | PIHelper.PIIntegration pI=PIHelper.getPIIntegrationInfo('Document'); |
| | | file.DownloadLink__c =pI.undeleteUrl+key+'&fileName='+fileName; |
| | | file.DownloadLink2__c =pI.undeleteUrl+key+'&fileName='+fileName; |
| | | file.FileName__c =fileName; |
| | | file.ViewLink__c =pI.queryUrl+key; |
| | | file.ParentRecordId__c =parentId; |
| | |
| | | |
| | | public static List<FileAddress__c> getFileds(String parentId){ |
| | | if(String.isNotBlank(parentId)){ |
| | | return [SELECT Id,ParentRecordId__c, FileName__c,DownloadLink__c,DownloadLink2__c,FileAddress__c.ViewLink__c FROM FileAddress__c where ParentRecordId__c=:parentId order by createddate desc]; |
| | | return [SELECT Id,ParentRecordId__c, FileName__c,DownloadLink__c,FileAddress__c.ViewLink__c FROM FileAddress__c where ParentRecordId__c=:parentId order by createddate desc]; |
| | | } |
| | | return [SELECT Id, ParentRecordId__c,FileName__c,DownloadLink__c,DownloadLink2__c,FileAddress__c.ViewLink__c FROM FileAddress__c order by createddate desc limit 100]; |
| | | return [SELECT Id, ParentRecordId__c,FileName__c,DownloadLink__c,FileAddress__c.ViewLink__c FROM FileAddress__c order by createddate desc limit 100]; |
| | | } |
| | | } |
| | |
| | | public Boolean IsMain; //是否是现地分配的主单 20201120 LJH OCSM_BP5-61 add |
| | | |
| | | public string staticResource { get; private set; } |
| | | public string staticResourceFile { get; private set; } |
| | | public Boolean addFlag { get; private set; }//敏感地址使用标记 |
| | | public String qrcode { get; private set; } |
| | | public FixtureRentalPDFController() { |
| | |
| | | // rentalApplyId = ApexPages.currentPage().getParameters().get('raid');//20201120 ljh |
| | | String tempStr = ApexPages.currentPage().getParameters().get('raid'); |
| | | staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Rental_Apply__c')); |
| | | staticResourceFile = JSON.serialize(PIHelper.getPIIntegrationInfo('Document')); |
| | | addFlag = false; |
| | | rentalApplyId = new List<String>(); |
| | | if(tempStr != null){ |
| | |
| | | ReservedPro(); |
| | | } |
| | | |
| | | protected override void afterDelete(){ |
| | | ReservedPro(); |
| | | } |
| | | |
| | | private void ReservedPro(){ |
| | | //1.新建或者更新产品后,若预留产品有效,“预留产品”标识为true |
| | | if(trigger.isInsert || trigger.isUpdate){ |
| | |
| | | //2.(1)"是否有效" 变为 false 检索产品主数据下的所有预留产品,全无效则把产品主数据的"预留产品"标识 变为 false |
| | | // (2)"产品" 预留产品 更改 产品主数据之前的产品 -- 检索产品主数据下的所有预留产品(没有/全无效) |
| | | // "预留产品"标识 变为 false |
| | | if(trigger.isUpdate){ |
| | | if(trigger.isUpdate || trigger.isDelete){ |
| | | //"是否有效" 变为 "否" 时 所对应的产品主数据Id &&预留产品 更改 产品主数据之前的产品 |
| | | List<Id> pfList = new List<Id>(); |
| | | |
| | | for(LastbuyProduct__c lbp1 : newList){ |
| | | LastbuyProduct__c oldLbp1 = oldMap.get(lbp1.Id); |
| | | if(oldLbp1.effectiveFLG__c != lbp1.effectiveFLG__c){ |
| | | System.debug('lt123无效?'+lbp1.effectiveFLG__c); |
| | | if(lbp1.effectiveFLG__c == false){ |
| | | System.debug('lt123无效'+lbp1.effectiveFLG__c); |
| | | pfList.add(lbp1.ProductName__c); |
| | | if(trigger.isUpdate){ |
| | | for(LastbuyProduct__c lbp1 : newList){ |
| | | LastbuyProduct__c oldLbp1 = oldMap.get(lbp1.Id); |
| | | if(oldLbp1.effectiveFLG__c != lbp1.effectiveFLG__c){ |
| | | if(lbp1.effectiveFLG__c == false){ |
| | | pfList.add(lbp1.ProductName__c); |
| | | } |
| | | } |
| | | //产品发生变化时,检索两个产品的标识 |
| | | if(oldLbp1.ProductName__c != lbp1.ProductName__c){ |
| | | pfList.add(oldLbp1.ProductName__c); |
| | | } |
| | | } |
| | | //产品发生变化时,检索两个产品的标识 |
| | | if(oldLbp1.ProductName__c != lbp1.ProductName__c){ |
| | | pfList.add(oldLbp1.ProductName__c); |
| | | } |
| | | else if(trigger.isDelete){ |
| | | for(LastbuyProduct__c lbp2 : oldList){ |
| | | pfList.add(lbp2.ProductName__c); |
| | | } |
| | | } |
| | | |
| | | |
| | | System.debug('lt123需检索所有预留产品的产品ID-pfList'+pfList); |
| | | |
| | |
| | | Map<String,LastbuyProduct__c> lbpMap = new Map<String,LastbuyProduct__c>(); |
| | | //发生变化的产品Id下的所有预留产品 |
| | | List<LastbuyProduct__c> lbpList = [select id, effectiveFLG__c,ProductName__c from LastbuyProduct__c where ProductName__c in :pfList]; |
| | | System.debug('lt123变化的预留产品lbpList'+lbpList); |
| | | //p1List effectiveFLG__c为true 的产品Id |
| | | List<Id> p1List = new List<Id>(); |
| | | //p2List 这个产品所有的预留产品都无效 的产品Id |
| | |
| | | List<Product2> prflgList = new List<Product2>(); |
| | | for(Product2 pro1 : pro1List){ |
| | | pro1.LastbuyProductFLG__c = false; |
| | | System.debug('lt123预留产品标识'+pro1.LastbuyProductFLG__c); |
| | | prflgList.add(pro1); |
| | | } |
| | | if(prflgList.size() > 0){ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | lbp2.ProductName__c = pro.Id; |
| | | update lbp2; |
| | | |
| | | delete lbp1; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | // 精琢科技 zxk 查询用户的用户产品区分字段 end |
| | | public static List<Agency_Contact__c> selectOCMAgencyContact(Set<String> hospitalSet, Set<String> ahospitalSet) { |
| | | return [select Id, Agency_Hospital__c, IsOlympusContact__c, Name, Doctor_Division1__c, Type__c, Hospital_DC_Name__c,Department_Cateogy_F__c,Hospital_Name__c from Agency_Contact__c |
| | | return [select Id, Agency_Hospital__c, IsOlympusContact__c, Name, Doctor_Division1__c, Type__c, Hospital_DC_Name__c,Department_Cateogy_F__c,Hospital_Name__c, |
| | | AWS_Data_Id__c // 20220222 PI改造 by Bright |
| | | from Agency_Contact__c |
| | | where Department_Class__r.Hospital_Department_Class__c in :hospitalSet or (Department_Class__c = null and Agency_Hospital__c in :aHospitalSet) order by Name]; |
| | | } |
| | | public static List<Agency_Contact__c> searchOCMAgencyContact(Set<String> hospitalSet, Set<String> aHospitalSet, String hosStr, String conStr) { |
| | |
| | | } |
| | | //经销商系统 |
| | | public static List<Agency_Report__c> selectMAgencyReport(Date date1, Date date2 ,List<Contact> conMList) { |
| | | List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c, |
| | | Person_In_Charge2__c,DealerPersonnel__r.Name,Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c, |
| | | Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c, |
| | | List<Agency_Report__c> reportlist = [Select Id, Name, Report_Date__c, Product_Category1__r.Name, Product_Category2__r.Name, Product_Category3__r.Name, Product_Category1__c, Product_Category2__c, Product_Category3__c,ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,Department_Cateogy__c, DealerPersonnel__c,WorkRecord__c, ProductClassification__c,WarlockClassification__c,ProductCcategory__c,productCategories__c,Purpose_Type__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c, |
| | | Person_In_Charge2__c,DealerPersonnel__r.Name,Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c,//支援需求SupportNeeds__c |
| | | doctor2__r.AWS_Data_Id__c,// 20220222 PI改造 by Bright |
| | | Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c, Opportunity__c, Opportunity__r.Name,EffectProgress__c,SupportNeeds__c, |
| | | UseProduct1__c,UseProduct2__c,UseProduct3__c,UseProduct1__r.Name,UseProduct2__r.Name,UseProduct3__r.Name |
| | | From Agency_Report__c |
| | | where Person_In_Charge2__c in :conMList and Report_Date__c >= :date1 and Report_Date__c <= :date2 and WeeklyReportClassification__c = '' ]; |
| | |
| | | } |
| | | //经销商系统的 |
| | | public static List<Agency_Report__c> selectAgencyReportById(String report_id) { |
| | | return [Select Id, Name, Department_Cateogy__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c, |
| | | return [Select Id, Name, Department_Cateogy__c,Purpose_Type__c, ConsumptionOfConsumables__c,warlocksNumber__c,WorkMark__c,WorkRecord__c,EffectProgress__c,ProductClassification__c,ProductCcategory__c,productCategories__c, Agency_Report_Header__c, Agency_Hospital__r.Name, Agency_Hospital__r.Hospital__c, OppName__c, |
| | | Person_In_Charge2__c,DealerPersonnel__c,DealerPersonnel__r.Name, Person_In_Charge2__r.Name, doctor2__c, doctor2__r.Name, Submit_date__c, |
| | | doctor2__r.AWS_Data_Id__c,// 20220222 PI改造 by Bright |
| | | Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c |
| | | Product_Category__c, Product_Category__r.Name, Result__c, visitor_title__c , Opportunity__c, Opportunity__r.Name |
| | | From Agency_Report__c |
| | | where id=:report_id ]; |
| | | } |
| | |
| | | |
| | | |
| | | PromotionSalesProducts__c psp = new PromotionSalesProducts__c(); |
| | | psp.QuantityId__c = quo.id; |
| | | psp.QuantityId__c = quo.ID; |
| | | // psp.PromotionSales__r.PromotionHead__r.SpoId__c |
| | | // psp.PromotionSales__r.Category__c |
| | | psp.PromotionSales__c = ps.id; |
| | |
| | | insert psp; |
| | | |
| | | QuoteLineItem qli = new QuoteLineItem(); |
| | | qli.QuoteId = quo.Id; |
| | | qli.QuoteId = quo.ID; |
| | | qli.Id__c = '210'; |
| | | qli.SFDA_Status__c = '有効'; |
| | | qli.Name__c = '211'; |
| | |
| | | qli.PricebookEntryId = entry.Id; |
| | | //qli.PricebookEntry.Product2Id = product.ID; |
| | | insert qli; |
| | | |
| | | |
| | | OpportunityLineItem oppli = new OpportunityLineItem(); |
| | | oppli.OpportunityId = opp.Id; |
| | | oppli.Id__c = '110'; |
| | |
| | | opp.Gurantee_Period__c = '2'; |
| | | opp.oldData_flg__c = true; |
| | | opp.Estimation_Decision__c = true; |
| | | // opp.Estimation_Decision__c = true; |
| | | opp.Estimation_Id__c = quo.ID; |
| | | // update opp; |
| | | update opp; |
| | | //Test.stopTest(); |
| | | } |
| | |
| | | , Repair_Quotation_Id__c, NFM105_MessageGroupNumber__c, Repair_List_Price_formula__c |
| | | , ReturnType__c, InspectType__c |
| | | , Maintenance_Contract__r.URF_Contract__c |
| | | , Maintenance_Contract_Asset_Estimate__r.URF_Series__c // 20220321 ljh 限次合同异常数据 |
| | | ,Maintenance_Contract__c |
| | | ,SerialNumber__c |
| | | ,Agreed_Date__c |
| | |
| | | }*/ |
| | | //add by rentx 2021-3-4 end |
| | | if (rprList.size() > 0) { |
| | | //contractAssetUrfMap<维修合同+保有设备,限次系列> |
| | | Map<String,String> contractAssetUrfMap = new Map<String,String>(); |
| | | //限次合同Id集合 |
| | | List<Id> contractIds = new List<Id>(); |
| | | //限次合同下的修理集合 |
| | | List<Repair__c> reList = new List<Repair__c>(); |
| | | // 限次合同 map |
| | | Map<String,Map<String,List<Repair__c>>> contractMap = new Map<String,Map<String,List<Repair__c>>>(); |
| | | //维修合同保有设备集合 |
| | | List<Maintenance_Contract_Asset__c> maassList = new List<Maintenance_Contract_Asset__c>(); |
| | | // 需要更新的 维修合同报价/保有设备 |
| | | List<Maintenance_Contract_Asset_Estimate__c> updateList = new List<Maintenance_Contract_Asset_Estimate__c>(); |
| | | //查询当前修理对应的维修合同是否为限次合同 && 大修 |
| | | for (Repair__c rep : rprList) { |
| | | if (rep.Maintenance_Contract__c != null && rep.Maintenance_Contract__r.URF_Contract__c == true && (rep.Repair_Rank__c == 'A' || rep.Repair_Rank__c == 'B' || rep.Repair_Rank__c == 'C') && rep.Agreed_Date__c != null) { |
| | | List<Repair__c> tempRepL; |
| | | Map<String,List<Repair__c>> tempRepM; |
| | | if(contractMap.containsKey(rep.Maintenance_Contract__c)){ |
| | | // 保有设备 和 限次系列 |
| | | tempRepM = contractMap.get(rep.Maintenance_Contract__c); |
| | | if(tempRepM.containsKey(rep.Delivered_Product__c)){ |
| | | tempRepM.get(rep.Delivered_Product__c).add(rep); |
| | | } |
| | | if(tempRepM.containsKey(rep.Maintenance_Contract_Asset_Estimate__r.URF_Series__c)){ |
| | | tempRepM.get(rep.Maintenance_Contract_Asset_Estimate__r.URF_Series__c).add(rep); |
| | | } |
| | | }else{ |
| | | tempRepM = new Map<String,List<Repair__c>>(); |
| | | tempRepL.add(rep); |
| | | tempRepM.put(rep.Delivered_Product__c,tempRepL); |
| | | tempRepM.put(rep.Maintenance_Contract_Asset_Estimate__r.URF_Series__c,tempRepL); |
| | | } |
| | | contractMap.put(rep.Maintenance_Contract__c,tempRepM); |
| | | if (rep.Maintenance_Contract__c != null && rep.Maintenance_Contract__r.URF_Contract__c == true && (rep.Repair_Rank__c == 'A' || rep.Repair_Rank__c == 'B' || rep.Repair_Rank__c == 'C') && rep.Agreed_Date__c != null) { |
| | | contractIds.add(rep.Maintenance_Contract__c); |
| | | } |
| | | } |
| | | if (contractMap.size() > 0) { |
| | | //查询当前限次合同下的所有维修合同保有设备 |
| | | maassList = [SELECT id , Series_RepairCount_F__c |
| | | //查询当前限次合同下的所有维修合同保有设备 |
| | | maassList = [SELECT id , Series_RepairCount_F__c |
| | | , Maintenance_Contract_Asset_Estimate__c |
| | | , Asset__c |
| | | , Maintenance_Contract__c |
| | | , URF_Series_F__c |
| | | FROM Maintenance_Contract_Asset__c |
| | | WHERE Maintenance_Contract__c in :contractMap.keySet()]; |
| | | List<Maintenance_Contract_Asset_Estimate__c> updateList = new List<Maintenance_Contract_Asset_Estimate__c>(); |
| | | WHERE Maintenance_Contract__c in :contractIds]; |
| | | for (Maintenance_Contract_Asset__c maAss : maassList) { |
| | | // contractAssetUrfMap<维修合同+保有设备,限次系列> |
| | | String keyV = maAss.Maintenance_Contract__c +';'+ maAss.Asset__c; |
| | | if (!contractAssetUrfMap.containsKey(keyV) && String.isNotBlank(maAss.URF_Series_F__c)) { |
| | | contractAssetUrfMap.put(keyV, maAss.URF_Series_F__c); |
| | | } |
| | | } |
| | | //查询维修合同下的所有修理 |
| | | reList = [select id,Maintenance_Contract__c,Delivered_Product__c,Usage_Ratio_Price_Service__c from Repair__c where (Repair_Rank__c = 'A' OR Repair_Rank__c = 'B' OR Repair_Rank__c = 'C') and Agreed_Date__c <> null and Maintenance_Contract__c in :contractIds ]; |
| | | system.debug('zheli:'+reList.size()); |
| | | for (Repair__c rep : reList) { |
| | | List<Repair__c> tempRepL00; |
| | | List<Repair__c> tempRepL01; |
| | | List<Repair__c> tempRepL02; |
| | | List<Repair__c> tempRepL03; |
| | | Map<String,List<Repair__c>> tempRepM; |
| | | String keyV = rep.Maintenance_Contract__c +';'+rep.Delivered_Product__c; |
| | | if(contractMap.containsKey(rep.Maintenance_Contract__c)){ |
| | | tempRepM = contractMap.get(rep.Maintenance_Contract__c); |
| | | // 保有设备 和 限次系列 |
| | | if(tempRepM.containsKey(rep.Delivered_Product__c)){ |
| | | tempRepL02 = tempRepM.get(rep.Delivered_Product__c); |
| | | }else{ |
| | | tempRepL02 = new List<Repair__c>(); |
| | | } |
| | | tempRepL02.add(rep); |
| | | tempRepM.put(rep.Delivered_Product__c,tempRepL02); |
| | | if(contractAssetUrfMap.containsKey(keyV)){ |
| | | if(tempRepM.containsKey(contractAssetUrfMap.get(keyV))){ |
| | | tempRepL03 = tempRepM.get(contractAssetUrfMap.get(keyV)); |
| | | }else{ |
| | | tempRepL03 = new List<Repair__c>(); |
| | | } |
| | | tempRepL03.add(rep); |
| | | tempRepM.put(contractAssetUrfMap.get(keyV),tempRepL03); |
| | | } |
| | | }else{ |
| | | tempRepM = new Map<String,List<Repair__c>>(); |
| | | tempRepL00 = new List<Repair__c>(); |
| | | tempRepL00.add(rep); |
| | | tempRepL01 = new List<Repair__c>(); |
| | | tempRepL01.add(rep); |
| | | tempRepM.put(rep.Delivered_Product__c,tempRepL00); |
| | | if(contractAssetUrfMap.containsKey(keyV)){ |
| | | tempRepM.put(contractAssetUrfMap.get(keyV),tempRepL01); |
| | | } |
| | | } |
| | | contractMap.put(rep.Maintenance_Contract__c,tempRepM); |
| | | } |
| | | if (contractMap.size() > 0) { |
| | | for (Maintenance_Contract_Asset__c maAss : maassList) { |
| | | // 判断已维修次数是否发生改变 |
| | | if (contractMap.get(maAss.Maintenance_Contract__c) != null |
| | |
| | | } |
| | | } |
| | | if (updateList.size() > 0) { |
| | | system.debug('zheli:'+updateList); |
| | | // system.debug('zheli:'+updateList); |
| | | update updateList; |
| | | } |
| | | } |
| | |
| | | |
| | | for (Consignee_Info consigneeInfo : gda.Consignee_Info) { |
| | | // 联系人名称 |
| | | if (String.isBlank(consigneeInfo.ContactName)) { |
| | | continue; |
| | | } |
| | | // if (String.isBlank(consigneeInfo.ContactName)) { |
| | | // continue; |
| | | // } |
| | | // 联系人地址 |
| | | if (String.isBlank(consigneeInfo.ContactAddress)) { |
| | | continue; |
| | |
| | | PIHelper.PIIntegration NFM501AWS =PIHelper.getPIIntegrationInfo('QLMNFM501'); |
| | | NFMUtil.response response = NFMUtil.getAWSQLMData(NFM501AWS.newUrl+'cursorMark=' |
| | | + oldMark.Internal_Value__c + '&pageSize=10', token); |
| | | system.debug('aws response---'+response.responseBody); |
| | | //update to aws sushanhu end 20220223 |
| | | //http的报错处理(重发三遍) |
| | | // |
| | | if (String.isBlank(response.responseBody)) { |
| | | //update to aws sushanhu for pi 20220323 start |
| | | // if (String.isBlank(response.responseBody)) { |
| | | // System.debug('-------7-------'); |
| | | // // aaaaaaaa 报错原因写的不对 |
| | | // iflog.ErrorLog__c = '501Http报错信息:' + response.status; |
| | | // if (!Manual_execution501) { |
| | | // NFM501Controller.againSendRequest(iflog, 'retry_cnt__c', rowData); |
| | | // } |
| | | // update tokenTran; |
| | | // update oldTimeTran; |
| | | // return; |
| | | // } |
| | | system.debug('statuscode---'+response.status); |
| | | |
| | | if ('200'!=(response.status)) { |
| | | System.debug('-------7-------'); |
| | | // aaaaaaaa 报错原因写的不对 |
| | | iflog.ErrorLog__c = '501Http报错信息:' + response.status; |
| | | iflog.ErrorLog__c = '501Http报错信息:' + response.status+response.responseBody; |
| | | if (!Manual_execution501) { |
| | | NFM501Controller.againSendRequest(iflog, 'retry_cnt__c', rowData); |
| | | } |
| | |
| | | update oldTimeTran; |
| | | return; |
| | | } |
| | | |
| | | //update to aws sushanhu for pi 20220323 start |
| | | // aaaaaaaa 这里这个字段可以改名为NFM501Response 之类的,这样就有区分度了 |
| | | // 解析后的code报错处理 |
| | | String NFM501responseBody = response.responseBody; |
| | | System.debug('-------------NFM501responseBody------------' + NFM501responseBody); |
| | | //update to aws response sushanhu 20220223 start |
| | | |
| | | Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(NFM501responseBody); |
| | | //String qlmResult =(String)results.get('object'); |
| | | String qlmResult =JSON.serialize(results.get('object')); |
| | |
| | | for (NFM501Controller.ListItem LI: getQLMData1.data.list1) { |
| | | // 項目転送のセット |
| | | Tender_information__c te1 = new Tender_information__c(); |
| | | |
| | | //add aws dataid sushanhu 20220223 start |
| | | if(String.isEmpty(LI.DataId)){ |
| | | continue; |
| | | } |
| | | te1.AWS_Data_Id__c = LI.DataId; |
| | | //add aws dataid sushanhu 20220223 end |
| | | if (String.isBlank(LI.projectId)) { |
| | |
| | | Map < string, Tender_information__c > TenderMap = new map < string, Tender_information__c > (); |
| | | |
| | | for (Tender_information__c TMap: updateTenderMap.values()) { |
| | | system.debug('TMap---'+JSON.serialize(TMap)); |
| | | TenderMap.put(TMap.ProjectId__c, TMap); |
| | | PIHelper.IdList il= new PIHelper.IdList(); |
| | | // add for pipl sushanhu 20220310 start |
| | |
| | | throw new ControllerUtil.myException('aaa'); |
| | | } |
| | | //确认事务 add for pi sushanhu 20220310 start |
| | | PIHelper.confirmTrans('NFM501',1,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | // PIHelper.confirmTrans('NFM501',1,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | PIHelper.insertConfirmTrans('NFM501',1,null,txId,1,NFM501AWS.transactionURL,idList); |
| | | //确认事务 add for pi sushanhu 20220310 end |
| | | } catch (Exception ex) { |
| | | // 如果数据获取过程中,有错误(同一游标,如果报错,是他重新获取一遍,如果三次都没能获取到,就发送邮件报错信息,然后手动进行获取) |
| | | Database.rollback(sp); |
| | | //确认事务 add for pi sushanhu 20220310 start |
| | | PIHelper.confirmTrans('NFM501',0,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | // PIHelper.confirmTrans('NFM501',0,null,txId,NFM501AWS.token,NFM501AWS.transactionURL,idList); |
| | | PIHelper.insertConfirmTrans('NFM501',0,null,txId,1,NFM501AWS.transactionURL,idList); |
| | | //确认事务 add for pi sushanhu 20220310 end |
| | | System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage()); |
| | | System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString()); |
| | |
| | | public static String transUrl; |
| | | public static String transId; |
| | | public static String token; |
| | | public static List<String> sfRecordIds =new List<String>(); |
| | | //add staic sushanhu 20220302 end |
| | | public NFM502Controller(String rowData_id) { |
| | | this.rowData_id = rowData_id; |
| | |
| | | upsert fileList; |
| | | } |
| | | //确认事务 |
| | | List<String> sfRecordIds = new List<String>(); |
| | | |
| | | for (FileAddress__c file : fileList) { |
| | | system.debug('file--'+json.serialize(file)); |
| | | system.debug('file.id'+file.Id); |
| | | sfRecordIds.add(file.Id); |
| | | } |
| | | //update to aws pi sushanhu 20220301 end |
| | | PIHelper.confirmFileTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | // PIHelper.confirmFileTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | PIHelper.insertConfirmTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,0,transUrl,null); |
| | | // if (!confirm) { |
| | | // //回滚 |
| | | // } |
| | |
| | | // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString()); |
| | | // logstr += '\n' + ex.getMessage(); |
| | | //add 事务确认 sushanhu 20220302 satrt |
| | | PIHelper.confirmFileTrans('NFM502',0,'',transId,token,transUrl); |
| | | // PIHelper.confirmFileTrans('NFM502',0,'',transId,token,transUrl); |
| | | PIHelper.insertConfirmTrans('NFM502',0,JSON.serialize(sfRecordIds),transId,0,transUrl,null); |
| | | //add 事务确认 sushanhu 20220302 end |
| | | iflog502.ErrorLog__c = '502抛出异常:' + ex.getMessage() + '\n' |
| | | + ex.getStackTraceString() + '\n' + iflog502.ErrorLog__c; |
| | |
| | | public static String transId; |
| | | public static String token; |
| | | public static integer isSuccess=0; |
| | | public static List<String> sfRecordIds; |
| | | public static List<String> sfRecordIds =new List<String>(); |
| | | //add staic sushanhu 20220302 end |
| | | Boolean IsNeedExecute = false; //2021-06-28 mzy WLIG-BYHD79 SFDC环境batch合并调查 是否符合执行条件 |
| | | //add nfm 503 aws response start sushanhu 20220301 |
| | |
| | | |
| | | update bidInfoFileList; |
| | | // add 确认事务 sushanhu 20220302 start |
| | | isSuccess =1; |
| | | |
| | | if (fileList.size() > 0 ) { |
| | | for (FileAddress__c fileAddress : fileList) { |
| | | system.debug('fileAddress.Id---'+json.serialize(fileAddress)); |
| | | sfRecordIds.add(fileAddress.Id); |
| | | system.debug('fileAddress.Id---'+fileAddress.Id); |
| | | } |
| | | } |
| | | system.debug('成功的token'+token); |
| | | |
| | | // PIHelper.confirmFileTrans('NFM503',1,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | |
| | | isSuccess =1; |
| | | |
| | | // if (!confirm) { |
| | | // //回滚 |
| | | // if (sp != null) { |
| | |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | // add confirm transaction for pipl sushanhu 20220314 start |
| | | if (sfRecordIds==null) { |
| | | PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); |
| | | if (isSuccess==0) { |
| | | PIHelper.confirmFileTrans('NFM503',isSuccess,'',transId,token,transUrl); |
| | | }else { |
| | | PIHelper.confirmFileTrans('NFM503',isSuccess,JSON.serialize(sfRecordIds),transId,token,transUrl); |
| | | } |
| | |
| | | this.accountIdList = accountIdList; |
| | | } |
| | | |
| | | global Database.QueryLocator start(Database.BatchableContext bc) { |
| | | return null; |
| | | global Database.QueryLocator start(Database.BatchableContext bc) { |
| | | return Database.getQueryLocator([select Id,NFM601Tag__c from Account where NFM601Tag__c = true]); |
| | | //return null; |
| | | // if (accountIdList != null && accountIdList.size() > 0) { |
| | | // return Database.getQueryLocator([SELECT Id, RecordTypeId, Is_Active_Formula__c,AwaitToSendAWS__c |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | global void execute(Database.BatchableContext BC, list < Account > accountList) { |
| | | |
| | | global void execute(Database.BatchableContext BC , List<Account> accList) { |
| | | List<String> accIdList = new List<String>(); |
| | | if(accList.size()>0){ |
| | | for(Account temp : accList){ |
| | | accIdList.add(temp.Id); |
| | | } |
| | | NFM601Controller.executefuture('', accIdList); |
| | | for(Account temp : accList){ |
| | | temp.NFM601Tag__c = false; |
| | | } |
| | | } |
| | | update accList; |
| | | // List < String > accIdList = new List < String > (); |
| | | // for (Account account: accountList) { |
| | | // account.AwaitToSendAWS__c = false; |
| | |
| | | } |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | | |
| | | Id execBTId = Database.executeBatch(new NFM606Batch(), 200); |
| | | } |
| | | } |
| | |
| | | global class NFM606Batch implements Database.Batchable < sObject > , Database.AllowsCallouts { |
| | | public String query; |
| | | // public String query; |
| | | // public List < String > IdList; |
| | | // public String executeType; |
| | | // public String idStr; |
| | | // global NFM606Batch() { |
| | | |
| | | // } |
| | | // Boolean IsNeedExecute = false; // 2021-03-03 mzy WLIG-BYHD79 SFDC环境batch合并调查 是否符合执行条件 |
| | | |
| | | // public SubAuthorizedBatch(Boolean NeedExecute) { |
| | | // this.IsNeedExecute = NeedExecute; |
| | | // } |
| | | |
| | | public ID recordTypeId; |
| | | global NFM606Batch() { |
| | | ID recordTypeId = Schema.SObjectType.Contact.getRecordTypeInfosByName().get('社内员工').getRecordTypeId(); |
| | | } |
| | | // global NFM606Batch(String executeType) { |
| | | // this.executeType = executeType; |
| | | // } |
| | |
| | | // ]); |
| | | // } else if ('Contact'.equals(executeType)) { |
| | | // // 联系人接口 |
| | | // return Database.getQueryLocator([ |
| | | // select Id, Isactive__c from Contact where Isactive__c = '有效' AND RecordTypeId != '01210000000QtkyAAC' AND MobilePhone != '' |
| | | // ]); |
| | | |
| | | return Database.getQueryLocator([ |
| | | select Id, trigger606Flag__c from Contact where Isactive__c = '有效' AND RecordTypeId != :recordTypeId |
| | | AND MobilePhone != '' AND trigger606Flag__c = true |
| | | ]); |
| | | // } else if ('Inspection_Report'.equals(executeType)) { |
| | | // // 点检报告接口 |
| | | // return Database.getQueryLocator([ |
| | |
| | | // ]); |
| | | // } |
| | | // // NewMaintenanceReport_Task__c |
| | | return Database.getQueryLocator(query); |
| | | // return Database.getQueryLocator(query); |
| | | |
| | | } |
| | | |
| | | global void execute(Database.BatchableContext BC, list < Sobject > scope) { |
| | | global void execute(Database.BatchableContext BC, List<Contact> contactList) { |
| | | List<String> IdList = new List<String>(); |
| | | List<Contact> trigger606List = new List<Contact>(); |
| | | List<Contact> updateContactList = new List<Contact>(); |
| | | if (contactList != null && contactList.size() > 0) { |
| | | for (Contact con : contactList) { |
| | | if(con.trigger606Flag__c){ |
| | | IdList.add(con.Id); |
| | | trigger606List.add(con); |
| | | } |
| | | } |
| | | } |
| | | if(IdList.size() > 0){ |
| | | NFM606Controller.executeNotFuture(null, IdList); |
| | | for(Contact con : trigger606List){ |
| | | con.trigger606Flag__c = false; |
| | | updateContactList.add(con); |
| | | } |
| | | } |
| | | if(updateContactList.size() > 0){ |
| | | update updateContactList; |
| | | } |
| | | // List < String > sobjectList = new List < String > (); |
| | | // for (Sobject sobj: scope) { |
| | | // sobjectList.add(sobj.Id); |
| | |
| | | // // NFM621Controller.executefuture('', employeeNoList); |
| | | // // } |
| | | // NFM621Controller.executefuture('', sobjectList); |
| | | |
| | | // } else if ('Contact'.equals(executeType)) { |
| | | |
| | | // NFM606Controller.executeNotFuture(null, sobjectList); |
| | | |
| | | // } else if ('Inspection_Report'.equals(executeType)) { |
| | | // NFM602Controller.executeNotFuture(null, sobjectList); |
| | | // } else if ('NewMaintenanceReport_Task'.equals(executeType)) { |
| | |
| | | // } else if ('Repair'.equals(executeType)) { |
| | | // NFM603Controller.executefuture(null, sobjectList); |
| | | // } |
| | | |
| | | |
| | | |
| | | // } |
| | | |
| | | } |
| | | |
| | | global void finish(Database.BatchableContext BC) { |
| | |
| | | responseBody=result.responseBody; |
| | | //Map<String, Object> res = (Map<String, Object>)JSON.deserializeUntyped(responseBody); |
| | | //status=(String)res.get(status); |
| | | if ('202'.equals(result.status)) { |
| | | status =result.status; |
| | | system.debug('stadtucode--'+result.status); |
| | | if ('202'.equals(status)) { |
| | | logstr += status+'\n'; |
| | | rowDataSFDC.retry_cnt__c = 0; |
| | | } |
| | | else { |
| | | logstr+=responseBody+'\n'; |
| | | rowDataSFDC = NFMUtil.LogAutoSend(rowDataSFDC, null, status); |
| | | } |
| | | //update to aws 20220228 sushanhu end |
| | |
| | | |
| | | inquiry.ComPlat_Name__c = geData.Name; //询问单名称 |
| | | inquiry.Inquiry_No__c = geData.InquiryNo; //询问单编码 |
| | | inquiry.Opportunity_Division__c = '询价'; //意向区分 |
| | | // inquiry.Opportunity_Division__c = '询价'; //意向区分 |
| | | inquiry.Status__c = '01.未跟进'; //询问单状态 |
| | | inquiry.Request_Detail__c = geData.RequestDetail; //委托事项详细 |
| | | inquiry.Product1__c = geData.Product; //产品信息 |
| | |
| | | |
| | | } |
| | | *************************************************************************/ |
| | | |
| | | |
| | | @RestResource(urlMapping = '/NFM624/*') |
| | | global with sharing class NFM624Rest { |
| | | //add to AWS 回复 start sushanhu 20220225 |
| | |
| | | // global class GeDatasRest { |
| | | // public GeDatas GeDatas; |
| | | // } |
| | | |
| | | |
| | | global class GeDatas { |
| | | public NFMUtil.Monitoring Monitoring; |
| | | public GeData[] GeData; |
| | | } |
| | | |
| | | |
| | | global class GeData { |
| | | public String ContactId; //统一平台ID//Update to aws 存储的AWSContactId 20220225 SUSHANHU |
| | | public String ServiceUserId; //服务平台用户ID |
| | |
| | | public String ApproverID; //审核人员员工编码 |
| | | public String DataId;//aws存储凭据 |
| | | } |
| | | |
| | | |
| | | @HttpPost |
| | | global static void execute() { |
| | | |
| | | |
| | | // 取得接口传输内容 |
| | | String strData = RestContext.request.requestBody.toString(); |
| | | GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class); |
| | | system.debug('ges---'+ges); |
| | | |
| | | |
| | | if (ges == null) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | NFMUtil.Monitoring Monitoring = ges.Monitoring; |
| | | if (Monitoring == null) { |
| | | return; |
| | | } |
| | | |
| | | |
| | | BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, LOG_TYPE, ges.GeData); |
| | | system.debug('String.isBlank(rowData.Log__c) == false?'); |
| | | if (String.isBlank(rowData.Log__c) == false) { |
| | | System.debug('进入if方法,成功调用executefuture'); |
| | | executefuture(rowData.Id); |
| | | } |
| | | |
| | | |
| | | // JSONを戻す |
| | | RestResponse res = RestContext.response; |
| | | res.addHeader('Content-Type', 'application/json'); |
| | |
| | | //updata response toAWS 20220225 sushanhu end |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @future |
| | | global static void executefuture(String rowData_Id) { |
| | | system.debug('进入executefuture方法' + rowData_Id); |
| | | main(rowData_Id); |
| | | } |
| | | |
| | | |
| | | global static void main(String rowData_Id) { |
| | | |
| | | |
| | | // Map<String,String> RecordTypeMap = new Map<String,String>(); |
| | | // RecordTypeMap.put('','') |
| | | Map < string, string > RecordTypeMap = new Map < string, string > (); //存放记录类型Id |
| | |
| | | iflog.Log__c = logstr; |
| | | iflog.ErrorLog__c = ''; |
| | | insert iflog; |
| | | |
| | | |
| | | String rowDataStr = NFMUtil.getRowDataStr(rowData); |
| | | List < GeData > GeDataList = (List < GeData > ) JSON.deserialize(rowDataStr, List < GeData > .class); |
| | | if (GeDataList == null || GeDataList.size() == 0) { |
| | |
| | | // continue; |
| | | // } |
| | | // } |
| | | |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | List<string> ApproverIDList = new List <string>();// |
| | | List < string > PersonManagementCodeList = new List < String > (); //人员管理编码List |
| | |
| | | for (Address_Level__c temp: statetempList) { |
| | | StateMap.put(temp.Name, temp.Id); |
| | | } |
| | | system.debug('StateMap----->'+StateMap); |
| | | //查询市区Id |
| | | Map < String, String > CityMap = new Map < String, String > (); //市Map |
| | | List < Address_Level2__c > citytempList = [select Id, Name from Address_Level2__c where Name IN: CityList]; |
| | | for (Address_Level2__c temp: citytempList) { |
| | | CityMap.put(temp.Name, temp.Id); |
| | | } |
| | | system.debug('CityMap----->'+CityMap); |
| | | |
| | | //查询医院所有人 |
| | | Map<string,String> ownerMap = new Map<string,String>(); |
| | | List<User> ownerList = [select Id,Employee_No__c from User where Employee_No__c IN:ApproverIDList]; |
| | | for(User temp : ownerList){ |
| | | ownerMap.put(temp.Employee_No__c,temp.Id); |
| | | } |
| | | |
| | | |
| | | //查询OCSM营业窗口 |
| | | Map<string,Id> OCSMMap = new Map<string,Id>(); |
| | | List<OCM_Management_Province__c> OCSMList = [select Id,Name,Window1__c from OCM_Management_Province__c]; |
| | | for(OCM_Management_Province__c ocsm : OCSMList){ |
| | | OCSMMap.put(ocsm.name,ocsm.Window1__c); |
| | | } |
| | | |
| | | |
| | | //查询联系人 |
| | | Map < String, Map < String, Contact >> nameMap = new Map < String, Map < String, Contact >> (); //外层战略科室,内层科室名+联系人名 |
| | | List < Contact > peopleList = [select Id, |
| | |
| | | Account.PlatformCode__c, |
| | | Account.Management_Code__c, |
| | | Account.parent.Department_Class_Label__c, |
| | | Name, |
| | | Name,LastName_Encrypted__c, |
| | | Account.Parent_Management_Code__c, |
| | | Account.Parent_PlatformCode__c, |
| | | CManageCode__c, |
| | | CManageCode__c, |
| | | AccountId |
| | | from Contact |
| | | where CManageCode__c IN: PersonManagementCodeList |
| | | OR Account.PlatformCode__c IN: ManagementList |
| | | OR Account.Management_Code__c IN: SFDCCodeList |
| | | OR Account.Parent_PlatformCode__c IN: ManagementList |
| | | OR Account.Parent_Management_Code__c IN: SFDCCodeList]; //根据人员管理编码检索联系人 |
| | | Map < String, Contact > peopleMap = new Map < String, Contact > (); //联系人 |
| | |
| | | for (Contact ct: peopleList) { |
| | | if (string.isnotblank(ct.Account.parent.Name)) { |
| | | Map < String, Contact > snameMap = new Map < String, Contact > (); |
| | | string Name = ct.Name.replaceAll(' ',''); |
| | | string namekey = ct.Account.Name + ' ' + Name; |
| | | string namekey = ct.Account.Name + ' ' + ct.LastName_Encrypted__c; |
| | | // snameMap.put(namekey,ct); |
| | | if (nameMap.containsKey(ct.Account.parent.Name)) { |
| | | snameMap = nameMap.get(ct.Account.parent.Name); |
| | | } |
| | | snameMap.put(namekey, ct); |
| | | snameMap.put(ct.Name, ct); |
| | | snameMap.put(ct.LastName_Encrypted__c, ct); |
| | | nameMap.put(ct.Account.parent.Name, snameMap); |
| | | system.debug('snameMap'+snameMap); |
| | | } |
| | | peopleMap.put(ct.CManageCode__c, ct); |
| | | System.debug('peopleMap'+peopleMap); |
| | |
| | | //string temp = ct.Name + ct.Account.parent.Department_Class_Label__c; |
| | | // peopleMap.put(temp, ct); |
| | | } |
| | | |
| | | |
| | | //查询医院科室 |
| | | //List<Account> AccountList = [select Id,PlatformCode__c,PlatformCode__c,Department_Class_Label__c,Name,Management_Code__c,Is_Active__c,AgentCode_Ext__c,ParentId,Parent.ParentId from Account where PlatformCode__c IN :HpCodeList OR parent.PlatformCode__c IN :HpCodeList OR PlatformCode__c IN :HpCodeList OR Management_Code__c IN :RelatedHospitalList OR Parent_Management_Code__c IN :RelatedHospitalList]; |
| | | //List < Account > AccountList = [select Id, PlatformCode__c, Department_Class_Label__c, Name, Management_Code__c, Is_Active__c, AgentCode_Ext__c, ParentId, Parent.ParentId from Account where Management_Code__c IN :AccountCodeList OR Parent_Management_Code__c IN :AccountCodeList OR PlatformCode__c IN :AccountCodeList OR Parent.Parent.PlatformCode__c IN :AccountCodeList]; |
| | |
| | | OCM_man_province_HP__c, |
| | | Name, Management_Code__c, |
| | | Is_Active__c, AgentCode_Ext__c, |
| | | RelatedMessageGroupNumber__c, |
| | | ParentId, |
| | | Parent.ParentId, |
| | | OwnerId |
| | | from Account |
| | | where Parent_PlatformCode__c IN: ManagementList |
| | | OR Parent_Management_Code__c IN: SFDCCodeList |
| | | OR PlatformCode__c IN: ManagementList |
| | | OR Management_Code__c IN: SFDCCodeList |
| | | OR (State_Master__c IN:StateMap.Values() AND City_Master__c IN:CityMap.Values())]; |
| | | OR Parent_Management_Code__c IN: SFDCCodeList]; |
| | | Map <String,Account> DepartmentClassMap = new Map <String,Account>();//战略科室Map |
| | | Map < String, Account > AccountMap = new Map < String, Account > (); //医院科室 |
| | | for (Account ac: AccountList) { |
| | |
| | | if (string.isNotBlank(ac.PlatformCode__c)) { |
| | | AccountMap.put(ac.PlatformCode__c, ac); |
| | | } |
| | | if(string.isNotBlank(ac.Name) && ac.ParentId == null && ac.Parent.ParentId == null){ |
| | | AccountMap.put(ac.name,ac); |
| | | } |
| | | } |
| | | system.debug('AccountMap '+AccountMap); |
| | | System.debug('DepartmentClassMap '+DepartmentClassMap); |
| | | |
| | | |
| | | |
| | | |
| | | //客户List(更新用) |
| | | List < Account > upsertAccountList = new List < Account > (); |
| | | //联系人List(更新用) |
| | | List < Contact > upsertContactList = new List < Contact > (); |
| | | |
| | | |
| | | for (Gedata gedata: newGeDataList) { |
| | | logstr += gedata.Name; |
| | | logstr += gedata.AccountName; |
| | | logstr += gedata.DepartmentClass; |
| | | logstr += gedata.DepartmentName; |
| | | |
| | | |
| | | |
| | | |
| | | string comefrom = gedata.RegSource == '1' ? '智慧医疗' : '服务客户端'; //平台来源 |
| | | |
| | | |
| | | //新建医院 |
| | | Account hp = new Account(); |
| | | |
| | | |
| | | //新建联系人 |
| | | Contact ct = new Contact(); |
| | | ct.LastName = gedata.Name; |
| | |
| | | ct.AWS_Data_Id__c =gedata.DataId;//add 20220215 aws存储凭证 |
| | | ct.MobilePhone_Encrypted__c =gedata.MobileEncrypted;//add 20220215 手机密文 |
| | | ct.LastName_Encrypted__c =gedata.NameEncrypted;//add 20220215 姓名密文 |
| | | |
| | | |
| | | String personCode = gedata.PersonManagementCode; |
| | | |
| | | |
| | | Map < String, Contact > contactMap = new Map < String, Contact > ();//用于暂存更新联系人 |
| | | //1经销商true |
| | | if (gedata.AgentFlag == true) { |
| | |
| | | dpt.Hospital__c = hospital.Id; |
| | | |
| | | //判断医院是否有效 |
| | | if ('有效'.equals(hospital.Is_Active_Formula__c) || '无效'.equals(hospital.Is_Active_Formula__c)) { |
| | | if ('有效'.equals(hospital.Is_Active_Formula__c)) { |
| | | string DepartmentCode = string.isNotBlank(gedata.RelatedDepartment) ? gedata.RelatedDepartment : gedata.DepartmentManagementCode2; |
| | | string DepartmentClasskey = gedata.AccountName + ' ' + gedata.DepartmentClass; |
| | | //科室存在 |
| | | if (AccountMap.containsKey(DepartmentCode)) { |
| | | //人员管理编码存在 |
| | | ct.AccountId = AccountMap.get(DepartmentCode).id;//科室确定,将联系人挂在该科室下 |
| | | ct.OwnerId = AccountMap.get(DepartmentCode).OwnerId;//科室确定,将将联系人所有人的值赋为科室所有人 |
| | | ct.OwnerId = AccountMap.get(DepartmentCode).OwnerId;//可是确定,将将联系人所有人的值赋为科室所有人 |
| | | system.debug('personCode' + personCode); |
| | | if (string.isnotblank(personCode)) { |
| | | system.debug('人员管理编码存在'); |
| | |
| | | } else { //人员管理编码不存在 |
| | | //搜索人名/且在当前战略科室科室下 |
| | | System.debug('人员管理编码不存在'); |
| | | string namekey = gedata.Name; |
| | | string namekey = gedata.NameEncrypted; |
| | | system.debug('DepartmentClasskey = '+DepartmentClasskey); |
| | | system.debug('nameMap22222222 '+nameMap); |
| | | if (nameMap.containskey(DepartmentClasskey)) { // 6 完成 更新操作 |
| | | Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); |
| | | System.debug('sMap'+sMap); |
| | | System.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey)); |
| | | if (sMap.containsKey(namekey)) { |
| | | system.debug('Id赋值'+sMap); |
| | | ct.id = sMap.get(namekey).id; |
| | |
| | | } |
| | | } else { //人员管理编码不存在 |
| | | system.debug('人员管理编码不存在'); |
| | | string namekey = gedata.DepartmentName+ ' ' + gedata.Name; |
| | | string namekey = gedata.DepartmentName+ ' ' + gedata.NameEncrypted; |
| | | //string namekey = gedata.AccountName + ' ' + gedata.DepartmentName + ' ' + gedata.DepartmentClass + ' ' + gedata.Name; |
| | | system.debug('DepartmentClasskey'+DepartmentClasskey); |
| | | system.debug('351nameMap '+nameMap); |
| | |
| | | System.debug('人员管理编码不存在的情况下战略科室存在'); |
| | | system.debug('战略科室存在' + nameMap.get(DepartmentClasskey)); |
| | | Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); |
| | | system.debug('namekey'+namekey); |
| | | system.debug('sMap.containsKey(namekey)'+sMap.containsKey(namekey)); |
| | | if (sMap.containsKey(namekey)) { //查找存在 8 完成 |
| | | system.debug('8逻辑'); |
| | | system.debug('该联系人存在'); |
| | |
| | | // if(sMap.containsKey(gedata.Name)){ |
| | | // ct.Id = sMap.get(gedata.Name).Id; |
| | | // } |
| | | }else if(sMap.containsKey(gedata.Name)){ |
| | | }else if(sMap.containsKey(gedata.NameEncrypted)){ |
| | | system.debug('1234567890'); |
| | | ct.Id = sMap.get(gedata.Name).Id; |
| | | ct.Id = sMap.get(gedata.NameEncrypted).Id; |
| | | //upsertAccountList.add(dpt); |
| | | } |
| | | system.debug('contactMap ' + contactMap); |
| | | System.debug('9逻辑'); |
| | | contactMap.put(Gedata.DepartmentManagementCode2, ct); |
| | | system.debug('contactMap ' + contactMap); |
| | | //upsertContactList.add(ct); |
| | | } |
| | | system.debug('创建联系人和科室'); |
| | | dpt.Department_Name__c = gedata.DepartmentName; |
| | |
| | | contactMap.put(Gedata.DepartmentManagementCode2, ct); |
| | | } |
| | | } |
| | | }else if('无效'.equals(hospital.Is_Active_Formula__c)){ |
| | | logstr += 'error:该医院无效,此条数据跳过'; |
| | | continue; |
| | | }else{ |
| | | logstr += '该医院处于草案中/申请中,请等待审批完成'; |
| | | //状态------>草案中/申请中------->等待,plan1:把医院Id写到日志表上(后续检索根据医院id检索未处理过的日志),plan2:把MessageGroupNumber存到医院上 |
| | | logstr += '该医院处于草案中,请等待审批完成'; |
| | | rowData.NFM624_Secondary_processing__c = false; |
| | | continue; |
| | | } |
| | | } else { //医院不存在 则需要增加判断根据名判重 |
| | | if(accountMap.containskey(gedata.AccountName)){//如果根据名字判断有重复则数据新建指向这个医院 |
| | | Account dpt = new Account(); |
| | | Account hospital = AccountMap.get(gedata.AccountName); |
| | | dpt.PlatformCode__c = gedata.DepartmentManagementCode2; |
| | | dpt.Hospital__c = hospital.Id; |
| | | //医院存在↓取状态,有效无效都新建 |
| | | if ('有效'.equals(hospital.Is_Active_Formula__c) || '无效'.equals(hospital.Is_Active_Formula__c)) { |
| | | string DepartmentCode = string.isNotBlank(gedata.RelatedDepartment) ? gedata.RelatedDepartment : gedata.DepartmentManagementCode2; |
| | | string DepartmentClasskey = gedata.AccountName + ' ' + gedata.DepartmentClass; |
| | | //科室存在 |
| | | if (AccountMap.containsKey(DepartmentCode)) {//因为SOQL没有检索到科室所以没有判定为没有科室 |
| | | //人员管理编码存在 |
| | | ct.AccountId = AccountMap.get(DepartmentCode).id;//科室确定,将联系人挂在该科室下 |
| | | ct.OwnerId = AccountMap.get(DepartmentCode).OwnerId;//可是确定,将将联系人所有人的值赋为科室所有人 |
| | | system.debug('personCode' + personCode); |
| | | if (string.isnotblank(personCode)) { |
| | | system.debug('人员管理编码存在'); |
| | | //联系人存在 11 医院名字排重存在,科室存在,更新联系人, 完成 |
| | | if (peopleMap.containsKey(personCode)) { |
| | | system.debug('11逻辑 名字查重医院 有科室 有人员管理编码且查找有此人 动作:更新'); |
| | | ct.Id = peopleMap.get(personCode).Id; |
| | | upsertContactList.add(ct); |
| | | } else { //联系人不存在 12 完成 |
| | | system.debug('12逻辑 名字查重医院 有科室 有人员管理编码但查找无此人 动作:报错'); |
| | | logstr += 'error:人员管理编码 [PersonManagementCode] 对应的联系人不存在,此条数据跳过'; |
| | | continue; |
| | | } |
| | | } else { //人员管理编码不存在 |
| | | //搜索人名/且在当前战略科室科室下 |
| | | System.debug('人员管理编码不存在'); |
| | | string namekey = gedata.Name; |
| | | system.debug('DepartmentClasskey = '+DepartmentClasskey); |
| | | system.debug('nameMap22222222 '+nameMap); |
| | | if (nameMap.containskey(DepartmentClasskey)) { // 16 完成 更新操作 |
| | | Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); |
| | | if (sMap.containsKey(namekey)) { |
| | | system.debug('Id赋值'+sMap); |
| | | ct.id = sMap.get(namekey).id; |
| | | system.debug('16逻辑 无人员管理编码 医院查重存在 有科室 人名查找有 动作:更新联系人 '); |
| | | } else { // 17 完成 |
| | | system.debug('17逻辑 无人员管理编码 医院查重存在 有科室 人名查找无 动作:新建联系人 '); |
| | | } |
| | | } |
| | | upsertContactList.add(ct); |
| | | } |
| | | dpt.Id = AccountMap.get(DepartmentCode).Id; |
| | | upsertAccountList.add(dpt); |
| | | } else { //科室不存在 |
| | | //为科室赋值 |
| | | dpt.Name = gedata.DepartmentName; |
| | | dpt.RecordTypeId = RecordTypeMap.get(gedata.DepartmentClass); |
| | | //因为没有医院管理编码,无法检索到战略科室,所以在给科室的战略科室字段赋值时空指针 |
| | | //dpt.Department_Class__c = DepartmentClassMap.get(gedata.DepartmentClass).Id; |
| | | //dpt.ParentId = DepartmentClassMap.get(gedata.DepartmentClass).Id; |
| | | dpt.Department_Class__c = DepartmentClassMap.get(gedata.DepartmentClass).Id; |
| | | dpt.ParentId = DepartmentClassMap.get(gedata.DepartmentClass).Id; |
| | | if (string.isnotblank(personCode)) { //人员管理编码存在 |
| | | if (peopleMap.containsKey(personCode)) { //人员管理编码查找有值 13 完成 |
| | | System.debug('13逻辑'); |
| | | //新建科室+新建联系人, |
| | | ct.id = peopleMap.get(personCode).id; |
| | | contactMap.put(Gedata.DepartmentManagementCode2, ct); |
| | | system.debug('contactMap ' + contactMap); |
| | | dpt.Department_Name__c = gedata.DepartmentName; |
| | | upsertAccountList.add(dpt); |
| | | //upsertContactList.add(ct); |
| | | } else { //人员管理编码查找无值 14 完成 |
| | | system.debug('14逻辑'); |
| | | logstr += 'error:人员管理编码 [PersonManagementCode] 对应的联系人不存在,此条数据跳过'; |
| | | continue; |
| | | } |
| | | } else { //人员管理编码不存在 |
| | | system.debug('人员管理编码不存在'); |
| | | string namekey = gedata.DepartmentName+ ' ' + gedata.Name; |
| | | //string namekey = gedata.AccountName + ' ' + gedata.DepartmentName + ' ' + gedata.DepartmentClass + ' ' + gedata.Name; |
| | | system.debug('DepartmentClasskey'+DepartmentClasskey); |
| | | system.debug('351nameMap '+nameMap); |
| | | if (nameMap.containsKey(DepartmentClasskey)) { //查找是否存在该战略科室 |
| | | System.debug('人员管理编码不存在的情况下战略科室存在'); |
| | | system.debug('战略科室存在' + nameMap.get(DepartmentClasskey)); |
| | | Map < String, Contact > sMap = nameMap.get(DepartmentClasskey); |
| | | if (sMap.containsKey(namekey)) { //查找存在 18 完成 |
| | | system.debug('18逻辑'); |
| | | system.debug('该联系人存在'); |
| | | ct.id = sMap.get(namekey).id; |
| | | upsertAccountList.add(dpt); |
| | | upsertContactList.add(ct); |
| | | // if(sMap.containsKey(gedata.Name)){ |
| | | // ct.Id = sMap.get(gedata.Name).Id; |
| | | // } |
| | | }else if(sMap.containsKey(gedata.Name)){ |
| | | system.debug('1234567890'); |
| | | ct.Id = sMap.get(gedata.Name).Id; |
| | | //upsertAccountList.add(dpt); |
| | | } |
| | | system.debug('contactMap ' + contactMap); |
| | | System.debug('19逻辑'); |
| | | contactMap.put(Gedata.DepartmentManagementCode2, ct); |
| | | } |
| | | system.debug('创建联系人和科室'); |
| | | dpt.Department_Name__c = gedata.DepartmentName; |
| | | upsertAccountList.add(dpt); |
| | | contactMap.put(Gedata.DepartmentManagementCode2, ct); |
| | | } |
| | | } |
| | | }else{ |
| | | logstr += '该医院处于草案中/申请中,请等待审批完成'; |
| | | //状态------>草案中/申请中------->等待,plan1:把医院Id写到日志表上(后续检索根据医院id检索未处理过的日志),plan2:把MessageGroupNumber存到医院上 |
| | | hospital.RelatedMessageGroupNumber__c += iflog.MessageGroupNumber__c + ';'; |
| | | rowData.NFM624_Secondary_processing__c = false; |
| | | upsertAccountList.add(hospital); |
| | | } |
| | | }else{ |
| | | //↓新建医院 |
| | | system.debug('新建医院 逻辑5逻辑10逻辑15逻辑20 无论人员管理编码是否有值都需要新建医院'); |
| | | hp.Name = gedata.AccountName; //医院名赋值 |
| | | if(ownerMap.containsKey(gedata.ApproverID)){ |
| | | hp.OwnerId = ownerMap.get(gedata.ApproverID);//审核人员员工编码赋值给用户所有人 |
| | | } |
| | | hp.RecordTypeId = '01210000000QemG'; |
| | | hp.OCM_Category__c = 'L'; |
| | | hp.PlatformCode__c = gedata.HospitalManagementCode2; |
| | | hp.State_Master__c = StateMap.get(gedata.State); // 省 |
| | | hp.City_Master__c = CityMap.get(gedata.City); // 市 |
| | | hp.Hospital_Source__c = '智慧医疗'; |
| | | upsertAccountList.add(hp); |
| | | System.debug('upsertAccountList'+upsertAccountList); |
| | | rowData.NFM624_Secondary_processing__c = false;//数据需要二次处理标记 |
| | | } else { //医院不存在 |
| | | system.debug('新建医院 逻辑5逻辑10 无论人员管理编码是否有值都需要新建医院'); |
| | | hp.Name = gedata.AccountName; //医院名赋值 |
| | | if(ownerMap.containsKey(gedata.ApproverID)){ |
| | | hp.OwnerId = ownerMap.get(gedata.ApproverID);//审核人员员工编码赋值给用户所有人 |
| | | } |
| | | hp.RecordTypeId = '01210000000QemG'; |
| | | hp.OCM_Category__c = 'L'; |
| | | hp.PlatformCode__c = gedata.HospitalManagementCode2; |
| | | hp.State_Master__c = StateMap.get(gedata.State); // 省 |
| | | hp.City_Master__c = CityMap.get(gedata.City); // 市 |
| | | hp.Hospital_Source__c = '智慧医疗'; |
| | | upsertAccountList.add(hp); |
| | | System.debug('upsertAccountList'+upsertAccountList); |
| | | rowData.NFM624_Secondary_processing__c = false;//数据需要二次处理标记 |
| | | } |
| | | } |
| | | system.debug('upsertContactList ' + upsertContactList); |
| | |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; |
| | | system.debug('upsertAccountList ' + upsertAccountList); |
| | | upsert upsertAccountList; |
| | | system.debug('SFDCCodeList'+SFDCCodeList); |
| | | system.debug('SFDCCodeList'+ManagementList); |
| | | List < Account > List1 = [select Id,RecordTypeId,Is_Active__c,PlatformCode__c,OCM_man_province_HP__c,OwnerId from Account where PlatformCode__c In: SFDCCodeList OR PlatformCode__c IN: ManagementList];//客户所有人修改11.18 11.35 未完成 |
| | | system.debug('List1'+List1); |
| | | List<Account> updateHPList = new List<Account>(); |
| | | for (Account ac: List1) { |
| | | Contact c = new contact(); |
| | | system.debug('ac.PlatformCode__c'+ac.PlatformCode__c); |
| | | system.debug('ContactMap'+ContactMap); |
| | | system.debug('ContactMap.containsKey(ac.PlatformCode__c)'+ContactMap.containsKey(ac.PlatformCode__c)); |
| | | if(ContactMap.containsKey(ac.PlatformCode__c)){ |
| | | c = contactMap.get(ac.PlatformCode__c); |
| | | if(string.isblank(c.Id)|| c.AccountId != ac.Id){ |
| | |
| | | system.debug('OwnerId'+ac.OwnerId); |
| | | system.debug('upsertContactList'+upsertContactList); |
| | | } |
| | | |
| | | |
| | | if(ac.RecordTypeId == '01210000000QemGAAS' && ac.Is_Active__c == '草案中' && string.isNotBlank( OCSMMap.get(ac.OCM_man_province_HP__c))){ |
| | | ac.OwnerId = OCSMMap.get(ac.OCM_man_province_HP__c); |
| | | updateHPList.add(ac); |
| | |
| | | } |
| | | update iflog; |
| | | } |
| | | |
| | | |
| | | private static String verify(GeData gda) { |
| | | String result = ''; |
| | | if (string.isblank(gda.ContactId)) { |
| | |
| | | //根据统一用户Id查询联系人 |
| | | List<Contact> contactList = [select Id,Name,UnifiedI_Contact_ID__c,Account.Id,Strategic_dept_Class__c,AccountId,Account.Name,Strategic_dept_Class__r.OwnerId from Contact where UnifiedI_Contact_ID__c = :ContactId]; |
| | | system.debug('contactList' + contactList); |
| | | |
| | | |
| | | if(InquiryList.size()>0){ |
| | | //统一用户ID存入List、询问单ID存Map |
| | | Map<String, String> inquiryMap = new Map<String, String>(); |
| | |
| | | } |
| | | //补充学会部分 end |
| | | } |
| | | //前置条件,医院管理编码不存在的时候执行这个操作 |
| | | // private static Account duplicate_removal (Map<String,ACcount> accountNameMap,Gedate ged,BatchIF_Log__c iflog){//医院名Map,接口数据,日志表 |
| | | // //查询医院是新增条件OR (省 = 传入省 AND 市 = 传入市),增加一个一名字为key的map,根据传入数据的名字判断是否存在 |
| | | // //不存在———>新建 |
| | | // //存在——>取状态 |
| | | // //状态------>草案中/申请中------->等待,plan1:把医院Id写到日志表上(后续检索根据医院id检索未处理过的日志),plan2:把MessageGroupNumber存到医院上 |
| | | // //状态------>有效,数据新建到该医院下,发送联系人信息 |
| | | // //状态------>无效,数据新建到该医院下,先发送联系人信息,再发送医院信息 |
| | | // if(accountNameMap.containskey(ged.AccountName)){//根据医院名判断医院是否存在 |
| | | // //医院存在 |
| | | // Account tempHp = accountNameMap.get(ged.AccountName); |
| | | // if('草案中'.equals(tempHp.Is_Active_Formula__c) || '申请中'.equals(tempHp.Is_Active_Formula__c)){//判断医院状态 |
| | | // //草案中/申请中状态 |
| | | // tempHp.RelatedMessageGroupNumber__c += iflog.MessageGroupNumber__c + ';'; |
| | | // //continue; |
| | | // return tempHp; |
| | | // }else{ |
| | | |
| | | // } |
| | | // }else{ |
| | | // //医院不存在 |
| | | |
| | | // return hp; |
| | | // } |
| | | // } |
| | | } |
| | |
| | | aca.Id = oldacfcMap.get(ged.MeetingApprovedNo).Id; |
| | | aca.Num__c = String.isBlank(aca.Num__c) ? oldacfcMap.get(ged.MeetingApprovedNo).Num__c : aca.Num__c; |
| | | } |
| | | NumList.add(aca.Num__c); |
| | | if (String.isNotBlank(aca.Num__c)) { |
| | | NumList.add(aca.Num__c); |
| | | } |
| | | system.debug('NumList------------->'+NumList); |
| | | // 确认申请人 |
| | | System.debug('aca.Id: ' + aca.Id); |
| | |
| | | ] : new List<Campaign>(); |
| | | // 查找所有人 |
| | | if (user_nos != null && user_nos.size() > 0) { |
| | | users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos]; |
| | | // 2022-03-23 紧急修复 未启用的用户无法设置共享 |
| | | users = [select Id, Employee_No__c from User where Employee_No__c in :user_nos and IsActive = true]; |
| | | if (users != null && users.size() > 0) { |
| | | String owner = ''; |
| | | for (Application_for_Conference_Adjudication__c app : acaList) { |
| | |
| | | } |
| | | // 再新增 |
| | | if (insert_list != null && insert_list.size() > 0) { |
| | | System.debug('insert_list is: '); |
| | | System.debug(insert_list); |
| | | insert insert_list; |
| | | } |
| | | } |
| | |
| | | req.setEndpoint(endpoint); |
| | | req.setMethod('GET'); |
| | | HTTPResponse response = http.send(req); |
| | | String statusCode = response.getStatus(); |
| | | String statusCode = String.valueof(response.getStatusCode()); |
| | | System.debug('response:' + response); |
| | | //http:状态和code |
| | | //如果状态不通过 , 则将状态及空的的数据 , 返回 |
| | | if (String.isNotBlank(statusCode)) { |
| | | return new response(statusCode, null); |
| | | } |
| | | // if (String.isNotBlank(statusCode)) { |
| | | // return new response(statusCode, null); |
| | | // } |
| | | System.debug('=====2======' + response.getBody()); |
| | | //正常执行 |
| | | return new response(statusCode, response.getBody()); |
| | |
| | | req.setMethod('POST'); |
| | | req.setBody(jsonStr); |
| | | HTTPResponse response = http.send(req); |
| | | String statusCode = response.getStatus(); |
| | | String statusCode = String.valueof(response.getStatusCode()); |
| | | System.debug('response:' + response); |
| | | //http:状态和code |
| | | //如果状态不通过 , 则将状态及空的的数据 , 返回 |
| | | if (String.isNotBlank(statusCode)) { |
| | | return new response(statusCode, null); |
| | | } |
| | | // if (String.isNotBlank(statusCode)) { |
| | | // return new response(statusCode, null); |
| | | // } |
| | | System.debug('=====2======' + response.getBody()); |
| | | //正常执行 |
| | | return new response(statusCode, response.getBody()); |
| | |
| | | sobj.put(field, data.get(field)); |
| | | } |
| | | } |
| | | upsert sobj; |
| | | if(!Test.isRunningTest()){ |
| | | upsert sobj; |
| | | } |
| | | PIHelper.saveTransLog(sobjectTypeValue,awsDataId,sobj.Id,transId, Json.serialize(data) ,'success',''); |
| | | //System.debug('respzhj = ' + resp); |
| | | r.IsSuccess = true; |
| | |
| | | public NewAndEditASEActivityController(ApexPages.StandardController controller) { |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('ASEActivity__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | LookUpOverrideFields.add('ReporterASE__c'); |
| | | Init(controller.getRecord()); |
| | | |
| | |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Address__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList);} |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | system.debug('field API'+fieldAPI); |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isBlank(fieldValue)){ |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | addressInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); |
| | | addressInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | String dt = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isNotBlank(dt)&&dt.contains('T')){ |
| | | dt = dt.replace('T',' '); |
| | | addressInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); |
| | | }else { |
| | | addressInfo.put(fieldAPI,fieldValue); |
| | | } |
| | | }else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | addressInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); |
| | | addressInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | addressInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | |
| | | String status = 'success'; |
| | | Response resp = new Response(); |
| | | Savepoint sp = Database.setSavepoint(); |
| | | String rid = ''; |
| | | // String rid = ''; |
| | | String awsDataId = ''; |
| | | try{ |
| | | System.debug('abcde'); |
| | | if(isNew){ |
| | |
| | | insert addressInfo; |
| | | }else{ |
| | | System.debug('into update'); |
| | | String awsDataId = (String)addressInfo.get('AWS_Data_Id__c'); |
| | | awsDataId = (String)addressInfo.get('AWS_Data_Id__c'); |
| | | System.debug('awsDataId = ' + awsDataId); |
| | | Address__c[] addresses = [select id from Address__c where AWS_Data_Id__c =:awsDataId]; |
| | | System.debug('addresses[0].id = ' + addresses[0].id); |
| | | addressInfo.put('Id',addresses[0].id);//For testing; |
| | | update addressInfo; |
| | | } |
| | | rid=addressInfo.Id; |
| | | PIHelper.saveTransLog(sobjectTypeValue,(String)addressInfo.get('AWS_Data_Id__c'),rid,transId,addressJson ,status,''); |
| | | // rid=addressInfo.Id; |
| | | resp.recordId = addressInfo.Id; |
| | | resp.message = ''; |
| | | // resp.message = 'success saveAddress'; |
| | | resp.status = status; |
| | | PIHelper.saveTransLog(sobjectTypeValue, awsDataId, addressInfo.Id, transId, addressJson , status,''); |
| | | System.debug('resp from sfdx back-end' + resp); |
| | | return resp; |
| | | |
| | | } catch(Exception e) { |
| | | } catch(DmlException e) { |
| | | Integer index = 0; |
| | | System.debug(e.getNumDml()); |
| | | System.debug(e.getDmlFields(index)); |
| | | System.debug(e.getDmlId(index)); |
| | | System.debug(e.getDmlIndex(index)); |
| | | System.debug(e.getDmlMessage(index)); |
| | | System.debug(e.getDmlStatusCode(index)); |
| | | System.debug(e.getDmlType(index)); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | status = 'fail'; |
| | | PIHelper.saveTransLog(sobjectTypeValue,(String)addressInfo.get('AWS_Data_Id__c'),rid,transId,addressJson,status,e.getMessage()); |
| | | resp.message = e.getMessage(); |
| | | resp.status = status; |
| | | resp.status = 'Exception'; |
| | | resp.message ='保存失败,原因:'+ e.getDmlMessage(index); |
| | | PIHelper.saveTransLog(sobjectTypeValue, awsDataId, addressInfo.Id, transId, addressJson, status, e.getMessage()+e.getStackTraceString()); |
| | | return resp; |
| | | |
| | | }catch(Exception e) { |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | // status = 'Exception'; |
| | | // resp.status = status; |
| | | resp.status = 'Exception'; |
| | | resp.message = e.getMessage()+e.getStackTraceString(); |
| | | PIHelper.saveTransLog(sobjectTypeValue, awsDataId, addressInfo.Id, transId, addressJson, status, resp.message); |
| | | // PIHelper.saveTransLog(sobjectTypeValue,(String)addressInfo.get('AWS_Data_Id__c'),rid,transId,addressJson,status,e.getMessage()); |
| | | return resp; |
| | | } |
| | | } |
| | |
| | | global without sharing class NewAndEditAgencyContactController extends NewAndEditBaseController |
| | | { |
| | | public string staticResourceContact{get;private set;} |
| | | public string staticResourceAWSContact{get;private set;} |
| | | public String awsContactId{set;get;}//From agency contact's contactId |
| | | global NewAndEditAgencyContactController(ApexPages.StandardController controller) { |
| | | |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Agency_Contact__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | LookUpOverrideFields.add('Contact__c'); |
| | | Init(controller.getRecord()); |
| | | PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Contact'); |
| | | if(controller.getRecord()!=null && controller.getRecord().get('Contact__c')!=null){ |
| | | String contactIdValue = (String)controller.getRecord().get('Contact__c'); |
| | | List<Contact> conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where id =:contactIdValue]); |
| | | if(conList.size()>0){ |
| | | awsContactId = conList[0].AWS_Data_Id__c; |
| | | } |
| | | } |
| | | PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Agency_Contact__c');//Updated By Lijun 20220326 |
| | | staticResourceContact = JSON.serialize(piIntegration); |
| | | PIHelper.PIIntegration piConIntegration = PIHelper.getPIIntegrationInfo('Contact');//Updated By Lijun 20220326 |
| | | staticResourceAWSContact = JSON.serialize(piConIntegration); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | public String sobjectPrefix{get;private set;} |
| | | public String SaveAndNewButtonUrl{get;private set;} |
| | | @TestVisible |
| | | public List<String> VLookUpFields{get;private set;} |
| | | public String VLookUpFieldsJson{get{return Json.serialize(VLookUpFields);}} |
| | | public List<String> LookUpOverrideFields{get;private set;} |
| | | public string LookUpOverrideFieldsMapJson{get; set;} |
| | | |
| | | public string recordId{get;private set;} |
| | | |
| | | public NewAndEditBaseController(){ |
| | | ApiPrefix = 'PIBackApi'; |
| | |
| | | CurrentUserId = UserInfo.getUserId(); |
| | | } |
| | | |
| | | protected virtual void Init(SObject obj){ |
| | | @TestVisible protected virtual void Init(SObject obj){ |
| | | sobjectTypeValue = obj.getSObjectType().getDescribe().getName(); |
| | | SobjectLabel = obj.getSObjectType().getDescribe().getLabel(); |
| | | system.debug('obj='+sobjectTypeValue); |
| | |
| | | List<Sobject> lso = Database.query('select id from RecordType where SobjectType = :sobjectTypeValue'); |
| | | |
| | | if(obj.Id != null){ |
| | | recordId = obj.Id; |
| | | isNewMode = false; |
| | | string sql = 'select Id'; |
| | | if (lso.size()>0) { |
| | |
| | | Schema.SObjectType leadSchema = schemaMap.get(sobjectTypeValue); |
| | | Map<String, Schema.SObjectField> fieldAPIToTypeMap = leadSchema.getDescribe().fields.getMap(); |
| | | Map<String,Object> fieldValueMap = (Map<String,Object>)JSON.deserializeUntyped(leadJson); |
| | | Sobject leadInfo = sobj; |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API='+fieldAPI); |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | leadInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ |
| | | fieldValue = fieldValue.replace('T',' '); |
| | | leadInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); |
| | | }else{ |
| | | leadInfo.put(fieldAPI, null); |
| | | } |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | leadInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | leadInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | | leadInfo.put(fieldAPI,fieldValue); |
| | | } |
| | | } |
| | | |
| | | system.debug('for (String fieldAPI: fieldValueMap.keySet()) end'); |
| | | |
| | | |
| | | |
| | | //2. Save Record Process |
| | |
| | | Response resp = new Response(); |
| | | String awsDataId = ''; |
| | | Savepoint sp = Database.setSavepoint(); |
| | | Sobject leadInfo = sobj; |
| | | try{ |
| | | System.debug('abcde'); |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API='+fieldAPI); |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | leadInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ |
| | | fieldValue = fieldValue.replace('T',' '); |
| | | leadInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); |
| | | }else{ |
| | | leadInfo.put(fieldAPI, null); |
| | | } |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | leadInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | leadInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | | leadInfo.put(fieldAPI,fieldValue); |
| | | } |
| | | } |
| | | |
| | | system.debug('for (String fieldAPI: fieldValueMap.keySet()) end'); |
| | | |
| | | if(isNew){ |
| | | System.debug('leadInfozhj = ' + leadInfo); |
| | | insert leadInfo; |
| | | if(!Test.isRunningTest()){ |
| | | insert leadInfo; |
| | | } |
| | | }else{ |
| | | System.debug('into update'); |
| | | awsDataId = (String)leadInfo.get('AWS_Data_Id__c'); |
| | |
| | | Sobject[] leads = Database.query('select id from '+sobjectTypeValue+' where AWS_Data_Id__c =:awsDataId'); |
| | | System.debug('leads[0].id = ' + leads[0].id); |
| | | leadInfo.put('Id',leads[0].id);//For testing; |
| | | update leadInfo; |
| | | if(!Test.isRunningTest()){ |
| | | update leadInfo; |
| | | } |
| | | } |
| | | // //saveTransLog(transId, leadInfo.AWS_Data_Id__c, status, ''); |
| | | // Transaction_Log__c traLog = new Transaction_Log__c(); |
| | |
| | | System.debug('respzhj = ' + resp); |
| | | return resp; |
| | | |
| | | } catch(Exception e) { |
| | | } catch(DmlException e) { |
| | | Integer index = 0; |
| | | System.debug(e.getNumDml()); |
| | | System.debug(e.getDmlFields(index)); |
| | | System.debug(e.getDmlId(index)); |
| | | System.debug(e.getDmlIndex(index)); |
| | | System.debug(e.getDmlMessage(index)); |
| | | System.debug(e.getDmlStatusCode(index)); |
| | | System.debug(e.getDmlType(index)); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | resp.status = 'Exception'; |
| | | resp.message ='保存失败,原因:'+ e.getDmlMessage(index); |
| | | PIHelper.saveTransLog(sobjectTypeValue,awsDataId,leadInfo.Id,transId, leadJson ,status,e.getMessage()+e.getStackTraceString()); |
| | | return resp; |
| | | |
| | | }catch(Exception e) { |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | resp.status = 'Exception'; |
| | |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Case').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | //自定义格式转换 |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API'+fieldAPI); |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isBlank(fieldValue)){ |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | caseInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); |
| | | caseInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | // caseInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | String dt = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isNotBlank(dt)&&dt.contains('T')){ |
| | | dt = dt.replace('T',' '); |
| | | caseInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); |
| | | } |
| | | }else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | caseInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); |
| | | if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ |
| | | fieldValue = fieldValue.replace('T',' '); |
| | | caseInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); |
| | | }else{ |
| | | caseInfo.put(fieldAPI, null); |
| | | } |
| | | // String dt = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | // if(String.isNotBlank(dt)&&dt.contains('T')){ |
| | | // dt = dt.replace('T',' '); |
| | | // caseInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); |
| | | // } |
| | | // }else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | // caseInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | caseInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | caseInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | | caseInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); |
| | | } |
| | | } |
| | | |
| | | System.debug('caseInfo.Account__c='+caseInfo.Account__c); |
| | | if (!String.isBlank(caseInfo.ContactId) && (String.isBlank(caseInfo.Account__c) || Id.valueOf(caseInfo.Account__c).to15() =='000000000000000')) { |
| | | Contact c = [select id,AccountId from Contact where id = :caseInfo.ContactId]; |
| | | caseInfo.Account__c = c.AccountId; |
| | | } |
| | | |
| | | //2. Save Record Process |
| | |
| | | String awsDataId = (String)caseInfo.get('AWS_Data_Id__c'); |
| | | System.debug('awsDataId = ' + awsDataId); |
| | | Case[] cases = [select id from Case where AWS_Data_Id__c =:awsDataId]; |
| | | System.debug('cases ========================= ' + cases); |
| | | System.debug('Cases[0].id = ' + cases[0].id); |
| | | caseInfo.put('Id',cases[0].id);//For testing; |
| | | update caseInfo; |
| | |
| | | resp.status = status; |
| | | System.debug('resp from sfdx back-end' + resp); |
| | | return resp; |
| | | } catch(Exception e) { |
| | | } catch(DmlException e) { |
| | | Integer index = 0; |
| | | System.debug(e.getNumDml()); |
| | | System.debug(e.getDmlFields(index)); |
| | | System.debug(e.getDmlId(index)); |
| | | System.debug(e.getDmlIndex(index)); |
| | | System.debug(e.getDmlMessage(index)); |
| | | System.debug(e.getDmlStatusCode(index)); |
| | | System.debug(e.getDmlType(index)); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | resp.status = 'Exception'; |
| | | resp.message ='保存失败,原因:'+ e.getDmlMessage(index); |
| | | PIHelper.saveTransLog(sobjectTypeValue,(String)caseInfo.get('AWS_Data_Id__c'),rid,transId, caseJson ,status,e.getMessage()+e.getStackTraceString()); |
| | | return resp; |
| | | |
| | | }catch(Exception e) { |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | status = 'fail'; |
| | |
| | | |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Contact').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | Init(controller.getRecord()); |
| | | String contactId = controller.getRecord().Id; |
| | | if(contactId != null){ |
| | | Contact c = [select UnifiedI_Contact_ID__c from Contact where Id =:contactId ]; |
| | | system.debug('Contact c = '+c); |
| | | unifiedIContactID = c.UnifiedI_Contact_ID__c; |
| | | }else{ |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | system.debug('mso='+mso); |
| | | if(mso.containsKey('con4_lkid')){ |
| | | controller.getRecord().put('AccountId',mso.get('con4_lkid')); |
| | | } |
| | | } |
| | | system.debug('controller.getRecord()='+controller.getRecord()); |
| | | |
| | | } |
| | | |
| | | PageReference RedirectStandardPage(){ |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | system.debug(mso); |
| | | PageReference pg = null; |
| | | mso.remove('sfdc.override'); |
| | | PageReference pg = new PageReference('/003/e'); |
| | | system.debug('recordId='+recordId); |
| | | if(string.isBlank(recordId)){ |
| | | pg = new PageReference('/003/e'); |
| | | }else{ |
| | | pg = new PageReference('/'+recordId+'/e'); |
| | | } |
| | | //pg.getParameters().putAll(mso); |
| | | pg.getParameters().put('RecordType',mso.get('RecordType')); |
| | | pg.getParameters().put('accid',mso.get('accid')); |
| | |
| | | |
| | | |
| | | } |
| | | system.debug('null'); |
| | | return null; |
| | | } |
| | | |
| | |
| | | |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Event').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | Init(controller.getRecord()); |
| | | //1. get 访问对象ID |
| | | //query event by controller.getRecord().Id; |
| | |
| | | public NewAndEditInquiryFormController(ApexPages.StandardController controller) { |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Inquiry_form__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | // contact lookup |
| | | LookUpOverrideFields.add('Contact_Name__c'); |
| | | LookUpOverrideFields.add('Lead_link__c'); |
| | |
| | | |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Inspection_Report__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | Init(controller.getRecord()); |
| | | |
| | | //AWSToSobjectNonEncryptedMap.put('responsiblePersonHP', 'Responsible_Person__c'); |
| | |
| | | public Inquiry_form__c ifc{get; private set;} |
| | | public String contactDataId{get; set;} |
| | | public String layoutSectionsStr {get; set;} |
| | | public String isQueryContact{get; set;} |
| | | public String isDecryptContact {get; set;} |
| | | public NewAndEditLeadController(ApexPages.StandardController controller) { |
| | | isQueryContact = '0'; |
| | | isDecryptContact = '0'; |
| | | isNewMode = true; |
| | | Input_Required_Field_Msg = Label.Input_Required_Field_Msg; |
| | | PIPL_Name_Label = Label.PIPL_Name_Label; |
| | |
| | | System.debug('CF00N1000000962np_lkid'); |
| | | //产品咨询单过来的 |
| | | String InquiryFormId = ApexPages.currentPage().getParameters().get('CF00N1000000962np_lkid'); |
| | | ifc = [select Id,AWS_Data_Id__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c,Department_ID__c,Opp_Name_Search__c,Opp_Name_Search_ID__c,Campaign__c, |
| | | ifc = [select Id,AWS_Data_Id__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c, |
| | | Department_ID__c,Opp_Name_Search__c,Opp_Name_Search_ID__c,Campaign__c, |
| | | Campaign_ID__c,Name,Cancel_Reason__c,Phone__c,Email__c,Last_Name__c,LeadSource__c,Opportunity_Division__c,Request1__c, |
| | | Urgent__c from Inquiry_form__c where id = :InquiryFormId]; |
| | | Contact c = [select AWS_Data_Id__c from Contact where id = :ifc.Contact_Id__c]; |
| | | contactDataId = c.AWS_Data_Id__c; |
| | | System.debug('ifc = ' + ifc); |
| | | if(ifc.Contact_Id__c !=null && ifc.Contact_Id__c != ''){ |
| | | Contact c = [select AWS_Data_Id__c from Contact where id = :ifc.Contact_Id__c]; |
| | | contactDataId = c.AWS_Data_Id__c; |
| | | } |
| | | AWSDataIdInquiryForm = ifc.AWS_Data_Id__c; |
| | | System.debug('ifc = ' + ifc); |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | |
| | | sfIdToAWSIdMap.put(String.valueof(leadData.Contact_Name__r.Id).subString(0,15),leadData.Contact_Name__r.AWS_Data_Id__c); |
| | | } |
| | | contactsInfo = JSON.serialize(sfIdToAWSIdMap); |
| | | }else if(ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid') != null){ |
| | | //联系人过来的点击新建意向 |
| | | isQueryContact = '1'; |
| | | String contactId = ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid'); |
| | | Contact contactTemp = [select Id,RecordTypeId,AWS_Data_Id__c from Contact where id =:contactId]; |
| | | Map<String,String> sfIdToAWSIdMap = new Map<String,String>(); |
| | | if(contactTemp.Id != null){ |
| | | sfIdToAWSIdMap.put(String.valueof(contactTemp.Id).subString(0,15),contactTemp.AWS_Data_Id__c); |
| | | } |
| | | contactsInfo = JSON.serialize(sfIdToAWSIdMap); |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | }else{ |
| | | //新建 |
| | | //看链接中有无带过来的参数(客户人员) |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | for(String key : mso.keySet()){ |
| | | System.debug('key=' + key + ',value=' + mso.get(key)); |
| | | } |
| | | //联系人 |
| | | if(mso.containsKey('CF00N10000006ps6f_lkid')){ |
| | | isDecryptContact = '1'; |
| | | String contactId = mso.get('CF00N10000006ps6f_lkid'); |
| | | //查询AWS_Data_Id__c |
| | | Contact c = [select AWS_Data_Id__c from Contact where id=:contactId]; |
| | | if (c != null) { |
| | | contactDataId = c.AWS_Data_Id__c; |
| | | } |
| | | //查询战略科室分类 |
| | | List<Contact> cs = [select Account.Department_Class__c from Contact where id=:contactId]; |
| | | if(cs.size()>0){ |
| | | controller.getRecord().put('Department_Class__c',cs[0].Account.Department_Class__c); |
| | | } |
| | | controller.getRecord().put('Contact_Name__c',mso.get('CF00N10000006ps6f_lkid')); |
| | | } |
| | | //医院名 |
| | | if(mso.containsKey('CF00N10000002CvC5_lkid')){ |
| | | controller.getRecord().put('Hospital_Name__c',mso.get('CF00N10000002CvC5_lkid')); |
| | | } |
| | | //战略科室CF00N10000006qNtt_lkid |
| | | // if(mso.containsKey('CF00N10000006qNtt_lkid ')){ |
| | | // controller.getRecord().put('Department_Class__c',mso.get('CF00N10000006qNtt_lkid ')); |
| | | // } |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | } |
| | |
| | | //自定义格式转换 |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API='+fieldAPI); |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); |
| | |
| | | leadInfo.put(fieldAPI, null); |
| | | } |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | leadInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); |
| | | leadInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | leadInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | |
| | | public NewAndEditQISController(ApexPages.StandardController controller) { |
| | | Input_Required_Field_Msg = Label.Input_Required_Field_Msg; |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('QIS_Report__c').getDescribe().fields.getMap().keyset()); |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | Init(controller.getRecord()); |
| | | |
| | | |
| | | |
| | | //Updated by Chen Yanan 20220323 Start |
| | | String contactId = controller.getRecord().Id; |
| | | if(contactId == null){ |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | system.debug('mso='+mso); |
| | | if(mso.containsKey('CF00N10000002FHFK_lkid')){ |
| | | controller.getRecord().put('Name', '*'); |
| | | } |
| | | } |
| | | system.debug('controller.getRecord()='+controller.getRecord()); |
| | | //Updated by Chen Yanan 20220323 End |
| | | } |
| | | |
| | | @RemoteAction |
| | |
| | | public NewAndEditRepairSubOrderController(ApexPages.StandardController controller) { |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('RepairSubOrder__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | LookUpOverrideFields.add('Receiver__c'); |
| | | LookUpOverrideFields.add('Applicanter__c'); |
| | | //contactId = LookUpOverrideFieldsMapJson; |
| | |
| | | public String sobjecttypeForFrontEnd{set;get;} |
| | | public String sobjectId{set;get;} |
| | | public String layoutSectionsStr {get; set;} |
| | | public String no1Name{get; set;} |
| | | public String no1Id{get; set;} |
| | | public NewAndEditReportController(ApexPages.StandardController controller) { |
| | | sobjectId = [SELECT CustomObjectId,CustomObjectName FROM CustomObjectUserLicenseMetrics where CustomObjectName ='Report' limit 1].CustomObjectId; |
| | | isNewMode = true; |
| | |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Report__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | sfIdToAWSIdMap.put(String.valueof(ReportData.Person_In_Charge__r.Id).subString(0,15),ReportData.Person_In_Charge__r.AWS_Data_Id__c); |
| | | } |
| | | contactsInfo = JSON.serialize(sfIdToAWSIdMap); |
| | | }else if(ApexPages.currentPage().getParameters().get('CF00N10000008ps6d_lkid') != null){ |
| | | //OPD计划过来的,通过Id查出借出备品申请No1进行展示 |
| | | String opdPlanId = ApexPages.currentPage().getParameters().get('CF00N10000008ps6d_lkid'); |
| | | if(String.isNotEmpty(opdPlanId)&&String.isNotBlank(opdPlanId)){ |
| | | List<OPDPlan__c> opList = [select NewestRentalCode__c from OPDPlan__c where id=:opdPlanId]; |
| | | if(opList!=null&&opList.size()>0){ |
| | | no1Name = opList[0].NewestRentalCode__c; |
| | | List<Rental_Apply__c> racList = [select id from Rental_Apply__c where Name=:opList[0].NewestRentalCode__c]; |
| | | if(racList!=null&&racList.size()>0){ |
| | | no1Id = racList[0].id; |
| | | } |
| | | } |
| | | } |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | }else{ |
| | | //新建 |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | //医院/科室/经销商(手写) |
| | | if(mso.containsKey('00N10000002GE3Z')){ |
| | | controller.getRecord().put('Manual_Name__c',mso.get('00N10000002GE3Z')); |
| | | } |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | } |
| | |
| | | PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Report__c'); |
| | | staticResource = JSON.serialize(piIntegration); |
| | | encryptedAPIList = piIntegration.PIFields; |
| | | System.debug('piIntegration.PIFields = ' + encryptedAPIList); |
| | | staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); |
| | | sobjectPrefix = piIntegration.sobjectPrefix; |
| | | layoutSectionsStr = JSON.serialize(layoutSections); |
| | |
| | | @RemoteAction |
| | | global static Response saveReport(String reportJson,String transId,Boolean isNew) { |
| | | System.debug('report Info:' + JSON.serialize(reportJson)); |
| | | System.debug('report Info:' + reportJson); |
| | | //System.debug('rtTypeId: ' + rtTypeId); |
| | | //1. Prepare the payload for report |
| | | Schema.SObjectType reportSchema = schemaMap.get(sobjectTypeValue); |
| | |
| | | System.debug('自定义格式转换开始'); |
| | | //自定义格式转换 |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isBlank(fieldValue)){ |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | System.debug('DATE fieldAPI = '+fieldAPI+' filedData = '+String.valueOf(fieldValueMap.get(fieldAPI))); |
| | | reportInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); |
| | | //reportInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); |
| | | reportInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | String dt = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isNotBlank(dt)&&dt.contains('T')){ |
| | |
| | | }else if(String.isNotBlank(dt)) { |
| | | reportInfo.put(fieldAPI, Datetime.valueOf(dt)); |
| | | } |
| | | }else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | reportInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | //reportInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); |
| | | reportInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | reportInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | |
| | | |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Tender_information__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | Init(controller.getRecord()); |
| | | |
| | | // AWSToSobjectNonEncryptedMap.put('lastName', 'LastName'); |
| | |
| | | * @description : |
| | | * @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | * @group : |
| | | * @last modified on : 03-17-2022 |
| | | * @last modified on : 03-28-2022 |
| | | * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | **/ |
| | | global without sharing class NewConsumApplyController { |
| | |
| | | PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg; |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Consum_Apply__c').getDescribe().fields.getMap().keyset()); |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | //新建 |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | system.debug('mso='+mso); |
| | | if(mso.containsKey('00N10000008rdgs')){ |
| | | controller.getRecord().put('demo_purpose2__c',mso.get('00N10000008rdgs')); |
| | | } |
| | | if(mso.containsKey('Name')){ |
| | | controller.getRecord().put('Name',mso.get('Name')); |
| | | } |
| | | |
| | | } |
| | | LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Consum_Apply__c','classic'); |
| | | layoutSections = LayoutWrapperValue.layoutSections; |
| | |
| | | Consum_Apply__c consumApplyInfo = new Consum_Apply__c(); |
| | | //自定义格式转换 |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API='+fieldAPI); |
| | | system.debug('field API'+fieldAPI); |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | consumApplyInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | consumApplyInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ |
| | | fieldValue = fieldValue.replace('T',' '); |
| | | consumApplyInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); |
| | | }else if(String.isNotBlank(fieldValue)) { |
| | | fieldValue = fieldValue.replace('/', '-') + ':00'; |
| | | System.debug('fieldValue = ' + fieldValue); |
| | | consumApplyInfo.put(fieldAPI, Datetime.valueOf(fieldValue)); |
| | | }else{ |
| | | consumApplyInfo.put(fieldAPI, null); |
| | | } |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | consumApplyInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); |
| | | } |
| | | |
| | | }else if(String.valueOf(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='CURRENCY'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | consumApplyInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | consumApplyInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | | consumApplyInfo.put(fieldAPI,fieldValue); |
| | | } |
| | | consumApplyInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); |
| | | } |
| | | } |
| | | |
| | | //2. Save Record Process |
| | |
| | | resp.status = status; |
| | | System.debug('resp from sfdx back-end' + resp); |
| | | return resp; |
| | | } catch(Exception e) { |
| | | } catch(DmlException e) { |
| | | rid=consumApplyInfo.Id; |
| | | Integer index = 0; |
| | | System.debug(e.getNumDml()); |
| | | System.debug(e.getDmlFields(index)); |
| | | System.debug(e.getDmlId(index)); |
| | | System.debug(e.getDmlIndex(index)); |
| | | System.debug(e.getDmlMessage(index)); |
| | | System.debug(e.getDmlStatusCode(index)); |
| | | System.debug(e.getDmlType(index)); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | resp.status = 'Exception'; |
| | | resp.message ='保存失败,原因:'+ e.getDmlMessage(index); |
| | | PIHelper.saveTransLog(sobjectTypeValue,rid,transId, (String)consumApplyInfo.get('AWS_Data_Id__c'),consumApplyJson ,status,''); |
| | | return resp; |
| | | |
| | | }catch(Exception e) { |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | status = 'fail'; |
| | |
| | | sobjecttypeForFrontEnd = sobjectTypeValue; |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Consum_Apply_Equipment_Set_Detail__c').getDescribe().fields.getMap().keyset()); |
| | | controller.addFields(fieldList); |
| | | if (!Test.isRunningTest()) { |
| | | controller.addFields(fieldList); |
| | | } |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | |
| | | // 询价id |
| | | oppid = System.currentPageReference().getParameters().get('oppid'); |
| | | //lastbuy 2022/3/10 fy start |
| | | QuoteIrai__c quoteiraiobj = new QuoteIrai__c(); |
| | | if(oppid==null&&tenderid==null&&quoId!=null&&leadid==null&&agencyoppid==null){ |
| | | quoteiraiobj = [select id,Note__c from QuoteIrai__c where id=:quoId]; |
| | | String[] quosub=quoteiraiobj.Note__c.split('/'); |
| | | oppid=quosub[quosub.size()-1]; |
| | | if(quoteiraiobj.Note__c!=null){ |
| | | String[] quosub=quoteiraiobj.Note__c.split('/'); |
| | | oppid=quosub[quosub.size()-1]; |
| | | } |
| | | } |
| | | //lastbuy 2022/3/10 fy start |
| | | system.debug('oppid:++++'+oppid); |
| | | // 报价id |
| | | String oppquoid = System.currentPageReference().getParameters().get('oppquoid'); |
| | |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | product1.SFDA_Expiration_Date__c= Date.today(); |
| | | product1.LastbuyProductFLG__c = true; |
| | | //CHAN-BHNBX6 2019/11/25 START |
| | | // product1.Intra_Trade_Service_RMB__c = 2150; |
| | | // product1.Entend_gurantee_period_all__c=1; |
| | |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | | controller.Save(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | QuoteIrai__c[] irais = [select Id, Name,Note__c, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.quoteIrai(); |
| | | |
| | | QuoteIrai__c[] irais2 = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | QuoteIrai__c[] irais2 = [select Id,Note__c, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | //System.assertEquals('_サンブリッジ う', irais2[0].LastIraiUser__c); |
| | | |
| | | Task[] tasks = [select Id,Subject,OwnerId,Description,ActivityDate,QuoteIraiId__c |
| | |
| | | |
| | | controller.activities[0].pageObject.Quantity__c = 1; |
| | | controller.Save(); |
| | | QuoteIrai__c[] irais3 = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | QuoteIrai__c[] irais3 = [select Id,Note__c, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | //System.assertEquals(null, irais3[0].LastIraiUser__c); |
| | | } |
| | | |
| | |
| | | product1.Foreign_Trade_Cost_US_End_Date2__c=Date.today().addDays(1); |
| | | product1.Foreign_Trade_Cost_US_1__c=10; |
| | | product1.Foreign_Trade_Cost_US_2__c=10; |
| | | // product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.OppReflection(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト02']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト02']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('テスト02', irais[0].IraiSubject__c); |
| | |
| | | product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | // product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | // System.assertEquals('你选择了不可报价的产品。产品已经更新为最新状态,请再次确认。', controller.errorMessage); |
| | | |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托02']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托02']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('委托02', irais[0].IraiSubject__c); |
| | |
| | | product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.quoteIrai(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托99']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托99']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('委托99', irais[0].IraiSubject__c); |
| | |
| | | // System.assertEquals('报价委托:委托99, テスト99, テスト99, 99.00%', tasks[0].Subject); |
| | | // System.assertEquals(user.Id, tasks[0].OwnerId); |
| | | // System.assertEquals(irais[0].Id, tasks[0].QuoteIraiId__c); |
| | | controller.Save(); |
| | | Opportunity opp1 = new Opportunity(); |
| | | opp1.Name = 'test'; |
| | | opp1.StageName = '引合'; |
| | | opp1.CloseDate = Date.today().adddays(1); |
| | | insert opp1; |
| | | |
| | | QuoteLineItem[] qlis = [select id,QuoteId,PricebookEntry.Product2Id from QuoteLineItem where PricebookEntry.Product2Id != :null limit 1]; |
| | | String str = ''; |
| | | if (qlis.size() > 0) { |
| | | str = qlis[0].QuoteId; |
| | | } |
| | | LastbuyProduct__c lst = new LastbuyProduct__c(); |
| | | lst.InquiryCode__c= opp1.Id; |
| | | lst.ProductName__c = Product1.Id; |
| | | lst.LastbuyQuantity__c = 3; |
| | | lst.effectiveFLG__c = true; |
| | | insert lst; |
| | | PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page2); |
| | | NewQuoteIraiController controller2 = new NewQuoteIraiController(); |
| | | controller2.init(); |
| | | LastbuyProduct__c lst2 = new LastbuyProduct__c(); |
| | | lst2.InquiryCode__c= opp1.Id; |
| | | lst2.ProductName__c = Product2.Id; |
| | | lst2.LastbuyQuantity__c = 3; |
| | | lst2.effectiveFLG__c = true; |
| | | insert lst2; |
| | | PageReference page3 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page3); |
| | | NewQuoteIraiController controller3 = new NewQuoteIraiController(); |
| | | controller3.init(); |
| | | |
| | | } |
| | | |
| | |
| | | product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | product2.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c=10; |
| | | product2.Intra_Trade_Cost_RMB_2__c=10; |
| | | product2.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product2.Entend_gurantee_period_all__c=2; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.Save(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('テスト05', irais[0].IraiSubject__c); |
| | |
| | | |
| | | controller.quoteIrai(); |
| | | |
| | | QuoteIrai__c[] irais2 = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIrai__c[] irais2 = [select Id, Note__c,Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIraiLineItem__c[] items2 = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais2[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('テスト05', irais2[0].IraiSubject__c); |
| | |
| | | update p2; |
| | | |
| | | controller.Save(); |
| | | Opportunity opp1 = new Opportunity(); |
| | | opp1.Name = 'test'; |
| | | opp1.StageName = '引合'; |
| | | opp1.CloseDate = Date.today().adddays(1); |
| | | insert opp1; |
| | | |
| | | QuoteLineItem[] qlis = [select id,QuoteId,PricebookEntry.Product2Id from QuoteLineItem where PricebookEntry.Product2Id != :null limit 1]; |
| | | String str = ''; |
| | | if (qlis.size() > 0) { |
| | | str = qlis[0].QuoteId; |
| | | } |
| | | LastbuyProduct__c lst = new LastbuyProduct__c(); |
| | | lst.InquiryCode__c= opp1.Id; |
| | | lst.ProductName__c = Product1.Id; |
| | | lst.LastbuyQuantity__c = 3; |
| | | lst.effectiveFLG__c = true; |
| | | insert lst; |
| | | PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page2); |
| | | NewQuoteIraiController controller2 = new NewQuoteIraiController(); |
| | | controller2.init(); |
| | | LastbuyProduct__c lst2 = new LastbuyProduct__c(); |
| | | lst2.InquiryCode__c= opp1.Id; |
| | | lst2.ProductName__c = Product2.Id; |
| | | lst2.LastbuyQuantity__c = 3; |
| | | lst2.effectiveFLG__c = true; |
| | | insert lst2; |
| | | PageReference page3 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page3); |
| | | NewQuoteIraiController controller3 = new NewQuoteIraiController(); |
| | | controller3.init(); |
| | | // System.assertEquals(true, controller.errorflg); |
| | | // System.assertEquals('停止', controller.activities[0].pageObject.SFDA_Status__c); |
| | | // System.assertEquals('00103:软管接头123', controller.activities[0].pageObject.Name__c); |
| | |
| | | if (qlis.size() > 0) { |
| | | str = qlis[0].QuoteId; |
| | | } |
| | | |
| | | // LastbuyProduct__c lst = new LastbuyProduct__c(); |
| | | // lst.InquiryCode__c= opp1.Id; |
| | | // lst.ProductName__c = Product1.Id; |
| | | // lst.LastbuyQuantity__c = 3; |
| | | system.debug('opp1.Id+++'+opp1.Id); |
| | | PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page2); |
| | | NewQuoteIraiController controller2 = new NewQuoteIraiController(); |
| | | controller2.init(); |
| | | |
| | |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Repair__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if(!Test.isRunningTest()){ |
| | | controller.addFields(fieldList); |
| | | } |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | ContactAWSDataId = String.valueOf(repairData.Contact_AWS_Data_Id__c); |
| | | }else{ |
| | | //新建 |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | system.debug('mso='+mso); |
| | | if(mso.containsKey('00N10000006P6SM')){ |
| | | controller.getRecord().put('SalesOfficeCode_selection__c',mso.get('00N10000006P6SM')); |
| | | } |
| | | if(mso.containsKey('00N10000002FH86')){ |
| | | controller.getRecord().put('On_site_repair__c',mso.get('00N10000002FH86')); |
| | | } |
| | | if(mso.containsKey('00N10000006P6Rn')){ |
| | | controller.getRecord().put('work_location_select__c',mso.get('00N10000006P6Rn')); |
| | | } |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | if(String.isBlank(rtTypeId)||String.isEmpty(rtTypeId)){ |
| | | List<RecordType> rtList = new List<RecordType>([select Id,DeveloperName from RecordType where SobjectType ='Repair__c' and DeveloperName ='Repair']); |
| | |
| | | //自定义格式转换 |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API'+fieldAPI); |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isBlank(fieldValue)){ |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | repairInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); |
| | | repairInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | String dt = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | if(String.isNotBlank(dt)&&dt.contains('T')){ |
| | | dt = dt.replace('T',' '); |
| | | repairInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); |
| | | } |
| | | if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ |
| | | fieldValue = fieldValue.replace('T',' '); |
| | | repairInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); |
| | | }else if(String.isNotBlank(fieldValue)) { |
| | | fieldValue = fieldValue.replace('/', '-') + ':00'; |
| | | System.debug('fieldValue = ' + fieldValue); |
| | | repairInfo.put(fieldAPI, Datetime.valueOf(fieldValue)); |
| | | }else{ |
| | | repairInfo.put(fieldAPI, null); |
| | | } |
| | | |
| | | }else if(String.valueOf(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='CURRENCY'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | repairInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); |
| | | repairInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | repairInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | |
| | | System.debug('resp from sfdx back-end' + resp); |
| | | return resp; |
| | | |
| | | } catch(DmlException e) { |
| | | rid=repairInfo.Id; |
| | | Integer index = 0; |
| | | System.debug(e.getNumDml()); |
| | | System.debug(e.getDmlFields(index)); |
| | | System.debug(e.getDmlId(index)); |
| | | System.debug(e.getDmlIndex(index)); |
| | | System.debug(e.getDmlMessage(index)); |
| | | System.debug(e.getDmlStatusCode(index)); |
| | | System.debug(e.getDmlType(index)); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | resp.status = 'Exception'; |
| | | resp.message ='保存失败,原因:'+ e.getDmlMessage(index); |
| | | PIHelper.saveTransLog(sobjectTypeValue,rid,transId, (String)repairInfo.get('AWS_Data_Id__c'),repairJson ,status,''); |
| | | return resp; |
| | | |
| | | } catch(Exception e) { |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | |
| | | * @description : |
| | | * @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | * @group : |
| | | * @last modified on : 03-17-2022 |
| | | * @last modified on : 03-28-2022 |
| | | * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | **/ |
| | | global without sharing class OnCallController { |
| | |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('On_Call__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if(!Test.isRunningTest()){ |
| | | controller.addFields(fieldList); |
| | | } |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | On_Call__c onCallInfo = new On_Call__c(); |
| | | //自定义格式转换 |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API='+fieldAPI); |
| | | system.debug('field API'+fieldAPI); |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | onCallInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | onCallInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ |
| | | fieldValue = fieldValue.replace('T',' '); |
| | | onCallInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); |
| | | }else if(String.isNotBlank(fieldValue)) { |
| | | fieldValue = fieldValue.replace('/', '-') + ':00'; |
| | | System.debug('fieldValue = ' + fieldValue); |
| | | onCallInfo.put(fieldAPI, Datetime.valueOf(fieldValue)); |
| | | }else{ |
| | | onCallInfo.put(fieldAPI, null); |
| | | } |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | onCallInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); |
| | | } |
| | | |
| | | }else if(String.valueOf(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='CURRENCY'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | onCallInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | onCallInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | | onCallInfo.put(fieldAPI,fieldValue); |
| | | } |
| | | onCallInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); |
| | | } |
| | | } |
| | | |
| | | //2. Save Record Process |
| | |
| | | traLog.Interface_URL__c = traLog.Module__c; |
| | | insert traLog; |
| | | } |
| | | //save qianlima log method add sushanhu 20220324 |
| | | // model 0 为文件 1为数据 |
| | | public static void insertConfirmTrans(String module,Integer isSuccess, String sfRecordId ,String transId ,Integer model,String transUrl,List<idList> idList){ |
| | | Boolean result =false; |
| | | Transaction_Log__c traLog = new Transaction_Log__c(); |
| | | if (model==0) { |
| | | traLog.Module__c = 'ConfirmFileTransaction '+module; |
| | | }else { |
| | | traLog.Module__c = 'Confirm Transaction '+module; |
| | | } |
| | | traLog.Interface_URL__c = transUrl; |
| | | traLog.TransId__c = transId; |
| | | Integer MaxLogColumnLength = 131072; |
| | | if (!String.isEmpty(sfRecordId)) { |
| | | traLog.Request__c=sfRecordId.substring(0, (sfRecordId.length() > MaxLogColumnLength ? MaxLogColumnLength : sfRecordId.length())); |
| | | }else { |
| | | String sfIds =JSON.serialize(idList); |
| | | traLog.Request__c=sfIds.substring(0, (sfIds.length() > MaxLogColumnLength ? MaxLogColumnLength : sfIds.length())); |
| | | } |
| | | if(isSuccess==0){ |
| | | traLog.Status__c = 'fail'; |
| | | } else { |
| | | traLog.Status__c='success'; |
| | | } |
| | | insert traLog; |
| | | } |
| | | public static PIIntegration getPIIntegrationInfo(String sobjectType){ |
| | | PIIntegration piIntegration = new PIIntegration(); |
| | | //查询url |
| | | PI_Policy_Configuration__c config = [select Full_New_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c from PI_Policy_Configuration__c where Sobject_Type__c =: sobjectType]; |
| | | PI_Policy_Configuration__c config = [SELECT Full_New_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c FROM PI_Policy_Configuration__c WHERE Sobject_Type__c =:sobjectType]; |
| | | System.debug('config = ' + config); |
| | | |
| | | //获取appid和appsecret |
| New file |
| | |
| | | global without sharing class QISToETQWebService { |
| | | public static List<ImgObj> ImgObjs = new List<ImgObj>(); |
| | | webservice static String sendToETQ(String iflog_Id,BatchIF_Log__c rowDataSFDC, List<String> repairIds,String statu){ |
| | | List<QIS_Report__c> temp = [select id,name,GeneratedPDFField__c,problem_detail_photo__c,Photo_1__c,Photo_2__c,Photo_3__c,Photo_4__c, |
| | | Photo_OSH_1__c,Photo_OSH_2__c,Photo_OSH_3__c,Photo_OSH_4__c |
| | | from QIS_Report__c where GeneratedPDFField__c = null and id in :repairIds ]; |
| | | List<Repair__c> tempRe = [select id,name,GeneratedPDFField__c,ProblemDescription__c,ASReportedCodeAC__c,AE_DetermineResult__c,PAE_Determine__c,PAE_DetermineAC__c from Repair__c where GeneratedPDFField__c = null |
| | | and id in :repairIds ]; |
| | | if(temp != null && temp.size() > 0){ |
| | | // try { |
| | | // 需要生成pdf的字段 |
| | | List<String> apiNames = new List<String>(); |
| | | apiNames.add('problem_detail_photo__c'); |
| | | apiNames.add('Photo_1__c'); |
| | | apiNames.add('Photo_2__c'); |
| | | apiNames.add('Photo_3__c'); |
| | | apiNames.add('Photo_4__c'); |
| | | apiNames.add('Photo_OSH_1__c'); |
| | | apiNames.add('Photo_OSH_2__c'); |
| | | apiNames.add('Photo_OSH_3__c'); |
| | | apiNames.add('Photo_OSH_4__c'); |
| | | List<QIS_Report__c> updateQis = new List<QIS_Report__c>(); |
| | | List<Attachment> attachments = new List<Attachment>(); |
| | | PageReference pdfPage ; |
| | | for(QIS_Report__c qis : temp){ |
| | | for (String apiName : apiNames) { |
| | | String generatedFields = qis.GeneratedPDFField__c; |
| | | if (checkFieldisGeneratedPDF(apiName,qis)) { |
| | | continue; |
| | | } |
| | | if (qis.get(apiName) == null) { |
| | | continue; |
| | | } |
| | | setImgSrcs(qis, apiName); |
| | | pdfPage = new PageReference('/apex/repairandqistopdf?api=qis&id='+qis.Id+'&field='+apiName); |
| | | Blob pdfBody; |
| | | if(Test.isRunningTest()) { |
| | | pdfBody = blob.valueOf('Unit.Test'); |
| | | } else { |
| | | pdfBody = pdfPage.getContentAsPDF(); |
| | | } |
| | | Attachment attach = new Attachment(); |
| | | attach.Body = pdfBody; |
| | | if ('problem_detail_photo__c'.equals(apiName)) { |
| | | attach.Name = substringApiName(qis.name) + '_Problem_Discription.pdf'; |
| | | }else { |
| | | attach.Name = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf'; |
| | | } |
| | | attach.ParentId = qis.id; |
| | | |
| | | attachments.add(attach); |
| | | if (generatedFields == null) { |
| | | qis.GeneratedPDFField__c = apiName; |
| | | }else { |
| | | qis.GeneratedPDFField__c += ',' + apiName; |
| | | } |
| | | } |
| | | updateQis.add(qis); |
| | | } |
| | | insert attachments; |
| | | update updateQis; |
| | | // RepairAndQISToPDFController.generateAttachment(temp); |
| | | NFM401Controller.callout(null, null, repairIds, statu); |
| | | // } |
| | | // catch (Exception e) { |
| | | // return '更新QIS报错:'+ e.getMessage(); |
| | | // } |
| | | // Database.executeBatch(new QISToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu),50); //生成PDF |
| | | }else{ |
| | | |
| | | BatchIF_Log__c iflog = new BatchIF_Log__c(); |
| | | iflog.Type__c = 'sendToETQ'; |
| | | iflog.ErrorLog__c = ''; |
| | | iflog.Log__c = 'NFM401WebService start--'; |
| | | |
| | | Repair__c updateRe = new Repair__c(); |
| | | updateRe.Id = tempRe[0].id; |
| | | updateRe.INTERFACE_RECORD_ID__c = null; |
| | | updateRe.ETQ_UPLOAD_STATUS__c = null; |
| | | updateRe.ETQ_UPLOAD_MESSAGE__c = null; |
| | | updateRe.OSH_ConfirmationDate__c = Date.today(); |
| | | updateRe.OSH_Affirmant__c = UserInfo.getUserId(); |
| | | updateRe.AWS_Interface_Time__c = Datetime.now(); |
| | | updateRe.AsyncData__c = true; |
| | | //update by rentx 2021-03-23 start 需要先更新修理的信息再掉401接口 不然的话可能会出现 调用成功但是部分修理更新失败的情况 将更新修理的步骤提前 则当修理更新失败时 就不会往下执行401的接口了 |
| | | // try{ |
| | | update updateRe; |
| | | // Database.executeBatch(new RepairToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu)); //生成PDF |
| | | // RepairAndQISToPDFController.generateAttachment(reList); |
| | | PageReference pdfPage ; |
| | | |
| | | List<Repair__c> updateRpr = new List<Repair__c>(); |
| | | List<Attachment> attachments = new List<Attachment>(); |
| | | for(Repair__c re : tempRe){ |
| | | String generatedFields = re.GeneratedPDFField__c; |
| | | if (checkFieldisGeneratedPDF('ProblemDescription__c',re)) { |
| | | continue; |
| | | } |
| | | if (re.get('ProblemDescription__c') == null) { |
| | | continue; |
| | | } |
| | | setImgSrcs(re, 'ProblemDescription__c'); |
| | | |
| | | pdfPage = new PageReference('/apex/repairandqistopdf?api=repair&id='+re.Id); |
| | | Blob pdfBody; |
| | | if(Test.isRunningTest()) { |
| | | pdfBody = blob.valueOf('Unit.Test'); |
| | | } else { |
| | | pdfBody = pdfPage.getContentAsPDF(); |
| | | } |
| | | Attachment attach = new Attachment(); |
| | | attach.Body = pdfBody; |
| | | attach.Name = re.name + '_' + 'Problem_Discription.pdf'; |
| | | attach.ParentId = re.id; |
| | | attachments.add(attach); |
| | | re.GeneratedPDFField__c = 'ProblemDescription__c'; |
| | | updateRpr.add(re); |
| | | } |
| | | insert attachments; |
| | | update updateRpr; |
| | | |
| | | Database.executeBatch(new RepairSendToETQBatch(null, null,repairIds,statu),1); |
| | | |
| | | iflog.Log__c += '\n修理:'+updateRe+' 更新成功'; |
| | | iflog.Log__c = '\nNFM401WebService end--'; |
| | | insert iflog; |
| | | // }catch(Exception ex){ |
| | | // iflog.ErrorLog__c += '修理:'+updateRe+' 更新失败,因为::'+ex.getMessage(); |
| | | // iflog.Log__c = '\nNFM401WebService end--'; |
| | | // // System.debug('更新修理报错::36'+updateRe); |
| | | // insert iflog; |
| | | // return '更新修理报错:'+ ex.getMessage(); |
| | | // } |
| | | } |
| | | return '发送成功!'; |
| | | } |
| | | |
| | | // 主要用于生成qis中问题描述对应的pdf文件名称(比较特殊) |
| | | public static String substringApiName(String name){ |
| | | for(Integer i = 0; i < 2; i++){ |
| | | name = name.substring(name.indexOf('-')+1); |
| | | } |
| | | return name; |
| | | } |
| | | |
| | | public static Boolean checkFieldisGeneratedPDF(String apiName,SObject obj){ |
| | | String generatedFields = (String) obj.get('GeneratedPDFField__c'); |
| | | if (generatedFields != null) { |
| | | List<String> ele = generatedFields.split(','); |
| | | return ele.contains(apiName); |
| | | } |
| | | return false; |
| | | } |
| | | public class ImgObj{ |
| | | public String imgSrc {get; set;} |
| | | public String height {get; set;} |
| | | } |
| | | // 设置页面展示的数据 |
| | | public static void setImgSrcs(SObject obj,String apiName){ |
| | | ImgObjs = new List<ImgObj>(); |
| | | String content = (String) obj.get(apiName); |
| | | ImgObj ImgObj = new ImgObj(); |
| | | ImgObj.imgSrc = content; |
| | | ImgObj.height = '900px'; |
| | | ImgObjs.add(ImgObj); |
| | | System.debug('ImgObjs++'+ImgObjs); |
| | | |
| | | } |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| New file |
| | |
| | | @isTest |
| | | public with sharing class QISToETQWebServiceTest { |
| | | @testSetup |
| | | static void makeTestQIS() { |
| | | StaticParameter.EscapeNFM001Trigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; |
| | | StaticParameter.EscapeNFM007Trigger = true; |
| | | StaticParameter.EscapeOpportunityBefUpdTrigger = true; |
| | | StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true; |
| | | |
| | | // List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | // if (rectCo.size() == 0) { |
| | | // throw new ControllerUtil.myException('not found 病院 recodetype'); |
| | | // } |
| | | List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 消化科']; |
| | | if (rectSct.size() == 0) { |
| | | throw new ControllerUtil.myException('not found 戦略科室分類 呼吸科 recodetype'); |
| | | } |
| | | // List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Department_GI']; |
| | | // if (rectDpt.size() == 0) { |
| | | // throw new ControllerUtil.myException('not found 診療科 消化科 recodetype'); |
| | | // } |
| | | // テストデータ |
| | | Account company = new Account(); |
| | | company.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('HP').getRecordTypeId(); |
| | | // company.RecordTypeId = rectCo[0].Id; |
| | | company.Name = 'NFM105TestCompany'; |
| | | upsert company; |
| | | Account section = [Select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where ParentId = :company.Id and RecordTypeId = :rectSct[0].Id]; |
| | | |
| | | Account depart = new Account(); |
| | | depart.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Department_GI').getRecordTypeId(); |
| | | depart.Name = '*'; |
| | | depart.Department_Name__c = 'NFM105TestDepart'; |
| | | depart.ParentId = section.Id; |
| | | depart.Department_Class__c = section.Id; |
| | | depart.Hospital__c = company.Id; |
| | | upsert depart; |
| | | |
| | | // 再取得 |
| | | List<Account> accList = new List<Account>(); |
| | | company = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :company.Id]; |
| | | accList.add(company); |
| | | accList.add(section); |
| | | depart = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :depart.Id]; |
| | | accList.add(depart); |
| | | |
| | | List<Product2> prdList = new List<Product2>(); |
| | | Product2 prd1 = new Product2(); |
| | | prd1.ProductCode_Ext__c = 'NFM105Prd1'; |
| | | prd1.ProductCode = 'NFM105Prd1'; |
| | | prd1.Repair_Product_Code__c = 'NFM105Prd1_RP'; |
| | | prd1.Name = 'NFM105Prd1'; |
| | | prd1.Manual_Entry__c = false; |
| | | prdList.add(prd1); |
| | | Product2 prd2 = new Product2(); |
| | | prd2.ProductCode_Ext__c = 'NFM105Prd2'; |
| | | prd2.ProductCode = 'NFM105Prd2'; |
| | | prd2.Repair_Product_Code__c = 'NFM105Prd2_RP'; |
| | | prd2.Name = 'NFM105Prd2'; |
| | | prd2.Manual_Entry__c = false; |
| | | prdList.add(prd2); |
| | | insert prdList; |
| | | |
| | | Asset ast = new Asset(); |
| | | ast.Name = 'NFM105Ast1'; |
| | | ast.AccountId = depart.Id; |
| | | ast.Department_Class__c = section.Id; |
| | | ast.Hospital__c = company.Id; |
| | | ast.Product2Id = prd1.Id; |
| | | ast.SerialNumber = 'NFM105SerialNumber'; |
| | | ast.Guarantee_period_for_products__c = Date.today(); |
| | | ast.InstallDate = Date.today(); |
| | | insert ast; |
| | | ast = [select Id, Name, Product_Serial_No__c, AccountId, Department_Class__c, Department_Class__r.Management_Code_Auto__c, Hospital__c, Product2Id, Product2.ProductCode, Product2.Repair_Product_Code__c, SerialNumber |
| | | from Asset |
| | | where Id = :ast.Id]; |
| | | |
| | | |
| | | // User testUser = new User(); |
| | | // testUser.Job_Category__c = '销售服务'; |
| | | |
| | | Repair__c rpr = new Repair__c(); |
| | | rpr.SAPRepairNo__c = 'NFM105Rpr1'; |
| | | rpr.Account__c = depart.Id; |
| | | rpr.Department_Class__c = section.Id; |
| | | rpr.Hospital__c = company.Id; |
| | | rpr.Delivered_Product__c = ast.Id; |
| | | rpr.Status__c = '1.受理完毕'; |
| | | rpr.Incharge_Staff__c = Userinfo.getUserId(); |
| | | rpr.Repair_Detail__c = 'test'; |
| | | // rpr.ProblemDescription__c = '<img alt="用户添加的图片" src="https://ocsm--stagefull--c.documentforce.com/servlet/rtaImage?eid=a0J10000008VbEm&feoid=00N10000008rsVu&refid=0EM1s0000005LCs" style="height: 666px; width: 500px;"></img><img alt="用户添加的图片" src="https://ocsm--stagefull--c.documentforce.com/servlet/rtaImage?eid=a0J10000008VbEm&feoid=00N10000008rsVu&refid=0EM1s0000005LD2" style="height: 666px; width: 500px;"></img><br>2020/06/24'; |
| | | rpr.GeneratedPDFField__c = null; |
| | | |
| | | //update by rentx 2020-10-1 |
| | | System.runAs(new User(Id = Userinfo.getUserId())){ |
| | | upsert rpr; |
| | | } |
| | | |
| | | |
| | | QIS_Report__c qr = new QIS_Report__c( |
| | | RC__c = UserInfo.getUserId(), |
| | | // Photo_1__c = '<img alt="用户添加的图片" src="https://ocsm--stagefull--c.documentforce.com/servlet/rtaImage?eid=a0J10000008VbEm&feoid=00N10000008rsVu&refid=0EM1s0000005LCs" style="height: 666px; width: 500px;"></img>', |
| | | Damage_For_Doc_Or_Pat__c = '有', |
| | | Relation_With_The_Problem__c = '有可能', |
| | | Report_For_Goz__c = '不知道', |
| | | Name = 'QIS012345', |
| | | GeneratedPDFField__c = null, |
| | | QIS_Submit_day__c = Date.Today(), |
| | | problem_detail_photo__c = '1231' |
| | | ); |
| | | insert qr; |
| | | } |
| | | |
| | | // @IsTest |
| | | // static void myTest(){ |
| | | |
| | | // QIS_Report__c qis = [select id,name,GeneratedPDFField__c,problem_detail_photo__c,Photo_1__c,Photo_2__c,Photo_3__c, |
| | | // Photo_4__c,Photo_OSH_1__c,Photo_OSH_2__c,Photo_OSH_3__c,Photo_OSH_4__c from QIS_Report__c]; |
| | | |
| | | // Test.startTest(); |
| | | // List<String> ids = new List<String>(); |
| | | // ids.add(qis.Id); |
| | | // Database.executeBatch(new QISToPDFBatch(ids)); |
| | | // Test.stopTest(); |
| | | |
| | | // } |
| | | |
| | | @IsTest |
| | | static void myTest1(){ |
| | | |
| | | QIS_Report__c qis = [select id,name,GeneratedPDFField__c,problem_detail_photo__c,Photo_1__c,Photo_2__c,Photo_3__c, |
| | | Photo_4__c,Photo_OSH_1__c,Photo_OSH_2__c,Photo_OSH_3__c,Photo_OSH_4__c from QIS_Report__c]; |
| | | |
| | | Test.startTest(); |
| | | List<String> ids = new List<String>(); |
| | | ids.add(qis.Id); |
| | | QISToETQWebService.sendToETQ(null, null,ids,null); |
| | | // Database.executeBatch(new QISToPDFBatch(null,null,ids,null)); |
| | | Test.stopTest(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | // 修理 |
| | | @isTest |
| | | static void myTest(){ |
| | | StaticParameter.EscapeNFM001Trigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; |
| | | StaticParameter.EscapeNFM007Trigger = true; |
| | | StaticParameter.EscapeOpportunityBefUpdTrigger = true; |
| | | StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true; |
| | | Repair__c res = [select id,name,GeneratedPDFField__c,ProblemDescription__c from Repair__c]; |
| | | List<String> ids = new List<String>(); |
| | | ids.add(res.Id); |
| | | Test.startTest(); |
| | | QISToETQWebService.sendToETQ(null, null,ids,''); |
| | | // Database.executeBatch(new RepairToPDFBatch(ids)); |
| | | // //add by rentx 2020-10-21 start |
| | | // Database.executeBatch(new RepairToPDFBatch(null,null,ids,'')); |
| | | // Database.executeBatch(new RepairToPDFBatch()); |
| | | //add by rentx 2020-10-21 end |
| | | Test.stopTest(); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> |
| | | <apiVersion>54.0</apiVersion> |
| | | <status>Active</status> |
| | | </ApexClass> |
| | |
| | | * @description : |
| | | * @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | * @group : |
| | | * @last modified on : 03-17-2022 |
| | | * @last modified on : 03-28-2022 |
| | | * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | **/ |
| | | global without sharing class RentalApplyController { |
| | |
| | | PIPL_Input_Account_Error_Msg = label.PIPL_Input_Account_Error_Msg; |
| | | //获取所有字段 |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Rental_Apply__c').getDescribe().fields.getMap().keyset()); |
| | | controller.addFields(fieldList); |
| | | if(!Test.isRunningTest()){ |
| | | controller.addFields(fieldList); |
| | | } |
| | | SObject obj = controller.getRecord(); |
| | | if(obj.Id != null){ |
| | | //更新 |
| | |
| | | rtTypeId = rentalApplyData.RecordTypeId; |
| | | AWSDataId = rentalApplyData.AWS_Data_Id__c; |
| | | Map<String,String> sfIdToAWSIdMap = new Map<String,String>(); |
| | | sfIdToAWSIdMap.put(String.valueof(rentalApplyData.Loaner_medical_Staff__r.Id).subString(0,15),rentalApplyData.Loaner_medical_Staff__r.AWS_Data_Id__c); |
| | | if(rentalApplyData.Loaner_medical_Staff__r.Id != null){ |
| | | sfIdToAWSIdMap.put(String.valueof(rentalApplyData.Loaner_medical_Staff__r.Id).subString(0,15),rentalApplyData.Loaner_medical_Staff__r.AWS_Data_Id__c); |
| | | } |
| | | contactsInfo = JSON.serialize(sfIdToAWSIdMap); |
| | | }else{ |
| | | //新建 |
| | | Map<string,string> mso = ApexPages.currentPage().getParameters(); |
| | | system.debug('mso='+mso); |
| | | if(mso.containsKey('Name')){ |
| | | controller.getRecord().put('Name',mso.get('Name')); |
| | | } |
| | | if(mso.containsKey('CF00N10000008ps61_lkid')){ |
| | | controller.getRecord().put('OPDPlan__c',mso.get('CF00N10000008ps61_lkid')); |
| | | } |
| | | if(mso.containsKey('CF00N10000003Mp1d_lkid')){ |
| | | controller.getRecord().put('Hospital__c',mso.get('CF00N10000003Mp1d_lkid')); |
| | | } |
| | | if(mso.containsKey('CF00N10000003O3V6_lkid')){ |
| | | controller.getRecord().put('Strategic_dept__c',mso.get('CF00N10000003O3V6_lkid')); |
| | | } |
| | | if(mso.containsKey('CF00N10000003Mp2R_lkid')){ |
| | | controller.getRecord().put('Account__c',mso.get('CF00N10000003Mp2R_lkid')); |
| | | } |
| | | if(mso.containsKey('00N10000003Msk0')){ |
| | | controller.getRecord().put('Demo_purpose1__c',mso.get('00N10000003Msk0')); |
| | | } |
| | | if(mso.containsKey('00N10000003Msk5')){ |
| | | controller.getRecord().put('demo_purpose2__c',mso.get('00N10000003Msk5')); |
| | | } |
| | | if(mso.containsKey('00N100000098amW')){ |
| | | controller.getRecord().put('NoOpp_Reason__c',mso.get('00N100000098amW')); |
| | | } |
| | | if(mso.containsKey('00N10000003OJzc')){ |
| | | controller.getRecord().put('Loaner_received_staff__c',mso.get('00N10000003OJzc')); |
| | | } |
| | | rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); |
| | | obj.put('OwnerId',UserInfo.getUserId()); |
| | | } |
| | |
| | | Rental_Apply__c rentalApplyInfo = new Rental_Apply__c(); |
| | | //自定义格式转换 |
| | | for (String fieldAPI: fieldValueMap.keySet()) { |
| | | system.debug('field API='+fieldAPI); |
| | | system.debug('field API'+fieldAPI); |
| | | if(!fieldAPIToTypeMap.containskey(fieldAPI)){ |
| | | continue; |
| | | } |
| | | Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); |
| | | String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); |
| | | system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); |
| | | if(String.valueOf(fielddataType)=='DATE'){ |
| | | rentalApplyInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | rentalApplyInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); |
| | | }else if(String.valueOf(fielddataType)=='DATETIME'){ |
| | | if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ |
| | | fieldValue = fieldValue.replace('T',' '); |
| | | rentalApplyInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); |
| | | }else if(String.isNotBlank(fieldValue)) { |
| | | fieldValue = fieldValue.replace('/', '-') + ':00'; |
| | | System.debug('fieldValue = ' + fieldValue); |
| | | rentalApplyInfo.put(fieldAPI, Datetime.valueOf(fieldValue)); |
| | | }else{ |
| | | rentalApplyInfo.put(fieldAPI, null); |
| | | } |
| | | }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | rentalApplyInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); |
| | | } |
| | | |
| | | }else if(String.valueOf(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='CURRENCY'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ |
| | | rentalApplyInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', ''))); |
| | | } else if(String.valueof(fielddataType)=='BOOLEAN'){ |
| | | rentalApplyInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); |
| | | }else { |
| | | rentalApplyInfo.put(fieldAPI,fieldValue); |
| | | rentalApplyInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); |
| | | } |
| | | } |
| | | |
| | |
| | | resp.status = status; |
| | | System.debug('respzhj = ' + resp); |
| | | return resp; |
| | | } catch(DmlException e) { |
| | | rid=rentalApplyInfo.Id; |
| | | Integer index = 0; |
| | | System.debug(e.getNumDml()); |
| | | System.debug(e.getDmlFields(index)); |
| | | System.debug(e.getDmlId(index)); |
| | | System.debug(e.getDmlIndex(index)); |
| | | System.debug(e.getDmlMessage(index)); |
| | | System.debug(e.getDmlStatusCode(index)); |
| | | System.debug(e.getDmlType(index)); |
| | | system.debug(e.getMessage()); |
| | | system.debug(e.getStackTraceString()); |
| | | |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | | resp.status = 'Exception'; |
| | | resp.message ='保存失败,原因:'+ e.getDmlMessage(index); |
| | | PIHelper.saveTransLog(sobjectTypeValue,rid,transId, (String)rentalApplyInfo.get('AWS_Data_Id__c'),rentalApplyJson ,status,''); |
| | | return resp; |
| | | |
| | | } catch(Exception e) { |
| | | System.debug('into catch'+e.getMessage()); |
| | | Database.rollback(sp); |
| | |
| | | //20220225 sx end obpm 办事处增加判断:是否申请决裁勾着没有决裁编号不能进行操作 |
| | | //20220315 sx obpm备品决裁状态相关修改 add start |
| | | else if(RaTar.Campaign__c != null && RaTar.Campaign__r.IF_Approved__c && RaTar.Campaign__r.Meeting_Approved_No__c != null && statusList.contains(RaTar.Campaign__r.Approved_Status__c)){ |
| | | ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error, '已申请决裁但决裁编码状态不符合需求')); |
| | | ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error, '已申请决裁但决裁状态不符合条件')); |
| | | return false; |
| | | } |
| | | //20220315 sx obpm备品决裁状态相关修改 add end |
| | |
| | | |
| | | |
| | | public void finish(Database.BatchableContext BC) { |
| | | //HHOA-C3LJWQ 先更新修理再发送etq 20210616 start byrentx |
| | | if (this.idss != null && this.idss.size() > 0) { |
| | | NFM401Controller.callout(null,null,this.idss,statu); |
| | | |
| | | } |
| | | //HHOA-C3LJWQ 先更新修理再发送etq 20210616 end byrentx |
| | | // gzw PDF空白优化 跳过测试程序 |
| | | if (!Test.isRunningTest()) { |
| | | //HHOA-C3LJWQ 先更新修理再发送etq 20210616 start byrentx |
| | | if (this.idss != null && this.idss.size() > 0) { |
| | | NFM401Controller.callout(null,null,this.idss,statu); |
| | | |
| | | } |
| | | //HHOA-C3LJWQ 先更新修理再发送etq 20210616 end byrentx |
| | | |
| | | Database.executeBatch(new NFM402Batch(),100); |
| | | Database.executeBatch(new NFM402Batch(),100); |
| | | } |
| | | // gzw PDF空白优化 跳过测试程序 |
| | | } |
| | | |
| | | } |
| | |
| | | controller.activities=actList; |
| | | controller.opp=opp1; |
| | | controller.addMultipleRow(); |
| | | SI_NewQuoteEntryController.QELine actList12 = new SI_NewQuoteEntryController.QELine(10,true,'aaa',Date.today(),'bbb',pE2.Id,'ddd','eee','fff','ggg','hhh','iii','jjj','kkk',10,1.1,2.2,3.3,4.0,5.5,6.6,'lll',7.7,8.8); |
| | | system.debug('xxxxxxxxxxxxxxxxxxxxxxxx++++++++++++++++++++++++'); |
| | | } |
| | | } |
| | |
| | | public String contactAWSIds {set;get;} |
| | | public String contactsInfo {set;get;} |
| | | public String PIPL_Search_Contact_Label{set;get;} |
| | | public String aId{set;get;} |
| | | public static Boolean checkNullString(String inputString){ |
| | | if(String.isEmpty(inputString)||String.isBlank(inputString)){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | public SearchContactController() { |
| | | String accountId = ApexPages.currentPage().getParameters().get('accountId'); |
| | | searchKeyWord = ApexPages.currentPage().getParameters().get('searchContactKeyWord'); |
| | | aId = accountId; |
| | | PIPL_Search_Contact_Label = Label.PIPL_Search_Contact_Label; |
| | | //1. Query Contact by accountId |
| | | List<Contact> conList = new List<Contact>(); |
| | | system.debug('Account Id from Front-end:'+accountId); |
| | | if(String.isNotBlank(accountId) && String.isNotEmpty(accountId)){ |
| | | conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='']); |
| | | } |
| | | if(checkNullString(accountId)&&checkNullString(searchKeyWord)){ |
| | | conList = new List<Contact>(); |
| | | }else{ |
| | | if(checkNullString(accountId)){ |
| | | conList = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c!='']); |
| | | }else { |
| | | conList = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId=:accountId and AWS_Data_Id__c!='']); |
| | | } |
| | | |
| | | } |
| | | //2. Prepare the Contact Info |
| | | Map<String,Contact> awsIdToContactMap = new Map<String,Contact>(); |
| | | List<String> conAWSIds = new List<String>(); |
| | |
| | | } |
| | | |
| | | @RemoteAction |
| | | public static Response searchContacts(String awsContactIds) { |
| | | public static Response searchContacts(String awsContactIds,String searchContactName,String accountId) { |
| | | system.debug('awsContactIds = ' + awsContactIds); |
| | | Response resp = new Response(); |
| | | resp.status = 'fail'; |
| | | if(String.isBlank(awsContactIds)||String.isEmpty(awsContactIds)){ |
| | | return resp; |
| | | } |
| | | List<String> awsDataIds = (List<String>) JSON.deserialize(awsContactIds, List<String>.class); |
| | | Map<String,Contact> awsIdToContactMapTemp = new Map<String,Contact>(); |
| | | List<Contact> conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c in:awsDataIds]); |
| | | for(Contact con:conListTemp){ |
| | | awsIdToContactMapTemp.put(con.AWS_Data_Id__c,con); |
| | | if(!checkNullString(awsContactIds)){ |
| | | List<String> awsDataIds = (List<String>) JSON.deserialize(awsContactIds, List<String>.class); |
| | | List<Contact> conListTemp = new List<Contact>(); |
| | | if(!checkNullString(accountId)){ |
| | | conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId=:accountId and AWS_Data_Id__c in:awsDataIds]); |
| | | }else { |
| | | conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c in:awsDataIds]); |
| | | } |
| | | for(Contact con:conListTemp){ |
| | | awsIdToContactMapTemp.put(con.AWS_Data_Id__c,con); |
| | | } |
| | | } |
| | | if(awsIdToContactMapTemp.keySet().size()>0){ |
| | | System.debug('awsIdToContactMapTemp = ' + awsIdToContactMapTemp); |
| | | Map<String,Contact> noPIContactMapTemp = new Map<String,Contact>(); |
| | | List<Contact> partnerContactList = AWSServiceTool.getNoPIContact(searchContactName,accountId); |
| | | System.debug('partnerContactList = ' + partnerContactList); |
| | | if(partnerContactList.size()>0){ |
| | | for(Contact con:partnerContactList){ |
| | | noPIContactMapTemp.put(con.Id,con); |
| | | } |
| | | } |
| | | if(awsIdToContactMapTemp.keySet().size()>0 ||noPIContactMapTemp.keySet().size()>0){ |
| | | resp.status = 'success'; |
| | | resp.message = JSON.serialize(awsIdToContactMapTemp); |
| | | resp.message = JSON.serialize(awsIdToContactMapTemp);// PI contact info |
| | | resp.noPIContactList = JSON.serialize(noPIContactMapTemp);//NoPI contact info |
| | | } |
| | | return resp; |
| | | } |
| | |
| | | public class Response{ |
| | | public String message{set;get;} |
| | | public String status{set;get;} |
| | | public String noPIContactList{set;get;} |
| | | } |
| | | } |
| | |
| | | public String PIPL_Search_Contact_Label{set;get;} |
| | | public SearchLeadController() { |
| | | // String accountId = ApexPages.currentPage().getParameters().get('accountId'); |
| | | searchKeyWord = ApexPages.currentPage().getParameters().get('searchLeadKeyWord');//add by Li Jun 20220321 |
| | | PIPL_Search_Contact_Label = Label.PIPL_Search_Contact_Label; |
| | | //1. Query Contact by accountId |
| | | List<Lead> leadList = new List<Lead>(); |
| | |
| | | public String contactAWSIds {set;get;} |
| | | public String contactsInfo {set;get;} |
| | | public String awsDataIdArray {set;get;} |
| | | public String sfContactId{set;get;} |
| | | //Add By Li Jun 20220217 End |
| | | |
| | | public SearchVisitorController(){ |
| | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try{ |
| | | upsert rc; |
| | | sfContactId = rc.Id; |
| | | }catch(Exception io){ |
| | | Database.rollback(sp); |
| | | return null; |
| | |
| | | } |
| | | } |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | String soql = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, ' |
| | | + 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, InstallDate,isNewDate_use__c, ' |
| | | + 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, ' |
| | |
| | | // 納入機器の情報を取得 |
| | | if (!String.isBlank(this.targetHospitalId) && (this.targetHospitalId.length() == 15 || this.targetHospitalId.length() == 18)) { |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | assetRecords = [SELECT Id, Name,OwnershipMachine_No__c,Product2.ProductURF__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c, Management_Code__c, IF_Warranty__c, Reson_Can_not_Warranty__c, |
| | | InstallDate, isNewDate_use__c, Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, CurrentContract_End_Date__c, EquipmentGuaranteeFlg__c, |
| | | CurrentContract_F__c, CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c, CurrentContract_F__r.RecordType_DeveloperName__c, CurrentContract_F__r.Estimate_Num__c, CurrentContract_F__r.Contract_End_Date__c, CurrentContract_F__r.Estimate_Contract_endDate__c, |
| | |
| | | } |
| | | notInId += '\')'; |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 start OwnershipMachine_No__c Product2.ProductURF__c |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | String sqlStr = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, ' |
| | | + 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, InstallDate,isNewDate_use__c, ' |
| | | + 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, ' |
| | | + 'CurrentContract_End_Date__c, Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c, ' |
| | | + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c,CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,' |
| | | + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c, CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,' |
| | | + 'CurrentContract_F_asset__c,CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,CurrentContract_F_asset__r.endDateGurantee_Text__c,CurrentContract_F__r.Gurantee_Estimate_startDate__c, ' |
| | | + 'CurrentContract_F__r.First_Estimate_Date__c,CurrentContract_F__r.Estimate_Contract_endDate__c,' |
| | | + 'CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c,' |
| New file |
| | |
| | | @isTest |
| | | public class SetProvinceTargetBatchTest { |
| | | static private String currentPeriod(Integer i) { |
| | | Date dateNow = Date.today(); |
| | | Integer year = dateNow.year(); |
| | | Integer month = dateNow.month(); |
| | | if (month < 4) { |
| | | year -= 1; |
| | | } |
| | | return String.valueOf(year + i - 1867 + 'P'); |
| | | } |
| | | static private Date oppCloseDate() { |
| | | Date nowDate = Date.today(); |
| | | Integer year = nowDate.year(); |
| | | Integer month = nowDate.month(); |
| | | if (month < 4) { |
| | | nowDate = nowDate.addYears(-1); |
| | | } |
| | | return nowDate; |
| | | } |
| | | static testMethod void testMethod1() { |
| | | RecordType[] rt = [select Id from RecordType where SobjectType = 'Opportunity' and IsActive = true and DeveloperName = 'Target']; |
| | | // システム管理者 |
| | | User u3 = new User(); |
| | | u3 = new User(); |
| | | u3.LastName = '_サンブリッジ'; |
| | | u3.FirstName = 'う'; |
| | | u3.Alias = 'う'; |
| | | u3.Email = 'olympusTest03@sunbridge.com'; |
| | | u3.Username = 'olympusTest03@sunbridge.com'; |
| | | u3.CommunityNickname = 'う'; |
| | | u3.IsActive = true; |
| | | u3.EmailEncodingKey = 'ISO-2022-JP'; |
| | | u3.TimeZoneSidKey = 'Asia/Tokyo'; |
| | | u3.LocaleSidKey = 'ja_JP'; |
| | | u3.LanguageLocaleKey = 'ja'; |
| | | u3.ProfileId = System.Label.ProfileId_SystemAdmin; |
| | | u3.Job_Category__c = '销售推广'; |
| | | u3.Province__c = '上海市'; |
| | | u3.Use_Start_Date__c = Date.today().addMonths(-6); |
| | | insert u3; |
| | | |
| | | System.runAs(u3) { |
| | | |
| | | // 102_销售产品推广 |
| | | User u2 = new User(); |
| | | u2.LastName = '四洋'; |
| | | u2.FirstName = '张'; |
| | | u2.Alias = '张四洋'; |
| | | u2.Email = 'olympusTest02@sunbridge.com'; |
| | | u2.Username = 'olympusTest02@sunbridge.com'; |
| | | u2.CommunityNickname = '张四洋'; |
| | | u2.IsActive = true; |
| | | u2.EmailEncodingKey = 'ISO-2022-JP'; |
| | | u2.TimeZoneSidKey = 'Asia/Tokyo'; |
| | | u2.LocaleSidKey = 'ja_JP'; |
| | | u2.LanguageLocaleKey = 'ja'; |
| | | u2.ProfileId = System.Label.ProfileId_SystemAdmin; |
| | | u2.Job_Category__c = '销售推广'; |
| | | u2.Province__c = '上海市'; |
| | | u2.Post__c = '主管'; |
| | | u2.Sales_Speciality__c = '医院担当'; |
| | | u2.Use_Start_Date__c = Date.today().addYears(-1); |
| | | insert u2; |
| | | |
| | | Opportunity[] opportunitys = [select Id from Opportunity where RecordTypeId = :rt[0].Id]; |
| | | delete opportunitys; |
| | | |
| | | Opportunity opp1 = new Opportunity(); |
| | | opp1.Name = u2.Alias + ' 目标'; |
| | | opp1.StageName = '目標'; |
| | | opp1.OwnerId = u2.Id; |
| | | opp1.Owner_System__c = u2.Id; |
| | | opp1.Opportunity_Category__c = 'GI'; |
| | | opp1.CloseDate = Date.valueOf(oppCloseDate().year() -1 + '-04-01'); |
| | | opp1.Amount = 150; |
| | | opp1.Target_category__c = '省目标'; |
| | | opp1.SAP_Province__c = '北京市'; |
| | | opp1.RecordTypeId = rt[0].Id; |
| | | opp1.OCM_Target_period__c = currentPeriod(-1); |
| | | opp1.Target_Source__c = 'SetProvinceTarget'; |
| | | insert opp1; |
| | | |
| | | Opportunity opp2 = new Opportunity(); |
| | | opp2.Name = u2.Alias + ' 目标'; |
| | | opp2.StageName = '目標'; |
| | | opp2.OwnerId = u2.Id; |
| | | opp2.Owner_System__c = u2.Id; |
| | | opp2.Opportunity_Category__c = 'GI'; |
| | | opp2.CloseDate = Date.valueOf(oppCloseDate().year() -2 + '-04-01'); |
| | | opp2.Amount = 250; |
| | | opp2.Target_category__c = '省目标'; |
| | | opp2.SAP_Province__c = '上海市'; |
| | | opp2.RecordTypeId = rt[0].Id; |
| | | opp2.OCM_Target_period__c = currentPeriod(-2); |
| | | opp2.Target_Source__c = 'SetProvinceTarget'; |
| | | insert opp2; |
| | | OCM_Management_Province__c aaa = new OCM_Management_Province__c(); |
| | | aaa.Province__c='上海市'; |
| | | aaa.GI_assistant__c=u2.Id; |
| | | aaa.SP_assistant__c=u2.Id; |
| | | aaa.Name='上海'; |
| | | insert aaa; |
| | | |
| | | Provincial_Goal_Setting_Input__c bbb = new Provincial_Goal_Setting_Input__c(); |
| | | bbb.key__c='黑龙江省_URO'; |
| | | bbb.Target_Source__c='SetProvinceTarget'; |
| | | bbb.SAP_Province__c='黑龙江省'; |
| | | bbb.iYear__c=2021; |
| | | bbb.Owner_System__c=u2.Id; |
| | | bbb.Department__c='2.东北'; |
| | | bbb.Amount__c=3000; |
| | | bbb.Is_Processing__c = true; |
| | | insert bbb; |
| | | Database.executeBatch(new SetProvinceTargetBatch(), 1); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | sptc.dataBeans[1].amount[0].Amount = 200; |
| | | sptc.dataBeans[1].isChanged = '1'; |
| | | sptc.saveBtn(); |
| | | |
| | | |
| | | sptc.UpdateBtn(); |
| | | List<Opportunity> opps = [select Id,SAP_Province__c,Amount,Owner_System__c from Opportunity where RecordTypeId = :rt[0].Id order by ownerId]; |
| | | System.assertEquals(24, opps.size()); |
| | | System.assertEquals('北京市', opps[0].SAP_Province__c); |
| | | System.debug('opps======+++'+opps); |
| | | // sptc.isDelete(sptc.dataBeans); |
| | | // System.assertEquals(24, opps.size()); |
| | | // System.assertEquals('北京市', opps[0].SAP_Province__c); |
| | | //System.assertEquals(u1.Id, opps[0].Owner_System__c); |
| | | System.assertEquals(100, opps[0].Amount); |
| | | System.assertEquals('天津市', opps[12].SAP_Province__c); |
| | | // System.assertEquals(100, opps[0].Amount); |
| | | // System.assertEquals('天津市', opps[12].SAP_Province__c); |
| | | //System.assertEquals(u2.Id, opps[12].Owner_System__c); |
| | | System.assertEquals(200, opps[12].Amount); |
| | | // System.assertEquals(200, opps[12].Amount); |
| | | |
| | | // 上年度 |
| | | sptc.previous(); |
| | |
| | | insert opp1; |
| | | |
| | | SetProvinceTargetController sptc = new SetProvinceTargetController(); |
| | | |
| | | sptc.getSalesDptOpts(); |
| | | // 初期表示 |
| | | sptc.init(); |
| | | |
| | | System.assertEquals('北京市', sptc.dataBeans[0].opportunity.SAP_Province__c); |
| | | // System.assertEquals('北京市', sptc.dataBeans[0].opportunity.SAP_Province__c); |
| | | //System.assertEquals(u1.Id, sptc.dataBeans[0].opportunity.Owner_System__c); |
| | | System.assertEquals(150, sptc.dataBeans[0].amount[0].Amount); |
| | | // System.assertEquals(150, sptc.dataBeans[0].amount[0].Amount); |
| | | |
| | | // 保存,上年度 |
| | | sptc.dataBeans[0].amount[0].Amount = 100; |
| | |
| | | opp2.OCM_Target_period__c = currentPeriod(-2); |
| | | opp2.Target_Source__c = 'SetProvinceTarget'; |
| | | insert opp2; |
| | | |
| | | OCM_Management_Province__c aaa = new OCM_Management_Province__c(); |
| | | aaa.Province__c='上海市'; |
| | | aaa.GI_assistant__c=u2.Id; |
| | | aaa.SP_assistant__c=u2.Id; |
| | | aaa.Name='上海'; |
| | | insert aaa; |
| | | SetProvinceTargetController sptc = new SetProvinceTargetController(); |
| | | |
| | | // 初期表示 |
| | |
| | | sptc.searchByDpt(); |
| | | //导出 |
| | | sptc.exportBycsv(); |
| | | sptc.csvAsString = '销售本部,省,担当,GI,ET,BF,GS,URO,GYN,ENT,ENG\n5.华东,上海市,张四洋,2000,2345,123,1200,400,500,40,55'; |
| | | sptc.csvAsString = '销售本部,省,GDP,GI,ET,BF,GS,URO,GYN,ENT,ENG\n5.华东,上海市,100,2000,2345,123,1200,400,500,40,55'; |
| | | //test read csv file |
| | | sptc.importCSVFile(); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public static string WId(string wid){ |
| | | public static string WId(object wid){ |
| | | return '\'' + wid + '\''; |
| | | } |
| | | |
| | |
| | | return string.join(lo, ','); |
| | | } |
| | | |
| | | /* |
| | | public static string ToInCondition(List<AggregateResult> lar ,string key) |
| | | { |
| | | if(lar==null || lar.size() == 0) |
| | |
| | | ss+=') '; |
| | | return ss; |
| | | } |
| | | |
| | | */ |
| | | public static string ToInCondition(Set<string> so){ |
| | | return ToInCondition(new List<string>(so)); |
| | | } |
| | |
| | | if(so_list == null || so_list.size() == 0)return; |
| | | update so_list; |
| | | } |
| | | |
| | | /* |
| | | public static Map<string,Database.UpsertResult> UpsertList(List<Sobject> so_list, Schema.SObjectField field) |
| | | { |
| | | Map<string,Database.UpsertResult> mid = new Map<string,Database.UpsertResult>(); |
| | |
| | | } |
| | | return mid; |
| | | } |
| | | |
| | | */ |
| | | public static void DeleteList(List<Sobject> so_list) |
| | | { |
| | | if(so_list == null || so_list.size() == 0)return; |
| | |
| | | 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 |
| | |
| | | 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; |
| | | //保存成功,需要初始化一下此对象,防止再次点击此按钮保存一个条同样的数据 |
| | |
| | | // 删除项目关联但不与保留项目关联的询价关联信息 |
| | | List<Tender_Opportunity_Link__c> linksList = [select id, Opportunity__c, Tender_information__c |
| | | from Tender_Opportunity_Link__c |
| | | where Tender_information__c = :TenInfo.Id and Opportunity__c |
| | | not in : BlinkOppId]; |
| | | where Tender_information__c = :TenInfo.Id ]; |
| | | // and Opportunity__c not in : BlinkOppId]; |
| | | // 把删除招投标 关联的询价 赋给 保留招投标上 |
| | | List<Tender_Opportunity_Link__c> addlinksList = new List<Tender_Opportunity_Link__c>(); |
| | | // 删除招投标关联的询价 |
| | | // 增加一个判断 看看是否还会写空进去 |
| | | if (linksList != null && linksList.size() > 0) { |
| | | for (Tender_Opportunity_Link__c link : linksList) { |
| | | Tender_Opportunity_Link__c linkinfo = new Tender_Opportunity_Link__c(); |
| | | linkinfo.Tender_information__c = BTen.Id; |
| | | linkinfo.Opportunity__c = link.Opportunity__c; |
| | | linkinfo.Tender_Opportunity_Uniq__c = BTen.Id + '' + link.Opportunity__c; |
| | | linkinfo.IsRelated__c = true; |
| | | // if (BlinksList.contains(linkinfo)) { |
| | | addlinksList.add(linkinfo); |
| | | // } |
| | | if(!BlinkOppId.contains(link.Opportunity__c)){ |
| | | Tender_Opportunity_Link__c linkinfo = new Tender_Opportunity_Link__c(); |
| | | linkinfo.Tender_information__c = BTen.Id; |
| | | linkinfo.Opportunity__c = link.Opportunity__c; |
| | | linkinfo.Tender_Opportunity_Uniq__c = BTen.Id + '' + link.Opportunity__c; |
| | | linkinfo.IsRelated__c = true; |
| | | // if (BlinksList.contains(linkinfo)) { |
| | | addlinksList.add(linkinfo); |
| | | // } |
| | | } |
| | | } |
| | | // 删除项目删掉关联询价 |
| | | // delete linksList; |
| | | delete linksList; |
| | | // 保留项目新增关联询价 |
| | | if (addlinksList.size() > 0) { |
| | | insert addlinksList; |
| | |
| | | |
| | | List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('Inquiry_form__c').getDescribe().fields.getMap().keyset()); |
| | | // Add fields to controller. This is to avoid the SOQL error in visualforce page |
| | | controller.addFields(fieldList); |
| | | if(!Test.isRunningTest()){ |
| | | controller.addFields(fieldList); |
| | | } |
| | | LookUpOverrideFields.add('Contact_Name__c'); |
| | | //添加项 |
| | | Init(controller.getRecord()); |
| | |
| | | } |
| | | protected override void beforeUpdate() { |
| | | changeAssume(); |
| | | SetAwaitToSendAWS();//new |
| | | } |
| | | //new |
| | | protected override void beforeInsert() { |
| | | SetAwaitToSendAWS();//new |
| | | } |
| | | |
| | | protected override void afterInsert() { |
| | | createAgencyTarget(); |
| | | SetAwaitToSendAWS(); |
| | | //SetAwaitToSendAWS();//old |
| | | |
| | | } |
| | | |
| | |
| | | // LHJ KWAG-BQMA89 202006 Start |
| | | updateAgencyAccout(); |
| | | // LHJ KWAG-BQMA89 202006 End |
| | | |
| | | SetAwaitToSendAWS(); |
| | | //SetAwaitToSendAWS();//old |
| | | } |
| | | |
| | | |
| | |
| | | if (!NFM601_IdMap.containsKey(acc.Id)) { |
| | | // 判断是否是接口用户 |
| | | if(UserInfo.getUserId().equals(System.Label.interfaceUserID)){ |
| | | interfaceUserUpsertAccount.add(acc.Id); |
| | | //此处做修改,NFM624Rest接收数据后触发trigger,trigger再去调用601存在bug,修改为增加标记,使用Batch发送 |
| | | //interfaceUserUpsertAccount.add(acc.Id); |
| | | //2022-3-28 pk start |
| | | acc.NFM601Tag__c = true; |
| | | //2022-3-28 pk end |
| | | } else { |
| | | queueableAccountIdList.add(acc.Id); |
| | | } |
| | |
| | | ) { |
| | | if (!NFM601_IdMap.containsKey(acc.Id)) { |
| | | if(UserInfo.getUserId().equals(System.Label.interfaceUserID)){ |
| | | interfaceUserUpsertAccount.add(acc.Id); |
| | | //interfaceUserUpsertAccount.add(acc.Id); |
| | | //2022-3-28 pk start |
| | | acc.NFM601tag__c = true; |
| | | //2022-3-28 pk start |
| | | } else { |
| | | queueableAccountIdList.add(acc.Id); |
| | | } |
| | |
| | | if (queueableAccountIdList.size() > 0) { |
| | | NFM601Controller.callout('', queueableAccountIdList); |
| | | } |
| | | if (interfaceUserUpsertAccount.size() > 0) { |
| | | NFM601Controller.executefuture('', interfaceUserUpsertAccount); |
| | | } |
| | | // if (interfaceUserUpsertAccount.size() > 0) { |
| | | // NFM601Controller.executefuture('', interfaceUserUpsertAccount); |
| | | // } |
| | | } |
| | | |
| | | } |
| | |
| | | @AuraEnabled |
| | | public static List<Agency_Hospital_Link__c> getHospitalList(String hospital_name) { |
| | | hospital_name = '%' + hospital_name.trim() + '%'; |
| | | return [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Hospital_Name_readonly__c like :hospital_name and Agency_Campaign_Obj__c = true]; |
| | | system.debug('hospital_name+++'+hospital_name); |
| | | List<Agency_Hospital_Link__c> ahllist = [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Hospital_Name_readonly__c like :hospital_name and Agency_Campaign_Obj__c = true]; |
| | | system.debug('Agency_Campaign_Obj__c+++'+ahllist); |
| | | return ahllist; |
| | | } |
| | | |
| | | @RemoteAction |
| | |
| | | //2021-10-15 mzy 任务管理改善 end |
| | | ) { |
| | | if (!String.isBlank(a.act.Activity_Type2__c) && a.act.Activity_Type2__c == '病院' |
| | | && a.act.Free_Input__c == false && String.isBlank(a.act.Visitor1__c)) { |
| | | && a.act.Free_Input__c == false && String.isBlank(a.act.Visitor1_ID__c)) { //Add By Chen Yanan 20220325 for PIPL |
| | | // && a.act.Free_Input__c == false && String.isBlank(a.act.Visitor1__c)) { |
| | | a.act.Visitor1__c.addError('请至少填写一位访问对象'); |
| | | eventFlg = true; |
| | | } |
| | |
| | | let y=window.event.y; |
| | | createDiv.style.left=x; |
| | | createDiv.style.top=y; |
| | | createDiv.style.height='30px'; |
| | | createDiv.style.width='100px'; |
| | | createDiv.style.background="#dddddd"; |
| | | createDiv.style.position = "absolute"; |
| | | parentNode.appendChild(createDiv); |
| | | parentNode.appendChild(createDiv); |
| | | parentNode.style.position = "relative"; |
| | | } |
| | | |
| | | function hidePIDiv(awsDataId){ |
| | |
| | | //全选功能 |
| | | function checkAll() { |
| | | var cnt = j$(escapeVfId('raCnt')).val(); |
| | | if (j$(escapeVfId('Page:Form:Block:j_id53:checkAll')).attr('checked') == 'checked') { |
| | | if (j$(escapeVfId('Page:allForm:allBlock:j_id66:checkAll')).attr('checked') == 'checked') { |
| | | for (var i = 0; i < cnt; i++) { |
| | | j$(escapeVfId('Page:Form:Block:j_id53:records:' + i + ':checklist')).attr('checked',true); |
| | | j$(escapeVfId('Page:allForm:allBlock:j_id66:records:' + i + ':checklist')).attr('checked',true); |
| | | } |
| | | } else { |
| | | for (var i = 0; i < cnt; i++) { |
| | | j$(escapeVfId('Page:Form:Block:j_id53:records:' + i + ':checklist')).attr('checked',false); |
| | | j$(escapeVfId('Page:allForm:allBlock:j_id66:records:' + i + ':checklist')).attr('checked',false); |
| | | } |
| | | } |
| | | } |
| | | //检索功能 |
| | | // function RetrievalBtnJS() { |
| | | // var RepairName = j$(escapeVfId("Page:Form:Block:RAInfoList:0:RepairName")).value(); |
| | | // var SAPRepairNo = j$(escapeVfId("Page:Form:Block:RAInfoList:0:SAPRepairNo")).value(); |
| | | // var HospitalName = j$(escapeVfId("Page:Form:Block:RAInfoList:0:HospitalName")).value(); |
| | | // blockme(); |
| | | // RetrievalBtn(); |
| | | // } |
| | | //跳转打印PDF页面 |
| | | // function showPDFJS() { |
| | | // blockme(); |
| | | // showPDF(); |
| | | // var raIdList = j$(escapeVfId('raIdList')).val(); |
| | | // if(raIdList != null && raIdList != ''){ |
| | | // var Id = raIdList.split(); |
| | | // for(var i = 0; i < Id.size(); i++){ |
| | | // window.open('apex/MaintenanceCommissionPDF?id=' + Id[i]); |
| | | // } |
| | | // } |
| | | // } |
| | | </script> |
| | | <apex:form id="allForm" style="margin: 10px 10px;"> |
| | | <apex:actionFunction name="RetrievalBtn" action="{!RetrievalBtn}" rerender="Form, message" onComplete="unblockUI();"/> |
| | |
| | | <apex:pageBlock title="检索列" id="Editable"> |
| | | <table> |
| | | <tr><td style="text-align: left;padding-right: 100px;"> </td></tr> |
| | | <apex:repeat value="{!RevalInfoList}" var="reval" id="RevalInfoList"> |
| | | <tr> |
| | | <!-- <td style="text-align: left;padding-right: 100px;"> </td> --> |
| | | <td style="text-align: right; width:200px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="状态2"/> |
| | | <td style="text-align: right; width:100px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="状态1"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputText id="Status2" value="{!reval.Status2}"/> |
| | | <td style="text-align: left;position: relative; top: 7px;"> |
| | | <apex:selectList value="{!RevalInfo.Status1}" size="1" style="width: 150px; height: 24px;"> |
| | | <apex:selectOptions value="{!StatusItems}"/> |
| | | </apex:selectList><p/> |
| | | </td> |
| | | <td style="text-align: right; width:200px;"> |
| | | <td style="text-align: right; width:150px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="RS修理单号"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputText id="RepairName" value="{!reval.RepairName}"/> |
| | | <apex:inputText id="RepairName" value="{!RevalInfo.RepairName}"/> |
| | | </td> |
| | | <td style="text-align: right; width:150px;"> |
| | | <td style="text-align: right; width:130px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="SAP修理单号"/> |
| | | </td> |
| | | <td style="text-align: left;padding-right: 100px;"> |
| | | <apex:inputText id="SAPRepairNo" value="{!reval.SAPRepairNo}"/> |
| | | <td style="text-align: left;padding-right: 70px;"> |
| | | <apex:inputText id="SAPRepairNo" value="{!RevalInfo.SAPRepairNo}"/> |
| | | </td> |
| | | <td style="text-align: right; width:60px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="服务方式"/> |
| | | </td> |
| | | <td style="text-align: left;position: relative; top: 7px;"> |
| | | <apex:selectList value="{!RevalInfo.onSiteRepair}" size="1" style="width: 150px; height: 24px;"> |
| | | <apex:selectOptions value="{!SiteRepairItems}"/> |
| | | </apex:selectList><p/> |
| | | </td> |
| | | </tr> |
| | | <tr><td style="text-align: left;padding-right: 100px;"> </td></tr> |
| | | <tr> |
| | | <!-- <td style="text-align: left;padding-right: 100px;"> </td> --> |
| | | <td style="text-align: right; width:100px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="机身编码"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputText id="SerialNumber" value="{!reval.SerialNumber}"/> |
| | | <apex:inputText id="SerialNumber" value="{!RevalInfo.SerialNumber}"/> |
| | | </td> |
| | | <td style="text-align: right; width:200px;"> |
| | | <td style="text-align: right; width:150px;"> |
| | | <apex:outputLabel style="font-weight: bold; " value="修理委托者"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputField id="InchargeStaffName" value="{!reval.repair.Incharge_Staff__c}"/> |
| | | <apex:inputField id="InchargeStaffName" value="{!RevalInfo.repair.Incharge_Staff__c}"/> |
| | | </td> |
| | | <td style="text-align: right; width:150px;"> |
| | | <td style="text-align: right; width:130px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="FSE申请日"/> |
| | | </td> |
| | | <td style="text-align: left;padding-right: 80px;"> |
| | | <apex:inputField id="FSE_ApplyForRepair_Day" value="{!reval.repair.Final_complete_day__c}"/> |
| | | <td style="text-align: left;padding-right: 50px;"> |
| | | <apex:inputField id="FSE_ApplyForRepair_Day" value="{!RevalInfo.repair.Aware_date__c}"/> |
| | | </td> |
| | | <td style="text-align: right; width:60px;"> |
| | | <apex:outputLabel style="font-weight: bold; padding-right: 5px;" value="维修中心"/> |
| | | </td> |
| | | <td style="text-align: left;"> |
| | | <apex:inputText id="workLocationSelect" value="{!RevalInfo.workLocationSelect}"/> |
| | | </td> |
| | | </tr> |
| | | </apex:repeat> |
| | | <tr><td style="text-align: left;padding-right: 100px;"> </td></tr> |
| | | <tr> |
| | | <td style="text-align: center;" colspan="6"> |
| | |
| | | </tr> |
| | | </table> |
| | | </apex:pageBlock> |
| | | <!-- <div style="font-size:12px;"> --> |
| | | <apex:pageBlock title="详细信息" > |
| | | <input type="hidden" id="raCnt" value="{!RACount}" /> |
| | | <apex:commandButton style="width:80px;" value="打印PDF" action="{!showPDF}" onclick="blockme();" reRender="allForm,message" onComplete="unblockUI();"/> |
| | |
| | | <th style="text-align:left; width:6%">状态1</th> |
| | | <th style="text-align:left; width:6%">状态2</th> |
| | | <th style="text-align:left; width:7%">RS修理单号</th> |
| | | <th style="text-align:left; width:10%">SAP修理单号</th> |
| | | <th style="text-align:left; width:8%">SAP修理单号</th> |
| | | <th style="text-align:left; width:10%">型号</th> |
| | | <th style="text-align:left; width:5%">机身编号</th> |
| | | <th style="text-align:left; width:8%">医院名称</th> |
| | | <th style="text-align:left; width:9%">医院名称</th> |
| | | <th style="text-align:left; width:5%">省份</th> |
| | | <th style="text-align:left; width:5%">修理委托者</th> |
| | | <th style="text-align:left; width:8%">FSE申请日期</th> |
| | | <th style="text-align:left; width:5%">维修中心</th> |
| | | <th style="text-align:left; width:6%">维修中心</th> |
| | | <th style="text-align:left; width:5%">服务方式</th> |
| | | <th style="text-align:left; width:8%">有无维修合同对象</th> |
| | | <th style="text-align:left; width:8%">无偿区别标志</th> |
| | |
| | | <td align="left" width="7%"> |
| | | <apex:outputField id="OTCode" value="{!ra.repair.Name}"/> |
| | | </td> |
| | | <td align="left" width="10%"> |
| | | <td align="left" width="8%"> |
| | | <apex:outputField id="SAP_Service_Repair_No" value="{!ra.repair.SAP_Service_Repair_No__c}"/> |
| | | </td> |
| | | <td align="left" width="10%"> |
| | | <apex:outputField id="Delivered_Product" value="{!ra.repair.Delivered_Product__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | | <td align="left" width="5%" style="word-wrap:break-word;word-break:break-all;"> |
| | | <apex:outputField id="SerialNumber" value="{!ra.repair.SerialNumber__c}"/> |
| | | </td> |
| | | <td align="left" width="8%"> |
| | | <td align="left" width="9%"> |
| | | <apex:outputField id="HP_Name" value="{!ra.repair.HP_Name__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | |
| | | <td align="left" width="8%"> |
| | | <apex:outputField id="FSE_ApplyForRepair_Day" value="{!ra.repair.FSE_ApplyForRepair_Day__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | | <td align="left" width="6%"> |
| | | <apex:outputField id="work_location_select" value="{!ra.repair.work_location_select__c}"/> |
| | | </td> |
| | | <td align="left" width="5%"> |
| | |
| | | </table> |
| | | </div> |
| | | </apex:pageBlock> |
| | | <!-- </div> --> |
| | | </div> |
| | | </apex:pageBlock> |
| | | </apex:outputPanel> |
| | |
| | | let parentNode = document.getElementById(awsDataId); |
| | | let createDiv = document.createElement("div"); |
| | | createDiv.id = awsDataId+"_PI"; |
| | | let piInformation = 'Name:'+contact[awsDataId].lastName +'\n' +'Phone:'+contact[awsDataId].phone |
| | | let piInformation = '姓名:'+contact[awsDataId].lastName +'\n' +'电话:'+contact[awsDataId].phone |
| | | //let piInformation = 'Name:'+contact['943114607025717249'].lastName +'\n' +'Phone:'+contact['943114607025717249'].phone |
| | | createDiv.innerText = piInformation; |
| | | let x=window.event.x; |
| | |
| | | createDiv.style.background="#dddddd"; |
| | | createDiv.style.position = "absolute"; |
| | | parentNode.appendChild(createDiv); |
| | | parentNode.style.position = "relative"; |
| | | } |
| | | |
| | | function hidePIDiv(awsDataId){ |
| | |
| | | function Foo(){ |
| | | j$('[aws-id]').each(function(i,e){ |
| | | let awsDataId = j$(e).attr('aws-id'); |
| | | let piInformation = 'Name:'+contact[awsDataId].lastName +'<br/>' +'Phone:'+ (contact[awsDataId].phone ? contact[awsDataId].phone :''); |
| | | j$(e).find('.decrypt').html(piInformation); |
| | | if (contact.hasOwnProperty(awsDataId)) { |
| | | let piInformation = '姓名:'+contact[awsDataId].lastName +'<br/>' +'手机号:'+ (contact[awsDataId].mobilePhone ? contact[awsDataId].mobilePhone :''); |
| | | j$(e).find('.decrypt').html(piInformation); |
| | | }else{ |
| | | console.log(awsDataId+' not in contact'); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | |
| | |
| | | for(var i=0;i<contacts.length;i++){ |
| | | let temp = {} |
| | | temp.lastName = contacts[i].lastName; |
| | | temp.phone = contacts[i].phone; |
| | | temp.mobilePhone = contacts[i].mobilePhone; |
| | | |
| | | contact[contacts[i].dataId] = temp; |
| | | } |
| | |
| | | // createDiv.style.position = "absolute"; |
| | | // parentNode.appendChild(createDiv); |
| | | console.log('dataId:'+dataId+'awsDataId Value:'+awsDataId); |
| | | let piInformation = 'Name:'+contact[awsDataId].lastName +'\n' +'Phone:'+ (contact[awsDataId].phone ? contact[awsDataId].phone :''); |
| | | let piInformation = '姓名:'+contact[awsDataId].lastName +'\n' +'电话:'+ (contact[awsDataId].mobilePhone?contact[awsDataId].mobilePhone:''); |
| | | document.getElementById(dataId+'_'+awsDataId).innerText = piInformation; |
| | | } |
| | | |
| | |
| | | <!-- <td><a href="#" onclick="setContact('{!lineinfo.lineNo}');" id="943114607025717249" onmouseover="showPIDiv('943114607025717249')" onmouseout="hidePIDiv('943114607025717249')">{!lineinfo.con.Name}</a></td> --> |
| | | <!-- 2022/02/15 张华建 解密信息 start --> |
| | | <td> |
| | | <a href="/{!lineinfo.con.Id}" onclick="setContact('{!lineinfo.lineNo}','{!lineinfo.con.AWS_Data_Id__c}');" aws-id="{!lineinfo.con.AWS_Data_Id__c}" style="position:relative"> |
| | | <a href="/{!lineinfo.con.Id}" target="_blank" onclick="setContact('{!lineinfo.lineNo}','{!lineinfo.con.AWS_Data_Id__c}');" aws-id="{!lineinfo.con.AWS_Data_Id__c}" style="position:relative"> |
| | | <span class="encrypt">{!lineinfo.con.Name}</span> |
| | | <span class="decrypt"></span> |
| | | </a> |
| | |
| | | var aws_result={}; |
| | | |
| | | jQuery(function(){ |
| | | var eles = document.getElementsByClassName("contact"); |
| | | for(let e of eles){ |
| | | let awsid = e.getAttribute('awsid'); |
| | | |
| | | jQuery("input.contact").each(function(){ |
| | | let awsid = this.getAttribute('awsid'); |
| | | if(awsid) awsids.push(awsid); |
| | | } |
| | | }) |
| | | |
| | | if(awsids.length > 0){ |
| | | AWSService.search(staticResource.searchUrl,JSON.stringify({dataIds:awsids}),function(result){ |
| | | if(result.status == '0' && result.object && result.object.length > 0){ |
| | | for(let obj of result.object){ |
| | | for(let obji in result.object){let obj=result.object[obji]; |
| | | jQuery("[awsid='"+obj.dataId + "']").val(obj.lastName); |
| | | } |
| | | } |
| | |
| | | } |
| | | function confirmTrans(transId, isSuccess) { |
| | | |
| | | fetch(staticResources.updateUrl, { |
| | | method: 'POST', |
| | | body: JSON.stringify({ 'txId': transId, "isSuccess": isSuccess }), |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'pi-token': staticResources.token |
| | | } |
| | | }).then((data) => { |
| | | return data.json(); |
| | | }).then(data => { |
| | | AWSService.post(staticResources.updateUrl, JSON.stringify({ |
| | | "txId":transId, |
| | | "sfRecordId":"", |
| | | "isSuccess":isSuccess |
| | | }), function(result){ |
| | | console.log("confirmTrans-" + JSON.stringify(data)); |
| | | document.getElementById("file").files[0].name = ''; |
| | | enableButtonStatus(); |
| | | refreshFiles(); |
| | | return data.status; |
| | | }) |
| | | refreshFiles(); |
| | | }, staticResources.token); |
| | | |
| | | } |
| | | function calculateFileSize(fileObject) { |
| | |
| | | var p = new Promise(function(resolve, reject){ |
| | | rowBList = JSON.parse('{!rowListString}') |
| | | var x = 0; |
| | | var y = 0; |
| | | let searchCallBack = function searchCallBack(result){ |
| | | let contacts = result.object; |
| | | if(contacts == null){ |
| | |
| | | x++; |
| | | }; |
| | | for(var i=0;i<rowBList.length;i++){ |
| | | ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id); |
| | | AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token); |
| | | if(rowBList[i].rnd.AWS_Data_Id__c ){ |
| | | y++; |
| | | ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id); |
| | | AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token); |
| | | } |
| | | } |
| | | var id = setInterval(function(){ |
| | | if(x >= rowBList.length){ |
| | | if(x == y){ |
| | | console.log('success') |
| | | resolve('success'); |
| | | clearInterval(id); |
| | | } |
| | | },1000); |
| | | },500); |
| | | }); |
| | | return p; |
| | | } |
| | |
| | | if(awsDataId.length == 0){ |
| | | return |
| | | } |
| | | if(TrialUser[awsDataId.substring(0,18)] == null){ |
| | | return |
| | | } |
| | | console.log('awsDataId Value:'+awsDataId); |
| | | let parentNode = document.getElementById(awsDataId); |
| | | let createDiv = document.createElement("div"); |
| | |
| | | if(awsDataId.length == 0){ |
| | | return |
| | | } |
| | | if(TrialUser[awsDataId.substring(0,18)] == null){ |
| | | return |
| | | } |
| | | document.getElementById(awsDataId+'_PI').remove(); |
| | | } |
| | | |
| | | function q3(){ |
| | | var p = new Promise(function(resolve, reject){ |
| | | console.log('saveRecordJS') |
| | | |
| | | var a = 0; |
| | | var b = 0; |
| | | let newCallBack = function newCallBack(result,indexNumber){ |
| | | |
| | | console.log('result = '+JSON.stringify(result)) |
| | | //赋值dataId和trialUser |
| | | document.getElementById('allPage:allForm:dataBlock:dataline_R_aws:'+indexNumber+':EditAWSDataId').value = result.object[0].dataId; |
| | | document.getElementById('allPage:allForm:dataBlock:dataline_R:'+indexNumber+':inputField:6:inputField').value = result.object[0].trialUser; |
| | | let transParameters = { |
| | | txId: result.txId, |
| | | isSuccess: 1 |
| | | }; |
| | | let confirmCallBack = function confirmCallBack(result){ |
| | | console.log('confirmCallBack = '+JSON.stringify(result)) |
| | | } |
| | | b++; |
| | | AWSService.confirmTrans(staticResource.transactionUrl,JSON.stringify(transParameters),confirmCallBack,staticResource.token) |
| | | }; |
| | | for(var i=0;i<rowBList.length;i++){ |
| | | if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){ |
| | | a++; |
| | | } |
| | | } |
| | | debugger |
| | | for(var i=0;i<rowBList.length;i++){ |
| | | if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){ |
| | | //加密试用者 |
| | | var trialUser = document.getElementById('allPage:allForm:dataBlock:dataline_R:'+i+':inputField:6:j_id86').children[0].children[0].value |
| | | let consumApplyPayloadList = []; |
| | | let consumApplyPIData = new Object(); |
| | | consumApplyPIData.trialUser = trialUser; |
| | | consumApplyPIData.sfRecordId = ''; |
| | | consumApplyPayloadList.push(consumApplyPIData); |
| | | AWSService.postConsumTrial(staticResource.newUrl,i,JSON.stringify(consumApplyPayloadList),newCallBack,staticResource.token); |
| | | } |
| | | } |
| | | var id = setInterval(function(){ |
| | | if(a == b){ |
| | | console.log('a==b success') |
| | | resolve('success'); |
| | | clearInterval(id); |
| | | } |
| | | },500); |
| | | }); |
| | | return p; |
| | | } |
| | | |
| | | function q4(){ |
| | | debugger |
| | | saveRecord(); |
| | | } |
| | | function saveRecordJS(){ |
| | | if('{!pageB.fixMode}' != 'true'){ |
| | | return |
| | | } |
| | | q3().then(function(data){ |
| | | return q4(data); |
| | | }) |
| | | unblockUI(); |
| | | } |
| | | //2022 02 24 张华建 display PI Data end |
| | | </script> |
| | |
| | | <apex:commandButton value="适用" rendered="{!canEdit}" onclick="applyJs();return false;"/> |
| | | </span> |
| | | <span style="margin-left: 10px;"> |
| | | <apex:commandButton value="保存" onclick="blockme();saveRecord(); return false;" rendered="{!canEdit}"/> |
| | | <apex:commandButton value="保存" onclick="blockme();saveRecordJS(); return false;" rendered="{!canEdit}"/> |
| | | </span> |
| | | </td> |
| | | </tr> |
| | |
| | | </apex:repeat> |
| | | </table> |
| | | </div> |
| | | <apex:repeat id="dataline_R_aws" value="{!pageB.rowBList}" var="var"> |
| | | <apex:inputHidden value="{!var.rnd.AWS_Data_Id__c}" id="EditAWSDataId"/> |
| | | </apex:repeat> |
| | | <div id="in_Div" style="overflow:auto;"> |
| | | <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableData"> |
| | | <apex:variable value="{!0}" var="Cnt_R" /> |
| | | <apex:repeat id="dataline_R" value="{!pageB.rowBList}" var="var"> |
| | | <tr id="tableData_R_{!Cnt_R}" class="dataRow" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" style="{!IF(var.isOddnumber, 'background-color : #EFF4FC;', '')}"> |
| | | <apex:repeat value="{!inputFieldList}" var="info" id="inputField"> |
| | | <td class="dataCellBorder1 intf {!info.value} col_{!info.value}" id="{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,info.value)}" onmouseover="showPIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')" onmouseout="hidePIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')"> |
| | | <td class="dataCellBorder1 intf {!info.value} col_{!info.value}" id="{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,info.value)}" onmouseover="showPIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')" onmouseout="hidePIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')"> |
| | | <apex:outputPanel rendered="{!(contains(var.canChangeField, info.value) || var.canChangeField == '') && pageB.fixMode == true && var.canChange == true && info.value != 'Degree_Of_Importance__c'}"> |
| | | <!-- onchange="setChangeFlg('{!var.lineNo}')" --> |
| | | <apex:outputPanel rendered="{!info.value != 'Case_OR_animal_organ__c'}"> |
| | |
| | | <!-- <apex:inputHidden value="{!var.rnd.Degree_Of_Importance__c}"/> --> |
| | | </td> |
| | | <td class="col_Scroll"></td> |
| | | |
| | | </tr> |
| | | <apex:variable value="{!Cnt_R+1}" var="Cnt_R" /> |
| | | |
| | | </apex:repeat> |
| | | </table> |
| | | </div> |
| | |
| | | body { |
| | | font-family: Arial Unicode MS; |
| | | page-break-inside: auto; |
| | | font-size: 14px; |
| | | font-size: 14pt; |
| | | } |
| | | table { |
| | | border-collapse: collapse; |
| | | width: 100%; |
| | | } |
| | | table, th, td { |
| | | border: 1px solid black; |
| | | border: 1pt solid black; |
| | | text-align: left; |
| | | } |
| | | table.headTable tr td { |
| | | font-size: 13px; |
| | | font-size: 13pt; |
| | | } |
| | | table.deliInfoTable tr td { |
| | | font-size: 13px; |
| | | font-size: 12pt; |
| | | } |
| | | table.detailListTable tr td { |
| | | font-size: 8px; |
| | | font-size: 8pt; |
| | | text-align: left; |
| | | box-sizing:border-box; |
| | | padding: 1px; |
| | | padding: 1pt; |
| | | } |
| | | table.tailTable tr td { |
| | | font-size: 12px; |
| | | font-size: 12pt; |
| | | } |
| | | body{margin: 0 auto;width: 920px;font-size: 14px;} |
| | | #title1{height: 30px;} |
| | | body{margin: 0 auto;width: 920px;font-size: 14pt;} |
| | | #title1{height: 50pt;} |
| | | #title2{height: 80px;} |
| | | #pdf-wrapper {position: relative;} |
| | | #pdf-wrapper table{width: 100%;border-spacing: 0px;border-collapse: collapse; border: none;} |
| | |
| | | <!-- 20220221 PI改造 by 徐亮 start --> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> |
| | | <!-- <script src="https://cdn.bootcss.com/es6-promise/4.1.1/es6-promise.auto.min.js" type="text/javascript"></script> --> |
| | | |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> |
| | |
| | | <!-- 序号 --> |
| | | <apex:variable value="{!1}" var="lineCnt" /> |
| | | <apex:repeat value="{!pdfPageList}" var="eachPdfPage"> |
| | | <img style="width:79px;height:79px;padding:0px;margin-top:1px;z-index:999;position:absolute;" |
| | | <div class="pdf-page"> |
| | | <div id="title1"></div> |
| | | <img style="width:72pt;height:72pt;padding:0px;margin-top:1pt;z-index:999;position:absolute;" |
| | | src="{!QRSrc}" /> |
| | | <!-- 表头 --> |
| | | <table class="headTable" style="position:relative;"> |
| | | <colgroup> |
| | | <col width="100%"/> |
| | | </colgroup> |
| | | <tr> |
| | | <th style="box-sizing:border-box; text-align:center; font-size:24px; font-weight:900;" height="35">奥林巴斯医疗手术附件(器械)临床试用表</th> |
| | | </tr> |
| | | <tr> |
| | | <td style="text-align:right;"> |
| | | 耗材备品申请单号:<apex:outputText value="{!targetConsumApply.Name}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td style="text-align:right;"> |
| | | 本单附件第(<apex:outputText value="{!pageCnt}" />)页/共(<apex:outputText value="{!pageTotalCnt}" />)页 |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | |
| | | <!-- 发货信息 --> |
| | | <table class="deliInfoTable"> |
| | | <colgroup> |
| | | <col width="16%" /> |
| | | <col width="14%" /> |
| | | <col width="36%" /> |
| | | <col width="16%" /> |
| | | <col width="18%" /> |
| | | </colgroup> |
| | | <tr> |
| | | <th style="text-align:center;" colspan="5" height="25">发货信息</th> |
| | | </tr> |
| | | <tr> |
| | | <td>使用目的</td> |
| | | <td colspan="4"> |
| | | <apex:outputText value="{!targetConsumApply.demo_purpose2__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td rowspan="2">申请人信息</td> |
| | | <td>所属本部名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Salesdept__c}" /> |
| | | </td> |
| | | <td>所属办事处名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.WorkPlace__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td>姓名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Person_In_Charge__r.Name}" /> |
| | | </td> |
| | | <td colspan="1">联系电话</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.ApplyPerson_Phone__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td>医疗机构信息</td> |
| | | <td>医疗机构名</td> |
| | | <td> |
| | | <apex:outputText value="{!hospitalName}" /> |
| | | </td> |
| | | <td>科室名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Account__r.Department_Name__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td rowspan="3" >发货地址</td> |
| | | <td colspan="2" rowspan="3"> |
| | | <apex:outputText value="{!shippmentAddress}" /> |
| | | </td> |
| | | <td colspan="1">邮编</td> |
| | | <td> |
| | | <apex:outputText value="{!IF(targetConsumApply.Shipment_address__r.Post_Code__c==null, targetConsumApply.Post_Code__c, targetConsumApply.Shipment_address__r.Post_Code__c)}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="1">接收人姓名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Loaner_received_staff__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="1">接收人电话</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Loaner_received_staff_phone__c}" /> |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | <apex:outputPanel layout="none" rendered="{!pageCnt == 1}"> |
| | | <!-- ※奥林巴斯耗材备品借用须知 --> |
| | | <table style="table-layout:fixed;"> |
| | | <!-- 表头 --> |
| | | <table class="headTable" style="position:relative;"> |
| | | <colgroup> |
| | | <col width="100%" /> |
| | | <col width="100%"/> |
| | | </colgroup> |
| | | <tr> |
| | | <th style="text-align:center;" colspan="5" height="25">※奥林巴斯耗材备品借用须知</th> |
| | | <th style="box-sizing:border-box; text-align:center; font-size:24pt; font-weight:900;" height="35">奥林巴斯医疗手术附件(器械)临床试用表</th> |
| | | </tr> |
| | | <tr> |
| | | <td style="font-size:12px;"> |
| | | 1、严格遵循医疗产品的合规使用原则,为评价该产品在临床使用的有效性、安全性无偿提供给医疗从业者进行试用。<br /> |
| | | 2、一次性医疗产品和重复性使用产品用于临床后由试用者按该院对医疗废弃物的处置规定进行废弃。<br /> |
| | | 3、未经奥林巴斯公司书面同意,借用方不得以任何理由对耗材进行临床用途以外的处理,包括但不限于向第三方转借、出租、出售、抵押等。<br /> |
| | | 4、此次耗材出借基于正当合理的理由,而非通过出借耗材对借用方购买、推荐奥林巴斯公司产品、服务等产生任何不正当影响。<br /> |
| | | 5、借用方应独立依靠其专业水平和能力,严格按照奥林巴斯公司的要求(“产品使用说明书”)内容尽审慎义务正确操作、维护、监测耗材,<br />由于借用方错误、疏忽等借用方原因而导致的任何问题均应由借用方自行负责处理。<br /> |
| | | 6、其他未尽事宜,双方应本着友好合作原则进行协商解决。 |
| | | <td style="text-align:right;"> |
| | | 耗材备品申请单号:<apex:outputText value="{!targetConsumApply.Name}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td style="text-align:right;"> |
| | | 本单附件第(<apex:outputText value="{!pageCnt}" />)页/共(<apex:outputText value="{!pageTotalCnt}" />)页 |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | </apex:outputPanel> |
| | | <!-- 借用耗材备品发货清单 --> |
| | | <table class="detailListTable" style="width: 100%;"> |
| | | <colgroup> |
| | | <!-- 序号 --> |
| | | <col width="3.00%" /> |
| | | <!-- 明细型号 --> |
| | | <col width="12.00%" /> |
| | | <!-- 中文名称 33--> |
| | | <col width="28.00%" /> |
| | | <!-- 管理编码 耗材追溯 yc --> |
| | | <col width="5.00%" /> |
| | | <!-- 备品管理码 耗材追溯 yc --> |
| | | <col width="3.00%" /> |
| | | <!-- 消耗品有效期 --> |
| | | <col width="6.00%" /> |
| | | <!-- 展示/演示 --> |
| | | <col width="5.27%" /> |
| | | <!-- 试用数量 3.46--> |
| | | <col width="3.46%" /> |
| | | <!-- 试用日期 --> |
| | | <col width="6.78%" /> |
| | | <!-- 病例/动物脏器 --> |
| | | <col width="4.82%" /> |
| | | <!-- 试用者盖章 --> |
| | | <col width="4.52%" /> |
| | | <!-- 跟台者盖章 --> |
| | | <col width="4.37%" /> |
| | | <!-- 备用 --> |
| | | <col width="3.46%" /> |
| | | <!-- 备注 --> |
| | | <!-- <col width="10%" /> --> |
| | | </colgroup> |
| | | <apex:outputPanel layout="none" rendered="{!eachPdfPage.equipSetDetailList.size > 0}"> |
| | | <tr> |
| | | <th style="text-align:center;" colspan="12" height="25">借用耗材备品发货清单</th> |
| | | </tr> |
| | | <tr> |
| | | <th style="text-align:center; font-size:10px;" colspan="12" height="25">共计耗材备品({!consumApplySetDetailListSize})件</th> |
| | | </tr> |
| | | <tr> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="序号"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="明细型号"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="中文名称"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="管理编码"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="备品管理码"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="消耗品有效期"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="展示/演示"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="试用数量"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="试用日期"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="病例/动物脏器"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="试用者盖章"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="跟台者盖章"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="备用"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="备注"/></td> |
| | | </tr> |
| | | </apex:outputPanel> |
| | | <apex:repeat value="{!eachPdfPage.equipSetDetailList}" var="eachEquipSetDetail"> |
| | | <tr style="vertical-align:center;"> |
| | | <!-- 序号 --> |
| | | <td style="text-align:center;height:30px;"> |
| | | <apex:outputPanel rendered="{!lineCnt <= consumApplySetDetailListSize}" layout="none"> |
| | | <c:PDFWbr targetStr="{!lineCnt}"/> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel rendered="{!lineCnt > consumApplySetDetailListSize}" layout="none"><br /></apex:outputPanel> |
| | | </td> |
| | | <!-- 明细型号 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Fixture_Model_No_F__c}"/></td> |
| | | <!-- 中文名称 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.ProductName__c}"/></td> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.ManagementCode__c}"/></td> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.EquipmentManagementCode__c}"/></td> |
| | | <!-- 消耗品有效期 --> |
| | | <td style="text-align: center;"> |
| | | <apex:outputText value="{0,date,yyyy'/'MM'/'dd}"> |
| | | <apex:param value="{!eachEquipSetDetail.Consumable_Guaranteen_end_F__c}"/> |
| | | </apex:outputText> |
| | | </td> |
| | | <!-- 展示/演示 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Show_demonstration__c}"/></td> |
| | | <!-- 试用数量 --> |
| | | <td style="text-align: right;"><c:PDFWbr targetStr="{!eachEquipSetDetail.Trial_Num__c}"/></td> |
| | | <!-- 试用日期 --> |
| | | <!-- <td style="text-align:left;"><c:PDFWbr targetStr="{!eachEquipSetDetail.Consum_Start_Date__c}"/></td> --> |
| | | <td style="text-align: center;"> |
| | | <apex:outputText value="{0,date,yyyy'/'MM'/'dd}"> |
| | | <apex:param value="{!eachEquipSetDetail.Consum_Start_Date__c}"/> |
| | | </apex:outputText> |
| | | </td> |
| | | <!-- 病例/动物脏器 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Case_OR_animal_organ__c}"/></td> |
| | | <!-- 试用者盖章 --> |
| | | <td aws-data-id="{!eachEquipSetDetail.AWS_Data_Id__c}"><c:PDFWbr targetStr="{!eachEquipSetDetail.Trial_User__c}"/></td> |
| | | <!-- 跟台者盖章 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Follower_User__r.Name}"/></td> |
| | | <!-- 备用 --> |
| | | <td style="text-align: center;"> |
| | | <!-- eachEquipSetDetail.Spare__c --> |
| | | <apex:outputPanel rendered="{!eachEquipSetDetail.Spare__c}"> |
| | | ✔️ |
| | | </apex:outputPanel> |
| | | </td> |
| | | <!-- 备注 --> |
| | | <td style="box-sizing: border-box;text-align:left;padding: 0px;"><c:PDFWbr targetStr="{!eachEquipSetDetail.Comment__c}"/></td> |
| | | </tr> |
| | | <apex:variable value="{!lineCnt + 1}" var="lineCnt" /> |
| | | </apex:repeat> |
| | | |
| | | </table> |
| | | <table class="tailTable" style="width:100%;"> |
| | | <tr> |
| | | <!-- 20210812 SFDC-C5CC5S 修改地址--> |
| | | <td colspan="2" height="40" > |
| | | 奥林巴斯 上海备品中心地址:上海市浦东新区金吉路778号3号楼1F<br /> |
| | | 邮编:201206 TEL:021-60391318-8877 FAX:021-60391316 |
| | | <!-- TODO 如果地址等内容需要修改的话,FixtureRentalPDF、LostReportEdit的地址等信息也需要确认是否需要一起修改 --> |
| | | </td> |
| | | </tr> |
| | | <!-- 20211210 ljh SFDC-C923SR add --> |
| | | <tr> |
| | | <td colspan="2" style=" border: none;"> |
| | | <img align="left" src="{!BRSrc}" /> |
| | | </td> |
| | | </tr> |
| | | <!-- 20211210 ljh SFDC-C923SR end --> |
| | | </table> |
| | | <apex:outputPanel rendered="{!pageCnt < pageTotalCnt}" layout="none"> |
| | | <div style="page-break-after:always;"/> |
| | | </apex:outputPanel> |
| | | <apex:variable value="{!pageCnt + 1}" var="pageCnt" /> |
| | | <!-- 发货信息 --> |
| | | <table class="deliInfoTable"> |
| | | <colgroup> |
| | | <col width="16%" /> |
| | | <col width="14%" /> |
| | | <col width="36%" /> |
| | | <col width="16%" /> |
| | | <col width="18%" /> |
| | | </colgroup> |
| | | <tr> |
| | | <th style="text-align:center;" colspan="5" height="25">发货信息</th> |
| | | </tr> |
| | | <tr> |
| | | <td>使用目的</td> |
| | | <td colspan="4"> |
| | | <apex:outputText value="{!targetConsumApply.demo_purpose2__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td rowspan="2">申请人信息</td> |
| | | <td>所属本部名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Salesdept__c}" /> |
| | | </td> |
| | | <td>所属办事处名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.WorkPlace__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td>姓名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Person_In_Charge__r.Name}" /> |
| | | </td> |
| | | <td colspan="1">联系电话</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.ApplyPerson_Phone__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td>医疗机构信息</td> |
| | | <td>医疗机构名</td> |
| | | <td> |
| | | <apex:outputText value="{!hospitalName}" /> |
| | | </td> |
| | | <td>科室名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Account__r.Department_Name__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td rowspan="3" >发货地址</td> |
| | | <td colspan="2" rowspan="3" id="shippmentAddress"> |
| | | <apex:outputText value="{!shippmentAddress}" /> |
| | | </td> |
| | | <td colspan="1">邮编</td> |
| | | <td> |
| | | <apex:outputText value="{!IF(targetConsumApply.Shipment_address__r.Post_Code__c==null, targetConsumApply.Post_Code__c, targetConsumApply.Shipment_address__r.Post_Code__c)}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="1">接收人姓名</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Loaner_received_staff__c}" /> |
| | | </td> |
| | | </tr> |
| | | <tr> |
| | | <td colspan="1">接收人电话</td> |
| | | <td> |
| | | <apex:outputText value="{!targetConsumApply.Loaner_received_staff_phone__c}" /> |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | <apex:outputPanel layout="none" rendered="{!pageCnt == 1}"> |
| | | <!-- ※奥林巴斯耗材备品借用须知 --> |
| | | <table style="table-layout:fixed;"> |
| | | <colgroup> |
| | | <col width="100%" /> |
| | | </colgroup> |
| | | <tr> |
| | | <th style="text-align:center;" colspan="5" height="25">※奥林巴斯耗材备品借用须知</th> |
| | | </tr> |
| | | <tr> |
| | | <td style="font-size:12pt;"> |
| | | 1、严格遵循医疗产品的合规使用原则,为评价该产品在临床使用的有效性、安全性无偿提供给医疗从业者进行试用。<br /> |
| | | 2、一次性医疗产品和重复性使用产品用于临床后由试用者按该院对医疗废弃物的处置规定进行废弃。<br /> |
| | | 3、未经奥林巴斯公司书面同意,借用方不得以任何理由对耗材进行临床用途以外的处理,包括但不限于向第三方转借、出租、出售、抵押等。<br /> |
| | | 4、此次耗材出借基于正当合理的理由,而非通过出借耗材对借用方购买、推荐奥林巴斯公司产品、服务等产生任何不正当影响。<br /> |
| | | 5、借用方应独立依靠其专业水平和能力,严格按照奥林巴斯公司的要求(“产品使用说明书”)内容尽审慎义务正确操作、维护、监测耗材,<br />由于借用方错误、疏忽等借用方原因而导致的任何问题均应由借用方自行负责处理。<br /> |
| | | 6、其他未尽事宜,双方应本着友好合作原则进行协商解决。 |
| | | </td> |
| | | </tr> |
| | | </table> |
| | | </apex:outputPanel> |
| | | <!-- 借用耗材备品发货清单 --> |
| | | <table class="detailListTable" style="width: 100%;"> |
| | | <colgroup> |
| | | <!-- 序号 --> |
| | | <col width="3.00%" /> |
| | | <!-- 明细型号 --> |
| | | <col width="12.00%" /> |
| | | <!-- 中文名称 33--> |
| | | <col width="28.00%" /> |
| | | <!-- 管理编码 耗材追溯 yc --> |
| | | <col width="5.00%" /> |
| | | <!-- 备品管理码 耗材追溯 yc --> |
| | | <col width="3.00%" /> |
| | | <!-- 消耗品有效期 --> |
| | | <col width="6.00%" /> |
| | | <!-- 展示/演示 --> |
| | | <col width="5.27%" /> |
| | | <!-- 试用数量 3.46--> |
| | | <col width="3.46%" /> |
| | | <!-- 试用日期 --> |
| | | <col width="6.78%" /> |
| | | <!-- 病例/动物脏器 --> |
| | | <col width="4.82%" /> |
| | | <!-- 试用者盖章 --> |
| | | <col width="4.52%" /> |
| | | <!-- 跟台者盖章 --> |
| | | <col width="4.37%" /> |
| | | <!-- 备用 --> |
| | | <col width="3.46%" /> |
| | | <!-- 备注 --> |
| | | <!-- <col width="10%" /> --> |
| | | </colgroup> |
| | | <apex:outputPanel layout="none" rendered="{!eachPdfPage.equipSetDetailList.size > 0}"> |
| | | <tr> |
| | | <th style="text-align:center;" colspan="14" height="25">借用耗材备品发货清单</th> |
| | | </tr> |
| | | <tr> |
| | | <th style="text-align:center; font-size:10pt;" colspan="14" height="25">共计耗材备品({!consumApplySetDetailListSize})件</th> |
| | | </tr> |
| | | <tr> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="序号"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="明细型号"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="中文名称"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="管理编码"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="备品管理码"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="消耗品有效期"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="展示/演示"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="试用数量"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="试用日期"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="病例/动物脏器"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="试用者盖章"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="跟台者盖章"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="备用"/></td> |
| | | <td style="text-align: center;"><c:PDFWbr targetStr="备注"/></td> |
| | | </tr> |
| | | </apex:outputPanel> |
| | | <apex:repeat value="{!eachPdfPage.equipSetDetailList}" var="eachEquipSetDetail"> |
| | | <tr style="vertical-align:center;"> |
| | | <!-- 序号 --> |
| | | <td style="text-align:center;height:25pt;"> |
| | | <apex:outputPanel rendered="{!lineCnt <= consumApplySetDetailListSize}" layout="none"> |
| | | <c:PDFWbr targetStr="{!lineCnt}"/> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel rendered="{!lineCnt > consumApplySetDetailListSize}" layout="none"><br /></apex:outputPanel> |
| | | </td> |
| | | <!-- 明细型号 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Fixture_Model_No_F__c}"/></td> |
| | | <!-- 中文名称 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.ProductName__c}"/></td> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.ManagementCode__c}"/></td> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.EquipmentManagementCode__c}"/></td> |
| | | <!-- 消耗品有效期 --> |
| | | <td style="text-align: center;"> |
| | | <apex:outputText value="{0,date,yyyy'/'MM'/'dd}"> |
| | | <apex:param value="{!eachEquipSetDetail.Consumable_Guaranteen_end_F__c}"/> |
| | | </apex:outputText> |
| | | </td> |
| | | <!-- 展示/演示 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Show_demonstration__c}"/></td> |
| | | <!-- 试用数量 --> |
| | | <td style="text-align: right;"><c:PDFWbr targetStr="{!eachEquipSetDetail.Trial_Num__c}"/></td> |
| | | <!-- 试用日期 --> |
| | | <!-- <td style="text-align:left;"><c:PDFWbr targetStr="{!eachEquipSetDetail.Consum_Start_Date__c}"/></td> --> |
| | | <td style="text-align: center;"> |
| | | <apex:outputText value="{0,date,yyyy'/'MM'/'dd}"> |
| | | <apex:param value="{!eachEquipSetDetail.Consum_Start_Date__c}"/> |
| | | </apex:outputText> |
| | | </td> |
| | | <!-- 病例/动物脏器 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Case_OR_animal_organ__c}"/></td> |
| | | <!-- 试用者盖章 --> |
| | | <td aws-data-id="{!eachEquipSetDetail.AWS_Data_Id__c}"><c:PDFWbr targetStr="{!eachEquipSetDetail.Trial_User__c}"/></td> |
| | | <!-- 跟台者盖章 --> |
| | | <td><c:PDFWbr targetStr="{!eachEquipSetDetail.Follower_User__r.Name}"/></td> |
| | | <!-- 备用 --> |
| | | <td style="text-align: center;"> |
| | | <!-- eachEquipSetDetail.Spare__c --> |
| | | <apex:outputPanel rendered="{!eachEquipSetDetail.Spare__c}"> |
| | | ✔️ |
| | | </apex:outputPanel> |
| | | </td> |
| | | <!-- 备注 --> |
| | | <td style="box-sizing: border-box;text-align:left;padding: 0px;"><c:PDFWbr targetStr="{!eachEquipSetDetail.Comment__c}"/></td> |
| | | </tr> |
| | | <apex:variable value="{!lineCnt + 1}" var="lineCnt" /> |
| | | </apex:repeat> |
| | | |
| | | </table> |
| | | <table class="tailTable" style="width:100%;"> |
| | | <tr> |
| | | <!-- 20210812 SFDC-C5CC5S 修改地址--> |
| | | <td colspan="2" height="40" > |
| | | 奥林巴斯 上海备品中心地址:上海市浦东新区金吉路778号3号楼1F<br /> |
| | | 邮编:201206 TEL:021-60391318-8877 FAX:021-60391316 |
| | | <!-- TODO 如果地址等内容需要修改的话,FixtureRentalPDF、LostReportEdit的地址等信息也需要确认是否需要一起修改 --> |
| | | </td> |
| | | </tr> |
| | | <!-- 20211210 ljh SFDC-C923SR add --> |
| | | <tr> |
| | | <td colspan="2" style=" border: none;"> |
| | | <img align="left" src="{!BRSrc}" /> |
| | | </td> |
| | | </tr> |
| | | <!-- 20211210 ljh SFDC-C923SR end --> |
| | | </table> |
| | | <apex:outputPanel rendered="{!pageCnt < pageTotalCnt}" layout="none"> |
| | | <div style="page-break-after:always;"/> |
| | | </apex:outputPanel> |
| | | <apex:variable value="{!pageCnt + 1}" var="pageCnt" /> |
| | | </div> |
| | | </apex:repeat> |
| | | </div> |
| | | </body> |
| | |
| | | <script> |
| | | AWSService.sfSessionId = '{!GETSESSIONID()}'; |
| | | var staticResource = JSON.parse('{!staticResource}'); |
| | | var staticResourceCon = JSON.parse('{!staticResourceCon}'); |
| | | var staticResourceFile = JSON.parse('{!staticResourceFile}'); |
| | | function Fun(pdf){ |
| | | var iframe = document.createElement('iframe'); |
| | | iframe.setAttribute('style', 'position:absolute;right:0; top:0; bottom:0; height:100%; width:100%'); |
| | | document.body.appendChild(iframe); |
| | | iframe.src = pdf.output('datauristring'); |
| | | for(let e of document.body.childNodes){ |
| | | if( e != iframe && e.style){ |
| | | e.style.display = 'none'; |
| | | } |
| | | } |
| | | |
| | | var form = jQuery("<form method='post'></form>"); |
| | | jQuery(document.body).append(form); |
| | | form.attr({"action":staticResourceFile.viewUnifiedContactUrl+"?from="+encodeURIComponent(window.location.href)}); |
| | | // form.attr({"action":"http://127.0.0.1:8080/a/d?from="+encodeURIComponent(window.location.href)}); |
| | | let input = jQuery("<input type='hidden'/>"); |
| | | input.attr({"name":"base64Str"}); |
| | | input.val(pdf.output('datauristring').substr(28)); |
| | | form.append(input); |
| | | form.submit(); |
| | | |
| | | // jQuery("body > *").each(function(){ |
| | | // jQuery(this).css('display','none'); |
| | | // }) |
| | | // jQuery("body").append('<embed style="position:absolute; left: 0; top: 0;" width="100%" height="100%" src="'+pdf.output('datauristring')+'" type="application/pdf"/>') |
| | | |
| | | } |
| | | |
| | | let id = "pdf-wrapper"; |
| | | var target = document.getElementById(id); |
| | | function jsPdfDownload(){ |
| | | let pdfName = "测试"; |
| | | let id = "pdf-wrapper"; |
| | | var target = document.getElementById(id); |
| | | target.style.background = "#FFFFFF"; |
| | | if(pdfName==''||pdfName==undefined) pdfName= getNowFormatDate(); |
| | | |
| | | html2canvas(target, { |
| | | scale: 2, |
| | | onrendered:function(canvas) { |
| | | var contentWidth = canvas.width; |
| | | var contentHeight = canvas.height; |
| | | let jtargets = jQuery("#pdf-wrapper .pdf-page"); |
| | | let j_arr = new Array(jtargets.length+1).join(0).split('').map(function(){return false}); |
| | | let landscape = false; |
| | | let pw = 595.28; |
| | | let ph = 841.89; |
| | | const marginw = 40; |
| | | |
| | | let orientation = ''; |
| | | if (landscape) { |
| | | pw += ph;ph = pw - ph;pw = pw - ph; |
| | | orientation = 'l'; |
| | | } |
| | | var pdf = new jsPDF(orientation, 'pt', 'a4');// 第一个参数填字母l,注意不是数字1,为横向pdf |
| | | jtargets.each(function(i,e){ |
| | | e.style.background = "#FFFFFF"; |
| | | }) |
| | | |
| | | //一页pdf显示html页面生成的canvas高度; |
| | | var pageHeight = contentWidth / 592.28 * 841.89; |
| | | //未生成pdf的html页面高度 |
| | | var leftHeight = contentHeight; |
| | | //页面偏移 |
| | | var position = 0; |
| | | //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高 |
| | | var imgWidth = 515.28;//595.28//左右边距20 |
| | | var imgHeight = 515.28/contentWidth * contentHeight;//左右边距20 |
| | | let rei = 0; |
| | | let recursion = null; |
| | | recursion = function(i){ |
| | | if(i>= jtargets.length){ |
| | | Fun(pdf); |
| | | return; |
| | | } |
| | | e = jtargets[i]; |
| | | html2canvas(e, { |
| | | scale: 2, |
| | | onrendered:function(canvas) { |
| | | |
| | | let canvas_max_page_num = 1; |
| | | let canvas_current_page_num = 0; |
| | | var contentWidth = canvas.width; |
| | | var contentHeight = canvas.height; |
| | | |
| | | var pageData = canvas.toDataURL('image/jpeg', 1.0); |
| | | //一页pdf显示html页面生成的canvas高度; |
| | | var pageHeight = contentWidth / pw * ph; |
| | | //未生成pdf的html页面高度 |
| | | var leftHeight = contentHeight; |
| | | //页面偏移 |
| | | var position = 0; |
| | | //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高 |
| | | var imgWidth = pw-2*marginw;//595.28//左右边距20 |
| | | var imgHeight = imgWidth/contentWidth * contentHeight;//左右边距20 |
| | | |
| | | var pdf = new jsPDF('', 'pt', 'a4'); |
| | | var pageData = canvas.toDataURL('image/jpeg', 1.0); |
| | | |
| | | //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89) |
| | | //当内容未超过pdf一页显示的范围,无需分页 |
| | | if (leftHeight < pageHeight) { |
| | | pdf.addImage(pageData, 'JPEG', 40, 0, imgWidth, imgHeight );//左右边距20 |
| | | } else { |
| | | while(leftHeight > 0) { |
| | | pdf.addImage(pageData, 'JPEG', 40, position, imgWidth, imgHeight)//左右边距20 |
| | | leftHeight -= pageHeight; |
| | | position -= 841.89; |
| | | //避免添加空白页 |
| | | if(leftHeight > 0) { |
| | | pdf.addPage(); |
| | | |
| | | |
| | | //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89) |
| | | //当内容未超过pdf一页显示的范围,无需分页 |
| | | if (leftHeight < pageHeight) { |
| | | pdf.addImage(pageData, 'JPEG', marginw, 0, imgWidth, imgHeight );//左右边距20 |
| | | } else { |
| | | while(leftHeight > 0) { |
| | | |
| | | if(i){ |
| | | pdf.addPage(); |
| | | } |
| | | canvas_current_page_num++; |
| | | pdf.addImage(pageData, 'JPEG', marginw, position, imgWidth, imgHeight)//左右边距20 |
| | | leftHeight -= pageHeight; |
| | | position -= ph; |
| | | |
| | | if (canvas_max_page_num > 0 && canvas_current_page_num>=canvas_max_page_num) { |
| | | break; |
| | | } |
| | | |
| | | //避免添加空白页 |
| | | if(leftHeight > 0) { |
| | | pdf.addPage(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | recursion(i+1); |
| | | } |
| | | Fun(pdf); |
| | | } |
| | | }) |
| | | }) |
| | | }; |
| | | recursion(rei); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | blockme(); |
| | | //blockme(); |
| | | document.body.onload = function(){ |
| | | let aws_ids = []; |
| | | j$("[aws-data-id]").each(function(i,e){ |
| | |
| | | |
| | | }) |
| | | |
| | | |
| | | let a1 = false; |
| | | let a2 = false; |
| | | var Foo = function(){ |
| | | if(a1 && a2){ |
| | | setTimeout(function() { |
| | | jsPdfDownload(); |
| | | }, 1500); |
| | | } |
| | | } |
| | | AWSService.search(staticResource.searchUrl, JSON.stringify({ |
| | | dataIds:aws_ids |
| | | }), function(data){ |
| | | unblockUI(); |
| | | //unblockUI(); |
| | | if (data && data.object && data.object.length > 0) { |
| | | for (const d of data.object) { |
| | | for(let di in data.object){let d=data.object[di]; |
| | | j$("[aws-data-id='"+d.dataId +"']").html(d.trialUser); |
| | | } |
| | | } |
| | | //document.getElementById("Responsible_Person_HP__c").innerHTML = data.object.responsiblePersonHP; |
| | | //document.getElementById("Caller_phone__c").innerHTML = data.object.callerPhone; |
| | | |
| | | setTimeout(() => { |
| | | jsPdfDownload(); |
| | | }, 1500); |
| | | } |
| | | a1= true; |
| | | Foo(); |
| | | }, staticResource.token); |
| | | |
| | | if('{!targetConsumApply.Shippment_adress_detail__c}'){ |
| | | a2 = true; |
| | | Foo(); |
| | | }else{ |
| | | AWSService.query(staticResourceCon.queryUrl, '{!targetConsumApply.AWS_Data_Id__c}', function(data){ |
| | | //unblockUI(); |
| | | if (data && data.object ) { |
| | | |
| | | j$("#shippmentAddress").html(data.object.directShippmentAddress); |
| | | } |
| | | a2 = true; |
| | | Foo(); |
| | | }, staticResource.token); |
| | | } |
| | | |
| | | |
| | | } |
| | | document.body.onclick = function(){ |
| | | //jsPdfDownload(); |
| | |
| | | iframe.setAttribute('style', 'position:absolute;right:0; top:0; bottom:0; height:100%; width:100%'); |
| | | document.body.appendChild(iframe); |
| | | iframe.src = pdf.output('datauristring'); |
| | | for(let e of document.body.childNodes){ |
| | | for(let ei in document.body.childNodes){let e=document.body.childNodes[ei]; |
| | | if( e != iframe && e.style){ |
| | | e.style.display = 'none'; |
| | | } |
| | |
| | | unblockUI(); |
| | | document.getElementById("Responsible_Person__c").innerHTML = data.object.responsiblePerson; |
| | | |
| | | setTimeout(() => { |
| | | setTimeout(function(){ |
| | | jsPdfDownload(); |
| | | }, 1500); |
| | | }, staticResources.token); |
| | |
| | | <!-- |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-23-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="ASEActivity__c" extensions="NewAndEditASEActivityController" id="page"> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> |
| | |
| | | accountValue = document.getElementById(accountNodeId).value; |
| | | } |
| | | console.log('accountValue = ' + accountValue); |
| | | let searchContactKeyWord = document.querySelector("[data-id='ReporterASE__c']").value; |
| | | if(accountValue !='000000000000000'){ |
| | | suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | }else{ |
| | | suffixUrl = "?contactId="+contactNodeId; |
| | | suffixUrl = "?contactId="+contactNodeId+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | } |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | replaceSearchContactLookup(); |
| | | document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | /* |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | |
| | | } |
| | | } |
| | | }); |
| | | */ |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['ContactId'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-17-2022 |
| | | @last modified on : 03-23-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="Address__c" extensions="NewAndEditAddressController" id="page"> |
| | |
| | | //1. Get Address Information from Form |
| | | let addressJson = getAddressInformation(); |
| | | //2. Validate the Address field value formate, for example the email formate or phone formate |
| | | let validationResultMessage = validateFieldValueFormate(); |
| | | console.log(validationResultMessage); |
| | | if (validationResultMessage) { |
| | | //Popup error message. - To Do After POC |
| | | alertErrorMessage(validationResultMessage); |
| | | return |
| | | } |
| | | // let validationResultMessage = validateFieldValueFormate(); |
| | | // console.log(validationResultMessage); |
| | | // if (validationResultMessage) { |
| | | // //Popup error message. - To Do After POC |
| | | // alertErrorMessage(validationResultMessage); |
| | | // return |
| | | // } |
| | | // Check Required Field |
| | | let checkRequiredFieldMsgResult = checkRequiredFieldMsg(addressJson); |
| | | if (checkRequiredFieldMsgResult) { |
| | |
| | | //1. Check account value |
| | | let accountNodeId = document.querySelector("[data-id='Customer__c']").id + '_lkid'; |
| | | let accountValue = document.getElementById(accountNodeId).value; |
| | | let searchContactKeyWord = document.querySelector("[data-id='Customer__c']").value; |
| | | console.log(accountValue); |
| | | if (accountValue != '000000000000000') { |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue; |
| | | let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl + suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | //Replace Vlookup Field |
| | | replaceSearchContactLookup(); |
| | | //3. Set Readonly Attribute |
| | | // document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | // document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | /* |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Province__c', 'OwnerId'].indexOf(dataid) > -1) return; |
| | | if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | |
| | |
| | | let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if(input){ |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | if(hidden){ |
| | | hidden.value = ''; |
| | | hidden.value = ''; |
| | | } |
| | | } |
| | | }); |
| | | */ |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Contacts__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | //1. Get Sobject Information from Form |
| | | let sobjJson = getSobjectInformation(); |
| | | //2. Validate the Sobject field value formate, for example the email formate or phone formate |
| | | |
| | | let validationResultMessage = validateFieldValueFormate(); |
| | | console.log(validationResultMessage); |
| | | if (validationResultMessage) { |
| | | //Popup error message. - To Do After POC |
| | | alertErrorMessage(validationResultMessage); |
| | | return |
| | | } |
| | | //updated by Lijun0325 Start |
| | | //let validationResultMessage = validateFieldValueFormate(); |
| | | //console.log(validationResultMessage); |
| | | // if (validationResultMessage) { |
| | | // //Popup error message. - To Do After POC |
| | | // alertErrorMessage(validationResultMessage); |
| | | // return |
| | | // } |
| | | //updated by Lijun0325 End |
| | | // Check Required Field |
| | | let checkRequiredFieldMsgResult = checkRequiredFieldMsg(sobjJson); |
| | | if (checkRequiredFieldMsgResult) { |
| | |
| | | console.log(accountValue); |
| | | if(true || accountValue !='000000000000000'){ |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | let searchContactKeyWord = document.querySelector("[data-id='Contact__c']").value; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | } |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | |
| | | /* |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | |
| | | hidden.value = ''; |
| | | } |
| | | } |
| | | }); |
| | | });*/ |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Contact__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | | for (let m = 0; m < layoutSections.length; m++) { |
| | |
| | | let nodelist = document.querySelectorAll("[data-id]"); |
| | | let result = {} |
| | | result.RecordTypeId = '{!rtTypeId}' |
| | | //富文本 |
| | | var describedbyAll = document.querySelectorAll("[aria-describedby = 'cke_34']"); |
| | | if(describedbyAll){ |
| | | for (let idx = 0; idx < describedbyAll.length; idx++) { |
| | | let describedby = describedbyAll[idx]; |
| | | if (describedby.title.indexOf('Text_attachement__c') > 0){ |
| | | result.Text_attachement__c = describedby.contentWindow.document.getElementsByTagName('body')[0].innerHTML; |
| | | if (result.Text_attachement__c == '<br>') { |
| | | result.Text_attachement__c = ''; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (let index = 0; index < nodelist.length; index++) { |
| | | if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) { |
| | | console.log(nodelist[index].id.indexOf('lkwgt')); |
| | |
| | | accountValue = document.getElementById(accountNodeId).value; |
| | | } |
| | | console.log(accountValue); |
| | | if(accountValue !='000000000000000'){ |
| | | if(accountValue !='000000000000000' || true){ |
| | | if (accountValue == '000000000000000') { |
| | | accountValue = ''; |
| | | } |
| | | |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | let searchContactKeyWord = document.querySelector("[data-id='ContactId']").value; |
| | | let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | this.className = "closeIcon" |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if(input){ |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | if(hidden){ |
| | | hidden.value = ''; |
| | | if(['ContactId'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | }) |
| | | // jQuery(".lookupInput").each(function(i,e){ |
| | | // let je =jQuery(e).find('input'); |
| | | // je.attr("readonly",""); |
| | | // je.css("background","unset"); |
| | | |
| | | // let dataid = je.attr('data-id'); |
| | | // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | // }) |
| | | |
| | | // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | // this.className = "closeIconOn"; |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | // this.className = "closeIcon" |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | // let input = document.getElementById(id); |
| | | // if(input){ |
| | | // input.value = ''; |
| | | // let hidden = document.getElementById(id+'_lkid'); |
| | | // if(hidden){ |
| | | // hidden.value = ''; |
| | | // } |
| | | // } |
| | | // }); |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | } |
| | | let phone = document.querySelector(textPhone); |
| | | |
| | | if(phone ){ |
| | | if(phone && false ){ |
| | | if(phone.value){ |
| | | if(!/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ |
| | | error_msg += ';电话号码错误'; |
| | |
| | | |
| | | function alertErrorMessage(errorMsg) { |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsg = '错误:无效数据。' + '\n' + errorMsg; |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | | } |
| | |
| | | } |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | |
| | | /* |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | |
| | | hidden.value = ''; |
| | | } |
| | | } |
| | | }); |
| | | });*/ |
| | | |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | | for (let m = 0; m < layoutSections.length; m++) { |
| | |
| | | accountValue = document.getElementById(accountNodeId).value; |
| | | } |
| | | console.log(accountValue); |
| | | |
| | | let searchContactKeyWord = document.querySelector("[data-id='Contact_Name__c']").value; |
| | | if(accountValue !='000000000000000'){ |
| | | suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | | newSearchContactWindow.focus(); |
| | | } |
| | | return false; |
| | | }else{ |
| | | suffixUrl = "?contactId="+contactNodeId; |
| | | // suffixUrl = "?contactId="+contactNodeId+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | alertErrorMessage('请先选择科室名'); |
| | | } |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | | newSearchContactWindow.focus(); |
| | | } |
| | | return false; |
| | | } |
| | | //窗口关闭时发生 |
| | | function closePopupWindow() { |
| | |
| | | function replaceSearchContactLookup() { |
| | | let lookUpNode = htmlToElement(contactHtmlString); |
| | | console.log(lookUpNode); |
| | | let eleContactValue = document.querySelector("[data-id='Contact_Name__c']").parentNode.parentNode.children[0].value; |
| | | if (!{!isNewMode} || (eleContactValue != '000000000000000')) { |
| | | //1. Query Contact from AWS by AWSDataId |
| | | queryContactName() |
| | | } |
| | | let eleContactValue = document.querySelector("[data-id='Contact_Name__c']").parentNode.parentNode.children[1].value; |
| | | if (eleContactValue) { |
| | | if (!{!isNewMode} || (eleContactValue != '000000000000000')) { |
| | | //1. Query Contact from AWS by AWSDataId |
| | | queryContactName() |
| | | } |
| | | } |
| | | let parentNode = document.querySelector("[data-id='Contact_Name__c']").parentNode; |
| | | document.querySelector("[data-id='Contact_Name__c']").removeAttribute("onchange"); |
| | | parentNode.replaceChild(lookUpNode, document.querySelector("[data-id='Contact_Name__c']").parentNode.children[2]); |
| | |
| | | function searchLead(leadNodeId){ |
| | | // let accountValue = ""; |
| | | // let suffixUrl = ""; |
| | | let suffixUrl = "?leadId="+leadNodeId; |
| | | let searchLeadKeyWord = document.querySelector("[data-id='Lead_link__c']").value; |
| | | let suffixUrl = "?leadId="+leadNodeId+"&searchLeadKeyWord=" + searchLeadKeyWord; |
| | | let baseUrl = "/apex/SearchLeadPage"; |
| | | let newSearchLeadParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchLeadWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchLeadParam); |
| | |
| | | </apex:pageBlockSection> |
| | | </apex:repeat> |
| | | <script> |
| | | var api_id_map={}; |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | var init_nodes = document.getElementsByClassName("PIBackApi"); |
| | | for(let ei in init_nodes){ |
| | | let e = init_nodes[ei]; |
| | | if(IsFormElement(e)){ |
| | | if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ |
| | | api_id_map[GetEleApiName(e)] = e.id; |
| | | } |
| | | } |
| | | } |
| | | |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | | for (let m = 0; m < layoutSections.length; m++) { |
| | | let layoutSection = layoutSections[m].layoutFields; |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | }else if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | }else if (VLookUpFields.indexOf(layoutField.fieldAPI) >= 0) { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Hospital_Name__c','Hospital__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | //Updated by Li Jun 20220322 Start |
| | | /* |
| | | |
| | | jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | this.className = "closeIconOn"; |
| | |
| | | hidden.value = ''; |
| | | } |
| | | } |
| | | }); |
| | | });*/ |
| | | //Updated by Li Jun 20220322 End |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let eleHospitalName = document.querySelector("[data-id='Hospital_Name__c']"); |
| | | let vlook_HospitalName = document.getElementById(eleHospitalName.id + '_lkid'); |
| | | |
| | | // let eleInput = eleHospitalName.parentNode.childNodes[0]; |
| | | // let eleImg = eleHospitalName.parentNode.childNodes[1]; |
| | | // let eleBlank = eleHospitalName.parentNode.childNodes[2]; |
| | | let dataid = je.attr('data-id'); |
| | | if(['Contact_Name__c','Lead_link__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | if("\v"=="v"){//true为IE浏览器 |
| | | vlook_ele.attachEvent("onporpertychange",function(e){ |
| | | console.log("inputting!!"); |
| | | }); |
| | | }else{ |
| | | eleHospitalName.parentNode.addEventListener("click",function(e){ |
| | | console.log("inputting!!"); |
| | | var hospitalNameValue = vlook_HospitalName.value; |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | // jQuery(".lookupInput").on("click","img.closeIconOn",function(){ |
| | | // if (jQuery(this).siblings("input").attr("data-id") == 'Hospital_Name__c'){ |
| | | // clearVlookup('Department_Class__c'); |
| | | // clearVlookup('Hospital__c'); |
| | | // } |
| | | // }); |
| | | |
| | | jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){ |
| | | setTimeout(() => { |
| | | console.log(document.getElementById(this.id+'_lkid').value); |
| | | var hospitalNameValue = document.getElementById(this.id+'_lkid').value; |
| | | if (hospitalNameValue != "000000000000000" && hospitalNameValue != '') { |
| | | console.log("hospitalNameValue = " + hospitalNameValue); |
| | | |
| | |
| | | clearVlookup('Department_Class__c'); |
| | | clearVlookup('Hospital__c'); |
| | | } |
| | | }); |
| | | } |
| | | }, 50); |
| | | }); |
| | | }); |
| | | |
| | | function setVlookup(lookups, lookup_id){ |
| | |
| | | }, |
| | | { escape: true } |
| | | ); |
| | | } |
| | | }; |
| | | |
| | | function clearVlookup(lookup){ |
| | | let ele = document.querySelector("[data-id='"+lookup+"']"); |
| | |
| | | <apex:page standardController="Inspection_Report__c" extensions="NewAndEditInspectionReportController" id="page"> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | |
| | | } |
| | | |
| | | } |
| | | //let reporter = GetEleApiName(nodelist[5]) |
| | | //console.log('reporter:'+reporter); |
| | | result['Reporter__c'] = document.getElementById('page:form:block:j_id50:0:j_id51:j_id52:4:j_id53_lkid').value; |
| | | //赋值富文本区域 |
| | | //科室负责人签字 |
| | | if(document.querySelector("[title = 'RTF 編輯器, page:form:block:j_id51:0:j_id52:j_id53:5:j_id54:textAreaDelegate_ResponsiblePerson_Sign__c']")){ |
| | | result.ResponsiblePerson_Sign__c = document.querySelector("[title = 'RTF 編輯器, page:form:block:j_id51:0:j_id52:j_id53:5:j_id54:textAreaDelegate_ResponsiblePerson_Sign__c']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | result['Reporter__c'] = document.getElementById('page:form:block:j_id51:0:j_id52:j_id53:4:j_id54_lkid').value; |
| | | return result; |
| | | } |
| | | function QuerySobjectFromAWS() { |
| | |
| | | </apex:repeat> |
| | | <script> |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | | for (let m = 0; m < layoutSections.length; m++) { |
| | | let layoutSection = layoutSections[m].layoutFields; |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | } |
| | | } |
| | | } |
| | | //1. Set Last Name label |
| | | //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '姓名'; |
| | | //2. Query AWS Data by dataId |
| | |
| | | oi.value = '{!CurrentUserId}' |
| | | } |
| | | } |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | | for (let m = 0; m < layoutSections.length; m++) { |
| | | let layoutSection = layoutSections[m].layoutFields; |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | } |
| | | } |
| | | } |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | |
| | | //Replace Contact Vlookup Field |
| | | replaceSearchContactLookup(); |
| | | //Replace Lead Vlookup Field |
| | | replaceSearchLeadLookup(); |
| | | document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); |
| | | // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); |
| | | |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | this.className = "closeIcon" |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if(input){ |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | if(hidden){ |
| | | hidden.value = ''; |
| | | if(['Hospital__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | }) |
| | | |
| | | // jQuery(".lookupInput").on("click","img.closeIconOn",function(){ |
| | | // if (jQuery(this).siblings("input").attr("data-id") == 'Hospital_Name__c'){ |
| | | // clearVlookup('Department_Class__c'); |
| | | // clearVlookup('Hospital__c'); |
| | | // } |
| | | // }); |
| | | |
| | | jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){ |
| | | setTimeout(() => { |
| | | console.log(document.getElementById(this.id+'_lkid').value); |
| | | var hospitalNameValue = document.getElementById(this.id+'_lkid').value; |
| | | if (hospitalNameValue != "000000000000000" && hospitalNameValue != '') { |
| | | console.log("hospitalNameValue = " + hospitalNameValue); |
| | | |
| | | var ls = ['Department_Class__c','Hospital__c']; |
| | | setVlookup(ls,hospitalNameValue); |
| | | }else{ |
| | | clearVlookup('Department_Class__c'); |
| | | clearVlookup('Hospital__c'); |
| | | } |
| | | }, 50); |
| | | }); |
| | | }); |
| | | |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | | <table cellspacing="0" cellpadding="0" border="0"> |
| | |
| | | } |
| | | function QueryLeadFromAWSIFS() { |
| | | //staticResourceInquiryForm |
| | | AWSService.query(staticResourceInquiryForm.queryUrl, '{!AWSDataIdInquiryForm}', queryBack, staticResourceInquiryForm.token); |
| | | AWSService.query(staticResourceInquiryForm.queryUrl, '{!AWSDataIdInquiryForm}', queryBackIFS, staticResourceInquiryForm.token); |
| | | } |
| | | var queryBack = function queryBack(data) { |
| | | console.log('data = ' + data); |
| | | document.querySelector("[data-id='LastName']").value = data.object.lastName == null ? '' : data.object.lastName; |
| | | document.querySelector("[data-id='Phone']").value = data.object.phone == null ? '' : data.object.phone; |
| | | document.querySelector("[data-id='Email']").value = data.object.email == null ? '' : data.object.email; |
| | | unblockUI(); |
| | | }; |
| | | var queryBackIFS = function queryBackIFS(data) { |
| | | console.log('data = ' + data); |
| | | //document.querySelector("[data-id='LastName']").value = document.querySelector("[data-id='Contact_Name__c']").value |
| | | document.querySelector("[data-id='Phone']").value = data.object.phone == null ? '' : data.object.phone; |
| | | document.querySelector("[data-id='Email']").value = data.object.email == null ? '' : data.object.email; |
| | | unblockUI(); |
| | |
| | | //1. Check account value |
| | | let accountNodeId = document.querySelector("[data-id='Hospital_Name__c']").id + '_lkid'; |
| | | let accountValue = document.getElementById(accountNodeId).value; |
| | | let searchContactKeyWord = document.querySelector("[data-id='Contact_Name__c']").value; |
| | | console.log(accountValue); |
| | | if (accountValue != '000000000000000') { |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue; |
| | | let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl + suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | } |
| | | let queryBackContactName = function queryBackContactName(result){ |
| | | document.querySelector("[data-id='Contact_Name__c']").value = result.object.lastName; |
| | | //document.querySelector("[data-id='LastName']").value = result.object.lastName; |
| | | }; |
| | | AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); |
| | | |
| | |
| | | // }).then((result) => { |
| | | // document.querySelector("[data-id='Contact_Name__c']").value = result.object.lastName; |
| | | // }) |
| | | } |
| | | function queryContactName2() { |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Contact_Name__c']").id + '_lkid').value; |
| | | let dataId = ''; |
| | | if ('{!contactsInfo}' != '') { |
| | | let contactsInfo = JSON.parse('{!contactsInfo}'); |
| | | dataId = contactsInfo[sfId]; |
| | | } else if ('{!contactDataId}' != '') { |
| | | dataId = '{!contactDataId}'; |
| | | }else{ |
| | | //没有进行加密 |
| | | document.querySelector("[data-id='LastName']").value = document.querySelector("[data-id='Contact_Name__c']").value; |
| | | return; |
| | | } |
| | | let queryBackContactName = function queryBackContactName(result){ |
| | | document.querySelector("[data-id='Contact_Name__c']").value = result.object.lastName; |
| | | document.querySelector("[data-id='LastName']").value = result.object.lastName; |
| | | }; |
| | | AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); |
| | | } |
| | | </script> |
| | | <div class="bPageTitle"> |
| | |
| | | let layoutSection = layoutSections[m].layoutFields; |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='" + layoutField.fieldAPI + "']") != null) { |
| | | document.querySelector("[data-id='" + layoutField.fieldAPI + "']").disabled = !(layoutField.editableField); |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | //3. Set Readonly Attribute |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | |
| | | //如果是联系人过来的点击新建意向 |
| | | if('{!isQueryContact}' == '1'){ |
| | | //查找客户姓名 |
| | | queryContactName(); |
| | | //是否解密联系人 |
| | | if('{!isDecryptContact}' == '1'){ |
| | | queryContactName2(); |
| | | } |
| | | |
| | | |
| | |
| | | if ('{!ifc}' != '') { |
| | | blockme(); |
| | | //状态 |
| | | document.querySelector("[data-id='Status']").value = '跟进中' |
| | | document.querySelector("[data-id='Status']").value = '未跟进' |
| | | //会议询问单 |
| | | if ('{!ifc.Id}') |
| | | document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:15:j_id37_lkid').value = '{!ifc.Id}' |
| | | if ('{!ifc.Name}') |
| | | document.querySelector("[data-id='Lead_Inquiry_form__c']").value = '{!ifc.Name}' |
| | | //客户姓名 |
| | | // if('{!ifc.Contact_Name__c}') |
| | | // document.querySelector("[data-id='Contact_Name__c']").value = '{!ifc.Contact_Name__c}' |
| | | if ('{!ifc.Contact_Id__c}') |
| | | document.getElementById(document.querySelector("[data-id='Contact_Name__c']").id + '_lkid').value = '{!ifc.Contact_Id__c}' |
| | | //医院 |
| | |
| | | //邮件 |
| | | if ('{!ifc.Email__c}') |
| | | document.querySelector("[data-id='Email']").value = '{!ifc.Email__c}' |
| | | //姓名 |
| | | if ('{!ifc.Last_Name__c}') |
| | | document.querySelector("[data-id='LastName']").value = '{!ifc.Last_Name__c}' |
| | | //咨询单来源 |
| | | if ('{!ifc.LeadSource__c}' && document.querySelector("[data-id='LeadSource__c']")) |
| | | document.querySelector("[data-id='LeadSource__c']").value = '{!ifc.LeadSource__c}' |
| | | if ('{!ifc.LeadSource__c}' && document.querySelector("[data-id='LeadSource']")) |
| | | document.querySelector("[data-id='LeadSource']").value = '{!ifc.LeadSource__c}' |
| | | //意向区分 |
| | | if ('{!ifc.Opportunity_Division__c}') |
| | | document.querySelector("[data-id='Opportunity_Division__c']").value = '{!ifc.Opportunity_Division__c}' |
| | |
| | | //紧急 |
| | | if ('{!ifc.Urgent__c}') |
| | | document.querySelector("[data-id='urgent__c']").checked = '{!ifc.Urgent__c}' == 'false' ? false : true; |
| | | //公司(科室) = 科室名称 |
| | | if(document.querySelector("[data-id='Company']") && document.querySelector("[data-id='Hospital_Name__c']").value != ''){ |
| | | document.querySelector("[data-id='Company']").value = document.querySelector("[data-id='Hospital_Name__c']").value; |
| | | } |
| | | //查找客户姓名 |
| | | queryContactName(); |
| | | queryContactName2(); |
| | | //解密 |
| | | QueryLeadFromAWSIFS(); |
| | | |
| | | unblockUI(); |
| | | } |
| | | jQuery(".lookupInput").each(function (i, e) { |
| | | let je = jQuery(e).find('input'); |
| | | je.attr("readonly", ""); |
| | | je.css("background", "unset"); |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if (['Contact_Name__c'].indexOf(dataid) > -1) |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | let dataid = je.attr('data-id'); |
| | | if(['Contact_Name__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { |
| | | this.className = "closeIcon" |
| | | }); |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | //Updated by Li Jun 20220323 Start |
| | | // jQuery(".lookupInput").each(function (i, e) { |
| | | // let je = jQuery(e).find('input'); |
| | | // je.attr("readonly", ""); |
| | | // je.css("background", "unset"); |
| | | |
| | | jQuery(".lookupInput").on("click", "img[generate]", function (e) { |
| | | let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if (input) { |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id + '_lkid'); |
| | | if (hidden) { |
| | | hidden.value = ''; |
| | | } |
| | | } |
| | | }); |
| | | // let dataid = je.attr('data-id'); |
| | | // if (['Contact_Name__c'].indexOf(dataid) > -1) |
| | | // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | // }) |
| | | |
| | | // jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { |
| | | // this.className = "closeIconOn"; |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { |
| | | // this.className = "closeIcon" |
| | | // }); |
| | | |
| | | |
| | | // jQuery(".lookupInput").on("click", "img[generate]", function (e) { |
| | | // let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); |
| | | // let input = document.getElementById(id); |
| | | // if (input) { |
| | | // input.value = ''; |
| | | // let hidden = document.getElementById(id + '_lkid'); |
| | | // if (hidden) { |
| | | // hidden.value = ''; |
| | | // } |
| | | // } |
| | | // }); |
| | | //Updated by Li Jun 20220323 Start |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> |
| | | <style> |
| | | .disabledbutton { |
| | | pointer-events: none; |
| | | opacity: 0.4; |
| | | } |
| | | </style> |
| | | <script> |
| | | |
| | | var config = {}; |
| | | config = { |
| | | SobjectName : "{!SobjectName}", |
| | |
| | | function ProcessPI(sobjJson, payloadForNewPI) { |
| | | blockme(); |
| | | if ({!isNewMode}) { |
| | | NewPIToAWS(sobjJson, payloadForNewPI) |
| | | NewPIToAWS(sobjJson, payloadForNewPI) |
| | | }else { |
| | | UpdatePIToAWS(sobjJson, payloadForNewPI) |
| | | } |
| | |
| | | } |
| | | return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; |
| | | } |
| | | |
| | | function IsFormElement(e){ |
| | | |
| | | function IsFormElement(e){ |
| | | return IsFormTag(e.tagName); |
| | | } |
| | | |
| | |
| | | function validateFieldValueFormate() { |
| | | let error_msg = ''; |
| | | //let textEmail = "[data-id='Email']"; |
| | | let textPhone = "[data-id='Caller_phone__c']"; |
| | | //let textPhone = "[data-id='Caller_phone__c']"; |
| | | //Email |
| | | // let email = document.querySelector(textEmail); |
| | | // if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ |
| | | // error_msg += ';邮件格式错误'; |
| | | // } |
| | | let phone = document.querySelector(textPhone); |
| | | //let phone = document.querySelector(textPhone); |
| | | |
| | | if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ |
| | | error_msg += ';联系电话格式错误'; |
| | | } |
| | | //if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ |
| | | // error_msg += ';联系电话格式错误'; |
| | | //} |
| | | |
| | | let es = document.getElementsByTagName('select') |
| | | for(let ei in es){ |
| | |
| | | |
| | | // let e1 = document.getElementById(api_id_map[field_api_name]); |
| | | // if(!result[field_api_name] && e1 && e1.value){ |
| | | // result[field_api_name] = e1.value; |
| | | // result[field_api_name] = e1.value; |
| | | // } |
| | | } |
| | | //赋值富文本区域 |
| | |
| | | var api_id_map={}; |
| | | for(let ei in init_nodes){ |
| | | let e = init_nodes[ei]; |
| | | if(IsFormElement(e)){ |
| | | if(IsFormElement(e)){ |
| | | if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ |
| | | api_id_map[GetEleApiName(e)] = e.id; |
| | | } |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-17-2022 |
| | | @last modified on : 03-23-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="RepairSubOrder__c" extensions="NewAndEditRepairSubOrderController" id="page"> |
| | |
| | | } |
| | | |
| | | function IsFormTag(tag_name){ |
| | | if (!tag_name) { |
| | | return false; |
| | | } |
| | | return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; |
| | | } |
| | | |
| | | function IsFormElement(tag_name){ |
| | | return ['input','select','textarea'].indexOf(tag_name)>-1; |
| | | function IsFormElement(e){ |
| | | return IsFormTag(e.tagName); |
| | | } |
| | | |
| | | function getPIPayload(sobjJson) { |
| | |
| | | |
| | | let nodelist = document.getElementsByClassName(config.ApiPrefix); |
| | | let result = {} |
| | | for (let index = 0; index < nodelist.length; index++) { |
| | | let ele = nodelist[index]; |
| | | let field_api_name = GetEleApiName(ele); |
| | | for (let index in api_id_map) { |
| | | let ele = document.getElementById(api_id_map[index]); |
| | | |
| | | let field_api_name = index; |
| | | let tag_name = ele.tagName.toLowerCase(); |
| | | if(!IsFormElement(tag_name)){ |
| | | if(!IsFormTag(tag_name)){ |
| | | console.log('tag_name='+tag_name+',field_api_name'+field_api_name+' is not a form element'); |
| | | continue; |
| | | } |
| | |
| | | <script> |
| | | var init_nodes = document.getElementsByClassName("PIBackApi"); |
| | | var api_id_map={}; |
| | | for(let e in init_nodes){ |
| | | if(IsFormElement(e)){ |
| | | api_id_map[GetEleApiName(e)] = e.id; |
| | | } |
| | | } |
| | | console.log(api_id_map); |
| | | for(let ei in init_nodes){ |
| | | let e = init_nodes[ei]; |
| | | if(IsFormElement(e)){ |
| | | if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ |
| | | api_id_map[GetEleApiName(e)] = e.id; |
| | | } |
| | | |
| | | } |
| | | } |
| | | console.log(api_id_map); |
| | | |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); |
| | | |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | /* |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | |
| | | } |
| | | } |
| | | }); |
| | | */ |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['ContactId'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | //自定义lookup查询 |
| | | function searchContact(contactNodeId,field){ |
| | | closeField = field; |
| | | //searchContactKeyWord |
| | | let searchContactKeyWord = document.querySelector("[data-id="+field+"]").value |
| | | let accountValue = ""; |
| | | if (document.querySelector("[data-id='Hospital_Department__c']")) { |
| | | let accountNodeId = document.querySelector("[data-id='Hospital_Department__c']").id + '_lkid'; |
| | |
| | | console.log(accountValue); |
| | | if(accountValue !='000000000000000'){ |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | } |
| | | return false; |
| | | }else{ |
| | | alertErrorMessage('{!PIPL_Input_Account_Error_Msg}'); |
| | | alertErrorMessage('请先选择科室!'); |
| | | } |
| | | } |
| | | //窗口关闭时发生 |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | replaceSearchContactLookup(); |
| | | //3. Set Readonly Attribute |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | jQuery(".lookupInput").each(function (i, e) { |
| | | let je = jQuery(e).find('input'); |
| | | je.attr("readonly", ""); |
| | | je.css("background", "unset"); |
| | | |
| | | //如果是OPD计划过来的 |
| | | if('{!no1Name}' != '' && '{!no1Id}' != ''){ |
| | | console.log('name = '+'{!no1Name}') |
| | | console.log('Id = '+'{!no1Id}') |
| | | document.querySelector("[data-id='Loaner_request_no1__c']").value = '{!no1Name}' |
| | | document.getElementById(document.querySelector("[data-id='Loaner_request_no1__c']").id + '_lkid').value = '{!no1Id}' |
| | | } |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if (['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) > -1) |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | if(['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | // jQuery(".lookupInput").each(function (i, e) { |
| | | // let je = jQuery(e).find('input'); |
| | | // je.attr("readonly", ""); |
| | | // je.css("background", "unset"); |
| | | |
| | | jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { |
| | | this.className = "closeIcon" |
| | | }); |
| | | // let dataid = je.attr('data-id'); |
| | | // if (['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) > -1) |
| | | // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | // }) |
| | | |
| | | jQuery(".lookupInput").on("click", "img[generate]", function (e) { |
| | | let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if (input) { |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id + '_lkid'); |
| | | if (hidden) { |
| | | hidden.value = ''; |
| | | } |
| | | } |
| | | }); |
| | | // jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { |
| | | // this.className = "closeIconOn"; |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { |
| | | // this.className = "closeIcon" |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("click", "img[generate]", function (e) { |
| | | // let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); |
| | | // let input = document.getElementById(id); |
| | | // if (input) { |
| | | // input.value = ''; |
| | | // let hidden = document.getElementById(id + '_lkid'); |
| | | // if (hidden) { |
| | | // hidden.value = ''; |
| | | // } |
| | | // } |
| | | // }); |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | //2. Query AWS Data by dataId |
| | | console.log('Mode for Sobject Page:' + {!isNewMode}); |
| | | if (!{!isNewMode}) { |
| | | bolckme(); |
| | | blockme(); |
| | | QuerySobjectFromAWS(); |
| | | }else{ |
| | | let ot = jQuery('input[data-id="OwnerId"]'); |
| | |
| | | oi.value = '{!CurrentUserId}' |
| | | } |
| | | } |
| | | //Replace Contact Vlookup Field |
| | | replaceSearchContactLookup(); |
| | | //Replace Lead Vlookup Field |
| | | replaceSearchLeadLookup(); |
| | | document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); |
| | | // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); |
| | | |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | jQuery('a[data-id="OwnerId"]').remove(); |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | this.className = "closeIcon" |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if(input){ |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | if(hidden){ |
| | | hidden.value = ''; |
| | | if(['Hospital__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | }) |
| | | |
| | | // jQuery(".lookupInput").on("click","img.closeIconOn",function(){ |
| | | // if (jQuery(this).siblings("input").attr("data-id") == 'Hospital_Name__c'){ |
| | | // clearVlookup('Department_Class__c'); |
| | | // clearVlookup('Hospital__c'); |
| | | // } |
| | | // }); |
| | | |
| | | jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){ |
| | | setTimeout(() => { |
| | | console.log(document.getElementById(this.id+'_lkid').value); |
| | | var hospitalNameValue = document.getElementById(this.id+'_lkid').value; |
| | | if (hospitalNameValue != "000000000000000" && hospitalNameValue != '') { |
| | | console.log("hospitalNameValue = " + hospitalNameValue); |
| | | |
| | | var ls = ['Department_Class__c','Hospital__c']; |
| | | setVlookup(ls,hospitalNameValue); |
| | | }else{ |
| | | clearVlookup('Department_Class__c'); |
| | | clearVlookup('Hospital__c'); |
| | | } |
| | | }, 50); |
| | | }); |
| | | }); |
| | | |
| | | |
| | | |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | | <table cellspacing="0" cellpadding="0" border="0"> |
| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-18-2022 |
| | | @last modified on : 03-28-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="Consum_Apply__c" extensions="NewConsumApplyController" id="page"> |
| | |
| | | //富文本 |
| | | if(document.querySelector("[aria-describedby = 'cke_34']")){ |
| | | result.HP_received_sign_rich__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | } |
| | | for (let index = 0; index < nodelist.length; index++) { |
| | | if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) { |
| | | console.log(nodelist[index].id.indexOf('lkwgt')); |
| | |
| | | } |
| | | } |
| | | for (let i = 0; i < userVLookUpFields.length; i++) { |
| | | let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; |
| | | console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); |
| | | if(userVlookUpNodeValue!='000000000000000'){ |
| | | result[userVLookUpFields[i]] = userVlookUpNodeValue; |
| | | } |
| | | if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ |
| | | let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; |
| | | console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); |
| | | if(userVlookUpNodeValue!='000000000000000'){ |
| | | result[userVLookUpFields[i]] = userVlookUpNodeValue; |
| | | } |
| | | } |
| | | } |
| | | //格式化时间 |
| | | if(result.pickup_time__c){ |
| | | result.pickup_time__c = result.pickup_time__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.Request_Shipping_7days_Before__c){ |
| | | result.Request_Shipping_7days_Before__c = result.Request_Shipping_7days_Before__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.Request_shipping_day__c){ |
| | | result.Request_shipping_day__c = result.Request_shipping_day__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.Consum_Received_Day__c){ |
| | | result.Consum_Received_Day__c = result.Consum_Received_Day__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.Request_demo_time__c){ |
| | | result.Request_demo_time__c = result.Request_demo_time__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.Request_approval_time__c){ |
| | | result.Request_approval_time__c = result.Request_approval_time__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.Application_accept_time__c){ |
| | | result.Application_accept_time__c = result.Application_accept_time__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.Request_answer_time__c){ |
| | | result.Request_answer_time__c = result.Request_answer_time__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | if(result.HP_received_sign_rich__c == '<br>'){ |
| | | result.HP_received_sign_rich__c = ''; |
| | | } |
| | | console.log(JSON.stringify(result)); |
| | | return result; |
| | |
| | | |
| | | //Alert Error Message |
| | | function alertErrorMessage(errorMsg) { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsg = '错误:无效数据。' + '\n' + errorMsg; |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | |
| | | |
| | | //Hide Error Message |
| | | function hiddenErrorMsgNode() { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsgNode.innerText = ''; |
| | | errorMsgNode.className = ''; |
| | | } |
| | |
| | | return template.content.firstChild; |
| | | } |
| | | function queryContactName() { |
| | | // let sfId = document.getElementById(document.querySelector("[data-id='Account__c']").id + '_lkid').value; |
| | | // let contactsInfo = JSON.parse('{!contactsInfo}'); |
| | | // let dataId = contactsInfo[sfId]; |
| | | // let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Loaner_medical_Staff__c']").id + '_lkid').value; |
| | | let contactsInfo = JSON.parse('{!contactsInfo}'); |
| | | let dataId = contactsInfo[sfId]; |
| | | let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; |
| | | let queryBackContactName = function queryBackContactName(result){ |
| | | document.querySelector("[data-id='Loaner_medical_Staff__c']").value = result.object.lastName; |
| | | //document.querySelector("[data-id='LastName']").value = result.object.lastName; |
| | | }; |
| | | AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); |
| | | // fetch(url, { |
| | | // method: 'GET', |
| | | // headers: { |
| | |
| | | // }).then((result) => { |
| | | // document.querySelector("[data-id='Loaner_medical_Staff__c']").value = result.object.lastName; |
| | | // }) |
| | | let sfId = document.getElementById(document.querySelector("[data-id='Account__c']").id + '_lkid').value; |
| | | let dataId = ''; |
| | | if ('{!contactsInfo}' != '') { |
| | | let contactsInfo = JSON.parse('{!contactsInfo}'); |
| | | dataId = contactsInfo[sfId]; |
| | | } else if ('{!AWSDataId}' != '') { |
| | | dataId = '{!AWSDataId}'; |
| | | } |
| | | let queryBackContactName = function queryBackContactName(result){ |
| | | document.querySelector("[data-id='Loaner_medical_Staff__c']").value = result.object.lastName; |
| | | }; |
| | | AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); |
| | | } |
| | | //自定义lookup查询 |
| | | function searchContact(contactNodeId){ |
| | |
| | | let accountNodeId = document.querySelector("[data-id='Account__c']").id + '_lkid'; |
| | | accountValue = document.getElementById(accountNodeId).value; |
| | | } |
| | | let searchContactKeyWord = document.querySelector("[data-id='Loaner_medical_Staff__c']").value; |
| | | console.log(accountValue); |
| | | if(accountValue !='000000000000000'){ |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | </div> |
| | | <apex:form id="form"> |
| | | <apex:inputHidden value="{!contactId}" id="contactId"/> |
| | | <!-- Error Msg--> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | <apex:pageblock > |
| | | <apex:pageblock id="block"> |
| | | <div class="pbHeader"> |
| | | <table cellspacing="0" cellpadding="0" border="0"> |
| | | <tbody> |
| | |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | <!-- Error Msg--> |
| | | <div style="text-align: center;"> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | </div> |
| | | <!-- Iterate the layoutSections, which is a list of sections --> |
| | | <apex:repeat value="{!layoutSections}" var="layoutSection"> |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | replaceSearchContactLookup(); |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | this.className = "closeIcon" |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if(input){ |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | if(hidden){ |
| | | hidden.value = ''; |
| | | if(['Loaner_medical_Staff__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | // jQuery(".lookupInput").each(function(i,e){ |
| | | // let je =jQuery(e).find('input'); |
| | | // je.attr("readonly",""); |
| | | // je.css("background","unset"); |
| | | |
| | | // let dataid = je.attr('data-id'); |
| | | // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | // }) |
| | | |
| | | // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | // this.className = "closeIconOn"; |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | // this.className = "closeIcon" |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | // let input = document.getElementById(id); |
| | | // if(input){ |
| | | // input.value = ''; |
| | | // let hidden = document.getElementById(id+'_lkid'); |
| | | // if(hidden){ |
| | | // hidden.value = ''; |
| | | // } |
| | | // } |
| | | // }); |
| | | |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-17-2022 |
| | | @last modified on : 03-24-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="On_Call__c" extensions="OnCallController" id="page"> |
| | |
| | | |
| | | //Alert Error Message |
| | | function alertErrorMessage(errorMsg) { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsg = '错误:无效数据。' + '\n' + errorMsg; |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | |
| | | |
| | | //Hide Error Message |
| | | function hiddenErrorMsgNode() { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsgNode.innerText = ''; |
| | | errorMsgNode.className = ''; |
| | | } |
| | |
| | | <div class="ptBreadcrumb"></div> |
| | | </div> |
| | | <apex:form id="form"> |
| | | <!-- Error Msg--> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | <apex:pageblock > |
| | | <apex:pageblock id="block" > |
| | | <div class="pbHeader"> |
| | | <table cellspacing="0" cellpadding="0" border="0"> |
| | | <tbody> |
| | |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | <!-- Error Msg--> |
| | | <div style="text-align: center;"> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | </div> |
| | | <!-- Iterate the layoutSections, which is a list of sections --> |
| | | <apex:repeat value="{!layoutSections}" var="layoutSection"> |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-18-2022 |
| | | @last modified on : 03-28-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="Rental_Apply__c" extensions="RentalApplyController" id="page"> |
| | |
| | | let nodelist = document.querySelectorAll("[data-id]"); |
| | | let result = {} |
| | | //富文本 |
| | | if(document.querySelector("[aria-describedby = 'cke_34']")){ |
| | | result.HP_received_sign_rich__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | if(document.querySelector("[aria-describedby = 'cke_38']")){ |
| | | result.HP_received_sign_rich__c = document.querySelector("[aria-describedby = 'cke_38']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | if(document.querySelector("[aria-describedby = 'cke_71']")){ |
| | | result. Extension_List_RentalApply__c = document.querySelector("[aria-describedby = 'cke_71']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | } |
| | | for (let index = 0; index < nodelist.length; index++) { |
| | | if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) { |
| | | console.log(nodelist[index].id.indexOf('lkwgt')); |
| | |
| | | } |
| | | } |
| | | for (let i = 0; i < userVLookUpFields.length; i++) { |
| | | let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; |
| | | console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); |
| | | if(userVlookUpNodeValue!='000000000000000'){ |
| | | result[userVLookUpFields[i]] = userVlookUpNodeValue; |
| | | } |
| | | if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ |
| | | let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; |
| | | console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); |
| | | if(userVlookUpNodeValue!='000000000000000'){ |
| | | result[userVLookUpFields[i]] = userVlookUpNodeValue; |
| | | } |
| | | } |
| | | } |
| | | //page:form:j_id30:j_id34:2:j_id35:j_id36:2:j_id37 |
| | | //page:form:j_id27:j_id31:2:j_id32:j_id33:2:j_id34 |
| | | result.demo_purpose2__c = document.querySelector("[id='page:form:j_id30:j_id34:2:j_id35:j_id36:2:j_id37']").value; |
| | | result.ToAgency__c = document.querySelector("[id='page:form:j_id30:j_id34:0:j_id35:j_id36:14:j_id37']").value; |
| | | result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:j_id30:j_id34:0:j_id35:j_id36:14:j_id37']").value; |
| | | result.demo_purpose2__c = document.querySelector("[id='page:form:block:j_id34:2:j_id35:j_id36:2:j_id37']").value; |
| | | result.ToAgency__c = document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:14:j_id37']").value; |
| | | result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:12:j_id35:j_id36:1:j_id37']").value; |
| | | console.log(JSON.stringify(result)); |
| | | //格式化时间 |
| | | if(result.HP_received_sign_day__c){ |
| | | result.HP_received_sign_day__c = result.HP_received_sign_day__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | |
| | | |
| | | //Alert Error Message |
| | | function alertErrorMessage(errorMsg) { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsg = '错误:无效数据。' + '\n' + errorMsg; |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | |
| | | |
| | | //Hide Error Message |
| | | function hiddenErrorMsgNode() { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsgNode.innerText = ''; |
| | | errorMsgNode.className = ''; |
| | | } |
| | |
| | | let accountNodeId = document.querySelector("[data-id='Account__c']").id + '_lkid'; |
| | | accountValue = document.getElementById(accountNodeId).value; |
| | | } |
| | | let searchContactKeyWord = document.querySelector("[data-id='Loaner_medical_Staff__c']").value; |
| | | console.log(accountValue); |
| | | if(accountValue !='000000000000000'){ |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | </div> |
| | | <apex:form id="form"> |
| | | <apex:inputHidden value="{!contactId}" id="contactId"/> |
| | | <!-- Error Msg--> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | <apex:pageblock > |
| | | <apex:pageblock id="block"> |
| | | <div class="pbHeader"> |
| | | <table cellspacing="0" cellpadding="0" border="0"> |
| | | <tbody> |
| | |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | <!-- Error Msg--> |
| | | <div style="text-align: center;"> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | </div> |
| | | <!-- Iterate the layoutSections, which is a list of sections --> |
| | | <apex:repeat value="{!layoutSections}" var="layoutSection"> |
| | | <apex:pageBlockSection title="{!layoutSection.name}" collapsible="{!layoutSection.allowCollapse}" columns="{!layoutSection.columns}"> |
| | | |
| | | <!--Each section has layoutFields, let's iterate them as well--> |
| | | <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> |
| | | <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" |
| | | <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" |
| | | required="{!layoutField.isRequired}" /> |
| | | <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> |
| | | </apex:pageblocksectionitem> |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | replaceSearchContactLookup(); |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | this.className = "closeIcon" |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if(input){ |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | if(hidden){ |
| | | hidden.value = ''; |
| | | if(['Loaner_medical_Staff__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | // jQuery(".lookupInput").each(function(i,e){ |
| | | // let je =jQuery(e).find('input'); |
| | | // je.attr("readonly",""); |
| | | // je.css("background","unset"); |
| | | |
| | | // let dataid = je.attr('data-id'); |
| | | // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | // }) |
| | | |
| | | // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | // this.className = "closeIconOn"; |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | // this.className = "closeIcon" |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | // let input = document.getElementById(id); |
| | | // if(input){ |
| | | // input.value = ''; |
| | | // let hidden = document.getElementById(id+'_lkid'); |
| | | // if(hidden){ |
| | | // hidden.value = ''; |
| | | // } |
| | | // } |
| | | // }); |
| | | |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-19-2022 |
| | | @last modified on : 03-25-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="Repair__c" extensions="NewRepairController" id="page"> |
| | |
| | | alertErrorMessage(errorMessage); |
| | | } |
| | | } |
| | | var GetEleApiName = function(ele){ |
| | | for(let ci in ele.classList){ |
| | | let c = ele.classList[ci]; |
| | | if(c.indexOf('PIBackApi'+'_')>-1){ |
| | | return c.replace('PIBackApi'+'_',''); |
| | | } |
| | | } |
| | | return ''; |
| | | } |
| | | |
| | | //Query Required Parameter |
| | | // var queryBack = function queryBack(data) { |
| | |
| | | console.log(nodelist[index].id.indexOf('lkwgt')); |
| | | if (nodelist[index].id.indexOf('lkwgt') == -1) { |
| | | let vlookUpNodeId = nodelist[index].id + '_lkid'; |
| | | let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; |
| | | result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; |
| | | if(document.getElementById(vlookUpNodeId)!=null){ |
| | | let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; |
| | | result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; |
| | | } |
| | | } |
| | | } else if (nodelist[index].type == 'checkbox') { |
| | | result[nodelist[index].getAttribute("data-id")] = nodelist[index].checked; |
| | |
| | | } |
| | | } |
| | | for (let i = 0; i < userVLookUpFields.length; i++) { |
| | | let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; |
| | | console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); |
| | | if(userVlookUpNodeValue!='000000000000000'){ |
| | | result[userVLookUpFields[i]] = userVlookUpNodeValue; |
| | | if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ |
| | | // let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; |
| | | let e = document.getElementById(jQuery('[data-id="'+userVLookUpFields[i]+'"] .lookupInput input').attr('id')+'_lkid'); |
| | | //let userVlookUpNodeValue = jQuery('[data-id="Incharge_Staff__c"] .lookupInput input').val() |
| | | // console.log('userVlookUpNodeValue:'+e.value); |
| | | if(e && e.value!='000000000000000'){ |
| | | result[userVLookUpFields[i]] = e.value; |
| | | } |
| | | } |
| | | } |
| | | result.work_location_select__c = document.querySelector("[id='page:form:j_id30:j_id34:1:j_id35:j_id36:18:j_id37']").value; |
| | | // result.work_location_select__c = document.querySelector("[id='page:form:block:j_id34:1:j_id35:j_id36:18:j_id37']").value; |
| | | // result.ProblemDescription__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML |
| | | /* |
| | | if(result.engineerSendDate__c){ |
| | | result.engineerSendDate__c = result.engineerSendDate__c.replace(/\//g, '-')+':00'; |
| | | } |
| | | */ |
| | | let e = null; |
| | | e = document.getElementById(jQuery('[data-id="Incharge_Staff__c"] .lookupInput input').attr('id')+'_lkid'); |
| | | if(e){ |
| | | result.Incharge_Staff__c = e.value; |
| | | } |
| | | |
| | | e = document.getElementById(api_id_map['work_location_select__c']); |
| | | if(e){ |
| | | result.work_location_select__c = e.value; |
| | | } |
| | | e = document.getElementById(jQuery('[data-id="OCSM_RC_CordingUser__c"] .lookupInput input').attr('id')+'_lkid'); |
| | | if(e){ |
| | | result.OCSM_RC_CordingUser__c = e.value; |
| | | } |
| | | |
| | | e = document.getElementById(jQuery('[data-id="OSH_Affirmant__c"] .lookupInput input').attr('id')+'_lkid'); |
| | | if(e){ |
| | | result.OSH_Affirmant__c = e.value; |
| | | } |
| | | e = document.getElementById(jQuery('[data-id="OSHRAConfirmUser__c"] .lookupInput input').attr('id')+'_lkid'); |
| | | if(e){ |
| | | result.OSHRAConfirmUser__c = e.value; |
| | | } |
| | | e = document.getElementById(jQuery('[data-id="Repair_Authenticator__c"] .lookupInput input').attr('id')+'_lkid'); |
| | | if(e){ |
| | | result.Repair_Authenticator__c = e.value; |
| | | } |
| | | e = document.getElementById(jQuery('[data-id="Repair_Determine_result_ConfirmationUser__c"] .lookupInput input').attr('id')+'_lkid'); |
| | | if(e){ |
| | | result.Repair_Determine_result_ConfirmationUser__c = e.value; |
| | | } |
| | | console.log(JSON.stringify(result)); |
| | | return result; |
| | | } |
| | |
| | | |
| | | var queryBack = function queryBack(data) { |
| | | console.log(data); |
| | | document.querySelector("[data-id='address_Contacts__c']").innerHTML = data.object.addressContacts; |
| | | document.querySelector("[data-id='address_Contacts_Name__c']").innerHTML = data.object.addressContactsName; |
| | | document.querySelector("[data-id='address_Telephone__c']").innerHTML = data.object.addressTelephone; |
| | | document.querySelector("[data-id='address_ZipCode__c']").innerHTML = data.object.addressZipCode; |
| | | document.querySelector("[data-id='Detailed_Address__c']").innerHTML = data.object.detailedAddress; |
| | | document.querySelector("[data-id='RepairApplicant__c']").innerHTML = data.object.repairApplicant; |
| | | document.querySelector("[data-id='address_Contacts__c']").value = data.object.addressContacts; |
| | | document.querySelector("[data-id='address_Contacts_Name__c']").value = data.object.addressContactsName; |
| | | document.querySelector("[data-id='address_Telephone__c']").value = data.object.addressTelephone; |
| | | document.querySelector("[data-id='address_ZipCode__c']").value = data.object.addressZipCode; |
| | | document.querySelector("[data-id='Detailed_Address__c']").value = data.object.detailedAddress; |
| | | document.querySelector("[data-id='RepairApplicant__c']").value = data.object.repairApplicant; |
| | | AWSService.query(staticResourceAddress.queryUrl, '{!DecryptAWSDataId}', queryBackDecrypt, staticResourceAddress.token); |
| | | }; |
| | | var queryBackContact = function queryBack(data) { |
| | | console.log(data); |
| | | document.querySelector("[data-id='address_Contacts__c']").innerHTML = data.object.lastName; |
| | | document.querySelector("[data-id='address_Contacts__c']").value = data.object.lastName; |
| | | }; |
| | | var queryBackDecrypt = function queryBack(data) { |
| | | document.querySelector("[data-id='Detailed_Address__c']").innerHTML = data.object.detailedAddress; |
| | | document.querySelector("[data-id='address_ZipCode__c']").innerHTML = data.object.zipCode; |
| | | document.querySelector("[data-id='address_Telephone__c']").innerHTML = data.object.telephone; |
| | | document.querySelector("[data-id='Detailed_Address__c']").value = data.object.detailedAddress; |
| | | document.querySelector("[data-id='address_ZipCode__c']").value = data.object.zipCode; |
| | | document.querySelector("[data-id='address_Telephone__c']").value = data.object.telephone; |
| | | AWSService.query(staticResourceContact.queryUrl, '{!ContactAWSDataId}', queryBackContact, staticResourceContact.token); |
| | | } |
| | | |
| | |
| | | |
| | | //Alert Error Message |
| | | function alertErrorMessage(errorMsg) { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsg = '错误:无效数据。' + '\n' + errorMsg; |
| | | errorMsgNode.innerText = errorMsg; |
| | | errorMsgNode.className = 'pbError'; |
| | |
| | | |
| | | //Hide Error Message |
| | | function hiddenErrorMsgNode() { |
| | | let errorMsgNode = document.getElementById("page:form:msgContent"); |
| | | let errorMsgNode = document.getElementById("page:form:block:msgContent"); |
| | | errorMsgNode.innerText = ''; |
| | | errorMsgNode.className = ''; |
| | | } |
| | |
| | | <div class="ptBreadcrumb"></div> |
| | | </div> |
| | | <apex:form id="form"> |
| | | <!-- Error Msg--> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | <apex:pageblock > |
| | | <apex:pageblock id="block"> |
| | | <div class="pbHeader"> |
| | | <table cellspacing="0" cellpadding="0" border="0"> |
| | | <tbody> |
| | |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | <!-- Error Msg--> |
| | | <div style="text-align: center;"> |
| | | <apex:outputPanel id="errorMsg"> |
| | | <apex:pageMessages id="msgContent" escape="false" /> |
| | | </apex:outputPanel> |
| | | </div> |
| | | <!-- Iterate the layoutSections, which is a list of sections --> |
| | | <apex:repeat value="{!layoutSections}" var="layoutSection"> |
| | | <apex:pageBlockSection title="{!layoutSection.name}" collapsible="{!layoutSection.allowCollapse}" columns="{!layoutSection.columns}"> |
| | | |
| | | <!--Each section has layoutFields, let's iterate them as well--> |
| | | <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> |
| | | <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" |
| | | <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" |
| | | required="{!layoutField.isRequired}" /> |
| | | <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> |
| | | </apex:pageblocksectionitem> |
| | |
| | | </apex:pageBlockSection> |
| | | </apex:repeat> |
| | | <script> |
| | | function IsFormTag(tag_name){ |
| | | if (!tag_name) { |
| | | return false; |
| | | } |
| | | return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; |
| | | } |
| | | |
| | | function IsFormElement(e){ |
| | | return IsFormTag(e.tagName); |
| | | } |
| | | var init_nodes = document.getElementsByClassName("PIBackApi"); |
| | | var api_id_map={}; |
| | | for(let ei in init_nodes){ |
| | | let e = init_nodes[ei]; |
| | | if(IsFormElement(e)){ |
| | | if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ |
| | | api_id_map[GetEleApiName(e)] = e.id; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | //Append Page |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | var layoutSections = JSON.parse('{!layoutSectionsStr}'); |
| | |
| | | for (let n = 0; n < layoutSection.length; n++) { |
| | | let layoutField = layoutSection[n]; |
| | | if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { |
| | | document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); |
| | | let e = document.querySelector("[data-id='"+layoutField.fieldAPI+"']"); |
| | | e.disabled = !(layoutField.editableField); |
| | | if (!(layoutField.editableField)) { |
| | | if (e.getAttribute("multiple") && e.getAttribute("multiple") == 'multiple') { |
| | | e.parentNode.classList.add("disabledbutton"); |
| | | } |
| | | if (e.tagName == 'DIV') { |
| | | e.classList.add("disabledbutton"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (!{!isNewMode}) { |
| | | blockme(); |
| | | QueryRepairFromAWS(); |
| | | unblockUI(); |
| | | }; |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | if(document.querySelector("[data-id='OwnerId']") != null) |
| | | document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); |
| | | |
| | | jQuery(".lookupInput").each(function(i,e){ |
| | | let je =jQuery(e).find('input'); |
| | | je.attr("readonly",""); |
| | | je.css("background","unset"); |
| | | |
| | | let previous_value = {}; |
| | | jQuery(".lookupInput input").each(function(i,e){ |
| | | let je =jQuery(e); |
| | | |
| | | let dataid = je.attr('data-id'); |
| | | if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | }) |
| | | |
| | | jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | this.className = "closeIconOn"; |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | this.className = "closeIcon" |
| | | }); |
| | | |
| | | jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | let input = document.getElementById(id); |
| | | if(input){ |
| | | input.value = ''; |
| | | let hidden = document.getElementById(id+'_lkid'); |
| | | if(hidden){ |
| | | hidden.value = ''; |
| | | if(['Incharge_Staff_Contact__c'].indexOf(dataid) < 0) return; |
| | | |
| | | jQuery(e).focus(function(){ |
| | | previous_value[this.id] = this.value; |
| | | }) |
| | | |
| | | jQuery(e).change(function(){ |
| | | if (previous_value[this.id] != jQuery(this).val()) { |
| | | document.getElementById(this.id+'_lkid').value = ''; |
| | | } |
| | | } |
| | | }); |
| | | }) |
| | | }) |
| | | |
| | | // jQuery(".lookupInput").each(function(i,e){ |
| | | // let je =jQuery(e).find('input'); |
| | | // je.attr("readonly",""); |
| | | // je.css("background","unset"); |
| | | |
| | | // let dataid = je.attr('data-id'); |
| | | // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; |
| | | // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); |
| | | // }) |
| | | |
| | | // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ |
| | | // this.className = "closeIconOn"; |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ |
| | | // this.className = "closeIcon" |
| | | // }); |
| | | |
| | | // jQuery(".lookupInput").on("click","img[generate]",function(e){ |
| | | // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); |
| | | // let input = document.getElementById(id); |
| | | // if(input){ |
| | | // input.value = ''; |
| | | // let hidden = document.getElementById(id+'_lkid'); |
| | | // if(hidden){ |
| | | // hidden.value = ''; |
| | | // } |
| | | // } |
| | | // }); |
| | | }); |
| | | </script> |
| | | <div class="pbBottomButtons"> |
| | |
| | | let divs = j$(e).find("div.message"); |
| | | for (let i = 0; i < divs.length; i++) { |
| | | for (let j = 0; j < divs[i].classList.length; j++) { |
| | | for(let cls of divs[i].classList){ |
| | | for(let clsi in divs[i].classList){let cls=divs[i].classList[clsi]; |
| | | if (cls.indexOf('error')>-1) { |
| | | return true; |
| | | } |
| | |
| | | <apex:page controller="SearchContactController" id="page"> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" /> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" /> |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}" /> |
| | | |
| | | <head> |
| | | </head> |
| | |
| | | var searchContactName = ''; |
| | | function searchAWSContact(){ |
| | | console.log('Search process!'); |
| | | //1. reset table; |
| | | //1. reset table; |
| | | blockme(); |
| | | resetTable(); |
| | | //2. get contact name value |
| | | searchContactName = document.getElementById('page:form:lksrch').value; |
| | |
| | | queryLeadFromAWS(); |
| | | }else{ |
| | | alert("请输入至少2个关键字"); |
| | | unblockUI(); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | myTableDiv.appendChild(table); |
| | | unblockUI(); |
| | | } |
| | | function initContactTable(data) { |
| | | let cols = ['Name','AccountName','Email', 'Phone']; |
| | |
| | | //Invoke SF BackEnd |
| | | Visualforce.remoting.Manager.invokeAction( |
| | | '{!$RemoteAction.SearchContactController.searchContacts}', |
| | | JSON.stringify(awsDataIds), |
| | | JSON.stringify(awsDataIds),'','', |
| | | function (result, event) { |
| | | if(event.status){ |
| | | if(result.status == 'success'){ |
| | |
| | | <apex:page controller="SearchContactController" showHeader="false" id="page"> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" /> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" /> |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}" /> |
| | | |
| | | <head> |
| | | </head> |
| | |
| | | var staticResources = JSON.parse('{!staticResource}'); |
| | | var contactAWSIds = JSON.parse('{!contactAWSIds}'); |
| | | var contactsInfo = JSON.parse('{!contactsInfo}'); |
| | | var searchContactName = ''; |
| | | var searchKeyWord = '{!searchKeyWord}'; |
| | | var searchContactName = searchKeyWord; |
| | | queryLeadFromAWS(); |
| | | function searchAWSContact(){ |
| | | console.log('Search process!'); |
| | | //1. reset table; |
| | | //1. reset table; |
| | | blockme(); |
| | | resetTable(); |
| | | //2. get contact name value |
| | | searchContactName = document.getElementById('page:form:lksrch').value; |
| | | queryLeadFromAWS(); |
| | | |
| | | } |
| | | function resetTable(){ |
| | | let queryResult = document.getElementById('QueryResult'); |
| | |
| | | function queryLeadFromAWS() { |
| | | //1. Prepare the payload for contact search |
| | | let requestSearchPayload = preparePayloadForSearchContact(); |
| | | console.log('request payload body:'+requestSearchPayload); |
| | | //2. Invoke AWS Service |
| | | // fetch(staticResources.searchUrl, { |
| | | // method: 'POST', |
| | |
| | | // } |
| | | // }) |
| | | let queryBackContactName = function queryBackContactName(result){ |
| | | if(result.object&&result.object.length>0){ |
| | | initContactTable(result); |
| | | } |
| | | // if(result.object){ |
| | | // initContactTable(result); |
| | | // } |
| | | initContactTable(result); |
| | | }; |
| | | AWSService.search(staticResources.searchUrl,requestSearchPayload,queryBackContactName,staticResources.token) |
| | | } |
| | |
| | | let tableBody = document.createElement('TBODY'); |
| | | table.appendChild(tableBody); |
| | | let headerTR = document.createElement('TR'); |
| | | let colsHeader = ['姓名','客户名称','邮箱', '电话']; |
| | | tableBody.appendChild(headerTR); |
| | | for (let i = 0; i < cols.length; i++) { |
| | | for (let i = 0; i < colsHeader.length; i++) { |
| | | let td = document.createElement('TH'); |
| | | td.width = '75'; |
| | | td.appendChild(document.createTextNode(cols[i])); |
| | | td.appendChild(document.createTextNode(colsHeader[i])); |
| | | headerTR.appendChild(td); |
| | | } |
| | | //3. Init the AWS data |
| | |
| | | for (let j = 0; j < cols.length; j++) { |
| | | let td = document.createElement('TD'); |
| | | td.width = '75'; |
| | | if (!contactsInfo.hasOwnProperty(contactInfoTemp.AWSDataId)) { |
| | | continue; |
| | | } |
| | | if(j == 0){ |
| | | td.id = contactsInfo[contactInfoTemp.AWSDataId].Id; |
| | | } |
| | | td.appendChild(document.createTextNode(contactInfoTemp[cols[j]])); |
| | | if(contactInfoTemp.pi){ |
| | | if (!contactsInfo.hasOwnProperty(contactInfoTemp.AWSDataId)) { |
| | | continue; |
| | | } |
| | | if(j == 0 && contactsInfo[contactInfoTemp.AWSDataId] ){ |
| | | td.id = contactsInfo[contactInfoTemp.AWSDataId].Id; |
| | | } |
| | | }else{ |
| | | td.id = contactInfoTemp.sfRecordId; |
| | | } |
| | | td.appendChild(document.createTextNode(contactInfoTemp[cols[j]]!=null?contactInfoTemp[cols[j]]:'')); |
| | | if (cols[j] == 'Name') { |
| | | td.addEventListener("click", function (obj) { |
| | | redirectToParentPage(obj); |
| | |
| | | } |
| | | } |
| | | myTableDiv.appendChild(table); |
| | | unblockUI(); |
| | | } |
| | | function initContactTable(data) { |
| | | let cols = ['Name', 'Email', 'Phone']; |
| | | let cols = ['Name','AccountName', 'Email', 'Phone']; |
| | | let contactInfoList = []; |
| | | let awsDataIds = []; |
| | | for(var i=0;i<data.object.length;i++){ |
| | | if(data.object[i].dataId){ |
| | | let contactInfo = new Object(); |
| | | contactInfo.Name = data.object[i].lastName; |
| | | contactInfo.Email = data.object[i].email; |
| | | contactInfo.Phone = data.object[i].phone; |
| | | contactInfo.AWSDataId = data.object[i].dataId; |
| | | awsDataIds.push(contactInfo.AWSDataId); |
| | | contactInfo.sfRecordId = ''; |
| | | contactInfoList.push(contactInfo); |
| | | } |
| | | if(data.object){ |
| | | for(var i=0;i<data.object.length;i++){ |
| | | if(data.object[i].dataId){ |
| | | let contactInfo = new Object(); |
| | | contactInfo.Name = data.object[i].lastName; |
| | | contactInfo.Email = data.object[i].email; |
| | | contactInfo.Phone = data.object[i].phone; |
| | | contactInfo.AWSDataId = data.object[i].dataId; |
| | | contactInfo.pi = true; |
| | | awsDataIds.push(contactInfo.AWSDataId); |
| | | contactInfo.sfRecordId = ''; |
| | | contactInfoList.push(contactInfo); |
| | | } |
| | | } |
| | | } |
| | | let AWSIdToSFIdMapValue = {}; |
| | | console.log(awsDataIds); |
| | | //Invoke SF BackEnd |
| | | Visualforce.remoting.Manager.invokeAction( |
| | | '{!$RemoteAction.SearchContactController.searchContacts}', |
| | | JSON.stringify(awsDataIds), |
| | | JSON.stringify(awsDataIds),searchContactName,'{!aId}', |
| | | function (result, event) { |
| | | if(event.status){ |
| | | if(result.status = 'success'){ |
| | | contactsInfo = JSON.parse(result.message.replace(/("\;)/g,"\"")); |
| | | if(result.message){ |
| | | contactsInfo = JSON.parse(result.message.replace(/("\;)/g,"\"")); |
| | | if(Object.keys(contactsInfo).length>0){ |
| | | for(let i=0;i<contactInfoList.length;i++){ |
| | | let contactFromSF = contactsInfo[contactInfoList[i]['AWSDataId']]; |
| | | if(contactFromSF){ |
| | | contactInfoList[i].sfRecordId = contactFromSF['Id']; |
| | | contactInfoList[i].AccountName = contactFromSF['Account']['Name']; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //1. get SF 非敏感的联系人信息 |
| | | if(result.noPIContactList){ |
| | | var noPIInfo = JSON.parse(result.noPIContactList.replace(/("\;)/g,"\"")); |
| | | for(let f in noPIInfo){ |
| | | let contactInfo = new Object(); |
| | | contactInfo.Name = noPIInfo[f].Name!=null?noPIInfo[f].Name:''; |
| | | contactInfo.Email = noPIInfo[f].Email!=null?noPIInfo[f].Email:''; |
| | | contactInfo.Phone = noPIInfo[f].Phone!=null?noPIInfo[f].Phone:''; |
| | | contactInfo.AWSDataId = ''; |
| | | contactInfo.sfRecordId = noPIInfo[f].Id!=null?noPIInfo[f].Id:''; |
| | | contactInfo.AccountName = noPIInfo[f]['Account']['Name']; |
| | | contactInfo.pi = false; |
| | | contactInfoList.push(contactInfo); |
| | | } |
| | | } |
| | | refreshTable(cols,contactInfoList); |
| | | }else{ |
| | | console.log('No result'); |
| | |
| | | var staticResources = JSON.parse('{!staticResource}'); |
| | | var leadAWSIds = JSON.parse('{!leadAWSIds}'); |
| | | var leadsInfo = JSON.parse('{!leadsInfo}'); |
| | | var searchContactName = ''; |
| | | var searchKeyWord = '{!searchKeyWord}'; |
| | | var searchContactName = searchKeyWord; |
| | | if(searchContactName){ |
| | | document.getElementById('page:form:lksrch').value = searchContactName; |
| | | } |
| | | queryLeadFromAWS(); |
| | | function searchAWSContact(){ |
| | | console.log('Search process!'); |
| | |
| | | ProcessPIForAWS({},GetEditObj()); |
| | | } |
| | | function Trans(){ |
| | | console.log('SFRcordId:'+document.getElementById('Page:mainForm:sfContactId').value); |
| | | AWSService.postAWS(staticResources.transactionUrl,AWSService.confirmTrans, JSON.stringify({ |
| | | "txId":aws_result.txId, |
| | | "sfRecordId":"", |
| | | "sfRecordId":document.getElementById('Page:mainForm:sfContactId').value, |
| | | "isSuccess":1 |
| | | }), function(result){ |
| | | window.location.reload(); |
| | |
| | | <apex:actionFunction name="editVistor" action="{!editVistor}" rerender="idRegistration" oncomplete="assignDencrypted();setButtonDisable(document.getElementById('Page:mainForm:idSearchVisitor:idRegSave'), false);"> |
| | | <apex:param name="index" assignTo="{!index}" value=""/> |
| | | </apex:actionFunction> |
| | | <apex:actionFunction name="saveNew" action="{!regContact}" rerender="idRegistration,idRezultVisitor,idAddVisitor,idMessage" onComplete="Trans();"> |
| | | <apex:actionFunction name="saveNew" action="{!regContact}" rerender="idRegistration,idRezultVisitor,idAddVisitor,idMessage,sfContactId" onComplete="Trans()"> |
| | | </apex:actionFunction> |
| | | <!-- Add By Li Jun for PIPL 20220228 Start --> |
| | | <apex:inputHidden id="LastName_Encrypted__c" value="{!rc.LastName_Encrypted__c}"/> |
| | |
| | | <apex:inputHidden id="Doctor_Division1_Encrypted__c" value="{!rc.Doctor_Division1_Encrypted__c}"/> |
| | | |
| | | <apex:inputHidden id="AWS_Data_Id__c" value="{!rc.AWS_Data_Id__c}"/> |
| | | <apex:inputHidden id="sfContactId" value="{!sfContactId}"/> |
| | | <!-- Add By Li Jun for PIPL 20220221 End --> |
| | | <apex:pageBlock id="idSearchVisitor" > |
| | | <table width="1060" height="50" border="0"> |
| | |
| | | result = '首签合同'; |
| | | }else if(firstCCount > 0 && firstCCount == allcount){ |
| | | result = '首签合同'; |
| | | }else if(oyearCount > 0 && oyearCount == conCCount){ |
| | | // 20220328 ljh update LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 start |
| | | // }else if(oyearCount > 0 && oyearCount == conCCount){ |
| | | }else if(oyearCount > 0 && oyearCount == conCCount && allcount == oyearCount ){ |
| | | // 20220328 ljh update LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 start |
| | | result = '非续签合同(空白期一年以上)'; |
| | | }else{ |
| | | result = '续签合同'; |
| | |
| | | } |
| | | |
| | | function refreshAsset(cnt) { |
| | | //alert('1111111111'); |
| | | // alert(cnt); |
| | | // 提交后就页面不计算了 |
| | | var isDisabled = {!PageDisabled}; |
| | | // 合同总理 |
| | |
| | | } |
| | | //最后结束日+1年 |
| | | lastendDate.setMonth(lastendDate.getMonth() + 12); |
| | | if (Date.parse(contractStartDate) > Date.parse(lastendDate)) { |
| | | if (Date.parse(contractStartDate) > Date.parse(lastendDate) ) { |
| | | oyearCount ++; |
| | | } |
| | | // 取联动价格 |
| | |
| | | } else { |
| | | strMoney = month * strMoney + month2 * strMoney; |
| | | } |
| | | var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value(); |
| | | var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value(); |
| | | var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value(); |
| | | if(b != ''){ |
| | | conCCount ++; |
| | |
| | | result = '首签合同'; |
| | | }else if(firstCCount > 0 && firstCCount == allcount){ |
| | | result = '首签合同'; |
| | | }else if(oyearCount > 0 && oyearCount == conCCount){ |
| | | // 20220328 ljh update LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 start |
| | | // }else if(oyearCount > 0 && oyearCount == conCCount){ |
| | | }else if(oyearCount > 0 && oyearCount == conCCount && allcount == oyearCount ){ |
| | | // 20220328 ljh update LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备 start |
| | | result = '非续签合同(空白期一年以上)'; |
| | | }else{ |
| | | result = '续签合同'; |
| | | } |
| | | console.log(result); |
| | | document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXT").innerHTML = result; |
| | | document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXTHidden").value = result; |
| | | // 取消酸化水 |
| | |
| | | if(isAddCon){ |
| | | AWSService.post(staticResourceContact.transactionUrl, JSON.stringify({ |
| | | "txId":con_aws_result.txId, |
| | | "isSuccess":b ? 0 : 1 |
| | | "isSuccess":b ? 0 : 1, |
| | | "sfRecordId":document.getElementById('allPage:allForm:sfRecordId').value |
| | | }), function(result){ |
| | | if(!b) |
| | | window.location.reload(); |
| | |
| | | '\n邮编: '+PIData[awsDataId].zipCode+ |
| | | '\n详细地址: '+PIData[awsDataId].detailedAddress |
| | | }else{ |
| | | piInformation = '联系人: null'+ |
| | | '\n电话: '+PIData[awsDataId].telephone+ |
| | | piInformation = |
| | | '电话: '+PIData[awsDataId].telephone+ |
| | | '\n邮编: '+PIData[awsDataId].zipCode+ |
| | | '\n详细地址: '+PIData[awsDataId].detailedAddress |
| | | } |
| | |
| | | //自定义lookup查询 |
| | | function searchContact(contactNodeId,field){ |
| | | closeField = field; |
| | | let searchContactKeyWord = document.getElementById(field).value |
| | | let accountValue = ""; |
| | | if (document.getElementById('allPage:allForm:oppBlock2:UpdAddressId:Customer__r_Name')!=null) { |
| | | let accountNodeId = document.getElementById('allPage:allForm:oppBlock2:UpdAddressId:Customer__r_Name').id + '_lkid'; |
| | |
| | | console.log(accountValue); |
| | | if(accountValue !='000000000000000'){ |
| | | let baseUrl = "/apex/SearchContactPage"; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; |
| | | let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; |
| | | let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; |
| | | newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); |
| | | if (window.focus) { |
| | |
| | | } |
| | | return false; |
| | | }else{ |
| | | console.log('请先选择客户再选择联系人') |
| | | alert('请先选择客户再选择联系人') |
| | | } |
| | | } |
| | | |
| | |
| | | <apex:inputHidden id="tableValueFrontEnd" value="{!tableDataStr}"/> |
| | | <apex:inputHidden value="{!contactId}" id="contactId"/> |
| | | <apex:inputHidden value="{!insUpdDataStr}" id="insUpdDataStr"/> |
| | | <apex:inputHidden value="{!sfRecordId}" id="sfRecordId"/> |
| | | <div id="tab01"> |
| | | <!-- 页面数据初始化方法 --> |
| | | <apex:actionFunction name="init" action="{!init}" rerender="oppBlock1,message,checEventFrame" onComplete="unblockUI();"></apex:actionFunction> |
| | |
| | | <apex:param name="isUpload" assignTo="{!isUpload}" value="" /> |
| | | </apex:actionFunction> |
| | | <!-- 保存和修改方法 --> |
| | | <apex:actionFunction name="save" action="{!save}" rerender="oppBlock2,message" onComplete="unblockUI();{!IF(isSearchBtn,'searchBtnJs()',false)};Trans()"></apex:actionFunction> |
| | | <apex:actionFunction name="save" action="{!save}" rerender="oppBlock2,message,sfRecordId" onComplete="unblockUI();{!IF(isSearchBtn,'searchBtnJs()',false)};Trans();"></apex:actionFunction> |
| | | <!-- 查询客户记录类型方法 --> |
| | | <apex:actionFunction name="queryRecordType" action="{!queryRecordType}" rerender="oppBlock2,message" onComplete="unblockUI();"></apex:actionFunction> |
| | | <!-- 点击修改按钮获取修改数据方法 --> |
| | |
| | | <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;"> |
| | | <apex:outputText value="{!or.address.Detailed_Address__c}" /> |
| | | </td> |
| | | <!-- <td align="center" style="vertical-align: inherit;width:30px;"> |
| | | <td align="center" style="vertical-align: inherit;width:30px;"> |
| | | <apex:commandButton value=" 编辑 " onclick="onEditorJs('{!or.address.id}');return false;" style="background:#98c1fbf7;display:{!or.canEdit};"/> |
| | | </td> --> |
| | | </td> |
| | | <td align="center" style="vertical-align: inherit;width:30px;"> |
| | | <apex:commandButton value=" 复制 " onclick="onCopyJs('{!or.address.id}');return false;" style="background: #98c1fbf7;display:{!or.canCopy};"/> |
| | | </td> |
| | |
| | | <!-- Before PIPL 20220308 --> |
| | | <!-- <apex:inputfield value="{!insUpdData.Contacts__c}" id="Contacts__c" required="false"/> --> |
| | | <!-- Add By Li Jun for PIPL 20220308 Start --> |
| | | <apex:inputText label="联系人" disabled="true" value="{!contactNameValue}" id="Contacts__c"> |
| | | <!-- <apex:inputText label="联系人" disabled="true" value="{!contactNameValue}" id="Contacts__c">--> |
| | | <apex:inputText label="联系人" value="{!contactNameValue}" id="Contacts__c"> |
| | | </apex:inputText> |
| | | <apex:inputHidden id="contactIdValue" value="{!contactIdValue}"/> |
| | | <!-- Add By Li Jun for PIPL 20220308 End --> |
| | |
| | | var fileObject = document.getElementById("page:theForm:block:uploadSection:file"); |
| | | var reader = new FileReader(); |
| | | var data = reader.readAsDataURL(fileObject.files[0]); |
| | | debugger |
| | | console.log(event); |
| | | } |
| | | function getBase64(file) { |
| | |
| | | "sfRecordId":"", |
| | | "isSuccess":isSuccess |
| | | }), function(result){ |
| | | window.location.reload(); |
| | | console.log("confirmTrans-" + JSON.stringify(data)); |
| | | document.getElementById("file").files[0].name = ''; |
| | | enableButtonStatus(); |
| | | refreshFiles(); |
| | | }, staticResources.token); |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | function uploadFileToAWS(data, size, fileName) { |
| | | debugger |
| | | |
| | | console.log("body=" + JSON.stringify({ 'file': data, "size": size, 'fileName': fileName })); |
| | | AWSService.post(uploadUrl, JSON.stringify({ |
| | | 'file': data, |
| | |
| | | confirmTrans(result.txId, 1); |
| | | } |
| | | |
| | | // window.location.reload(); |
| | | window.location.reload(); |
| | | }, |
| | | { escape: true } |
| | | ); |
| | | debugger |
| | | |
| | | console.log('key' + key); |
| | | } else { |
| | | alertErrorMessage('上传失败请稍后再试!'); |
| | |
| | | } |
| | | </style> |
| | | <apex:form id="theForm"> |
| | | <apex:actionFunction name="refreshFiles" action="{!refreshFiles}" reRender="pdf,uploadSection"/> |
| | | <apex:actionFunction name="refreshFiles" action="{!refreshFiles}" reRender="pdf,theForm"/> |
| | | <br/> |
| | | <br/> |
| | | <apex:pageBlock id="block"> |
| | |
| | | <apex:page standardController="Agency_Contact__c" extensions="NewAndEditAgencyContactController" id="page"> |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> |
| | | <apex:form id="form"> |
| | | <apex:pageblock id="pageBlock"> |
| | |
| | | </apex:repeat> |
| | | </apex:pageBlockSection> |
| | | <script> |
| | | var config = { |
| | | var config = { |
| | | SobjectName : "{!SobjectName}", |
| | | ApiPrefix:"{!ApiPrefix}", |
| | | AWSToSobjectMap:{!AWSToSobjectMapJson}, |
| | |
| | | AWSToSobjectEncryptedMap:{!AWSToSobjectEncryptedMapJson} |
| | | }; |
| | | var staticResources = JSON.parse('{!staticResource}'); |
| | | var staticResourceAWSContact = JSON.parse('{!staticResourceAWSContact}'); |
| | | function QuerySobjectFromAWS() { |
| | | AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); |
| | | console.log('Query contact by awsid:'+'{!awsContactId}'); |
| | | if('{!awsContactId}'){ |
| | | AWSService.query(staticResourceAWSContact.queryUrl, '{!awsContactId}', queryBack, staticResources.token); |
| | | } |
| | | |
| | | } |
| | | var queryBack = function queryBack(data) { |
| | | if(!data.object){ |
| | | console.log('data.object is ' + data.object); |
| | | return; |
| | | } |
| | | console.log('Data from AWS:'+JSON.stringify(data.object)); |
| | | if('{!awsContactId}'){ |
| | | data.object.name = data.object.lastName; |
| | | data.object.type = data.object.type; |
| | | data.object.doctorDivision1 = data.object.doctorDivision1; |
| | | } |
| | | console.log('Data from AWS:'+JSON.stringify(data.object)); |
| | | |
| | | for(let f in config.AWSToSobjectNonEncryptedMap){ |
| | | let t = "[title='"+config.ApiPrefix+config.AWSToSobjectNonEncryptedMap[f]+"']"; |
| | |
| | | <apex:page standardController="Contact" extensions="NewAndEditContactController" id="page"> |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <apex:form id="form"> |
| | | <apex:pageblock id="pageBlock"> |
| | |
| | | <apex:pageblock id="pageBlock"> |
| | | <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> |
| | | <!--Each section has layoutFields, let's iterate them as well--> |
| | | <apex:repeat value="{!layoutEncryptedAPIList}" var="encryptedAPI"> |
| | | <!-- <apex:repeat value="{!layoutEncryptedAPIList}" var="encryptedAPI"> |
| | | <apex:outputField html-data-id="{!encryptedAPI}" title="{!ApiPrefix}{!encryptedAPI}" value="{!Event[encryptedAPI]}" /> |
| | | </apex:repeat> |
| | | </apex:repeat> --> |
| | | <apex:outputField html-data-id="Visitor1__c" title="{!ApiPrefix}Visitor1__c" value="{!Event['Visitor1__c']}" /> |
| | | <apex:outputField html-data-id="Visitor2__c" title="{!ApiPrefix}Visitor2__c" value="{!Event['Visitor2__c']}" /> |
| | | <apex:outputField html-data-id="Visitor3__c" title="{!ApiPrefix}Visitor3__c" value="{!Event['Visitor3__c']}" /> |
| | | <apex:outputField html-data-id="Visitor4__c" title="{!ApiPrefix}Visitor4__c" value="{!Event['Visitor4__c']}" /> |
| | | <apex:outputField html-data-id="Visitor5__c" title="{!ApiPrefix}Visitor5__c" value="{!Event['Visitor5__c']}" /> |
| | | </apex:pageBlockSection> |
| | | <script> |
| | | // var config = { |
| | |
| | | // AWSToSobjectNonEncryptedMap:{!AWSToSobjectNonEncryptedMapJson}, |
| | | // AWSToSobjectEncryptedMap:{!AWSToSobjectEncryptedMapJson} |
| | | // }; |
| | | AWSService.sfSessionId = '{!GETSESSIONID()}'; |
| | | |
| | | var staticResources = JSON.parse('{!staticResources}'); |
| | | var contactAWSIds = JSON.parse('{!contactAWSIds}'); //AWS ContactId |
| | | var sfIdToContactInfo = {}; |
| | |
| | | var queryBack = function queryBack(data) { |
| | | document.querySelector("[data-id='LastName']").innerHTML = data.object.lastName; |
| | | document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id3:0:j_id4']").innerHTML = data.object.phone; |
| | | document.querySelector("[data-id='Email']").innerHTML = data.object.email; |
| | | |
| | | //document.querySelector("[data-id='Email']").innerHTML = data.object.email; |
| | | let eml = document.querySelector("[data-id='Email']"); |
| | | eml.href = 'mailto:'+data.object.email; |
| | | eml.text = data.object.email; |
| | | }; |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | console.log('sfdcPage.appendToOnloadQueue') |
| | |
| | | </apex:repeat> |
| | | </apex:pageBlockSection> |
| | | <script> |
| | | AWSService.sfSessionId = '{!GETSESSIONID()}'; |
| | | var staticResources = JSON.parse('{!staticResource}'); |
| | | function QueryConsumApplyFromAWS() { |
| | | AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); |
| | |
| | | @description : |
| | | @author : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | @group : |
| | | @last modified on : 03-17-2022 |
| | | @last modified on : 03-23-2022 |
| | | @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc |
| | | --> |
| | | <apex:page standardController="Repair__c" extensions="NewRepairController" id="page"> |
| | | <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> |
| | | <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> |
| | | <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> |
| | | <apex:form id="form"> |
| | | <apex:pageblock id="pageBlock"> |
| | | <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> |
| | |
| | | AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); |
| | | } |
| | | var queryBack = function queryBack(data) { |
| | | document.querySelector("[data-id='VOC_Informer_Name__c']").innerHTML=data.object.vocInformerName!=null?data.object.vocInformerName.replace(/"/g,""):''; |
| | | document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerHTML=data.object.callerPhone!=null?data.object.callerPhone.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='VOC_Informer_Contact__c']").innerHTML=data.object.vocInformerContact!=null?data.object.vocInformerContact.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Person_In_Charge_Text__c']").innerHTML=data.object.personInChargeText!=null?data.object.personInChargeText.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Professor_sigh_text__c']").innerHTML=data.object.professorSighText!=null?data.object.professorSighText.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Staff_Info_Manual_c__c']").innerHTML=data.object.staffInfoManual!=null?data.object.staffInfoManual.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Responsible_Person_HP_c__c']").innerHTML=data.object.responsiblePersonHP!=null?data.object.responsiblePersonHP.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Practitioner1_Part__c']").innerHTML=data.object.practitioner1Part!=null?data.object.practitioner1Part.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Practitioner2_Part__c']").innerHTML=data.object.practitioner2Part!=null?data.object.practitioner2Part.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Practitioner3_Part__c']").innerHTML=data.object.practitioner3Part!=null?data.object.practitioner3Part.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Practitioner4_Part__c']").innerHTML=data.object.practitioner4Part!=null?data.object.practitioner4Part.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Practitioner5_Part__c']").innerHTML=data.object.practitioner5Part!=null?data.object.practitioner5Part.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='age__c']").innerHTML=data.object.age!=null?data.object.age.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='Medical_History__c']").innerHTML=data.object.medicalHistory!=null?data.object.medicalHistory.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='sex__c']").innerHTML=data.object.sex!=null?data.object.sex.replace(/"/g,""):''; |
| | | document.querySelector("[data-id='VOC_Informer_Name__c']").innerText=data.object.vocInformerName |
| | | document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerText=data.object.callerPhone |
| | | document.querySelector("[data-id='VOC_Informer_Contact__c']").innerText=data.object.vocInformerContact |
| | | document.querySelector("[data-id='Person_In_Charge_Text__c']").innerText=data.object.personInChargeText |
| | | document.querySelector("[data-id='Professor_sigh_text__c']").innerText=data.object.professorSighText |
| | | document.querySelector("[data-id='Staff_Info_Manual_c__c']").innerText=data.object.staffInfoManual |
| | | document.querySelector("[data-id='Medical_History__c']").innerText = data.object.medicalHistory |
| | | document.querySelector("[data-id='Responsible_Person_HP_c__c']").innerText=data.object.responsiblePersonHP |
| | | document.querySelector("[data-id='Practitioner1_Part__c']").innerText=data.object.practitioner1Part |
| | | document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:8:j_id3').innerText=data.object.practitioner2Part |
| | | document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:9:j_id3').innerText=data.object.practitioner3Part |
| | | document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:10:j_id3').innerText=data.object.practitioner4Part |
| | | document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:11:j_id3').innerText=data.object.practitioner5Part |
| | | document.querySelector("[data-id='age__c']").innerText=data.object.age |
| | | document.querySelector("[data-id='sex__c']").innerText=data.object.sex |
| | | }; |
| | | sfdcPage.appendToOnloadQueue(function () { |
| | | console.log('awsDataId = '+'{!AWSDataId}') |
| | |
| | | |
| | | }, |
| | | |
| | | |
| | | //update |
| | | postConsumTrial:function(postURL, indexNumber , payloadForNewPI, callback, token) { |
| | | console.log('Process New PI Data'); |
| | | console.log(JSON.stringify(payloadForNewPI)); |
| | | |
| | | let payloadstr= null; |
| | | if (payloadForNewPI) { |
| | | if (typeof payloadForNewPI == 'string') { |
| | | payloadstr = payloadForNewPI; |
| | | }else{ |
| | | payloadstr = JSON.stringify(payloadForNewPI); |
| | | } |
| | | } |
| | | let para = { |
| | | url:postURL, |
| | | headers: { |
| | | 'Content-Type': 'application/json', |
| | | 'pi-token': token |
| | | }, |
| | | type: "post", |
| | | success: function (result) { |
| | | AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),AWSService.successStatus); |
| | | if(callback) callback(result,indexNumber); |
| | | }, |
| | | error: function (error){ |
| | | AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),AWSService.failStatus); |
| | | console.log(error); |
| | | } |
| | | }; |
| | | if (payloadstr) { |
| | | para.data = payloadstr; |
| | | } |
| | | jQuery.ajax(para); |
| | | |
| | | }, |
| | | |
| | | confirmTrans:function(transactionURL,transParameters,callback,token){ |
| | | |
| | | let payloadstr= null; |
| | |
| | | trigger LastbuyProductTrigger on LastbuyProduct__c (before insert, after insert, after update) { |
| | | trigger LastbuyProductTrigger on LastbuyProduct__c (before insert, after insert, after update, after delete) { |
| | | LastbuyProductHandler handler = new LastbuyProductHandler(); |
| | | handler.run(); |
| | | } |
| | |
| | | QuoteLineItem |
| | | where |
| | | Quoteid = :opp.Estimation_Id__c ]; |
| | | System.debug('opp.Estimation_Id__c+++'+opp.Estimation_Id__c); |
| | | System.debug('items+++'+items); |
| | | List<Id> ChechProId = new List<Id>(); |
| | | Integer CntSFDC = 0, CntCostOrListPrice = 0; |
| | | |
| | |
| | | System.debug(Logginglevel.DEBUG, 'NFM007_' + iflog.Name + ' start'); // callout の中 end のlogを出します |
| | | NFM007Controller.callout(iflog.Id, oppIds, purposeOfAdviceMap); |
| | | } |
| | | |
| | | if(System.Test.isRunningTest()){ |
| | | Integer i=0; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | |
| | | } |
| | | } |
| | |
| | | //wangweipeng 20210727 end |
| | | |
| | | if ((Trigger.isAfter && Trigger.isInsert) || (Trigger.isAfter && Trigger.isUpdate) || (Trigger.isAfter && Trigger.isDelete)) { |
| | | NFM103Controller.NFM103Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | NFM603Controller.NFM603Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | RepairTrigger.UpdateAssert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | if(!(System.isFuture()||System.isBatch())){// Add By Lijun 20220303 to avoid mutiple execute |
| | | NFM103Controller.NFM103Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | NFM603Controller.NFM603Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | RepairTrigger.UpdateAssert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | } |
| | | } |
| | | // ---------------------------------------------------------------------- |
| | | // ここより、修理のサービスコントラクト項目を自動的に更新するロジック |
| | | // ---------------------------------------------------------------------- |
| | | if (Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) { |
| | | //先款后修-修理增加先款标识 thh 20220322 start |
| | | RepairTrigger.AdvancePaymentFlagUpsert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | //先款后修-修理增加先款标识 thh 20220322 end |
| | | if ( Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) { |
| | | //先款后修-修理增加先款标识 thh 20220322 start |
| | | RepairTrigger.AdvancePaymentFlagUpsert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | //先款后修-修理增加先款标识 thh 20220322 end |
| | | |
| | | // 納入機器IDを一意に格納する Setです。 |
| | | Set<ID> assetIds = new Set<Id>(); |
| | |
| | | boolean defaultFlag = true; |
| | | //add wangweipeng 2021/12/09 end |
| | | // 草案中修理だけ更新 |
| | | // GZW 特殊处理 跳过维修中心自动赋值,以手选为准 start |
| | | // GZW 特殊处理 跳过维修中心自动赋值,以手选为准 start |
| | | // 判断条件追加 && repair.Exc_work_location__c == false |
| | | if(repair.Exc_work_location__c){ |
| | | defaultFlag = false; |
| | |
| | | if ((repair.Status__c == '草案中' || String.isBlank(repair.Status__c)) == false) { |
| | | // if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null) { |
| | | if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null && repair.Exc_work_location__c == false) { |
| | | |
| | | |
| | | repair = RepairTrigger.updateWorkLocationSelect(repair, null); |
| | | defaultFlag = false; |
| | | } |
| | |
| | | //迁移进程生成器中repair Alltime功能 End |
| | | /****************************************************************************************************/ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // ---------------------------------------------------------------------- |
| | | // ここまで、サービスコントラクト項目を自動的に更新するロジック |
| | | // ---------------------------------------------------------------------- |
| | | |
| | | |
| | | |
| | | // ---------------------------------------------------------------------- |
| | | // これより、On-Callの「On-Call跟进结果」を更新するロジック |