public with sharing class ISO_DemandOperAndDemonsNewController {
|
// Is需求表id
|
public String ISodcIdStr {get;set;}
|
public String OpporIdStr {get;set;}
|
public String PDFfileName {get;set;}//为打印PDF提供名字
|
public String ErrorColorChangeStr{get;set;}
|
public Boolean returnNew {get;set;}
|
public Boolean saveAndReturnB {get;set;}
|
// si询价需求表
|
public IS_Opportunity_Demand__c ISOppDemandList{ get; set; }
|
public List<IS_Opportunity_Demand__c> ISOpptunityDemandList{ get; set; }
|
// si询价手术室
|
public List<IS_Opportunity_Demand_Operating__c> ISOppDemandOperList{ get; set; }
|
public IS_Opportunity_Demand_Operating__c ISOppDemandOper1{ get; set; }
|
public IS_Opportunity_Demand_Operating__c ISOppDemandOper2{ get; set; }
|
public IS_Opportunity_Demand_Operating__c ISOppDemandOper3{ get; set; }
|
public IS_Opportunity_Demand_Operating__c ISOppDemandOperMore{ get; set; }
|
// si询价示教点
|
public List<IS_Opportunity_Demand_Demonstration__c> ISOppDemandDemonList{ get; set; }
|
public IS_Opportunity_Demand_Demonstration__c ISOppDemandDemon1{ get; set; }
|
public IS_Opportunity_Demand_Demonstration__c ISOppDemandDemon2{ get; set; }
|
public IS_Opportunity_Demand_Demonstration__c ISOppDemandDemonMore{ get; set; }
|
// si询价配置单
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate11{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate12{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate13{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate14{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate21{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate22{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate23{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate24{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate31{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate32{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate33{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate34{get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguateList{ get; set; }
|
public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguateListStandard{ get; set; }
|
// 判断是否显示标准配置单
|
// public Boolean ISOppDemandConfiguateStand11 = false;
|
// public Boolean ISOppDemandConfiguateStand12 = false;
|
// public Boolean ISOppDemandConfiguateStand13 = false;
|
// public Boolean ISOppDemandConfiguateStand14 = false;
|
// public Boolean ISOppDemandConfiguateStand21 = false;
|
// public Boolean ISOppDemandConfiguateStand22 = false;
|
// public Boolean ISOppDemandConfiguateStand23 = false;
|
// public Boolean ISOppDemandConfiguateStand24 = false;
|
// public Boolean ISOppDemandConfiguateStand31 = false;
|
// public Boolean ISOppDemandConfiguateStand32 = false;
|
// public Boolean ISOppDemandConfiguateStand33 = false;
|
// public Boolean ISOppDemandConfiguateStand34 = false;
|
// public List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguateListStandard{ get; set; }
|
// 默认值显示
|
public Boolean oddNeed {get;set;}
|
public Boolean odoNeed {get;set;}
|
// 控制术间及示教点的显示
|
public Boolean showISOdo1 { get; set; }
|
public Boolean showISOdo2 { get; set; }
|
public Boolean showISOdo3 { get; set; }
|
public Boolean showISOdoMore { get; set; }
|
public Boolean showISOdd1 { get; set; }
|
public Boolean showISOdd2 { get; set; }
|
public Boolean showISOddMore { get; set; }
|
// 控制配置单的显示
|
public Boolean showISOdc11 { get; set; }
|
public Boolean showISOdc12 { get; set; }
|
public Boolean showISOdc13 { get; set; }
|
public Boolean showISOdc14 { get; set; }
|
public Boolean showISOdc21 { get; set; }
|
public Boolean showISOdc22 { get; set; }
|
public Boolean showISOdc23 { get; set; }
|
public Boolean showISOdc24 { get; set; }
|
public Boolean showISOdc31 { get; set; }
|
public Boolean showISOdc32 { get; set; }
|
public Boolean showISOdc33 { get; set; }
|
public Boolean showISOdc34 { get; set; }
|
// 控制是否新建需求表
|
public String Operating_Room_Count { get; set; }
|
public String Operating_Room_Type1 { get; set; }
|
public String Operating_Room_Type2 { get; set; }
|
public String Operating_Room_Type3 { get; set; }
|
public String Demonstration_Number { get; set; }
|
public String Demonstration_Type1 { get; set; }
|
public String Demonstration_Type2 { get; set; }
|
public String Demand_DemonstrationType { get; set; }
|
public Boolean insertOrNot { get; set; }
|
public ISO_DemandOperAndDemonsNewController(){
|
// if(ISodcIdStr=='' || ISodcIdStr==null){
|
OpporIdStr = ApexPages.currentPage().getParameters().get('OppoerID');
|
system.debug(OpporIdStr+'========');
|
// OpporIdStr = '006p0000007IQvq';
|
// }
|
}
|
|
public ISO_DemandOperAndDemonsNewController(ApexPages.StandardController controller){
|
|
}
|
public void init(){
|
returnNew = false;
|
saveAndReturnB = false;
|
OpporIdStr = ApexPages.currentPage().getParameters().get('OppoerID');
|
ISodcIdStr = ApexPages.currentPage().getParameters().get('Id');
|
System.debug(ISodcIdStr+'======ISodcIdStr');
|
if(ISodcIdStr == '' || ISodcIdStr == null){
|
returnNew = true;
|
}
|
if(ISodcIdStr != '' && ISodcIdStr != null){
|
returnNew = false;
|
}
|
System.debug(returnNew+'======returnNew');
|
system.debug(OpporIdStr+'========111');
|
// OpporIdStr = '006p0000007IQvq';
|
String idstr = ISodcIdStr;
|
ISOppDemandConfiguate11 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate12 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate13 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate14 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate21 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate22 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate23 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate24 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate31 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate32 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate33 = new List<IS_Opportunity_Demand_Configuration__c>();
|
ISOppDemandConfiguate34 = new List<IS_Opportunity_Demand_Configuration__c>();
|
showISOdc11 = false;
|
showISOdc12 = false;
|
showISOdc13 = false;
|
showISOdc14 = false;
|
showISOdc21 = false;
|
showISOdc22 = false;
|
showISOdc23 = false;
|
showISOdc24 = false;
|
showISOdc31 = false;
|
showISOdc32 = false;
|
showISOdc33 = false;
|
showISOdc34 = false;
|
showISOdo1 = false;
|
showISOdo2 = false;
|
showISOdo3 = false;
|
showISOdoMore = false;
|
showISOdd1 = false;
|
showISOdd2 = false;
|
showISOddMore = false;
|
|
odoNeed = false;
|
oddNeed = false;
|
// 查询si询价需求表的信息
|
// ISOpptunityDemandList = [select id,Demonstration_Number__c,Opportunity_ID__c,Transmission_Mode__c,Operating_Room_Count__c,Demand_DemonstrationType__c,OperatingRoomName__c,Operating_Room_Position_Area__c,Operating_Room_Position_Building__c,Operating_Room_Position_Stage__c from IS_Opportunity_Demand__c where Opportunity_ID__c = :OpporIdStr and Func_SOD_Status__c != '00 已终止'];
|
ISOpptunityDemandList = [select id,Demonstration_Number__c,Opportunity_ID__c,Transmission_Mode__c,Operating_Room_Count__c,Demand_DemonstrationType__c,OperatingRoomName__c,Operating_Room_Position_Area__c,Operating_Room_Position_Building__c,Operating_Room_Position_Stage__c from IS_Opportunity_Demand__c where id = :ISodcIdStr ];
|
if(ISOpptunityDemandList.size() <= 0){
|
ISOppDemandList = new IS_Opportunity_Demand__c();
|
// ISOppDemandList.Operating_Room_Count__c = '1';
|
// ISOppDemandList.Demonstration_Number__c = '0';
|
ISOppDemandList.Opportunity_ID__c = OpporIdStr;
|
System.debug('默认是空的');
|
// insert ISOppDemandList;
|
}else{
|
ISOppDemandList = ISOpptunityDemandList[0];
|
}
|
idstr = ISOppDemandList.Id;
|
// 获取PDF的名称
|
String oppoIDs = ISOppDemandList.Opportunity_ID__c;
|
Opportunity OppList = [select id,SI_Decide_ID__c,Opportunity_No__c from Opportunity where id =:oppoIDs];
|
PDFfileName = OppList.Opportunity_No__c;
|
// 查询si询价手术间
|
ISOppDemandOperList = [select id,Project_Information__c,Name,Name__c,IS_Opportunity_Demand__c,Operating_Room_Area__c,Remarks_Text__c,Operating_Room_Type__c,Olympus_LightSource_Host__c,Olympus_CD_Writer__c,Olympus_Ultrasound_Knife__c,Olympus_Insufflator__c,Olympus_Camera_Host__c,Olympus_Electric_Knife__c,ThirdParty_OperatingTable__c,ThirdParty_OperationLamp__c,ThirdParty_Camera__c from IS_Opportunity_Demand_Operating__c where IS_Opportunity_Demand__c = :idstr];
|
// 查询si询价示教点
|
ISOppDemandDemonList = [select id,Name,IS_Opportunity_Demand__c,Teaching_Needs__c,Other_Require_Text__c,Demonstration_Type__c,Other_Relative_Position__c,Name__c from IS_Opportunity_Demand_Demonstration__c where IS_Opportunity_Demand__c = :idstr];
|
// 查询si询价配置单
|
ISOppDemandConfiguateList = [select id,name,Configuration_Type__c,Selection__c,Matching__c,SerialNumber__c,Number__c,Standard_Configuration__c,IS_Opportunity_Demand_Operating__c,Brand__c,Company__c,IS_Opportunity_Demand_Operating__r.Name__c from IS_Opportunity_Demand_Configuration__c where IS_Opportunity_Demand_Operating__c = :ISOppDemandOperList or Standard_Configuration__c = true order by SerialNumber__c];
|
// insert ISOppDemandConfiguate11;
|
|
// 用来控制术间页面的初始显示
|
if(ISOppDemandList.Operating_Room_Count__c == '1'){
|
showISOdo1 = true;
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '2'){
|
showISOdo1 = true;
|
showISOdo2 = true;
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '3'){
|
showISOdo1 = true;
|
showISOdo2 = true;
|
showISOdo3 = true;
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '>3'){
|
showISOdoMore = true;
|
}
|
// 用来控制示教点页面的初始显示
|
if(ISOppDemandList.Demonstration_Number__c == '1'){
|
showISOdd1 = true;
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '2'){
|
showISOdd1 = true;
|
showISOdd2 = true;
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '>2'){
|
showISOddMore = true;
|
}
|
for(IS_Opportunity_Demand_Operating__c isOdo : ISOppDemandOperList){
|
if(isOdo.Name__c == '手术间1'){
|
ISOppDemandOper1 = isOdo;
|
}
|
if(isOdo.Name__c == '手术间2'){
|
ISOppDemandOper2 = isOdo;
|
}
|
if(isOdo.Name__c == '手术间3'){
|
ISOppDemandOper3 = isOdo;
|
}
|
if(isOdo.Name__c == '术间数量>3间'){
|
ISOppDemandOperMore = isOdo;
|
// System.debug('=====Project_Information__c'+ISOppDemandOperMore.Project_Information__c+'===');
|
if(ISOppDemandOperMore.Project_Information__c == '' || ISOppDemandOperMore.Project_Information__c == null){
|
odoNeed = true;
|
}
|
}
|
}
|
// 判断手术间是否已存在
|
Map<String,IS_Opportunity_Demand_Operating__c> isOdoMap = new Map<String,IS_Opportunity_Demand_Operating__c>();
|
if(ISOppDemandOper1 == null){
|
ISOppDemandOper1 = new IS_Opportunity_Demand_Operating__c();
|
ISOppDemandOper1.Name__c = '手术间1';
|
// ISOppDemandOper1.IS_Opportunity_Demand__c = idstr;
|
isOdoMap.put('1', ISOppDemandOper1);
|
}
|
if(ISOppDemandOper2 == null){
|
ISOppDemandOper2 = new IS_Opportunity_Demand_Operating__c();
|
ISOppDemandOper2.Name__c = '手术间2';
|
// ISOppDemandOper2.IS_Opportunity_Demand__c = idstr;
|
isOdoMap.put('2', ISOppDemandOper2);
|
}
|
if(ISOppDemandOper3 == null){
|
ISOppDemandOper3 = new IS_Opportunity_Demand_Operating__c();
|
ISOppDemandOper3.Name__c = '手术间3';
|
// ISOppDemandOper3.IS_Opportunity_Demand__c = idstr;
|
isOdoMap.put('3', ISOppDemandOper3);
|
}
|
if(ISOppDemandOperMore == null){
|
ISOppDemandOperMore = new IS_Opportunity_Demand_Operating__c();
|
ISOppDemandOperMore.Name__c = '术间数量>3间';
|
odoNeed = true;
|
// ISOppDemandOperMore.IS_Opportunity_Demand__c = idstr;
|
isOdoMap.put('more', ISOppDemandOperMore);
|
}
|
// insert isOdoMap.values();
|
|
for(IS_Opportunity_Demand_Demonstration__c isOdd : ISOppDemandDemonList){
|
if(isOdd.Name__c == '示教点1'){
|
ISOppDemandDemon1 = isOdd;
|
}
|
if(isOdd.Name__c == '示教点2'){
|
ISOppDemandDemon2 = isOdd;
|
}
|
if(isOdd.Name__c == '示教点数量>2'){
|
ISOppDemandDemonMore = isOdd;
|
if(isOdd.Teaching_Needs__c == '' || isOdd.Teaching_Needs__c == null){
|
oddNeed = true;
|
}
|
}
|
}
|
// 判断示教点是否存在
|
Map<String,IS_Opportunity_Demand_Demonstration__c> isOddMap = new Map<String,IS_Opportunity_Demand_Demonstration__c>();
|
if(ISOppDemandDemon1 == null){
|
ISOppDemandDemon1 = new IS_Opportunity_Demand_Demonstration__c();
|
ISOppDemandDemon1.Name__c = '示教点1';
|
// ISOppDemandDemon1.IS_Opportunity_Demand__c = idstr;
|
isOddMap.put('1', ISOppDemandDemon1);
|
}
|
if(ISOppDemandDemon2 == null){
|
ISOppDemandDemon2 = new IS_Opportunity_Demand_Demonstration__c();
|
ISOppDemandDemon2.Name__c = '示教点2';
|
// ISOppDemandDemon2.IS_Opportunity_Demand__c = idstr;
|
isOddMap.put('2', ISOppDemandDemon2);
|
}
|
if(ISOppDemandDemonMore == null){
|
ISOppDemandDemonMore = new IS_Opportunity_Demand_Demonstration__c();
|
ISOppDemandDemonMore.Name__c = '示教点数量>2';
|
oddNeed = true;
|
// ISOppDemandDemonMore.IS_Opportunity_Demand__c = idstr;
|
isOddMap.put('more', ISOppDemandDemonMore);
|
}
|
// insert isOddMap.values();
|
|
for(IS_Opportunity_Demand_Configuration__c isOdc : ISOppDemandConfiguateList){
|
// 判断是否是第一次创建,还是查看
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c != null){
|
// 经过保存了查看si询价页面信息
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间1' && isodc.Configuration_Type__c == '01 _ HD整体手术间配置单'){
|
ISOppDemandConfiguate11.add(isOdc);
|
showISOdc11 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间1' && isodc.Configuration_Type__c == '02 _ 3D整体手术间配置单'){
|
ISOppDemandConfiguate12.add(isOdc);
|
showISOdc12 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间1' && isodc.Configuration_Type__c == '03 _ 4K整体手术间配置单'){
|
ISOppDemandConfiguate13.add(isOdc);
|
showISOdc13 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间1' && isodc.Configuration_Type__c == '04 _ 3D/4K整体手术间配置单'){
|
ISOppDemandConfiguate14.add(isOdc);
|
showISOdc14 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间2' && isodc.Configuration_Type__c == '01 _ HD整体手术间配置单'){
|
ISOppDemandConfiguate21.add(isOdc);
|
showISOdc21 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间2' && isodc.Configuration_Type__c == '02 _ 3D整体手术间配置单'){
|
ISOppDemandConfiguate22.add(isOdc);
|
showISOdc22 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间2' && isodc.Configuration_Type__c == '03 _ 4K整体手术间配置单'){
|
ISOppDemandConfiguate23.add(isOdc);
|
showISOdc23 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间2' && isodc.Configuration_Type__c == '04 _ 3D/4K整体手术间配置单'){
|
ISOppDemandConfiguate24.add(isOdc);
|
showISOdc24 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间3' && isodc.Configuration_Type__c == '01 _ HD整体手术间配置单'){
|
ISOppDemandConfiguate31.add(isOdc);
|
showISOdc31 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间3' && isodc.Configuration_Type__c == '02 _ 3D整体手术间配置单'){
|
ISOppDemandConfiguate32.add(isOdc);
|
showISOdc32 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间3' && isodc.Configuration_Type__c == '03 _ 4K整体手术间配置单'){
|
ISOppDemandConfiguate33.add(isOdc);
|
showISOdc33 = true;
|
}
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == '手术间3' && isodc.Configuration_Type__c == '04 _ 3D/4K整体手术间配置单'){
|
ISOppDemandConfiguate34.add(isOdc);
|
showISOdc34 = true;
|
}
|
}
|
}
|
System.debug(ISOppDemandConfiguate11.size()+'==='+showISOdc11);
|
|
if(ISOppDemandConfiguate11.size() <= 0){
|
System.debug('等于空格');
|
}
|
for(IS_Opportunity_Demand_Configuration__c isOdc : ISOppDemandConfiguateList){
|
if(isOdc.IS_Opportunity_Demand_Operating__r.Name__c == null){
|
// 第一次打开,显示标准的配置单
|
if(isodc.Configuration_Type__c == '01 _ HD整体手术间配置单'){
|
System.debug('===='+isOdc);
|
if(!showISOdc11){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper1,isOdc);
|
ISOppDemandConfiguate11.add(isOdc11);
|
}
|
if(!showISOdc21){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper2,isOdc);
|
ISOppDemandConfiguate21.add(isOdc11);
|
}
|
if(!showISOdc31){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper3,isOdc);
|
ISOppDemandConfiguate31.add(isOdc11);
|
}
|
|
}
|
if(isodc.Configuration_Type__c == '02 _ 3D整体手术间配置单'){
|
if(!showISOdc12){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper1,isOdc);
|
ISOppDemandConfiguate12.add(isOdc11);
|
}
|
if(!showISOdc22){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper2,isOdc);
|
ISOppDemandConfiguate22.add(isOdc11);
|
}
|
if(!showISOdc32){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper3,isOdc);
|
ISOppDemandConfiguate32.add(isOdc11);
|
}
|
}
|
if(isodc.Configuration_Type__c == '03 _ 4K整体手术间配置单'){
|
if(!showISOdc13){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper1,isOdc);
|
ISOppDemandConfiguate13.add(isOdc11);
|
}
|
if(!showISOdc23){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper2,isOdc);
|
ISOppDemandConfiguate23.add(isOdc11);
|
}
|
if(!showISOdc33){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper3,isOdc);
|
ISOppDemandConfiguate33.add(isOdc11);
|
}
|
}
|
if(isodc.Configuration_Type__c == '04 _ 3D/4K整体手术间配置单'){
|
if(!showISOdc14){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper1,isOdc);
|
ISOppDemandConfiguate14.add(isOdc11);
|
}
|
if(!showISOdc24){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper2,isOdc);
|
ISOppDemandConfiguate24.add(isOdc11);
|
}
|
if(!showISOdc34){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11 = makeISOdc(ISOppDemandOper3,isOdc);
|
ISOppDemandConfiguate34.add(isOdc11);
|
}
|
}
|
}
|
}
|
// if(ISOppDemandConfiguate11 != null && showISOdc11 == false){
|
// insert ISOppDemandConfiguate11;
|
// }
|
// if(ISOppDemandConfiguate12 != null && showISOdc12 == false){
|
// insert ISOppDemandConfiguate12;
|
// }
|
// if(ISOppDemandConfiguate13 != null && showISOdc13 == false){
|
// insert ISOppDemandConfiguate13;
|
// }
|
// if(ISOppDemandConfiguate14 != null && showISOdc14 == false){
|
// insert ISOppDemandConfiguate14;
|
// }
|
// if(ISOppDemandConfiguate21 != null && showISOdc21 == false){
|
// insert ISOppDemandConfiguate21;
|
// }
|
// if(ISOppDemandConfiguate22 != null && showISOdc22 == false){
|
// insert ISOppDemandConfiguate22;
|
// }
|
// if(ISOppDemandConfiguate23 != null && showISOdc23 == false){
|
// insert ISOppDemandConfiguate23;
|
// }
|
// if(ISOppDemandConfiguate24 != null && showISOdc24 == false){
|
// insert ISOppDemandConfiguate24;
|
// }
|
// if(ISOppDemandConfiguate31 != null && showISOdc31 == false){
|
// insert ISOppDemandConfiguate31;
|
// }
|
// if(ISOppDemandConfiguate32 != null && showISOdc32 == false){
|
// insert ISOppDemandConfiguate32;
|
// }
|
// if(ISOppDemandConfiguate33 != null && showISOdc33 == false){
|
// insert ISOppDemandConfiguate33;
|
// }
|
// if(ISOppDemandConfiguate34 != null && showISOdc34 == false){
|
// insert ISOppDemandConfiguate34;
|
// }
|
|
// 在控制一遍
|
if(ISOppDemandOper1.Name__c == '手术间1'){
|
if(ISOppDemandOper1.Operating_Room_Type__c == 'HD整体手术间'){
|
showISOdc11 = true;
|
showISOdc12 = false;
|
showISOdc13 = false;
|
showISOdc14 = false;
|
}else if(ISOppDemandOper1.Operating_Room_Type__c == '3D整体手术间'){
|
showISOdc11 = false;
|
showISOdc12 = true;
|
showISOdc13 = false;
|
showISOdc14 = false;
|
}else if(ISOppDemandOper1.Operating_Room_Type__c == '4K整体手术间'){
|
showISOdc11 = false;
|
showISOdc12 = false;
|
showISOdc13 = true;
|
showISOdc14 = false;
|
}else if(ISOppDemandOper1.Operating_Room_Type__c == '3D/4K整体手术间'){
|
showISOdc11 = false;
|
showISOdc12 = false;
|
showISOdc13 = false;
|
showISOdc14 = true;
|
}else{
|
showISOdc11 = false;
|
showISOdc12 = false;
|
showISOdc13 = false;
|
showISOdc14 = false;
|
}
|
|
}
|
|
if(ISOppDemandOper2.Name__c == '手术间2'){
|
if(ISOppDemandOper2.Operating_Room_Type__c == 'HD整体手术间'){
|
showISOdc21 = true;
|
showISOdc22 = false;
|
showISOdc23 = false;
|
showISOdc24 = false;
|
}else if(ISOppDemandOper2.Operating_Room_Type__c == '3D整体手术间'){
|
showISOdc21 = false;
|
showISOdc22 = true;
|
showISOdc23 = false;
|
showISOdc24 = false;
|
}else if(ISOppDemandOper2.Operating_Room_Type__c == '4K整体手术间'){
|
showISOdc21 = false;
|
showISOdc22 = false;
|
showISOdc23 = true;
|
showISOdc24 = false;
|
}else if(ISOppDemandOper2.Operating_Room_Type__c == '3D/4K整体手术间'){
|
showISOdc21 = false;
|
showISOdc22 = false;
|
showISOdc23 = false;
|
showISOdc24 = true;
|
}else{
|
showISOdc21 = false;
|
showISOdc22 = false;
|
showISOdc23 = false;
|
showISOdc24 = false;
|
}
|
|
}
|
if(ISOppDemandOper3.Name__c == '手术间3'){
|
if(ISOppDemandOper3.Operating_Room_Type__c == 'HD整体手术间'){
|
showISOdc31 = true;
|
showISOdc32 = false;
|
showISOdc33 = false;
|
showISOdc34 = false;
|
}else if(ISOppDemandOper3.Operating_Room_Type__c == '3D整体手术间'){
|
showISOdc31 = false;
|
showISOdc32 = true;
|
showISOdc33 = false;
|
showISOdc34 = false;
|
}else if(ISOppDemandOper3.Operating_Room_Type__c == '4K整体手术间'){
|
showISOdc31 = false;
|
showISOdc32 = false;
|
showISOdc33 = true;
|
showISOdc34 = false;
|
}else if(ISOppDemandOper3.Operating_Room_Type__c == '3D/4K整体手术间'){
|
showISOdc31 = false;
|
showISOdc32 = false;
|
showISOdc33 = false;
|
showISOdc34 = true;
|
}else{
|
showISOdc31 = false;
|
showISOdc32 = false;
|
showISOdc33 = false;
|
showISOdc34 = false;
|
}
|
|
}
|
// 需求表初始化的时候为判断是否新建需求表的判断条件赋值
|
Operating_Room_Count = ISOppDemandList.Operating_Room_Count__c;
|
Operating_Room_Type1 = ISOppDemandOper1.Operating_Room_Type__c;
|
Operating_Room_Type2 = ISOppDemandOper2.Operating_Room_Type__c;
|
Operating_Room_Type3 = ISOppDemandOper3.Operating_Room_Type__c;
|
Demonstration_Number = ISOppDemandList.Demonstration_Number__c;
|
Demonstration_Type1 = ISOppDemandDemon1.Demonstration_Type__c;
|
Demonstration_Type2 = ISOppDemandDemon2.Demonstration_Type__c;
|
Demand_DemonstrationType = ISOppDemandList.Demand_DemonstrationType__c;
|
System.debug('oddNeed======='+oddNeed+'odoNeed======'+odoNeed);
|
}
|
|
// 判断是否是否需要新建SI需求表
|
public Boolean insertSIodOrNot(){
|
return Operating_Room_Count == ISOppDemandList.Operating_Room_Count__c && Operating_Room_Type1 == ISOppDemandOper1.Operating_Room_Type__c &&
|
Operating_Room_Type2 == ISOppDemandOper2.Operating_Room_Type__c &&
|
Operating_Room_Type3 == ISOppDemandOper3.Operating_Room_Type__c &&
|
Demonstration_Number == ISOppDemandList.Demonstration_Number__c &&
|
Demonstration_Type1 == ISOppDemandDemon1.Demonstration_Type__c &&
|
Demonstration_Type2 == ISOppDemandDemon2.Demonstration_Type__c &&
|
Demand_DemonstrationType == ISOppDemandList.Demand_DemonstrationType__c;
|
}
|
|
// 返回
|
public PageReference returnOpp(){
|
if(ISodcIdStr == '' || ISodcIdStr == null){
|
PageReference page = new PageReference('/'+OpporIdStr);
|
page.setRedirect(true);
|
return page;
|
}
|
if(ISodcIdStr != '' && ISodcIdStr != null){
|
PageReference page = new PageReference('/'+ISodcIdStr);
|
page.setRedirect(true);
|
return page;
|
}
|
return null;
|
}
|
|
// 保存并返回
|
public PageReference saveAndReturn(){
|
saveAndReturnB = true;
|
save();
|
if(ISodcIdStr == '' || ISodcIdStr == null){
|
PageReference page = new PageReference('/'+OpporIdStr);
|
page.setRedirect(true);
|
return page;
|
}
|
if(ISodcIdStr != '' && ISodcIdStr != null){
|
PageReference page = new PageReference('/'+ISodcIdStr);
|
page.setRedirect(true);
|
return page;
|
}
|
return null;
|
}
|
|
public PageReference save(){
|
PDFfileName = 'save';
|
System.debug('需求表信息'+ISOppDemandList);
|
System.debug('选择的术间的数量'+ISOppDemandList.Operating_Room_Count__c);
|
System.debug('术间1信息'+ISOppDemandOper1);
|
System.debug('术间1对应的配置信息'+ISOppDemandConfiguate11);
|
System.debug('术间2信息'+ISOppDemandOper2);
|
System.debug('术间2对应的配置信息'+ISOppDemandConfiguate22);
|
System.debug('术间3信息'+ISOppDemandOper3);
|
System.debug('术间>3信息'+ISOppDemandOperMore);
|
|
System.debug('选择的示教点的数量'+ISOppDemandList.Demonstration_Number__c);
|
System.debug('示教点1信息'+ISOppDemandDemon1);
|
System.debug('示教点2信息'+ISOppDemandDemon2);
|
System.debug('示教点>2信息'+ISOppDemandDemonMore);
|
// 首先先检查完整性
|
mustCheck();
|
system.debug(ErrorColorChangeStr+'======');
|
if(ErrorColorChangeStr != ''){
|
ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.ERROR, ErrorColorChangeStr));
|
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, '需求表未填写完整,请修正'));
|
}else{
|
// ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, '需求表已填写完整'));
|
// 保存需求表信息
|
if(ISOpptunityDemandList.size() <= 0){
|
ISOppDemandList.Data_Check_TF__c = true;
|
upsert ISOppDemandList;
|
}
|
insertOrNot = insertSIodOrNot();
|
if(ISOpptunityDemandList.size() > 0){
|
if(insertOrNot){
|
update ISOppDemandList;
|
}else{
|
ISOppDemandList.Abort_Date__c = Date.today();
|
ISOppDemandList.Data_Check_TF__c = true;
|
update ISOppDemandList;
|
ISOppDemandList.Id = null;
|
ISOppDemandList.Abort_Date__c = null;
|
insert ISOppDemandList;
|
}
|
|
}
|
String isoId = ISOppDemandList.Id;
|
ISodcIdStr = ISOppDemandList.Id;
|
System.debug(isoId+'需求表的id');
|
// 根据需求表的信息保存术间的信息
|
// 术间数量为1
|
|
// List<IS_Opportunity_Demand_Configuration__c> deleteISOdc = new List<IS_Opportunity_Demand_Configuration__c>();
|
if(ISOppDemandList.Operating_Room_Count__c == '1' || ISOppDemandList.Operating_Room_Count__c == '2' || ISOppDemandList.Operating_Room_Count__c == '3'){
|
// 更新术间1信息
|
if(ISOppDemandOper1 != null){
|
if(ISOppDemandOper1.IS_Opportunity_Demand__c == null){
|
ISOppDemandOper1.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOper1;
|
}
|
// if(ISOppDemandOper1.IS_Opportunity_Demand__c != null){
|
else{
|
if(!insertOrNot){
|
ISOppDemandOper1.Id = null;
|
ISOppDemandOper1.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOper1;
|
}else{
|
update ISOppDemandOper1;
|
}
|
|
}
|
|
}
|
// 根据术间1的术间配置类型来更新或创建配置单的信息
|
if(ISOppDemandOper1.Operating_Room_Type__c == 'HD整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper1,ISOppDemandConfiguate11);
|
// upsert ISOppDemandConfiguate11;
|
// deleteISOdc.addAll(ISOppDemandConfiguate12);
|
// deleteISOdc.addAll(ISOppDemandConfiguate13);
|
// deleteISOdc.addAll(ISOppDemandConfiguate14);
|
}
|
if(ISOppDemandOper1.Operating_Room_Type__c == '3D整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper1,ISOppDemandConfiguate12);
|
// upsert ISOppDemandConfiguate12;
|
// deleteISOdc.addAll(ISOppDemandConfiguate11);
|
// deleteISOdc.addAll(ISOppDemandConfiguate13);
|
// deleteISOdc.addAll(ISOppDemandConfiguate14);
|
}
|
if(ISOppDemandOper1.Operating_Room_Type__c == '4K整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper1,ISOppDemandConfiguate13);
|
// upsert ISOppDemandConfiguate13;
|
// deleteISOdc.addAll(ISOppDemandConfiguate11);
|
// deleteISOdc.addAll(ISOppDemandConfiguate12);
|
// deleteISOdc.addAll(ISOppDemandConfiguate14);
|
}
|
if(ISOppDemandOper1.Operating_Room_Type__c == '3D/4K整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper1,ISOppDemandConfiguate14);
|
// upsert ISOppDemandConfiguate14;
|
// deleteISOdc.addAll(ISOppDemandConfiguate11);
|
// deleteISOdc.addAll(ISOppDemandConfiguate12);
|
// deleteISOdc.addAll(ISOppDemandConfiguate13);
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '2' || ISOppDemandList.Operating_Room_Count__c == '3'){
|
// 更新术间1信息
|
if(ISOppDemandOper2 != null){
|
if(ISOppDemandOper2.IS_Opportunity_Demand__c == null){
|
ISOppDemandOper2.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOper2;
|
}
|
// if(ISOppDemandOper2.IS_Opportunity_Demand__c != null){
|
else{
|
if(!insertOrNot){
|
ISOppDemandOper2.Id = null;
|
ISOppDemandOper2.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOper2;
|
}else{
|
update ISOppDemandOper2;
|
}
|
// update ISOppDemandOper2;
|
}
|
// update ISOppDemandOper2;
|
}
|
|
// 根据术间1的术间配置类型来更新或创建配置单的信息
|
if(ISOppDemandOper2.Operating_Room_Type__c == 'HD整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper2,ISOppDemandConfiguate21);
|
// upsert ISOppDemandConfiguate21;
|
// deleteISOdc.addAll(ISOppDemandConfiguate22);
|
// deleteISOdc.addAll(ISOppDemandConfiguate23);
|
// deleteISOdc.addAll(ISOppDemandConfiguate24);
|
}
|
if(ISOppDemandOper2.Operating_Room_Type__c == '3D整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper2,ISOppDemandConfiguate22);
|
// upsert ISOppDemandConfiguate22;
|
// deleteISOdc.addAll(ISOppDemandConfiguate21);
|
// deleteISOdc.addAll(ISOppDemandConfiguate23);
|
// deleteISOdc.addAll(ISOppDemandConfiguate24);
|
}
|
if(ISOppDemandOper2.Operating_Room_Type__c == '4K整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper2,ISOppDemandConfiguate23);
|
// upsert ISOppDemandConfiguate23;
|
// deleteISOdc.addAll(ISOppDemandConfiguate21);
|
// deleteISOdc.addAll(ISOppDemandConfiguate22);
|
// deleteISOdc.addAll(ISOppDemandConfiguate24);
|
}
|
if(ISOppDemandOper2.Operating_Room_Type__c == '3D/4K整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper2,ISOppDemandConfiguate24);
|
// upsert ISOppDemandConfiguate24;
|
// deleteISOdc.addAll(ISOppDemandConfiguate21);
|
// deleteISOdc.addAll(ISOppDemandConfiguate22);
|
// deleteISOdc.addAll(ISOppDemandConfiguate23);
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '3'){
|
// 更新术间1信息
|
if(ISOppDemandOper3 != null){
|
if(ISOppDemandOper3.IS_Opportunity_Demand__c == null){
|
ISOppDemandOper3.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOper3;
|
}
|
// if(ISOppDemandOper3.IS_Opportunity_Demand__c != null){
|
else{
|
if(!insertOrNot){
|
|
ISOppDemandOper3.Id = null;
|
ISOppDemandOper3.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOper3;
|
}else{
|
update ISOppDemandOper3;
|
}
|
// update ISOppDemandOper3;
|
}
|
// upsert ISOppDemandOper3;
|
}
|
// 根据术间1的术间配置类型来更新或创建配置单的信息
|
if(ISOppDemandOper3.Operating_Room_Type__c == 'HD整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper3,ISOppDemandConfiguate31);
|
// upsert ISOppDemandConfiguate31;
|
// deleteISOdc.addAll(ISOppDemandConfiguate32);
|
// deleteISOdc.addAll(ISOppDemandConfiguate33);
|
// deleteISOdc.addAll(ISOppDemandConfiguate34);
|
}
|
if(ISOppDemandOper3.Operating_Room_Type__c == '3D整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper3,ISOppDemandConfiguate32);
|
// upsert ISOppDemandConfiguate32;
|
// deleteISOdc.addAll(ISOppDemandConfiguate31);
|
// deleteISOdc.addAll(ISOppDemandConfiguate33);
|
// deleteISOdc.addAll(ISOppDemandConfiguate34);
|
}
|
if(ISOppDemandOper3.Operating_Room_Type__c == '4K整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper3,ISOppDemandConfiguate33);
|
// upsert ISOppDemandConfiguate33;
|
// deleteISOdc.addAll(ISOppDemandConfiguate31);
|
// deleteISOdc.addAll(ISOppDemandConfiguate32);
|
// deleteISOdc.addAll(ISOppDemandConfiguate34);
|
}
|
if(ISOppDemandOper3.Operating_Room_Type__c == '3D/4K整体手术间'){
|
updateOrInsertISOdc(ISOppDemandOper3,ISOppDemandConfiguate34);
|
// upsert ISOppDemandConfiguate34;
|
// deleteISOdc.addAll(ISOppDemandConfiguate31);
|
// deleteISOdc.addAll(ISOppDemandConfiguate32);
|
// deleteISOdc.addAll(ISOppDemandConfiguate33);
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '>3'){
|
// 更新术间1信息
|
if(ISOppDemandOperMore != null){
|
if(ISOppDemandOperMore.IS_Opportunity_Demand__c == null){
|
ISOppDemandOperMore.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOperMore;
|
}
|
// if(ISOppDemandOperMore.IS_Opportunity_Demand__c != null){
|
else{
|
if(!insertOrNot){
|
ISOppDemandOperMore.Id = null;
|
ISOppDemandOperMore.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandOperMore;
|
}else{
|
update ISOppDemandOperMore;
|
}
|
// update ISOppDemandOperMore;
|
}
|
// upsert ISOppDemandOperMore;
|
}
|
}
|
// 保存示教点信息
|
if(ISOppDemandList.Demonstration_Number__c == '1' || ISOppDemandList.Demonstration_Number__c == '2'){
|
if(ISOppDemandDemon1 != null){
|
if(ISOppDemandDemon1.IS_Opportunity_Demand__c == null){
|
ISOppDemandDemon1.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandDemon1;
|
}
|
// if(ISOppDemandDemon1.IS_Opportunity_Demand__c != null){
|
else{
|
if(!insertOrNot){
|
ISOppDemandDemon1.Id = null;
|
ISOppDemandDemon1.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandDemon1;
|
}else{
|
update ISOppDemandDemon1;
|
}
|
// update ISOppDemandDemon1;
|
}
|
// upsert ISOppDemandDemon1;
|
}
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '2'){
|
if(ISOppDemandDemon2 != null){
|
if(ISOppDemandDemon2.IS_Opportunity_Demand__c == null){
|
ISOppDemandDemon2.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandDemon2;
|
}
|
// if(ISOppDemandDemon2.IS_Opportunity_Demand__c != null){
|
else{
|
if(!insertOrNot){
|
ISOppDemandDemon2.Id = null;
|
ISOppDemandDemon2.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandDemon2;
|
}else{
|
update ISOppDemandDemon2;
|
}
|
// update ISOppDemandDemon2;
|
}
|
// upsert ISOppDemandDemon2;
|
}
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '>2'){
|
if(ISOppDemandDemonMore != null){
|
if(ISOppDemandDemonMore.IS_Opportunity_Demand__c == null){
|
ISOppDemandDemonMore.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandDemonMore;
|
}
|
// if(ISOppDemandDemonMore.IS_Opportunity_Demand__c != null){
|
else{
|
if(!insertOrNot){
|
ISOppDemandDemonMore.Id = null;
|
ISOppDemandDemonMore.IS_Opportunity_Demand__c = isoId;
|
insert ISOppDemandDemonMore;
|
}else{
|
update ISOppDemandDemonMore;
|
}
|
// update ISOppDemandDemonMore;
|
}
|
// upsert ISOppDemandDemonMore;
|
}
|
}
|
// 保存后删除无用的术间和示教点
|
List<IS_Opportunity_Demand_Operating__c> deleteOdo = new List<IS_Opportunity_Demand_Operating__c>();
|
List<IS_Opportunity_Demand_Demonstration__c> deleteOdd = new List<IS_Opportunity_Demand_Demonstration__c>();
|
if(ISOppDemandList.Demonstration_Number__c == '1'){
|
if(ISOppDemandDemonMore.Id != null){
|
deleteOdd.add(ISOppDemandDemonMore);
|
}
|
if(ISOppDemandDemon2.Id != null){
|
deleteOdd.add(ISOppDemandDemon2);
|
}
|
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '2'){
|
if(ISOppDemandDemonMore.Id != null){
|
deleteOdd.add(ISOppDemandDemonMore);
|
}
|
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '>2'){
|
if(ISOppDemandDemon1.Id != null){
|
deleteOdd.add(ISOppDemandDemon1);
|
}
|
if(ISOppDemandDemon2.Id != null){
|
deleteOdd.add(ISOppDemandDemon2);
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '1'){
|
if(ISOppDemandOper2.Id != null){
|
deleteOdo.add(ISOppDemandOper2);
|
}
|
if(ISOppDemandOper3.Id != null){
|
deleteOdo.add(ISOppDemandOper3);
|
}
|
if(ISOppDemandOperMore.Id != null){
|
deleteOdo.add(ISOppDemandOperMore);
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '2'){
|
if(ISOppDemandOper3.Id != null){
|
deleteOdo.add(ISOppDemandOper3);
|
}
|
if(ISOppDemandOperMore.Id != null){
|
deleteOdo.add(ISOppDemandOperMore);
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '>3'){
|
if(ISOppDemandOper2.Id != null){
|
deleteOdo.add(ISOppDemandOper2);
|
}
|
if(ISOppDemandOper3.Id != null){
|
deleteOdo.add(ISOppDemandOper3);
|
}
|
if(ISOppDemandOper1.Id != null){
|
deleteOdo.add(ISOppDemandOper1);
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '3'){
|
if(ISOppDemandOperMore.Id != null){
|
deleteOdo.add(ISOppDemandOperMore);
|
}
|
}
|
if(deleteOdo.size() > 0){
|
delete deleteOdo;
|
}
|
if(deleteOdd.size() > 0){
|
delete deleteOdd;
|
}
|
|
if(returnNew == true && saveAndReturnB == false){
|
PageReference page = new PageReference('/apex/ISO_DemandOperAndDemonsNew?OppoerID='+ISOppDemandList.Opportunity_ID__c+'&id='+ISodcIdStr);
|
page.setRedirect(true);
|
|
return page;
|
}
|
// 因为新建了需求表,所以需要刷新页面到新的需求表
|
if(!insertOrNot){
|
PageReference page = new PageReference('/apex/ISO_DemandOperAndDemonsNew?OppoerID='+ISOppDemandList.Opportunity_ID__c+'&id='+ISodcIdStr);
|
page.setRedirect(true);
|
|
return page;
|
}
|
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, '保存好了'));
|
|
}
|
// delete deleteISOdc;
|
return null;
|
}
|
// 创建或者更新术间配置单信息
|
public void updateOrInsertISOdc(IS_Opportunity_Demand_Operating__c ISOppDemandOper,List<IS_Opportunity_Demand_Configuration__c> ISOppDemandConfiguate){
|
// 根据手术间类型更新或创建术间的配置信息
|
// if(ISOppDemandOper.Operating_Room_Type__c == operRoomType){
|
if(ISOppDemandConfiguate.size() > 0){
|
// if(ISOppDemandConfiguate[0].Standard_Configuration__c == true){
|
// 新建术间配置单
|
// List<IS_Opportunity_Demand_Configuration__c> isOdcList11 = new List<IS_Opportunity_Demand_Configuration__c>();
|
for(IS_Opportunity_Demand_Configuration__c isOdc :ISOppDemandConfiguate){
|
// IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
// isOdc11.Name = isOdc.Name;
|
// isOdc11.Brand__c = isOdc.Brand__c;
|
// isOdc11.Company__c = isOdc.Company__c;
|
// isOdc11.Configuration_Type__c = isOdc.Configuration_Type__c;
|
// isOdc11.Matching__c = isOdc.Matching__c;
|
// isOdc11.Number__c = isOdc.Number__c;
|
// isOdc11.Selection__c = isOdc.Selection__c;
|
// isOdc11.SerialNumber__c = isOdc.SerialNumber__c;
|
// isOdc11.IS_Opportunity_Demand_Operating__c = ISOppDemandOper.Id;
|
// isOdcList11.add(isOdc11);
|
if(!insertOrNot){
|
isOdc.Id = null;
|
}
|
isOdc.IS_Opportunity_Demand_Operating__c = ISOppDemandOper.Id;
|
}
|
upsert ISOppDemandConfiguate;
|
|
// }else{
|
// // 更新配置单
|
// update ISOppDemandConfiguate;
|
// }
|
}
|
// }
|
}
|
// 构造si术间配置单
|
public IS_Opportunity_Demand_Configuration__c makeISOdc(IS_Opportunity_Demand_Operating__c ISOppDemandOper,IS_Opportunity_Demand_Configuration__c isOdc){
|
IS_Opportunity_Demand_Configuration__c isOdc11 = new IS_Opportunity_Demand_Configuration__c();
|
isOdc11.Name = isOdc.Name;
|
isOdc11.Brand__c = isOdc.Brand__c;
|
isOdc11.Company__c = isOdc.Company__c;
|
isOdc11.Configuration_Type__c = isOdc.Configuration_Type__c;
|
isOdc11.Matching__c = isOdc.Matching__c;
|
isOdc11.Number__c = isOdc.Number__c;
|
isOdc11.Selection__c = isOdc.Selection__c;
|
isOdc11.SerialNumber__c = isOdc.SerialNumber__c;
|
isOdc11.IS_Opportunity_Demand_Operating__c = ISOppDemandOper.Id;
|
return isodc11;
|
}
|
// 检查完整性的方法
|
public PageReference completenessCheck(){
|
mustCheck();
|
if(ErrorColorChangeStr != ''){
|
ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.ERROR, ErrorColorChangeStr));
|
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, '需求表未填写完整,请修正'));
|
}else{
|
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, '需求表已填写完整'));
|
}
|
return null;
|
}
|
// 必填字段的检查
|
public void mustCheck(){
|
// 术间字段的验证
|
ErrorColorChangeStr = '';
|
if(ISOppDemandList.Operating_Room_Count__c == null || ISOppDemandList.Operating_Room_Count__c == ''){
|
ErrorColorChangeStr += '术间数量不能为空;';
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '1'){
|
if(ISOppDemandOper1.Operating_Room_Type__c == '' || ISOppDemandOper1.Operating_Room_Type__c == null){
|
ErrorColorChangeStr += '术间1的术间类型不能为空;';
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '2'){
|
if(ISOppDemandOper1.Operating_Room_Type__c == '' || ISOppDemandOper1.Operating_Room_Type__c == null){
|
ErrorColorChangeStr += '术间1的术间类型不能为空;';
|
}
|
if(ISOppDemandOper2.Operating_Room_Type__c == '' || ISOppDemandOper2.Operating_Room_Type__c == null){
|
ErrorColorChangeStr += '术间2的术间类型不能为空;';
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '3'){
|
if(ISOppDemandOper1.Operating_Room_Type__c == '' || ISOppDemandOper1.Operating_Room_Type__c == null){
|
ErrorColorChangeStr += '术间1的术间类型不能为空;';
|
}
|
if(ISOppDemandOper2.Operating_Room_Type__c == '' || ISOppDemandOper2.Operating_Room_Type__c == null){
|
ErrorColorChangeStr += '术间2的术间类型不能为空;';
|
}
|
if(ISOppDemandOper3.Operating_Room_Type__c == '' || ISOppDemandOper3.Operating_Room_Type__c == null){
|
ErrorColorChangeStr += '术间3的术间类型不能为空;';
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '>3'){
|
if(ISOppDemandOperMore.Project_Information__c == ''){
|
ErrorColorChangeStr += '术间>3时须填写项目信息;';
|
}
|
}
|
|
// 示教点字段的验证
|
// if(ISOppDemandList.Demonstration_Number__c == null || ISOppDemandList.Demonstration_Number__c == ''){
|
// ErrorColorChangeStr += '示教点数量不能为空;';
|
// }
|
if(ISOppDemandList.Demonstration_Number__c == '1'){
|
if(ISOppDemandDemon1.Demonstration_Type__c == '' || ISOppDemandDemon1.Demonstration_Type__c == null){
|
ErrorColorChangeStr += '示教点1的示教点类型不能为空;';
|
}
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '2'){
|
if(ISOppDemandDemon1.Demonstration_Type__c == '' || ISOppDemandDemon1.Demonstration_Type__c == null){
|
ErrorColorChangeStr += '示教点1的示教点类型不能为空;';
|
}
|
if(ISOppDemandDemon2.Demonstration_Type__c == '' || ISOppDemandDemon2.Demonstration_Type__c == null){
|
ErrorColorChangeStr += '示教点2的示教点类型不能为空;';
|
}
|
}
|
if(ISOppDemandList.Demonstration_Number__c == '>2'){
|
if(ISOppDemandDemonMore.Teaching_Needs__c == ''){
|
ErrorColorChangeStr += '示教点>2时需填写示教需求;';
|
}
|
}
|
if(ISOppDemandList.Operating_Room_Count__c == '2' || ISOppDemandList.Operating_Room_Count__c == '3' || ISOppDemandList.Operating_Room_Count__c == '>3'){
|
if(ISOppDemandList.Demand_DemonstrationType__c == '' || ISOppDemandList.Demand_DemonstrationType__c == null){
|
ErrorColorChangeStr += '术间数量≥2时示教系统类型必填;';
|
}
|
}
|
|
// 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 );
|
// return null;
|
}
|
// 根据选择来控制术间的显示数量
|
// public void updateshowISOdo1(){
|
// showISOdo1 = true;
|
// showISOdo2 = false;
|
// showISOdo3 = false;
|
// showISOdoMore = false;
|
// }
|
// public void updateshowISOdo2(){
|
// showISOdo1 = true;
|
// showISOdo2 = true;
|
// showISOdo3 = false;
|
// showISOdoMore = false;
|
// }
|
// public void updateshowISOdo3(){
|
// showISOdo1 = true;
|
// showISOdo2 = true;
|
// showISOdo3 = true;
|
// showISOdoMore = false;
|
// }
|
// public void updateshowISOdoMore(){
|
// showISOdoMore = true;
|
// showISOdo1 = false;
|
// showISOdo2 = false;
|
// showISOdo3 = false;
|
// }
|
// // 根据选择来控制配置单的显示
|
// public void updateshowISOdcHD(){
|
// System.debug('======'+showISOdc11);
|
// showISOdc11 = true;
|
// showISOdc12 = false;
|
// showISOdc13 = false;
|
// showISOdc14 = false;
|
// System.debug('======'+showISOdc11);
|
// }
|
// public void updateshowISOdc3D(){
|
// showISOdc11 = false;
|
// showISOdc12 = true;
|
// showISOdc13 = false;
|
// showISOdc14 = false;
|
// }
|
// public void updateshowISOdc4K(){
|
// showISOdc11 = false;
|
// showISOdc12 = false;
|
// showISOdc13 = true;
|
// showISOdc14 = false;
|
// }
|
// public void updateshowISOdc3D4K(){
|
// showISOdc11 = false;
|
// showISOdc12 = false;
|
// showISOdc13 = false;
|
// showISOdc14 = true;
|
// }
|
// public Boolean displayPopup {get;set;}
|
// public ISO_DemandOperAndDemonsNewController (ApexPages.StandardController controller)
|
// {
|
|
// }
|
// public void showPopup()
|
// {
|
// displayPopup = true;
|
// }
|
// public void closePopup()
|
// {
|
// displayPopup = false;
|
// }
|
// public List<SelectOption> getItems()
|
// {
|
// List<SelectOption> options = new List<SelectOption>();
|
// options.add(new SelectOption('US','US'));
|
// options.add(new SelectOption('CANADA','Canada'));
|
// options.add(new SelectOption('MEXICO','Mexico')); return options;
|
// }
|
// public PageReference redirectPopup()
|
// {
|
// displayPopup = false;
|
// //Please uncomment below 3 statements and replace YourObjectId
|
// PageReference p=new Pagereference('/');
|
// p.setRedirect(true);
|
// return p;
|
// }
|
}
|