public class HpConfirmPageController { public eSignForm__c eSignForm { get; set; } public boolean disableInput{get;Set;} public HpConfirmPageController(ApexPages.StandardController controller) { } public HpConfirmPageController(){ } public void init(){ String paramId = ApexPages.currentPage().getParameters().get('id'); list ESignFormList = [Select id,HPSignUpStatus__c,HPAccessoriesQualified__c ,HPDenyReason__c, HPSignUpDate__c , HPAcceptResult__c , handleOpinionHP__c from eSignForm__c where Id = :paramId]; if( ESignFormList.size() == 0){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '找不到对应的签收单!')); return; } eSignForm = ESignFormList[0]; if(eSignForm.HPSignUpStatus__c!= null && eSignForm.HPSignUpStatus__c.equals('申请中')){ disableInput = false; }else{ disableInput = true; } return; } public PageReference confirm() { if(eSignForm.HPAccessoriesQualified__c){ eSignForm.HPSignUpStatus__c = '已批准'; }else if(string.isBlank(eSignForm.HPDenyReason__c)){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '医院验收附件不合格,请您填写驳回理由!')); return null; // alert('医院验收附件不合格,请您填写驳回理由!'); }else{ eSignForm.HPSignUpStatus__c = '不批准'; } try{ update eSignForm; disableInput = true; ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '确认完毕!')); }catch(exception e){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage())); } return null; } //直销的二次确认check public PageReference directSalesConfirm() { if(eSignForm.HPAccessoriesQualified__c){ if(eSignForm.HPAcceptResult__c.equals('全部验收') || string.isNotBlank(eSignForm.handleOpinionHP__c)){ eSignForm.HPSignUpStatus__c = '已批准'; }else{ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '在验收结果不是全部验收时,请您先填写处理意见!')); return null; } }else if(string.isBlank(eSignForm.HPDenyReason__c)){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '医院验收附件不合格,请您填写驳回理由!')); return null; }else{ eSignForm.HPSignUpStatus__c = '不批准'; } try{ update eSignForm; ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '确认完毕!')); disableInput = true; }catch(exception e){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage())); } return null; } }