public with sharing class ISO_DemandOperAndDemonsController {
|
|
|
|
//公共变量:list
|
public List<IS_Opportunity_Demand_Operating__c> pageQueryoDoList{get;set;}
|
public List<IS_Opportunity_Demand_Demonstration__c> pageQueryoDDList{get;set;}
|
//公共变量:对象数据
|
public IS_Opportunity_Demand_Operating__c pageShwoElement{get;set;}
|
public String ISodcIdStr {get;set;}
|
public String OpporIdStr {get;set;}
|
public String abortCode {get;set;}
|
public IS_Opportunity_Demand__c ISOhead {get;set;}
|
public ISOpportunityDemandInfo pageShowSet{get;set;}
|
public ISOpportunityDemandInfo pageShowSetClone{get;set;}
|
public List<IS_Opportunity_Demand__c> ISOheadList{get;set;}
|
public List<MailEle> initMail{get;set;}
|
//公共变量: 数据类型
|
public Id thePageIdStr{get;set;}
|
public Integer indexOpr{get;set;}
|
public Integer indexDom{get;set;}
|
public String nowDateShow{get;set;}
|
public String ErrorMsg{get;set;}
|
public String StatusMsg{get;set;}
|
public String Brand_of_Laparoscopy_Tower{get;set;}
|
public boolean NewOrNot {get;set;}
|
public boolean EditAble {get;set;}
|
public String TargetName{get;set;}
|
public Integer OprNumCnt{get;set;}
|
public Integer DomNumCnt{get;set;}
|
public boolean UnableToEdit{get;set;}
|
public String MailTarget{get;set;}
|
public String Cc {get;set;}
|
public String Ccid {get;set;}
|
public String MailDetail {get;set;}
|
public String CopyIDStr {get;set;}
|
public String PDFfileName {get;set;}//为打印PDF提供名字
|
public String isReturn{get;set;} //判断保存之后是否返回
|
/**
|
追加了一个字符串,把需要变色的id压进去,传到前台
|
*/
|
public String ErrorColorChangeStr {get;set;}
|
public String ErrorColorChangeStrShow {get;set;}
|
//公共变量:集合变量
|
public List<String> CcList{get;set;}
|
//公共变量:Flg控制标签
|
//
|
public String ErrorHead{get;set;}
|
public String ErrorTitle{get;set;}
|
public String ErrorElements{get;set;}
|
public boolean ifCtrlUtil{get;set;}
|
//
|
|
public ISO_DemandOperAndDemonsController() {
|
ifCtrlUtil = false;
|
nowDateShow = Date.today().year()+'年' +Date.today().month()+'月'+Date.today().day()+'日';
|
ISodcIdStr = ApexPages.currentPage().getParameters().get('id');
|
CopyIDStr = ApexPages.currentPage().getParameters().get('CopyID');
|
system.debug(OpporIdStr+'::::::::OppoerID');
|
abortCode = ApexPages.currentPage().getParameters().get('abortID');
|
if(ISodcIdStr==''|ISodcIdStr==null){
|
OpporIdStr = ApexPages.currentPage().getParameters().get('OppoerID');
|
NewOrNot = false;
|
EditAble = true;
|
}else{
|
NewOrNot = true;
|
EditAble = false;
|
}
|
pageQueryoDoList = new List<IS_Opportunity_Demand_Operating__c>();
|
pageQueryoDDList = new List<IS_Opportunity_Demand_Demonstration__c>();
|
pageShwoElement = new IS_Opportunity_Demand_Operating__c();
|
pageShowSetClone = new ISOpportunityDemandInfo();
|
pageShowSet = new ISOpportunityDemandInfo();
|
ISOheadList = new List<IS_Opportunity_Demand__c>();
|
initMail = new List<MailEle>();
|
CcList = new List<String>();
|
//ErrorElements = new List<String>();
|
ErrorElements='ErrorHead,ErrorHead,ErrorHead,ErrorHead';
|
//system.debug('Test$$$$$00002'+ErrorElements);
|
this.ErrorHead = 'ErrorHead';
|
this.ErrorTitle = 'ErrorTitle';
|
indexOpr = 0;
|
indexDom = 0;
|
}
|
//*******************************************************************************************/
|
// 外部使用的方法 Start
|
//*******************************************************************************************/
|
public static String synchronousSodWithOppor(List<String> oppoidList){
|
//对于询价新增的需求表,通过这个方法进行必要的参数同步,一般用于同步状态,日期
|
List<Opportunity> ThisOpporList = [select id,S_Install_Date__c,SI_FinishedPorj_Date__c from Opportunity
|
where
|
id = : oppoidList];
|
Map<String,String> opporidMap = new Map<String,String>();
|
Map<String,Date> opporDateInsMap = new Map<String,Date>();
|
Map<String,Date> opporDateProMap = new Map<String,Date>();
|
for(Opportunity ops : ThisOpporList){
|
opporDateInsMap.put(ops.Id, ops.S_Install_Date__c);
|
opporDateProMap.put(ops.Id, ops.SI_FinishedPorj_Date__c);
|
}
|
List<IS_Opportunity_Demand__c> updateISO = [select id, Program_Finished_Date__c,Install_Date__c,Opportunity_ID__c from IS_Opportunity_Demand__c
|
where
|
Opportunity_ID__c = :oppoidList
|
and
|
Abort_Date__c = null];
|
for(IS_Opportunity_Demand__c iso : updateISO){
|
opporidMap.put(iso.id, iso.Opportunity_ID__c);
|
}
|
for(IS_Opportunity_Demand__c iso : updateISO){
|
iso.Program_Finished_Date__c = opporDateProMap.get(opporidMap.get(iso.id));
|
iso.Install_Date__c = opporDateInsMap.get(opporidMap.get(iso.id));
|
}
|
Savepoint sp = Database.setSavepoint();
|
try{
|
update updateISO;
|
return 'Fin';
|
}catch(Exception o){
|
Database.rollback(sp);
|
return 'DDL Error';
|
}
|
|
}
|
public static String SetQuoteDecide(String oppoid){
|
List<IS_Opportunity_Demand__c> setDecideDate = [SELECT Quote_Locked_Date__c from IS_Opportunity_Demand__c where Opportunity_ID__c = :oppoid];
|
for(IS_Opportunity_Demand__c iso: setDecideDate){
|
iso.Quote_Locked_Date__c = Date.today();
|
}
|
Savepoint sp = Database.setSavepoint();
|
try{
|
update setDecideDate;
|
}catch(Exception o){
|
return o+'';
|
DataBase.rollback(sp);
|
}
|
return 'Fin';
|
}
|
public static Map<id,Integer> setNameForNew(List<IS_Opportunity_Demand__c> newList){
|
Map<id,Integer> isoCount = new Map<id,Integer>();
|
Set<id> OppoIDset = new Set<id>();
|
|
for(IS_Opportunity_Demand__c NewISO : newList){
|
OppoIDset.add(NewISO.Opportunity_ID__c);
|
}
|
//
|
|
List<AggregateResult> ISOList = [ select
|
count(id) isoID,
|
Opportunity_ID__c oppoID
|
from
|
IS_Opportunity_Demand__c
|
where
|
Opportunity_ID__c = :OppoIDset
|
group by
|
Opportunity_ID__c];
|
|
for(AggregateResult ar : ISOList){
|
system.debug('$$$$$$$$$$$$$$$$$$'+Integer.valueOf(ar.get('isoID')));
|
isoCount.put((id)ar.get('oppoID'), Integer.valueOf(ar.get('isoID')));
|
}
|
|
return isoCount;
|
}
|
public static boolean UpdateMotherOpportunity(List<IS_Opportunity_Demand__c> oldList,List<IS_Opportunity_Demand__c> newList){
|
List<id> oldIdList = new List<id>();
|
Map<id,id> NewIdMap = new Map<id,id>();
|
Map<id,id> OppToSODIdMap = new Map<id,id>();
|
List<id> updateOppor = new List<id>();
|
for(IS_Opportunity_Demand__c iso : oldList){
|
if(iso.Approval_Date__c == null &&iso.Submit_Date__c !=null){
|
oldIdList.add(iso.id);
|
}
|
}
|
for(IS_Opportunity_Demand__c iso : newList){
|
if(iso.Approval_Date__c !=null){
|
NewIdMap.put(iso.id, iso.Opportunity_ID__c);
|
OppToSODIdMap.put(iso.Opportunity_ID__c, iso.id);
|
}
|
}
|
for(id idc : oldIdList){
|
if(NewIdMap.containsKey(idc)){
|
updateOppor.add(NewIdMap.get(idc));
|
}
|
}
|
List<Opportunity> OppList = [select id,SI_Decide_ID__c,Opportunity_No__c from Opportunity where id in:updateOppor];
|
for(Opportunity Op : OppList){
|
Op.SI_Decide_ID__c = OppToSODIdMap.get(Op.Id);
|
}
|
Savepoint sp = Database.setSavepoint();
|
boolean Flg;
|
try{
|
update OppList;
|
Flg = true;
|
}catch (Exception o){
|
Database.rollback(sp);
|
Flg = false;
|
}
|
return Flg;
|
}
|
public static String SetStockDate(id isoID){
|
List<IS_Opportunity_Demand__c> updateList = new List<IS_Opportunity_Demand__c>();
|
updateList = [SELECT id,Stock_Comfirm_Date__c,Equipment_Confirm_Date__c from IS_Opportunity_Demand__c where id = :isoID];
|
return 'Fin';
|
}
|
public static String Abort_SI(id isoID,String AbortReason){
|
List<IS_Opportunity_Demand__c> updateList = new List<IS_Opportunity_Demand__c>();
|
if(AbortReason==null||String.isBlank(AbortReason)){
|
return '请输入终止SI需求原因';
|
}else{
|
|
updateList = [SELECT id,Abort_SI_Reason__c,Abort_Date__c from IS_Opportunity_Demand__c where id = :isoID];
|
for(IS_Opportunity_Demand__c iso : updateList){
|
iso.Abort_SI_Reason__c = AbortReason;
|
iso.Abort_Date__c = Date.today();
|
}
|
Savepoint sp = Database.setSavepoint();
|
try{
|
update updateList;
|
return 'Fin';
|
}catch (Exception o){
|
Database.rollback(sp);
|
return 'DataBase is Crashed,Connect with the Developer PLEASE';
|
}
|
}
|
}
|
public static String CopyFunc(String ISodcIdStr){
|
|
IS_Opportunity_Demand__c isoHead = new IS_Opportunity_Demand__c() ;
|
List<IS_Opportunity_Demand_Operating__c> isoODO = new List<IS_Opportunity_Demand_Operating__c>();
|
List<IS_Opportunity_Demand_Demonstration__c> isoODD = new List<IS_Opportunity_Demand_Demonstration__c>();
|
isoODD = [ SELECT
|
Id,
|
IsDeleted,
|
Name,
|
Other_Relative_Position__c,
|
IS_Opportunity_Demand__c,
|
Demand_Demonstration_Area_Sum__c,
|
Display_Separate_TF__c,
|
Mobile_Equip_Controller_TF__c,
|
Display_Equipment_List__c,
|
HD_Camera_Panorama_TF__c,
|
Microphone_Type_List__c,
|
Position_To_Operating_Room_List__c,
|
Share_With_Other_Firm_TF__c,
|
Other_Require_Text__c,
|
Microphone_Number__c,
|
Microphone_Exsit_TF__c,
|
Brand_Name__c
|
FROM
|
IS_Opportunity_Demand_Demonstration__c
|
where
|
IS_Opportunity_Demand__c =:ISodcIdStr
|
];
|
isoHead = [SELECT
|
Id,
|
Name,
|
Name_Index__c ,
|
Response__c,
|
Opportunity_ID__c,
|
Mail_Tar_Selector__c,
|
Phone_Of_Nuers__c,
|
Phone_Of_HDOA__c,
|
Phone_of_ImfD__c,
|
Phone_of_GAD__c,
|
Phone_of_EDC__c,
|
Phone_of_CCD__c,
|
Lead_Of_Nurses__c,
|
Lead_Of_Department_Of_Anesthesia__c,
|
Lead_Of_Information_Department__c,
|
Lead_of_General_Affairs_Department__c,
|
Lead_of_Equipment_Department__c,
|
Lead_of_Capital_Construction_Department__c,
|
Public_Hospital_TF__c,
|
Private_Hospital_TF__c,
|
Other_Hospital_TF__c,
|
Operating_Room_Sum__c,
|
Demand_Demonstration_Cnt__c,
|
OperatingCnt__c,
|
Demonstration_Area_Sum__c,
|
Preparation_Stage_TF__c,
|
Building_Phase_Stage_TF__c,
|
Purification_Construction_Stage_TF__c,
|
Other_Stage_Text__c,
|
Operating_Room_Plane_Graph_TF__c,
|
Head_Mast_Position_Graph_TF__c,
|
Operating_Room_Clear_Graph_TF__c,
|
Demonstration_Area_Plane_Graph_TF__c,
|
Buliding_Plane_Graph_TF__c,
|
Other_Enginee_List_Text__c,
|
Func_SOD_Status__c
|
FROM
|
IS_Opportunity_Demand__c
|
where
|
Id =: ISodcIdStr
|
];
|
isoODO = [SELECT Id,
|
Name,
|
IS_Opportunity_Demand__c,
|
Operating_Room_Num_or_Name__c,
|
Operating_Room_Position_Area__c,
|
Operating_Room_Position_Building__c,
|
Operating_Room_Position_Stage__c,
|
Operating_Room_Length__c,
|
Operating_Room_Width__c,
|
Operating_Room_Build_Heigth__c,
|
Operating_Room_Top_heigth__c,
|
isChirurgery_TF__c,
|
isGynaecology_TF__c,
|
isUrological_TF__c,
|
isOrthopedics_TF__c,
|
isENT_TF__c,
|
isPlanned_TF__c,
|
isAural_Sursery_TF__c,
|
isGastroenterology_TF__c,
|
isRespirationDept_TF__c,
|
isInvasive_Technology_TF__c,
|
Wall_Mounting_Type_TF__c,
|
Dept_Others_Text__c,
|
Centre_Air_Support_System_TF__c,
|
Purify_Operating_Room_TF__c,
|
Lamp_Panel_Type_List__c,
|
Lamp_Panel_Sum__c,
|
Planning_Blue_Room_TF__c,
|
Need_to_Transform_TF__c,
|
Centralized_Control_TF__c,
|
Shadowless_And_Carm_Ctrl1_TF__c,
|
Shadowless_And_Carm_Ctrl2_TF__c,
|
Shadowless_And_Carm_Ctrl3_TF__c,
|
Reform_Lamp_Plane_List__c,
|
Reform_Lamp_Plane_Sum__c,
|
Equipment_Centralized_Control_TF__c,
|
Equipment_Center_Crtl_Minor_TF__c,
|
OTV_S190_TF__c,
|
OTV_S7_Pro_TF__c,
|
T3D_System_TF__c,
|
CV_180_TF__c,
|
CV_190_TF__c,
|
Olympus_Endoscope_Other_Text__c,
|
UHI_4_TF__c,
|
UHI_3_TF__c,
|
UHI_3_TF_add__c,
|
Other_3D_Displayer__c ,
|
Pneumoperitoneum_Other__c,
|
Storz_Main__c,
|
Storz_Main_Model__c,
|
Stryker_Main__c,
|
Stryker_Main_Model__c,
|
Compatible_Signal_TF__c,
|
Compatible_Signal_Format_Text__c,
|
Compatible_Signal_Sum__c,
|
Party_a_Purchase_TF__c,
|
Olympus_Package_Purchase_TF__c,
|
Party_A_Hold_TF__c,
|
Laparoscopy_Tower_TF__c,
|
Anesthesia_Tower_TF__c,
|
Surgical_Tower_TF__c,
|
Display_Tower_Radiation_TF__c,
|
Other_Tower_TF__c,
|
Brand_of_Laparoscopy_Tower_List__c,
|
Other_Brand_Laparoscopy_Text__c,
|
Laparoscopy_Tower_Type_List__c,
|
Install_Type_FullHD_List_Display__c,
|
Laparoscopy_Tower_Model_Desciption_Text__c,
|
Brand_Surgical_Tower_List__c,
|
Surgical_Tower_Model_Or_Decription_Text__c,
|
Brand_Of_Display_Tower_Radiation_List__c,
|
Display_Tower_Model_Or_Description__c,
|
Other_Tower_Brand__c,
|
Performanc_60inch_Display__c,
|
Other_FullHD_Display__c,
|
Other_Tower_Brand_List__c,
|
Other_Tower_Model_Description__c,
|
Purchase_Plan_SpringArm_List__c,
|
Brand_Of_SpringArm__c,
|
Other_Medic_Displayer__c,
|
HIS_TF__c,PASC_TF__c,
|
Hand_Anaesthesia_SYS_TF__c,
|
Other_IMF_Interface__c,
|
SpringArm_AC2000_Sum__c,
|
SpringArm_AC3000_Sum__c,
|
SpringArm_Other_Name__c,
|
Shadowless_Lamp_Procurement_Plan__c,
|
Other_Main_And_Model_Text__c,
|
Equipment_Centralized_Control_List__c,
|
Brand_Of_Shadowless_Lamp_List__c,
|
ShadowlessLamp_Model_Or_Description_Text__c,
|
Shadowless_Lamp_Type_List__c,
|
Brand_Of_Mid_Camera_List__c,
|
Mid_Camera_Model_Or_Descirption_Text__c,
|
Mid_Camera_Signal_Type_List__c,
|
Side_Camera_Procurement_Plan__c,
|
Brand_Of_Side_Camera__c,
|
Side_Camera_Model_Or_Description_Text__c,
|
Side_Camera_Signal_Type_List__c,
|
Endoscopic_Other_Video_Src_ListM__c,
|
OEV_262_2D_Sum__c,
|
Other_2D_Sum__c,
|
Other_2D_Name__c,
|
Dept_Others_TF__c,
|
Olympus_Endoscope_2_Model_List__c,
|
Other_Main_And_Model_TF__c,
|
Energy_Portable_ESG_400_TF__c,
|
Energy_Portable_USG_400_TF__c,
|
Energy_Portable_UES_40_TF__c,
|
Energy_Portable_SSG_2_TF__c,
|
Energy_Portable_Other_Text__c,
|
Covidien_Brand_TF__c,
|
Force_FX_C_Brand_TF__c,
|
Force_Triad_Brand_TF__c,
|
ERBE_Brand_TF__c,
|
VIO300D_Brand_TF__c,
|
Anesthesia_Tower_Text_Description__c,
|
Brand_Of_Anesthesia_Tower_List__c,
|
Operating_Room_Plan__c,
|
Brand_Of_Operating_Bed_List__c,
|
Operating_Bed_Model_Or_Description_Text__c,
|
Operating_Equipment_Ctrl_TF__c,
|
Other_Vs_Arm_Type_C_TF__c,
|
Other_Vs_DSA_TF__c,
|
Other_Vs_EUS_TF__c,
|
Other_Vs_Type_B_ultrasonic_TF__c,
|
Other_Vs_Other_Text__c,
|
LMD_2451TC_Sum__c,
|
LMD_3251TC_Sum__c,
|
Other_3D_Displayer_Sum__c,
|
Size60_3D_Displayer_Sum__c,
|
Sony_42_3D_Displayer_Pro_Sum__c,
|
In_Cell_InstallType_TF__c,
|
Display_60_Install_TF__c,
|
IMF_IO_System__c,
|
IMH_20_Model_TF__c,
|
IMH_10_Model_TF__c,
|
Install_Type_60Display_List__c,
|
MultiTouch_Display_Equip_Ctrl_TF__c,
|
Wireless_Music_Input_Ctrl_TF__c,
|
Reserved_Video_Channels_Sum__c,
|
Reserved_Audio_Channels_Sum__c,
|
Remarks_Text__c
|
FROM
|
IS_Opportunity_Demand_Operating__c
|
where
|
IS_Opportunity_Demand__c =: ISodcIdStr
|
];
|
isoHead.id =null;
|
isoHead.name='*';
|
insert isoHead;
|
for(IS_Opportunity_Demand_Operating__c odo: isoODO){
|
odo.id= null;
|
odo.IS_Opportunity_Demand__c = isoHead.id;
|
}
|
for(IS_Opportunity_Demand_Demonstration__c odd: isoODD){
|
odd.id= null;
|
odd.IS_Opportunity_Demand__c = isoHead.id;
|
}
|
insert isoODO;
|
insert isoODD;
|
return isoHead.id;
|
}
|
//*******************************************************************************************/
|
// 外部使用的方法 END
|
//*******************************************************************************************/
|
public ISO_DemandOperAndDemonsController(ApexPages.StandardController controller) {
|
//this.targetEstimateId = (String)(ApexPages.currentPage().getParameters().get('id'));
|
nowDateShow = Date.today().year()+'年' +Date.today().month()+'月'+Date.today().day()+'日';
|
ISodcIdStr = ApexPages.currentPage().getParameters().get('id');
|
OpporIdStr = ApexPages.currentPage().getParameters().get('OppoerID');
|
system.debug(OpporIdStr+'::::::::OppoerID');
|
abortCode = ApexPages.currentPage().getParameters().get('abortID');
|
if(ISodcIdStr==''|ISodcIdStr==null){
|
NewOrNot = false;
|
EditAble = true;
|
}else{
|
NewOrNot = true;
|
EditAble = false;
|
}
|
pageQueryoDoList = new List<IS_Opportunity_Demand_Operating__c>();
|
pageQueryoDDList = new List<IS_Opportunity_Demand_Demonstration__c>();
|
pageShwoElement = new IS_Opportunity_Demand_Operating__c();
|
pageShowSetClone = new ISOpportunityDemandInfo();
|
pageShowSet = new ISOpportunityDemandInfo();
|
ISOheadList = new List<IS_Opportunity_Demand__c>();
|
initMail = new List<MailEle>();
|
CcList = new List<String>();
|
//ErrorElements = new List<String>();
|
ErrorElements='ErrorHead,ErrorHead,ErrorHead,ErrorHead';
|
//system.debug('Test$$$$$00002'+ErrorElements);
|
this.ErrorHead = 'ErrorHead';
|
this.ErrorTitle = 'ErrorTitle';
|
indexOpr = 0;
|
indexDom = 0;
|
}
|
public void init(){
|
OprNumCnt = 0;
|
DomNumCnt = 0;
|
pageQueryoDoList = new List<IS_Opportunity_Demand_Operating__c>();
|
pageQueryoDDList = new List<IS_Opportunity_Demand_Demonstration__c>();
|
if(abortCode!=null&&abortCode!=''){
|
//更新需求表:终止之前的需求表,然后创建新的
|
List<IS_Opportunity_Demand__c> ODCLIST = new List<IS_Opportunity_Demand__c>();
|
ODCLIST = [SELECT id,Abort_Date__c from IS_Opportunity_Demand__c where Opportunity_ID__c =:abortCode and Abort_Date__c=null];
|
for(IS_Opportunity_Demand__c Od : ODCLIST){
|
Od.Abort_Date__c = Date.today();
|
}
|
update ODCLIST;
|
}
|
ISOhead = new IS_Opportunity_Demand__c();
|
if(ISodcIdStr!=''&&ISodcIdStr!=null){
|
pageQueryoDDList = [ SELECT
|
Id,
|
IsDeleted,
|
Name,
|
Other_Relative_Position__c,
|
IS_Opportunity_Demand__c,
|
Demand_Demonstration_Area_Sum__c,
|
Display_Separate_TF__c,
|
Mobile_Equip_Controller_TF__c,
|
Display_Equipment_List__c,
|
HD_Camera_Panorama_TF__c,
|
Microphone_Type_List__c,
|
Position_To_Operating_Room_List__c,
|
Share_With_Other_Firm_TF__c,
|
Other_Require_Text__c,
|
Microphone_Number__c,
|
Microphone_Exsit_TF__c,
|
Brand_Name__c
|
FROM
|
IS_Opportunity_Demand_Demonstration__c
|
where
|
IS_Opportunity_Demand__c =:ISodcIdStr
|
];
|
ISOheadList = [SELECT
|
Id,
|
OwnerId,
|
IsDeleted,
|
Name,
|
Name_Index__c ,
|
Submit_Date__c,
|
Response__c,
|
Mail_Tar_Selector__c,
|
Approval_Date__c,
|
Phone_Of_Nuers__c,
|
Phone_Of_HDOA__c,
|
Phone_of_ImfD__c,
|
Phone_of_GAD__c,
|
Phone_of_EDC__c,
|
Phone_of_CCD__c,
|
Opportunity_ID__c,
|
Lead_Of_Nurses__c,
|
Lead_Of_Department_Of_Anesthesia__c,
|
Lead_Of_Information_Department__c,
|
Lead_of_General_Affairs_Department__c,
|
Lead_of_Equipment_Department__c,
|
Lead_of_Capital_Construction_Department__c,
|
Table_Create_Date__c,
|
Public_Hospital_TF__c,
|
Private_Hospital_TF__c,
|
Other_Hospital_TF__c,
|
Operating_Room_Sum__c,
|
Demand_Demonstration_Cnt__c,
|
OperatingCnt__c,
|
Demonstration_Area_Sum__c,
|
Preparation_Stage_TF__c,
|
Building_Phase_Stage_TF__c,
|
Purification_Construction_Stage_TF__c,
|
Other_Stage_Text__c,
|
Operating_Room_Plane_Graph_TF__c,
|
Head_Mast_Position_Graph_TF__c,
|
Operating_Room_Clear_Graph_TF__c,
|
Demonstration_Area_Plane_Graph_TF__c,
|
Buliding_Plane_Graph_TF__c,
|
Other_Enginee_List_Text__c,
|
Func_SOD_Status__c
|
FROM
|
IS_Opportunity_Demand__c
|
where
|
Id =: ISodcIdStr
|
];
|
if(ISOheadList.size()==1){
|
ISOhead = ISOheadList[0];
|
ISOhead.Operating_Room_Sum__c = ISOhead.OperatingCnt__c;
|
ISOhead.Demonstration_Area_Sum__c = ISOhead.Demand_Demonstration_Cnt__c;
|
String oppoIDs = ISOhead.Opportunity_ID__c;
|
Opportunity OppList = [select id,SI_Decide_ID__c,Opportunity_No__c from Opportunity where id =:oppoIDs];
|
PDFfileName = OppList.Opportunity_No__c;
|
|
}else{
|
ISOhead = new IS_Opportunity_Demand__c(Operating_Room_Sum__c = 1,Demonstration_Area_Sum__c = 1,Response__c='');
|
}
|
pageQueryoDoList = [SELECT Id,
|
Name,
|
IS_Opportunity_Demand__c,
|
Operating_Room_Num_or_Name__c,
|
Operating_Room_Position_Area__c,
|
Operating_Room_Position_Building__c,
|
Operating_Room_Position_Stage__c,
|
Operating_Room_Length__c,
|
Operating_Room_Width__c,
|
Operating_Room_Build_Heigth__c,
|
Operating_Room_Top_heigth__c,
|
isChirurgery_TF__c,
|
isGynaecology_TF__c,
|
isUrological_TF__c,
|
isOrthopedics_TF__c,
|
isENT_TF__c,
|
isPlanned_TF__c,
|
isAural_Sursery_TF__c,
|
isGastroenterology_TF__c,
|
isRespirationDept_TF__c,
|
isInvasive_Technology_TF__c,
|
Wall_Mounting_Type_TF__c,
|
Dept_Others_Text__c,
|
Centre_Air_Support_System_TF__c,
|
Purify_Operating_Room_TF__c,
|
Lamp_Panel_Type_List__c,
|
Lamp_Panel_Sum__c,
|
Planning_Blue_Room_TF__c,
|
Need_to_Transform_TF__c,
|
Centralized_Control_TF__c,
|
Shadowless_And_Carm_Ctrl1_TF__c,
|
Shadowless_And_Carm_Ctrl2_TF__c,
|
Shadowless_And_Carm_Ctrl3_TF__c,
|
Reform_Lamp_Plane_List__c,
|
Reform_Lamp_Plane_Sum__c,
|
Equipment_Centralized_Control_TF__c,
|
Equipment_Center_Crtl_Minor_TF__c,
|
OTV_S190_TF__c,
|
OTV_S7_Pro_TF__c,
|
T3D_System_TF__c,
|
CV_180_TF__c,
|
CV_190_TF__c,
|
Olympus_Endoscope_Other_Text__c,
|
UHI_4_TF__c,
|
UHI_3_TF__c,
|
UHI_3_TF_add__c,
|
Other_3D_Displayer__c ,
|
Pneumoperitoneum_Other__c,
|
Storz_Main__c,
|
Storz_Main_Model__c,
|
Stryker_Main__c,
|
Stryker_Main_Model__c,
|
Compatible_Signal_TF__c,
|
Compatible_Signal_Format_Text__c,
|
Compatible_Signal_Sum__c,
|
Party_a_Purchase_TF__c,
|
Olympus_Package_Purchase_TF__c,
|
Party_A_Hold_TF__c,
|
Laparoscopy_Tower_TF__c,
|
Anesthesia_Tower_TF__c,
|
Surgical_Tower_TF__c,
|
Display_Tower_Radiation_TF__c,
|
Other_Tower_TF__c,
|
Brand_of_Laparoscopy_Tower_List__c,
|
Other_Brand_Laparoscopy_Text__c,
|
Laparoscopy_Tower_Type_List__c,
|
Install_Type_FullHD_List_Display__c,
|
Laparoscopy_Tower_Model_Desciption_Text__c,
|
Brand_Surgical_Tower_List__c,
|
Surgical_Tower_Model_Or_Decription_Text__c,
|
Brand_Of_Display_Tower_Radiation_List__c,
|
Display_Tower_Model_Or_Description__c,
|
Other_Tower_Brand__c,
|
Performanc_60inch_Display__c,
|
Other_FullHD_Display__c,
|
Other_Tower_Brand_List__c,
|
Other_Tower_Model_Description__c,
|
Purchase_Plan_SpringArm_List__c,
|
Brand_Of_SpringArm__c,
|
Other_Medic_Displayer__c,
|
HIS_TF__c,PASC_TF__c,
|
Hand_Anaesthesia_SYS_TF__c,
|
Other_IMF_Interface__c,
|
SpringArm_AC2000_Sum__c,
|
SpringArm_AC3000_Sum__c,
|
SpringArm_Other_Name__c,
|
Shadowless_Lamp_Procurement_Plan__c,
|
Other_Main_And_Model_Text__c,
|
Equipment_Centralized_Control_List__c,
|
Brand_Of_Shadowless_Lamp_List__c,
|
ShadowlessLamp_Model_Or_Description_Text__c,
|
Shadowless_Lamp_Type_List__c,
|
Brand_Of_Mid_Camera_List__c,
|
Mid_Camera_Model_Or_Descirption_Text__c,
|
Mid_Camera_Signal_Type_List__c,
|
Side_Camera_Procurement_Plan__c,
|
Brand_Of_Side_Camera__c,
|
Side_Camera_Model_Or_Description_Text__c,
|
Side_Camera_Signal_Type_List__c,
|
Endoscopic_Other_Video_Src_ListM__c,
|
OEV_262_2D_Sum__c,
|
Other_2D_Sum__c,
|
Other_2D_Name__c,
|
Dept_Others_TF__c,
|
Olympus_Endoscope_2_Model_List__c,
|
Other_Main_And_Model_TF__c,
|
Energy_Portable_ESG_400_TF__c,
|
Energy_Portable_USG_400_TF__c,
|
Energy_Portable_UES_40_TF__c,
|
Energy_Portable_SSG_2_TF__c,
|
Energy_Portable_Other_Text__c,
|
Covidien_Brand_TF__c,
|
Force_FX_C_Brand_TF__c,
|
Force_Triad_Brand_TF__c,
|
ERBE_Brand_TF__c,
|
VIO300D_Brand_TF__c,
|
Anesthesia_Tower_Text_Description__c,
|
Brand_Of_Anesthesia_Tower_List__c,
|
Operating_Room_Plan__c,
|
Brand_Of_Operating_Bed_List__c,
|
Operating_Bed_Model_Or_Description_Text__c,
|
Operating_Equipment_Ctrl_TF__c,
|
Other_Vs_Arm_Type_C_TF__c,
|
Other_Vs_DSA_TF__c,
|
Other_Vs_EUS_TF__c,
|
Other_Vs_Type_B_ultrasonic_TF__c,
|
Other_Vs_Other_Text__c,
|
LMD_2451TC_Sum__c,
|
LMD_3251TC_Sum__c,
|
Other_3D_Displayer_Sum__c,
|
Size60_3D_Displayer_Sum__c,
|
Sony_42_3D_Displayer_Pro_Sum__c,
|
In_Cell_InstallType_TF__c,
|
Display_60_Install_TF__c,
|
IMF_IO_System__c,
|
IMH_20_Model_TF__c,
|
IMH_10_Model_TF__c,
|
Install_Type_60Display_List__c,
|
MultiTouch_Display_Equip_Ctrl_TF__c,
|
Wireless_Music_Input_Ctrl_TF__c,
|
Reserved_Video_Channels_Sum__c,
|
Reserved_Audio_Channels_Sum__c,
|
Remarks_Text__c
|
FROM
|
IS_Opportunity_Demand_Operating__c
|
where
|
IS_Opportunity_Demand__c =: ISodcIdStr
|
];
|
}else{
|
String TestJson = '';
|
//String TestJson = '{ "MailEle": [{ "To":"AppleTest", "Fromer": "Applier", "Cc":"McLaughlin", "Details": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" },{ "To":"AppleTest", "Fromer": "SI", "Cc":"Hunter", "Details": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"},{ "To":"AppleTest", "Fromer": "SI", "Cc":"Harold", "Details": "cccc" },{ "To":"AppleTest", "Fromer": "Applier", "Cc":"Harold", "Details": "cccc" },{ "To":"AppleTest", "Fromer": "SI", "Cc":"Harold", "Details": "cccc" }]}';
|
ISOhead = new IS_Opportunity_Demand__c(Operating_Room_Sum__c = 1,Demonstration_Area_Sum__c = 0,Response__c=TestJson);
|
pageQueryoDoList.add(new IS_Opportunity_Demand_Operating__c(name='*'));
|
//pageQueryoDDList.add(new IS_Opportunity_Demand_Demonstration__c(name='*'));
|
pageShowSet = new ISOpportunityDemandInfo(ISOhead,pageQueryoDoList,pageQueryoDDList);
|
}
|
|
if(pageQueryoDoList.size()==1){
|
pageShwoElement = pageQueryoDoList[0];
|
}else if(pageQueryoDoList.size()==0){
|
pageQueryoDoList.add(new IS_Opportunity_Demand_Operating__c(name='*'));
|
}
|
if(pageQueryoDDList.size()==0){
|
//pageQueryoDDList.add(new IS_Opportunity_Demand_Demonstration__c(name='*'));
|
}
|
System.debug('ididididid'+ISOhead);
|
System.debug('ddddd'+pageQueryoDoList.size());
|
pageShowSet = new ISOpportunityDemandInfo(ISOhead,pageQueryoDoList,pageQueryoDDList);
|
if(pageShowSet!=null){
|
StatusMsg = 'Normal';
|
}else{
|
StatusMsg = 'Empty';
|
}
|
if(ISOhead.Submit_Date__c!=null||ISOhead.Approval_Date__c!=null){
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '数据已提交审批,不能再进行编辑了'));
|
UnableToEdit = false;
|
}else{
|
UnableToEdit = true;
|
}
|
if(ISOhead.Response__c!=null){
|
system.debug('开始解析');
|
initMail = ISO_DemandOperAndDemonsController.JSONtoMailElement(ISOhead.Response__c);
|
system.debug('结束解析'+initMail);
|
}
|
OprNumCnt = pageQueryoDoList.size();
|
DomNumCnt = pageQueryoDDList.size();
|
//system.debug('开始解析id'+pageQueryoDDList[0].id);
|
}
|
/**
|
页面交互功能,用于刷新相关负责人的联系方式
|
*/
|
public void SearchPhone(){
|
|
Map<String,String> ContactMap = new Map<String,String>();
|
ContactMap.put(pageShowSet.ISOdcInfoHead.Lead_Of_Nurses__c, '');
|
ContactMap.put(pageShowSet.ISOdcInfoHead.Lead_Of_Department_Of_Anesthesia__c, '');
|
ContactMap.put(pageShowSet.ISOdcInfoHead.Lead_Of_Information_Department__c, '');
|
ContactMap.put(pageShowSet.ISOdcInfoHead.Lead_of_General_Affairs_Department__c, '');
|
ContactMap.put(pageShowSet.ISOdcInfoHead.Lead_of_Equipment_Department__c, '');
|
ContactMap.put(pageShowSet.ISOdcInfoHead.Lead_of_Capital_Construction_Department__c, '');
|
List<Contact> ConPhoneList = [
|
SELECT
|
id,
|
name,
|
MobilePhone,
|
Phone
|
FROM
|
Contact
|
where
|
id in: ContactMap.keySet()
|
];
|
for(Contact Co : ConPhoneList){
|
if(Co.MobilePhone!=null && Co.MobilePhone!=''){
|
ContactMap.put(Co.id, Co.MobilePhone);
|
}else if(Co.Phone!=null && Co.Phone!=''){
|
ContactMap.put(Co.id, Co.Phone);
|
}
|
}
|
if(pageShowSet.ISOdcInfoHead.Phone_Of_Nuers__c==null||pageShowSet.ISOdcInfoHead.Phone_Of_Nuers__c==''){
|
pageShowSet.ISOdcInfoHead.Phone_Of_Nuers__c = ContactMap.get(pageShowSet.ISOdcInfoHead.Lead_Of_Nurses__c);
|
}
|
|
if(pageShowSet.ISOdcInfoHead.Phone_Of_HDOA__c==null||pageShowSet.ISOdcInfoHead.Phone_Of_HDOA__c=='')pageShowSet.ISOdcInfoHead.Phone_Of_HDOA__c = ContactMap.get(pageShowSet.ISOdcInfoHead.Lead_Of_Department_Of_Anesthesia__c);
|
if(pageShowSet.ISOdcInfoHead.Phone_of_ImfD__c==null||pageShowSet.ISOdcInfoHead.Phone_of_ImfD__c=='')pageShowSet.ISOdcInfoHead.Phone_of_ImfD__c = ContactMap.get(pageShowSet.ISOdcInfoHead.Lead_Of_Information_Department__c);
|
if(pageShowSet.ISOdcInfoHead.Phone_of_GAD__c==null||pageShowSet.ISOdcInfoHead.Phone_of_GAD__c=='')pageShowSet.ISOdcInfoHead.Phone_of_GAD__c = ContactMap.get(pageShowSet.ISOdcInfoHead.Lead_of_General_Affairs_Department__c);
|
if(pageShowSet.ISOdcInfoHead.Phone_of_EDC__c==null||pageShowSet.ISOdcInfoHead.Phone_of_EDC__c=='')pageShowSet.ISOdcInfoHead.Phone_of_EDC__c = ContactMap.get(pageShowSet.ISOdcInfoHead.Lead_of_Equipment_Department__c);
|
if(pageShowSet.ISOdcInfoHead.Phone_of_CCD__c==null||pageShowSet.ISOdcInfoHead.Phone_of_CCD__c=='')pageShowSet.ISOdcInfoHead.Phone_of_CCD__c = ContactMap.get(pageShowSet.ISOdcInfoHead.Lead_of_Capital_Construction_Department__c);
|
|
}
|
public void refreshDetail() {
|
|
system.debug(indexOpr+'####'+indexDom );
|
for(integer i = 0 ; i < indexOpr ; i++){
|
pageQueryoDoList.add(new IS_Opportunity_Demand_Operating__c(name='*'));
|
}
|
for(integer i = 0 ; i < indexDom ; i++){
|
pageQueryoDDList.add(new IS_Opportunity_Demand_Demonstration__c(name='*'));
|
}
|
//return null;
|
}
|
//public void refreshDetail(integer i,integer j){
|
// system.debug(indexOpr+'===='+indexDom );
|
//}
|
public Pagereference renturn(){
|
if(OpporIdStr==null){
|
OpporIdStr ='';
|
}
|
PageReference ref = new Pagereference('/'+(OpporIdStr!=''?OpporIdStr:ISodcIdStr));
|
ref.setRedirect(true);
|
return ref;
|
}
|
public PageReference Save(){
|
//insert
|
System.debug('==========Test999'+pageShowSet.ISodoc_InfoList.size());
|
System.debug('==========Test888'+pageShowSet.ISOdd_InfoList.size());
|
system.debug('Test0001');
|
PageReference ref = new Pagereference('/');
|
//******************************************************************************
|
//Pneumoperitoneum_Other__c 整理数据
|
//******************************************************************************
|
|
//******************************************************************************
|
//Pneumoperitoneum_Other__c 整理数据
|
//******************************************************************************
|
if(ISodcIdStr==null||ISodcIdStr==''){
|
ErrorColorChangeStr = this.CheckRules(pageShowSet.ISOdcInfoHead,pageShowSet.ISodoc_InfoList,pageShowSet.ISOdd_InfoList);
|
system.debug('Test0002');
|
IS_Opportunity_Demand__c insertODC = new IS_Opportunity_Demand__c();
|
List<IS_Opportunity_Demand_Operating__c> insertOperatingList = new List<IS_Opportunity_Demand_Operating__c>();
|
List<IS_Opportunity_Demand_Demonstration__c> insertDemonstration = new List<IS_Opportunity_Demand_Demonstration__c>();
|
insertODC = pageShowSet.ISOdcInfoHead;
|
insertODC.Table_Create_Date__c = Date.today();
|
//insertOperatingList = pageShowSet.ISodoc_InfoList;
|
//insertDemonstration = pageShowSet.ISOdd_InfoList;
|
//if(insertODC.Operating_Room_Length__c == '无效'
|
// ||insertODC.Operating_Room_Width__c == '无效'
|
// ||insertODC.Operating_Room_Build_Heigth__c == '无效'
|
// ||insertODC.Operating_Room_Top_heigth__c = '无效'){
|
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请修正无效的数据'));
|
// return null;
|
//}
|
if(insertODC.Operating_Room_Sum__c>0 ){
|
system.debug('Test0003');
|
Savepoint sp = Database.setSavepoint();
|
try{
|
insertODC.Id = null;
|
system.debug('Test0003====OpporIdStr'+OpporIdStr);
|
if(OpporIdStr!=null&&OpporIdStr!=''){
|
insertODC.Opportunity_ID__c = OpporIdStr;
|
insert insertODC;
|
system.debug('Test0003===TestInsert');
|
}else if(abortCode!=null && abortCode!=''){
|
insertODC.Opportunity_ID__c = abortCode;
|
insert insertODC;
|
OpporIdStr = abortCode;
|
} else{
|
system.debug('Test0003===TestInsert');
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '未能锁定询价'));
|
return null;
|
}
|
system.debug('Test0003===2');
|
if(pageShowSet.ISodoc_InfoList.size()>0){
|
for(IS_Opportunity_Demand_Operating__c ODO : pageShowSet.ISodoc_InfoList){
|
if( ODO.IS_Opportunity_Demand__c == null){
|
ODO.IS_Opportunity_Demand__c = insertODC.id;
|
}
|
ODO.id = null;
|
if(ODO.Equipment_Centralized_Control_List__c=='控制无影灯'){
|
if(ODO.Brand_Of_Shadowless_Lamp_List__c ==''
|
||ODO.ShadowlessLamp_Model_Or_Description_Text__c == ''
|
||ODO.Shadowless_Lamp_Type_List__c ==''){
|
system.debug(ODO.Brand_Of_Shadowless_Lamp_List__c+'###'+ODO.ShadowlessLamp_Model_Or_Description_Text__c+'###'+ODO.Shadowless_Lamp_Type_List__c);
|
ODO.Equipment_Centralized_Control_List__c.addError('请补全所选控制设备的相关信息');
|
//ApexPages.addMessages('请补全无影灯相关控制设备信息');
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请补全无影灯相关控制设备信息'));
|
return null;
|
}
|
}
|
if(ODO.Equipment_Centralized_Control_List__c=='控制术野摄像机'){
|
if(ODO.Mid_Camera_Model_Or_Descirption_Text__c==''
|
||ODO.Mid_Camera_Signal_Type_List__c == ''
|
||ODO.Brand_Of_Mid_Camera_List__c ==''){
|
ODO.Equipment_Centralized_Control_List__c.addError('请补全所选控制设备的相关信息');
|
system.debug(ODO.Mid_Camera_Signal_Type_List__c+'###'+ODO.Brand_Of_Mid_Camera_List__c+'###'+ODO.Mid_Camera_Model_Or_Descirption_Text__c);
|
|
//ApexPages.addMessages('请补中置术野摄像机相关控制设备信息');
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请补中置术野摄像机相关控制设备信息'));
|
return null;
|
}
|
}
|
insertOperatingList.add(ODO);
|
}
|
insert insertOperatingList;
|
}
|
if(pageShowSet.ISOdd_InfoList.size()>0){
|
system.debug('检测InsertDemon数量'+pageShowSet.ISOdd_InfoList.size());
|
for(IS_Opportunity_Demand_Demonstration__c ODD : pageShowSet.ISOdd_InfoList){
|
if( ODD.IS_Opportunity_Demand__c == null){
|
ODD.IS_Opportunity_Demand__c = insertODC.id;
|
}
|
ODD.id = null;
|
insertDemonstration.add(ODD);
|
}
|
system.debug('检测InsertDemon数量'+insertDemonstration.size());
|
insert insertDemonstration;
|
}
|
}catch(Exception e){
|
system.debug('Test0004');
|
Database.rollback(sp);
|
ApexPages.addMessages(e);
|
return null;
|
//ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'e'));
|
}
|
}else{
|
system.debug('Test0005');
|
String Error = '';
|
if(insertODC.Operating_Room_Sum__c == 0 ||insertODC.Operating_Room_Sum__c == null){
|
Error = Error + '手术间数量为零 ';
|
}
|
//if(insertODC.Demonstration_Area_Sum__c == 0||insertODC.Demonstration_Area_Sum__c == null){
|
// Error = Error + '示教点数量为零 ';
|
//}
|
Error = Error + '不可保存';
|
system.debug('Test0005'+Error);
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, Error));
|
return null;
|
}
|
ref = new Pagereference('/'+OpporIdStr);
|
}else if(CopyIDStr!=''&&CopyIDStr!=null){
|
|
pageShowSet.ISOdcInfoHead.id=null;
|
insert pageShowSet.ISOdcInfoHead;
|
for(IS_Opportunity_Demand_Operating__c odo: pageShowSet.ISodoc_InfoList){
|
odo.id=null;
|
odo.IS_Opportunity_Demand__c = pageShowSet.ISOdcInfoHead.id;
|
}
|
for(IS_Opportunity_Demand_Demonstration__c odd: pageShowSet.ISOdd_InfoList){
|
odd.id=null;
|
odd.IS_Opportunity_Demand__c = pageShowSet.ISOdcInfoHead.id;
|
}
|
insert pageShowSet.ISodoc_InfoList;
|
insert pageShowSet.ISOdd_InfoList;
|
}else{
|
if(UnableToEdit){
|
ErrorColorChangeStr = this.CheckRules(pageShowSet.ISOdcInfoHead,pageShowSet.ISodoc_InfoList,pageShowSet.ISOdd_InfoList);
|
system.debug('Anydatatype_msg'+pageShowSet.ISodoc_InfoList.size());
|
Savepoint sp = Database.setSavepoint();
|
system.debug('Test0009');
|
try{
|
update pageShowSet.ISOdcInfoHead;
|
for(IS_Opportunity_Demand_Operating__c isodo : pageShowSet.ISodoc_InfoList){
|
if(isodo.IS_Opportunity_Demand__c==null){
|
isodo.IS_Opportunity_Demand__c = pageShowSet.ISOdcInfoHead.id;
|
}
|
if(isodo.Name==null){
|
isodo.Name ='*';
|
}
|
}
|
system.debug('Test0010'+pageShowSet.ISOdd_InfoList.size());
|
for(IS_Opportunity_Demand_Demonstration__c isddd : pageShowSet.ISOdd_InfoList){
|
if(isddd.IS_Opportunity_Demand__c==null){
|
isddd.IS_Opportunity_Demand__c = pageShowSet.ISOdcInfoHead.id;
|
}
|
if(isddd.Name==null){
|
isddd.Name ='*';
|
}
|
}
|
List<IS_Opportunity_Demand_Operating__c> insertList = new List<IS_Opportunity_Demand_Operating__c>();
|
List<IS_Opportunity_Demand_Operating__c> updateList = new List<IS_Opportunity_Demand_Operating__c>();
|
List<IS_Opportunity_Demand_Demonstration__c> insertListODD = new List<IS_Opportunity_Demand_Demonstration__c>();
|
List<IS_Opportunity_Demand_Demonstration__c> updateListODD = new List<IS_Opportunity_Demand_Demonstration__c>();
|
for(IS_Opportunity_Demand_Operating__c isodo : pageShowSet.ISodoc_InfoList){
|
if(isodo.id==null){
|
insertList.add(isodo);
|
}else{
|
updateList.add(isodo);
|
}
|
}
|
for(IS_Opportunity_Demand_Demonstration__c isoDD : pageShowSet.ISOdd_InfoList){
|
if(isoDD.id==null){
|
insertListODD.add(isoDD);
|
}else{
|
updateListODD.add(isoDD);
|
}
|
}
|
if(insertList.size()>0){
|
insert insertList;
|
}
|
if(insertListODD.size()>0){
|
if(pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c!=0){
|
insert insertListODD;
|
}
|
|
}
|
if(updateList.size()>0){
|
update updateList;
|
}
|
if(updateListODD.size()>0){
|
update updateListODD;
|
}
|
ref = new Pagereference('/'+pageShowSet.ISOdcInfoHead.id);
|
}catch(Exception IO){
|
Database.rollback(sp);
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, ''+IO));
|
return null;
|
}
|
}else{
|
ref = new Pagereference('/'+pageShowSet.ISOdcInfoHead.id);
|
}
|
|
//ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '已存在的需求表'));
|
system.debug('Test0006');
|
//return null;
|
}
|
if(ErrorColorChangeStr!='Fin'){
|
if(isReturn == 'false'){
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO , '以上数据不完整,请及时修正'));
|
}else{
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '数据不完整,请修正'));
|
}
|
|
//return null;
|
}
|
ref.setRedirect(true);
|
if(isReturn == 'true'){
|
return ref;
|
}else{
|
ISodcIdStr = pageShowSet.ISOdcInfoHead.id;
|
return null;
|
}
|
|
}
|
public void completenessCheck(){
|
ErrorColorChangeStr = this.CheckRules(pageShowSet.ISOdcInfoHead,pageShowSet.ISodoc_InfoList,pageShowSet.ISOdd_InfoList);
|
if(ErrorColorChangeStr !='Fin')ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '需求表未填写完整,请修正'));
|
|
system.debug('ErrorColorChangeStr'+ErrorColorChangeStr );
|
}
|
public String CheckRules(IS_Opportunity_Demand__c checkSOD,List<IS_Opportunity_Demand_Operating__c> checkoDoList,List<IS_Opportunity_Demand_Demonstration__c> checkoDDList){
|
String ErrorStr = '';
|
ErrorColorChangeStrShow = '';
|
//提交的时候才验证
|
if(true){
|
/**
|
工程文件清单(必须提供)
|
*/
|
//if(checkSOD.Operating_Room_Plane_Graph_TF__c==false
|
// &&checkSOD.Head_Mast_Position_Graph_TF__c == false
|
// &&checkSOD.Operating_Room_Clear_Graph_TF__c == false
|
// &&checkSOD.Demonstration_Area_Plane_Graph_TF__c == false
|
// &&checkSOD.Buliding_Plane_Graph_TF__c == false
|
// &&( checkSOD.Other_Enginee_List_Text__c == '' || checkSOD.Other_Enginee_List_Text__c == null )){
|
// ErrorStr += 'ProgramFileList,';
|
// ErrorColorChangeStrShow +='工程文件清单(必须提供);';
|
// }
|
/**
|
循环检索oDo内部的错误数据
|
*/
|
for(integer i = 0;i < checkoDoList.size() ; i++ ){
|
if(checkoDoList[i].isChirurgery_TF__c == false
|
&&checkoDoList[i].isGynaecology_TF__c == false
|
&&checkoDoList[i].isUrological_TF__c == false
|
&&checkoDoList[i].isOrthopedics_TF__c == false
|
&&checkoDoList[i].isENT_TF__c == false
|
&&checkoDoList[i].isAural_Sursery_TF__c == false
|
&&checkoDoList[i].isGastroenterology_TF__c == false
|
&&checkoDoList[i].isRespirationDept_TF__c == false
|
&&checkoDoList[i].isInvasive_Technology_TF__c ==false
|
&&checkoDoList[i].Dept_Others_TF__c == false
|
){
|
ErrorStr += 'DeptForUse'+i+',';
|
ErrorColorChangeStrShow += i+':使用科室;';
|
}else if(checkoDoList[i].Dept_Others_TF__c == true
|
&&( checkoDoList[i].Dept_Others_Text__c == '' || checkoDoList[i].Dept_Others_Text__c== null)){
|
ErrorStr += 'DeptForUse'+i+',';
|
}
|
if( checkoDoList[i].Operating_Room_Position_Area__c ==null ||
|
checkoDoList[i].Operating_Room_Position_Area__c ==''){
|
ErrorStr += 'ErrorPosition'+i+',';
|
ErrorColorChangeStrShow += i+':院区;';
|
}else if( checkoDoList[i].Operating_Room_Position_Building__c ==null ||
|
checkoDoList[i].Operating_Room_Position_Building__c ==''){
|
ErrorStr += 'ErrorPosition'+i+',';
|
ErrorColorChangeStrShow += i+':楼;';
|
}else if( checkoDoList[i].Operating_Room_Position_Stage__c ==null ||
|
checkoDoList[i].Operating_Room_Position_Stage__c ==''){
|
ErrorStr += 'ErrorPosition'+i+',';
|
ErrorColorChangeStrShow += i+':层;';
|
}
|
if(checkoDoList[i].Equipment_Center_Crtl_Minor_TF__c== true
|
&&checkoDoList[i].OTV_S190_TF__c == false
|
&& checkoDoList[i].OTV_S7_Pro_TF__c == false
|
&& checkoDoList[i].T3D_System_TF__c == false
|
&& checkoDoList[i].CV_180_TF__c == false
|
&& checkoDoList[i].CV_190_TF__c == false
|
&& (checkoDoList[i].Olympus_Endoscope_Other_Text__c =='' || checkoDoList[i].Olympus_Endoscope_Other_Text__c == null)){
|
ErrorStr += 'olympusMainMirrorOne'+i+',';
|
ErrorColorChangeStrShow +=i+':奥林巴斯内镜主机1型号;';
|
}
|
system.debug('FFFFFFFFFF'+checkoDoList[i].Equipment_Centralized_Control_TF__c+checkoDoList[i].OTV_S190_TF__c+checkoDoList[i].Olympus_Endoscope_Other_Text__c);
|
if(checkoDoList[i].Energy_Portable_ESG_400_TF__c == false
|
&& checkoDoList[i].Energy_Portable_USG_400_TF__c == false
|
&& checkoDoList[i].Energy_Portable_UES_40_TF__c == false
|
&& checkoDoList[i].Energy_Portable_SSG_2_TF__c == false
|
&& (checkoDoList[i].Energy_Portable_Other_Text__c==null || checkoDoList[i].Energy_Portable_Other_Text__c =='')){
|
ErrorStr += 'OlympusEnergy'+i+',';
|
ErrorColorChangeStrShow +=i+':奥林巴斯能量平台;';
|
}
|
if(checkoDoList[i].Compatible_Signal_TF__c == true
|
&&(checkoDoList[i].Compatible_Signal_Format_Text__c == '' ||checkoDoList[i].Compatible_Signal_Format_Text__c == null)){
|
ErrorStr += 'Compatible_Signal_TF__c'+i+',';
|
ErrorColorChangeStrShow +=i+':兼容其信号;';
|
}
|
/**
|
这里是吊塔配置判断
|
*/
|
system.debug(checkoDoList[i].Laparoscopy_Tower_TF__c);
|
system.debug(checkoDoList[i].Brand_of_Laparoscopy_Tower_List__c);
|
system.debug(checkoDoList[i].Brand_of_Laparoscopy_Tower_List__c ==null);
|
if(checkoDoList[i].Party_A_Hold_TF__c == true
|
&&checkoDoList[i].Laparoscopy_Tower_TF__c ==false
|
&&checkoDoList[i].Anesthesia_Tower_TF__c ==false
|
&&checkoDoList[i].Surgical_Tower_TF__c ==false
|
&&checkoDoList[i].Display_Tower_Radiation_TF__c ==false
|
&&checkoDoList[i].Other_Tower_TF__c ==false){
|
ErrorStr += 'SetOfTower'+i+',';
|
ErrorColorChangeStrShow +=i+':吊塔配置;';
|
}
|
if(checkoDoList[i].Purchase_Plan_SpringArm_List__c == '甲方已有'
|
&&(checkoDoList[i].Brand_Of_SpringArm__c == ''||checkoDoList[i].Brand_Of_SpringArm__c == null)){
|
ErrorStr += 'Brand_Of_SpringArm'+i+',';
|
ErrorColorChangeStrShow +=i+':补全弹簧臂品牌;';
|
}
|
if(checkoDoList[i].Shadowless_Lamp_Procurement_Plan__c == '甲方已有'
|
&&(checkoDoList[i].Brand_Of_Shadowless_Lamp_List__c == ''||checkoDoList[i].Brand_Of_Shadowless_Lamp_List__c == null)
|
&&(checkoDoList[i].Brand_Of_Mid_Camera_List__c == ''||checkoDoList[i].Brand_Of_Mid_Camera_List__c == null)){
|
ErrorStr += 'Brand_Of_Mid_Camera_List'+i+',';
|
ErrorStr += 'Brand_Of_Shadowless_Lamp_List'+i+',';
|
ErrorColorChangeStrShow +=i+':无影灯及中置术野摄像机补全无影灯品牌;';
|
}
|
if(checkoDoList[i].Side_Camera_Procurement_Plan__c == '甲方已有'
|
&&(checkoDoList[i].Brand_Of_Side_Camera__c == ''||checkoDoList[i].Brand_Of_Side_Camera__c == null)){
|
ErrorStr += 'Brand_Of_Side_Camera__cTitle'+i+',';
|
ErrorColorChangeStrShow +=i+':补全旁置术野摄像机品牌;';
|
}
|
if(checkoDoList[i].Operating_Room_Plan__c == '甲方已有'
|
&&(checkoDoList[i].Brand_Of_Operating_Bed_List__c == ''||checkoDoList[i].Brand_Of_Operating_Bed_List__c == null)){
|
ErrorStr += 'Brand_Of_Operating_Bed'+i+',';
|
ErrorColorChangeStrShow +=i+':补全手术床品牌;';
|
}
|
if( checkoDoList[i].Laparoscopy_Tower_TF__c == true
|
&& (checkoDoList[i].Brand_of_Laparoscopy_Tower_List__c == ''||checkoDoList[i].Brand_of_Laparoscopy_Tower_List__c == null )){
|
ErrorStr += 'Brand_of_Laparoscopy_Tower'+i+',';
|
ErrorColorChangeStrShow +=i+':腔镜塔品牌;';
|
}
|
if(checkoDoList[i].Anesthesia_Tower_TF__c == true
|
&& (checkoDoList[i].Brand_Of_Anesthesia_Tower_List__c == ''||checkoDoList[i].Brand_Of_Anesthesia_Tower_List__c == null)){
|
ErrorStr += 'Brand_Of_Anesthesia_Tower'+i+',';
|
ErrorColorChangeStrShow +=i+':麻醉塔品牌;';
|
}
|
if(checkoDoList[i].Surgical_Tower_TF__c == true
|
&& (checkoDoList[i].Brand_Surgical_Tower_List__c == ''||checkoDoList[i].Brand_Surgical_Tower_List__c == null)){
|
ErrorStr += 'Brand_Surgical_Tower'+i+',';
|
ErrorColorChangeStrShow +=i+':外科塔品牌;';
|
}
|
if(checkoDoList[i].Display_Tower_Radiation_TF__c == true
|
&& (checkoDoList[i].Brand_Of_Display_Tower_Radiation_List__c == ''||checkoDoList[i].Brand_Of_Display_Tower_Radiation_List__c == null)){
|
ErrorStr += 'Brand_Of_Display_Tower_Radiation'+i+',';
|
ErrorColorChangeStrShow +=i+':显示塔品牌;';
|
}
|
if(checkoDoList[i].Other_Tower_TF__c == true
|
&& (checkoDoList[i].Other_Tower_Brand_List__c == ''||checkoDoList[i].Other_Tower_Brand_List__c == null||
|
checkoDoList[i].Other_Tower_Model_Description__c == '' ||checkoDoList[i].Other_Tower_Model_Description__c == null)){
|
ErrorStr += 'Other_Tower_Brand'+i+',';
|
ErrorColorChangeStrShow +=i+':其他塔品牌;';
|
}
|
if( checkoDoList[i].Laparoscopy_Tower_TF__c == true &&
|
(checkoDoList[i].Laparoscopy_Tower_Model_Desciption_Text__c == '' ||checkoDoList[i].Laparoscopy_Tower_Model_Desciption_Text__c == null)){
|
ErrorStr += 'Laparoscopy_Tower_Model_Desciption_Text__c'+i+',';
|
ErrorColorChangeStrShow +=i+':腔镜塔型号或描述;';
|
}
|
if( checkoDoList[i].Anesthesia_Tower_TF__c == true &&
|
(checkoDoList[i].Anesthesia_Tower_Text_Description__c == '' ||checkoDoList[i].Anesthesia_Tower_Text_Description__c == null)){
|
ErrorStr += 'Anesthesia_Tower_Text_Description__c'+i+',';
|
ErrorColorChangeStrShow +=i+':麻醉塔型号或描述;';
|
}
|
if( checkoDoList[i].Surgical_Tower_TF__c == true &&
|
(checkoDoList[i].Surgical_Tower_Model_Or_Decription_Text__c == '' ||checkoDoList[i].Surgical_Tower_Model_Or_Decription_Text__c == null)){
|
ErrorStr += 'Surgical_Tower_Model_Or_Decription_Text__c'+i+',';
|
ErrorColorChangeStrShow +=i+':外科塔型号或描述;';
|
}
|
if( checkoDoList[i].Display_Tower_Radiation_TF__c == true &&
|
(checkoDoList[i].Display_Tower_Model_Or_Description__c == '' ||checkoDoList[i].Display_Tower_Model_Or_Description__c == null)){
|
ErrorStr += 'Display_Tower_Model_Or_Description__c'+i+',';
|
ErrorColorChangeStrShow +=i+':显示塔(放射)型号或描述;';
|
}
|
if( checkoDoList[i].Other_Tower_TF__c == true &&
|
(checkoDoList[i].Other_Tower_Model_Description__c == '' ||checkoDoList[i].Other_Tower_Model_Description__c == null)){
|
ErrorStr += 'Other_Tower_Model_Description__c'+i+',';
|
ErrorColorChangeStrShow +=i+':其他塔品牌型号或描述;';
|
}
|
if( checkoDoList[i].Brand_Of_SpringArm__c == null){
|
ErrorStr += 'Brand_Of_SpringArm'+i+',';
|
ErrorColorChangeStrShow +=i+':弹簧臂;';
|
}
|
if( checkoDoList[i].Brand_Of_Mid_Camera_List__c == null && checkoDoList[i].Equipment_Centralized_Control_List__c=='控制术野摄像机'){
|
ErrorStr += 'Brand_Of_Mid_Camera_List'+i+',';
|
ErrorColorChangeStrShow +=i+':中置显示器;';
|
}
|
if( checkoDoList[i].Brand_Of_Operating_Bed_List__c == null){
|
ErrorStr += 'Brand_Of_Operating_Bed'+i+',';
|
ErrorColorChangeStrShow +=i+':手术床;';
|
}
|
if( checkoDoList[i].Brand_Of_Shadowless_Lamp_List__c == null && checkoDoList[i].Equipment_Centralized_Control_List__c=='控制无影灯'){
|
ErrorStr += 'Brand_Of_Shadowless_Lamp_List'+i+',';
|
ErrorColorChangeStrShow +=i+':无影灯;';
|
}
|
}
|
Integer j = 0;
|
for(IS_Opportunity_Demand_Demonstration__c odd : checkoDDList){
|
System.debug('Brand_Name__c'+odd.Brand_Name__c+'===Microphone_Exsit_TF__c'+odd.Microphone_Exsit_TF__c);
|
if(odd.Microphone_Exsit_TF__c == true
|
&& (odd.Brand_Name__c =='' ||odd.Brand_Name__c == null)){
|
ErrorStr += 'Brand_Name__c'+j+',';
|
ErrorColorChangeStrShow +=j+':麦克风品牌;';
|
}
|
j++;
|
}
|
}
|
system.debug(ErrorStr+'ErrorStr=======');
|
if(ErrorColorChangeStrShow!=''){
|
if(isReturn == 'false'){
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '已保存,但以下字段存在问题:'+ErrorColorChangeStrShow));
|
}else{
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '以下字段存在问题:'+ErrorColorChangeStrShow));
|
}
|
}else{
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '已填写完整'));
|
}
|
ErrorStr += 'Fin';
|
if(ErrorStr == 'Fin' && checkSOD.Id!=null && checkSOD.Submint_TF__c ==false){
|
IS_Opportunity_Demand__c updateISO = new IS_Opportunity_Demand__c(id =checkSOD.Id,Data_Check_TF__c= true );
|
update updateISO;
|
}
|
return ErrorStr;
|
}
|
public void SetDetailSum(){
|
//刷新表格数量
|
//如果数字比以前小,要在这里执行删除
|
this.ErrorHead = '测试ErrorHead';
|
this.ErrorTitle = '测试ErrorTitle';
|
//this.ErrorElements = ErrorList;
|
//this.SetErrorMsg('测试ErrorHead','测试ErrorTitle',ErrorList);
|
List<IS_Opportunity_Demand_Operating__c> EmptyoDoList = new List<IS_Opportunity_Demand_Operating__c>();
|
List<IS_Opportunity_Demand_Demonstration__c> EmptyoDDList =new List<IS_Opportunity_Demand_Demonstration__c>();
|
/**
|
System.debug('==========1');
|
System.debug('==========1ODO'+pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c);
|
System.debug('==========1ODD'+pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c);
|
System.debug('==========1'+TargetName);
|
*/
|
if(TargetName =='Operating_Room'){
|
if(pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c!=null){
|
if(pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c>0){
|
//重定义,如果刷新数据大于原本
|
if( pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c > pageShowSet.ISodoc_InfoList.size() ){
|
Decimal addCly = pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c - pageShowSet.ISodoc_InfoList.size();
|
System.debug('==========1');
|
for(Decimal i = 0; i<addCly ; i++ ){
|
pageShowSet.ISodoc_InfoList.add(new IS_Opportunity_Demand_Operating__c(name='*'));
|
System.debug('==========1^'+i);
|
}
|
}else if( pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c < pageShowSet.ISodoc_InfoList.size() ){
|
List<IS_Opportunity_Demand_Operating__c> rebuildList = pageShowSet.ISodoc_InfoList.clone();
|
List<IS_Opportunity_Demand_Operating__c> deleteListoDo = new List<IS_Opportunity_Demand_Operating__c>();
|
Decimal minCly = pageShowSet.ISodoc_InfoList.size() - pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c;
|
for( Decimal i = 0; i<minCly ; i++ ){
|
deleteListoDo.add(rebuildList.get(rebuildList.size()-1));
|
rebuildList.remove(rebuildList.size()-1);
|
}
|
pageShowSet.ISodoc_InfoList = rebuildList;
|
if(deleteListoDo.size()>0){
|
delete deleteListoDo;
|
}
|
}
|
}else if(pageShowSet.ISOdcInfoHead.Operating_Room_Sum__c==0){
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '手术间数量不能为零'));
|
}
|
}
|
|
}else if(TargetName =='Demonstration'){
|
for(IS_Opportunity_Demand_Demonstration__c isodd : pageShowSet.ISOdd_InfoList){
|
System.debug('Head确认ID::::::::'+isoDD.Id);
|
}
|
if(pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c!=null){
|
if(pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c >0){
|
System.debug('################1');
|
for(integer i = 0;i<pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c;i++){
|
EmptyoDDList.add(new IS_Opportunity_Demand_Demonstration__c(name='*'));
|
}
|
System.debug('==========2');
|
if(pageShowSet.ISOdd_InfoList==null){
|
pageShowSet.ISOdd_InfoList = EmptyoDDList;
|
System.debug('==========3='+pageShowSet.ISOdd_InfoList.size());
|
}else if(pageShowSet.ISOdd_InfoList.size()==0){
|
pageShowSet.ISOdd_InfoList = EmptyoDDList;
|
System.debug('==========4='+pageShowSet.ISOdd_InfoList.size());
|
}else if(pageShowSet.ISOdd_InfoList.size()<=pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c){
|
Decimal CountODD = (pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c-pageShowSet.ISOdd_InfoList.size());
|
for(integer i = 0;
|
i<CountODD;
|
i++){
|
pageShowSet.ISOdd_InfoList.add(new IS_Opportunity_Demand_Demonstration__c(name='*'));
|
System.debug('==========5####'+pageShowSet.ISOdd_InfoList);
|
System.debug('==========5=i '+i+'####'+CountODD);
|
System.debug('==========5=Minu '+(pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c-pageShowSet.ISOdd_InfoList.size()));
|
}
|
for(IS_Opportunity_Demand_Demonstration__c isodd : pageShowSet.ISOdd_InfoList){
|
System.debug('Midd确认ID::::::::'+isoDD.Id);
|
}
|
//pageShowSet.ISOdd_InfoList = EmptyoDDList;
|
System.debug('==========5='+pageShowSet.ISOdd_InfoList.size());
|
System.debug('==========5='+EmptyoDDList.size());
|
}else{
|
System.debug('==========6');
|
//pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c.addError('已有'+pageShowSet.ISOdd_InfoList.size()+'条记录');
|
List<IS_Opportunity_Demand_Demonstration__c> rebuildListODD = pageShowSet.ISOdd_InfoList.clone();
|
List<IS_Opportunity_Demand_Demonstration__c> deleteListODD = new List<IS_Opportunity_Demand_Demonstration__c>();
|
Decimal minClyOdd = pageShowSet.ISOdd_InfoList.size() - pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c;
|
for( Decimal i = 0; i<minClyOdd ; i++ ){
|
System.debug('==========6_'+i+'***'+deleteListODD.size());
|
deleteListODD.add(rebuildListODD.get(rebuildListODD.size()-1));
|
System.debug('==========7_'+i+'***'+deleteListODD.size());
|
rebuildListODD.remove(rebuildListODD.size()-1);
|
}
|
pageShowSet.ISOdd_InfoList = rebuildListODD;
|
System.debug('==========7'+deleteListODD);
|
System.debug('==========8'+pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c);
|
if(deleteListODD.size()>0){
|
System.debug('执行删除'+deleteListODD.size());
|
delete deleteListODD;
|
}
|
}
|
}else if(pageShowSet.ISOdcInfoHead.Demonstration_Area_Sum__c == 0){
|
System.debug('==========设置为零');
|
Savepoint sp = Database.setSavepoint();
|
try{
|
System.debug('执行删除'+ pageShowSet.ISOdd_InfoList.size());
|
delete pageShowSet.ISOdd_InfoList;
|
pageShowSet.ISOdd_InfoList = new List<IS_Opportunity_Demand_Demonstration__c>();
|
}catch (Exception ex ){
|
Database.rollback(sp);
|
ApexPages.addMessages(ex);
|
}
|
}
|
}
|
}
|
OprNumCnt = pageShowSet.ISodoc_InfoList.size();
|
DomNumCnt = pageShowSet.ISOdd_InfoList.size();
|
for(IS_Opportunity_Demand_Demonstration__c isodd : pageShowSet.ISOdd_InfoList){
|
System.debug('确认ID::::::::'+isoDD.Id);
|
System.debug('确认Name::::::::'+isoDD.Name);
|
}
|
System.debug('==========19'+pageShowSet.ISodoc_InfoList.size());
|
System.debug('==========18'+pageShowSet.ISOdd_InfoList.size());
|
|
}
|
public void sendMail(){
|
if(MailTarget == 'Applyer'){
|
|
}else if(MailTarget == 'SIoppor'){
|
|
}
|
Datetime dt = Datetime.now();
|
String temp = '';
|
temp += '****** ' + ' ' + dt.format() + ' ******\n';
|
temp += '*** To:' + MailTarget + '\n';
|
temp += '*** Cc:' + Cc + '\n';
|
temp += MailDetail;
|
MailEle me = new MailEle();
|
me.Fromer=MailTarget;
|
me.Cc=Cc;
|
me.To=MailTarget;
|
me.Details=MailDetail;
|
initMail.add(me);
|
String response = MailImfParseToJson(initMail);
|
pageShowSet.ISOdcInfoHead.Response__c = response;
|
|
try{
|
update pageShowSet.ISOdcInfoHead;
|
Messaging.SingleEmailMessage messageNEW= new Messaging.SingleEmailMessage();
|
//get the bode from above dummy instance and set it to your actual email
|
//messageNEW.HTMLBody = message.getHtmlBody();
|
//messageNEW.Subject = '备品借出申请' + ra.Name + '' + '应答沟通';
|
messageNEW.Subject = 'SI询价需求表 ' + pageShowSet.ISOdcInfoHead.Name + ' \n' + 'SI术间:';
|
for(IS_Opportunity_Demand_Operating__c odo: pageShowSet.ISodoc_InfoList){
|
messageNEW.Subject += odo.name +' ';
|
}
|
messageNEW.Subject += '\n SI示教点:';
|
for(IS_Opportunity_Demand_Demonstration__c odd: pageShowSet.ISOdd_InfoList){
|
messageNEW.Subject += odd.name +' ';
|
}
|
|
messageNEW.PlainTextBody = temp;
|
//set desired email addresses
|
messageNEW.setCharset('UTF-8');
|
List<String> idList = Ccid.split(',');
|
List<user> UserEmail = [SELECT Id, Name, Email from user where id in :idList];
|
List<String> MailCc = new List<String>();
|
for(User us : UserEmail){
|
MailCc.add(us.Email);
|
}
|
//messageNEW.toAddresses = toMailList;
|
messageNEW.ccAddresses = MailCc;
|
//send the mail
|
Messaging.SendEmailResult[] results = messaging.sendEmail(new Messaging.SingleEmailMessage[] {messageNEW});
|
if(!results[0].success){
|
system.debug('=====' + results[0].errors[0].message);
|
//MailDetail.addError('邮件发送失败。');
|
//hasError=true;
|
}else{
|
//邮件发送成功
|
//hasError=false;
|
}
|
} catch (Exception ex) {
|
system.debug('=====' + ex.getMessage());
|
//hasError = true;
|
ApexPages.addMessages(ex);
|
}
|
}
|
class ISOpportunityDemandInfo{
|
//主题数据组
|
public IS_Opportunity_Demand__c ISOdcInfoHead{get;set;}
|
public List<IS_Opportunity_Demand_Operating__c> ISodoc_InfoList {get;set;}
|
public List<IS_Opportunity_Demand_Demonstration__c> ISOdd_InfoList{get;set;}
|
//验证关系
|
boolean isCheckPass{get;set;}
|
public ISOpportunityDemandInfo(){
|
isCheckPass =false;
|
}
|
public ISOpportunityDemandInfo(IS_Opportunity_Demand__c ISHead,List<IS_Opportunity_Demand_Operating__c> ISodocInfoList,List<IS_Opportunity_Demand_Demonstration__c> ISOddInfoList){
|
isCheckPass = false;
|
this.ISOdcInfoHead = ISHead;
|
this.ISodoc_InfoList = ISodocInfoList;
|
this.ISOdd_InfoList =ISOddInfoList;
|
if(ISOdcInfoHead!=null){
|
if(ISOdcInfoHead.Demonstration_Area_Sum__c!=ISOdd_InfoList.size()
|
||ISOdcInfoHead.Operating_Room_Sum__c!=ISodoc_InfoList.size()
|
||ISOdd_InfoList.size()==0
|
||ISodoc_InfoList.size()==0){
|
}else{
|
isCheckPass = true;
|
}
|
}
|
}
|
|
}
|
public static String MailImfParseToJson(List<MailEle> imfList){
|
String JsonString;
|
JSONGenerator CreateJson = JSON.createGenerator(true);
|
CreateJson.writeStartObject();
|
for(MailEle Mail : imfList){
|
CreateJson.writeFieldName('MailEle');
|
CreateJson.writeObject(Mail);
|
}
|
CreateJson.writeEndObject();
|
JsonString = CreateJson.getAsString();
|
return JsonString;
|
}
|
public static List<MailEle> JSONtoMailElement(String JsonStr){
|
JSONParser parser = JSON.createParser(JsonStr);
|
List<MailEle> OutputList = new List<MailEle>();
|
while(parser.nextToken()!=null){
|
system.debug('23333333333');
|
while(parser.nextToken() != null){
|
if(parser.getCurrentToken() == JSONToken.START_OBJECT){
|
MailEle Me = (MailEle)parser.readValueAs(MailEle.class);
|
OutputList.add(Me);
|
system.debug('==++==Me++==++'+Me);
|
}
|
}
|
}
|
return OutputList;
|
}
|
public class MailEle{
|
public String Fromer {get;set;}
|
public String Cc{get;set;}
|
public String To{get;set;}
|
public String Details{get;set;}
|
public MailEle(){
|
|
}
|
}
|
}
|