public with sharing class MaintenanceProductDataController { public static final String NONE = system.label.StartTrading_None; public Maintenance_Product_Data__c mpd {get; set;} //搜索相关 public String category1 { get; set; }//Family public String category2 { get; set; }//Category2__c public String category3 { get; set; }//Category3__c public String category4 { get; set; }//Category4__c public String category5 { get; set; }//Category5__c public String searchCateName { get; set; } public String searchProductCodeExt { get; set; } public String searchGuranteeType { get; set; } public String id { get; set; } public String mpddId { get; set; } public String RecordType {get;set;} public String RecordTypeName {get;set;} //public static Integer FIELDMAX = 200; public List tempImportantRroduct{ get; private set; } //权限 public String GuranteeMainProductService {get;set;} public String profileName{ get; set; } /*****************画面初始化用********************************/ /******20160313_add**************/ public Boolean editAble {get;set;} public String statusEdit {get;set;} public Boolean editDisabled {get;set;} //---------- // 字段标签 public List title { get; private set; } //字段名 public List column; public List> columns { get; private set; } public List column_Old; public List> columns_Old { get; private set; } //---- List dataselectedId = new List(); Map dataselectedId_s = new Map(); //分页功能 //public List paginationSizeOptions{get;set;} public Integer size{get;set;} public Integer pageLimit{get;set;} public Integer noOfRecords{get; set;} public ApexPages.StandardSetController con { get; set; } public String soql {get;set;} //--- /*****************画面表示Bean******************/ //private List mpdDerdetailsRecords = new List(); public List mpdDetailsRecordsView { get; set; }//页面的明细 public List mpdDetailsRecords { get; set; }//页面已经选择的明细20200622 public Integer mpdDetailsRecordsCount { get { return mpdDetailsRecords == null ? 0 : mpdDetailsRecords.size(); } } public Integer mpdDetailsRecordsViewCount { get { return mpdDetailsRecordsView == null ? 0 : mpdDetailsRecordsView.size(); } } //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 Star public List RepairInfo { get { // 20231103 陈京武 sitbug对应 Start return [select id,Service_Category6__c,Service_Category7__c FROM Maintenance_Product_Data_Details__c where Default_Fixture_Arrival_Product__c = '' and Service_Category6__c = null and Service_Category7__c = null LIMIT 1 ]; // 20231103 陈京武 sitbug对应 End } } //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 End public List EquipmentInfo { get { return [select id,Default_Fixture_Arrival_Product__c FROM Maintenance_Product_Data_Details__c where Default_Fixture_Arrival_Product__c = '' LIMIT 1 ]; } } //----- //附件 public List attachmentRecoeds { get; set; } public Boolean editDelCommitBtnDisabled {get; private set;} public Boolean saveBtnDisabled { get; private set; } //public Boolean sorderBtnDisabled { get; private set; } // 20231103 chenjingwu Lightning文件修改 Start private List attachmentinfo = new List(); // 20231103 chenjingwu Lightning文件修改 End //----------- private void initStandardController(){ con = new ApexPages.StandardSetController(Database.getQueryLocator( soql ) ); con.setPageSize(size); noOfRecords = con.getResultSize(); } public List product2s() { return (List) con.getRecords(); } public PageReference refreshPageSize() { con.setPageSize(size); getPageInfo(); return null; } public MaintenanceProductDataController(ApexPages.StandardController controller) { mpdDetailsRecordsView = new List(); attachmentRecoeds = new List(); mpdDetailsRecords = new List(); id = ApexPages.currentPage().getParameters().get('id'); statusEdit = ApexPages.currentPage().getParameters().get('KeyWords'); category1 = ApexPages.currentPage().getParameters().get('category1'); category2 = ApexPages.currentPage().getParameters().get('category2'); category3 = ApexPages.currentPage().getParameters().get('category3'); category4 = ApexPages.currentPage().getParameters().get('category4'); category5 = ApexPages.currentPage().getParameters().get('category5'); searchCateName = ApexPages.currentPage().getParameters().get('searchCateName'); searchProductCodeExt = ApexPages.currentPage().getParameters().get('searchProductCodeExt'); searchGuranteeType = ApexPages.currentPage().getParameters().get('searchGuranteeType'); RecordType = ApexPages.currentPage().getParameters().get('RecordType'); editAble = false;//不可编辑 editDisabled = true; RecordTypeName = ApexPages.currentPage().getParameters().get('RecordTypeName');//20200509 add size = Integer.valueOf(System.Label.mpddetLimitsize);//系统标签 pageLimit = Integer.valueOf(System.Label.mpddetPageLimitsize);//系统标签 //Integer.valueOf(System.Label.orderdetPageLimitsize) } private List getPageInfo(){ Map selectedIdMap = new Map(); //取出选择的产品 for (MpdDetailsInfo ass : mpdDetailsRecords) { if(ass.check == true){ selectedIdMap.put(ass.mpded.id,ass.mpded.id); } } Integer addNo = 0; for(Integer i=0; i= pageLimit){ break; ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '页面所选数据不能超过200条!')); } //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '===mpdDetailList_status==='+mpdDetailList_status[0])); //if(mpdDetailsRecordsView[i].check != true) if(dataselectedId_s.containsKey(mpdDetailsRecordsView[i].Prod.Id)){ mpdDetailsRecordsView[i].canSelect = false; mpdDetailsRecordsView[i].check = false; } //else{ if(RecordTypeName.equals('ImportantProduct')){ mpdDetailsRecordsView[i].mpdrdd.ENG_DeaerProFlag__c = mpdDetailsRecordsView[i].Prod.ENG_DeaerProFlag__c; mpdDetailsRecordsView[i].mpdrdd.Dealer_special_Object__c = mpdDetailsRecordsView[i].Prod.Dealer_special_Object__c; mpdDetailsRecordsView[i].mpdrdd.Key_product_147P__c = mpdDetailsRecordsView[i].Prod.Key_product_147P__c; mpdDetailsRecordsView[i].mpdrdd.Important_Endopartner_product__c = mpdDetailsRecordsView[i].Prod.Important_Endopartner_product__c; //mpdDetailsRecordsView[i].mpdrdd.Tier1_Category__c = mpdDetailsRecordsView[i].Prod.Tier1_Category__c; // FY23修改 WLIG-CFV4AV 重点产品维护(新)start mpdDetailsRecordsView[i].mpdrdd.Key_product_155P__c = mpdDetailsRecordsView[i].Prod.Key_product_155P__c; mpdDetailsRecordsView[i].mpdrdd.Celon_Product__c = mpdDetailsRecordsView[i].Prod.Celon_Product__c; // FY23修改 WLIG-CFV4AV 重点产品维护(新)end // 20221020 ljh SWAG-CJ98AJ start mpdDetailsRecordsView[i].mpdrdd.suitDepartment__c = mpdDetailsRecordsView[i].Prod.suitDepartment__c; // 20221020 ljh SWAG-CJ98AJ end } if(RecordTypeName.equals('GuranteeMain')){ Integer Entend_gurantee_period_all = mpdDetailsRecordsView[i].Prod.Entend_gurantee_period_all__c.intValue(); if(Entend_gurantee_period_all==2){mpdDetailsRecordsView[i].mpdrdd.Entend_gurantee_period__c='两年';} if(Entend_gurantee_period_all==3){mpdDetailsRecordsView[i].mpdrdd.Entend_gurantee_period__c='三年';} if(Entend_gurantee_period_all==4){mpdDetailsRecordsView[i].mpdrdd.Entend_gurantee_period__c='四年';} if(Entend_gurantee_period_all==5){mpdDetailsRecordsView[i].mpdrdd.Entend_gurantee_period__c='五年';} mpdDetailsRecordsView[i].mpdrdd.Gurantee_Start_Date__c = mpdDetailsRecordsView[i].Prod.Gurantee_Start_Date_F__c; mpdDetailsRecordsView[i].mpdrdd.Gurantee_End_Date__c = mpdDetailsRecordsView[i].Prod.Gurantee_End_Date_F__c; mpdDetailsRecordsView[i].mpdrdd.GuranteeType__c = mpdDetailsRecordsView[i].Prod.GuranteeType__c; mpdDetailsRecordsView[i].mpdrdd.CanNotCancelledGurantee__c = mpdDetailsRecordsView[i].Prod.CanNotCancelledGurantee__c;//20201012 ljh CHAN-BTR67N add /* mpdDetailsRecordsView[i].mpdrdd.Maintenance_Price_Year__c = mpdDetailsRecordsView[i].Prod.Maintenance_Price_Year__c; //另两个价格 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Service_RMB__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB__c; mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Gurantee_RMB__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB__c; */ mpdDetailsRecordsView[i].mpdrdd.Maintenance_Price_Year__c = null; //另两个价格 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Service_RMB__c = null; //2021/01/19 liying start mpdDetailsRecordsView[i].mpdrdd.Virtual_Contract__c = null; //2021/01/19 liying end mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Gurantee_RMB__c = null; //日期 //Intra_Trade_Service_RMB_DateFrom__c if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_EndDate1__c ){ //取时间1 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Service_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c; } if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_EndDate2__c ){ //取时间2 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Service_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c; } //Intra_Trade_Gurantee_RMB_DateFrom__c if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_End_Date1__c ){ //取时间1 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Gurantee_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c; } if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_End_Date2__c ){ //取时间2 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Gurantee_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c; } } if(RecordTypeName.equals('GuranteePrice')){ mpdDetailsRecordsView[i].mpdrdd.Maintenance_Price_Year__c = mpdDetailsRecordsView[i].Prod.Maintenance_Price_Year__c; //另两个价格 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Service_RMB__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB__c; //2021/01/19 liying start mpdDetailsRecordsView[i].mpdrdd.Virtual_Contract__c = mpdDetailsRecordsView[i].Prod.Virtual_Contract__c; //2021/01/19 liying end mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Gurantee_RMB__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB__c; //日期 //Intra_Trade_Service_RMB_DateFrom__c if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_EndDate1__c ){ //取时间1 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Service_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c; } if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date1__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_EndDate2__c ){ //取时间2 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Service_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Service_RMB_Date2__c; } //Intra_Trade_Gurantee_RMB_DateFrom__c if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_End_Date1__c ){ //取时间1 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Gurantee_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c; } if( ( (mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c <= Date.today() &&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c <= Date.today()&&mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c >= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c) ||(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c <= Date.today()&&(mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c > Date.today()||mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date1__c==null)) )&&Date.today() <= mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_End_Date2__c ){ //取时间2 mpdDetailsRecordsView[i].mpdrdd.Intra_Trade_Gurantee_RMB_DateFrom__c = mpdDetailsRecordsView[i].Prod.Intra_Trade_Gurantee_RMB_Date2__c; } } if(RecordTypeName.equals('RepairInfo')){ mpdDetailsRecordsView[i].mpdrdd.RepairListPriceLevelA__c = mpdDetailsRecordsView[i].Prod.RepairListPriceLevelA__c; mpdDetailsRecordsView[i].mpdrdd.RepairListPriceLevelB__c = mpdDetailsRecordsView[i].Prod.RepairListPriceLevelB__c; mpdDetailsRecordsView[i].mpdrdd.RepairListPriceLevelC__c = mpdDetailsRecordsView[i].Prod.RepairListPriceLevelC__c; mpdDetailsRecordsView[i].mpdrdd.CanRepairAccsessary__c = mpdDetailsRecordsView[i].Prod.CanRepairAccsessary__c; mpdDetailsRecordsView[i].mpdrdd.Repair_Product_Code__c = mpdDetailsRecordsView[i].Prod.Repair_Product_Code__c; mpdDetailsRecordsView[i].mpdrdd.PartSupplyFinishDate__c = mpdDetailsRecordsView[i].Prod.PartSupplyFinishDate__c; mpdDetailsRecordsView[i].mpdrdd.Maintenance_Price_Year__c = mpdDetailsRecordsView[i].Prod.Maintenance_Price_Year__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 Star mpdDetailsRecordsView[i].mpdrdd.Can_Repair__c = mpdDetailsRecordsView[i].Prod.Can_Repair__c; mpdDetailsRecordsView[i].mpdrdd.Service_Category1__c = mpdDetailsRecordsView[i].Prod.Service_Category1__c; mpdDetailsRecordsView[i].mpdrdd.Service_Category2__c = mpdDetailsRecordsView[i].Prod.Service_Category2__c; mpdDetailsRecordsView[i].mpdrdd.Service_Category3__c = mpdDetailsRecordsView[i].Prod.Service_Category3__c; mpdDetailsRecordsView[i].mpdrdd.Service_Category4__c = mpdDetailsRecordsView[i].Prod.Service_Category4__c; mpdDetailsRecordsView[i].mpdrdd.Service_Category5__c = mpdDetailsRecordsView[i].Prod.Service_Category5__c; mpdDetailsRecordsView[i].mpdrdd.Service_Category6__c = mpdDetailsRecordsView[i].Prod.Service_Category6__c; mpdDetailsRecordsView[i].mpdrdd.Service_Category7__c = mpdDetailsRecordsView[i].Prod.Service_Category7__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 End } if(RecordTypeName.equals('EquipmentInfo')){ mpdDetailsRecordsView[i].mpdrdd.Asset_loaner_category__c = mpdDetailsRecordsView[i].Prod.Asset_loaner_category__c; mpdDetailsRecordsView[i].mpdrdd.Special_Model__c = mpdDetailsRecordsView[i].Prod.Special_Model__c; mpdDetailsRecordsView[i].mpdrdd.Fixture_Model_No__c = mpdDetailsRecordsView[i].Prod.Fixture_Model_No__c; mpdDetailsRecordsView[i].mpdrdd.Packing_list_Fixture__c = mpdDetailsRecordsView[i].Prod.Packing_list_Fixture__c; mpdDetailsRecordsView[i].mpdrdd.Default_Fixture_Arrival_Process__c = mpdDetailsRecordsView[i].Prod.Default_Fixture_Arrival_Process__c; mpdDetailsRecordsView[i].mpdrdd.Default_Fixture_Arrival_Product__c = mpdDetailsRecordsView[i].Prod.Default_Fixture_Arrival_Product__c; } //} } return mpdDetailsRecordsView; } public void init() { //权限 start profileName = ''; String profileId = UserInfo.getProfileId();//18位 if(profileId.equals(System.Label.ProfileId_EquCenAdminPic)){ profileName = '2B3'; } if(profileId.equals(System.Label.profileId_2F3)){//niwu -00eC600000004OXIAY profileName = '2F3';//服务 } if(profileId.equals(System.Label.ProfileId_2M5)){ profileName = '2M5';//产品 } if (profileId.equals(System.Label.ProfileId_2F4)) { //niwu - 00eC600000004OZIAY profileName = '2F4';//技术推进部 } if(String.isBlank(id)&&String.isBlank(RecordTypeName)){ if(String.isBlank(RecordType)){ if(profileName.equals('2B3')){ RecordTypeName = 'EquipmentInfo'; } else if (profileName.equals('2F4')) { RecordTypeName = 'RepairInfo'; } }else{ //RecordTypeId获取对应的RecordTypeName List rt_Map = [SELECT Id, Name, DeveloperName, isActive FROM RecordType WHERE id =:RecordType AND SobjectType = 'Maintenance_Product_Data__c']; RecordTypeName = rt_Map[0].DeveloperName; } }else if(!String.isBlank(id)){ mpd = [SELECT Id,Status__c,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName, CreatedDate, CreatedById FROM Maintenance_Product_Data__c where Id = :id]; RecordTypeName = mpd.RecordType.DeveloperName; } //mpdDerdetailsRecords = new List(); mpdDetailsRecordsView = new List(); List product2Selected = new List(); //查找 List mpdDetailList = new List(); Map midMaprecord = new Map(); // 获得维护主数据一览 Map fsMap = Schema.getGlobalDescribe().get('Maintenance_Product_Data_Details__c').getDescribe().fieldSets.getMap(); // 20211103 ljh WLIG-BXE443 add start String fsTemp = RecordTypeName; String fsTempOld = RecordTypeName; /*if(RecordTypeName.equals('GuranteeMain')&&profileName.equals('2F3')){ fsTemp += 'YY'; fsTempOld += 'YY'; }*/ System.debug('RecordTypeName>>>>>>> ' + RecordTypeName); System.debug('profileName>>>>>>> ' + profileName); if(RecordTypeName.equals('GuranteeMain')&&profileName.equals('2M5')){ fsTemp += 'FW'; fsTempOld += 'FW'; } fsTempOld += '_Old'; System.debug('fsTemp: ' + fsTemp); System.debug(fsMap.get(fsTemp)); // 20211103 ljh WLIG-BXE443 add end // 20211103 ljh WLIG-BXE443 update start // Schema.FieldSet fs = fsMap.get(RecordTypeName); Schema.FieldSet fs = fsMap.get(fsTemp); // 20211103 ljh WLIG-BXE443 update end // 获得维护主数据中的所有项目 List fsmList = fs.getFields(); // 获得字段标签和字段名 title = new List(); List titleService = new List(); column = new List(); columns = new List>(); //List> columnsService = new List>();//20200628 add for (FieldSetMember fsm : fsmList) { title.add(fsm.getLabel()); column.add(fsm.getFieldPath()); columns.add(fsm.getFieldPath().split('\\.')); } // 20211103 ljh WLIG-BXE443 update start // Schema.FieldSet fs_Old = fsMap.get(RecordTypeName+'_Old'); Schema.FieldSet fs_Old = fsMap.get(fsTempOld); // 20211103 ljh WLIG-BXE443 update end List fsmList_Old = fs_Old.getFields(); column_Old = new List(); columns_Old = new List>(); for (FieldSetMember fsm_Old : fsmList_Old) { column_Old.add(fsm_Old.getFieldPath()); columns_Old.add(fsm_Old.getFieldPath().split('\\.')); } /*多年保主数据维护不同部门编辑权限 条件真是这些字段不可输入 start*/ if(RecordTypeName.equals('GuranteeMain')&&profileName.equals('2F3')){ GuranteeMainProductService = 'GuranteeType__c,Entend_gurantee_period__c,Gurantee_Start_Date__c,Gurantee_End_Date__c,CanNotCancelledGurantee__c'; }else if(RecordTypeName.equals('GuranteeMain')&&profileName.equals('2M5')){ GuranteeMainProductService = 'Virtual_Contract__c,Intra_Trade_Gurantee_RMB__c,Intra_Trade_Gurantee_RMB_DateFrom__c,Maintenance_Price_Year__c,Intra_Trade_Service_RMB_DateFrom__c,Intra_Trade_Service_RMB__c'; }else{ GuranteeMainProductService = ' ';//必须有值空有可以 所有可输入 } saveBtnDisabled = false; if(id!=null&&id!=''&&statusEdit==''&&statusEdit==null){ editAble = false; }else if((id == null||id=='')&&(statusEdit==''||statusEdit==null)){ editAble = true; }else if(id != null&&id!=''&&statusEdit!=''&&statusEdit!=null){ editAble = true; } List mpdDetailList_status = new List(); mpdDetailList_status= [select Id ,ProductsID__c,Name from Maintenance_Product_Data_Details__c where Maintenance_Product_Data__r.Status__c !='完成']; for(Maintenance_Product_Data_Details__c ss : mpdDetailList_status ){ dataselectedId_s.put(ss.ProductsID__c,ss.ProductsID__c); } if(String.isBlank(id)){ EditDelCommitBtnDisabled = true; }else{ List mpdDetailsSelected = new List(); String mpdsoql = 'select Id ,Name,GuranteeTypeP__c,ProductCode_Ext__c ,ProductsID__c,Maintenance_Product_Data__c,ProductsID__r.Name '; for (Integer i=0;i MidMap = new Map(); for (Integer i = 0; i < mpdDetailsSelected.size(); i++) { MidMap.put(mpdDetailsSelected[i].Id, new MpdDetailsInfo(mpdDetailsSelected[i])); } for (MpdDetailsInfo mpded : MidMap.values()) { mpdDetailsRecords.add(mpded); } if(String.isNotBlank(searchCateName)||String.isNotBlank(searchProductCodeExt) ||String.isNotBlank(searchGuranteeType) ||String.isNotBlank(category1)||String.isNotBlank(category2)||String.isNotBlank(category3)||String.isNotBlank(category4)||String.isNotBlank(category5) ){ searchMaintenanceProductDataDetails(); } List qs = New List(); qs = [SELECT Id,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName,isAttachment__c, RepairListPriceLevelA_Sum__c,RepairListPriceLevelB_Sum__c,RepairListPriceLevelC_Sum__c,Intra_Trade_Service_RMB_Sum__c, Status__c,ApplyPersion__c,applyDate__c,GuranteeType_Sum__c,Intra_Trade_Gurantee_RMB_Sum__c,BuchangApprovalRecommend__c, ServiceWritePersion__c,Maintenance_Price_Year_Sum__c,CreatedDate, CreatedById FROM Maintenance_Product_Data__c where Id = :id]; if (qs.size()>0){ mpd = qs[0]; } if(mpd.Status__c.equals('已提交') || mpd.Status__c.equals('完成')){ saveBtnDisabled = true; editDelCommitBtnDisabled = false; } //服务本部填写 //UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin) if(profileName.equals('2F3')&&mpd.Status__c.equals('服务填写')){ //if(profileId.equals(System.Label.ProfileId_SystemAdmin) ||profileName.equals('2F3')&&mpd.Status__c == '服务填写'){ editDisabled = false; } //状态多年保主数据【审批中】价格相关字段显示0.00 if((mpd.Status__c.equals('审批中')||mpd.Status__c.equals('草案中'))&&RecordTypeName.equals('GuranteeMain')){ for(MpdDetailsInfo mpdPrice : mpdDetailsRecords){ mpdPrice.mpded.Maintenance_Price_Year__c = null; //2021/01/19 liying start mpdPrice.mpded.Virtual_Contract__c=null; //2021/01/19 liying end mpdPrice.mpded.Intra_Trade_Gurantee_RMB__c = null; mpdPrice.mpded.Intra_Trade_Service_RMB__c = null; mpdPrice.mpded.Maintenance_Price_Year_Old__c = null; mpdPrice.mpded.Intra_Trade_Gurantee_RMB_Old__c = null ; mpdPrice.mpded.Intra_Trade_Service_RMB_Old__c = null; } } //附件(lightning) // 20231103 chenjingwu Lightning文件修改 Start List cdlList = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :id]; List fileIDs = new List(); for (ContentDocumentLink docLink : cdlList) { fileIDs.add(docLink.ContentDocumentId); } attachmentinfo=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs]; // attachmentinfo =[SELECT Id, Name,OwnerId FROM Attachment WHERE parentid =:id ]; // 20231103 chenjingwu Lightning文件修改 End if(attachmentinfo.size()>0){ for (Integer i = 0; i < attachmentinfo.size(); i++) { attachmentRecoeds.add(new MaintenanceProductDataDetailsInfo(attachmentinfo[i])); } } //是否上传附件 if(AttachmentRecoeds.size()>0&&mpd.isAttachment__c != true){ mpd.isAttachment__c = true; update mpd; } if(!editAble&&((mpd.Status__c.equals('服务填写')&&RecordTypeName.equals('GuranteeMain'))||!RecordTypeName.equals('GuranteeMain'))){ Integer tempRepairInfo = 0,tempGuranteeMainPrice = 0; tempRepairInfo = mpd.RepairListPriceLevelA_Sum__c.intValue()+mpd.RepairListPriceLevelB_Sum__c.intValue()+mpd.RepairListPriceLevelC_Sum__c.intValue()+mpd.Maintenance_Price_Year_Sum__c.intValue(); tempGuranteeMainPrice = mpd.Intra_Trade_Service_RMB_Sum__c.intValue()+mpd.Intra_Trade_Gurantee_RMB_Sum__c.intValue()+mpd.Maintenance_Price_Year_Sum__c.intValue(); //检查应该有附件的是否有附件 if(RecordTypeName.equals('GuranteePrice') && tempGuranteeMainPrice > 0&&AttachmentRecoeds.size()==0){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '还没有上传附件,请上传附件!')); }else if(RecordTypeName.equals('RepairInfo') && tempRepairInfo > 0 && AttachmentRecoeds.size()==0){ //RepairInfo ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '还没有上传附件,请上传附件!')); }else if(RecordTypeName.equals('GuranteeMain')&& tempGuranteeMainPrice > 0 &&AttachmentRecoeds.size()==0){ //GuranteeMain ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '还没有上传附件,请上传附件!')); } } //System.debug('============02:'+mpdDetailsRecords); } } // 检索 public void searchMaintenanceProductDataDetails() { System.debug('enter searchMaintenanceProductDataDetails'); Map selectedIdMap = new Map(); Map midMaprecord = new Map(); mpdDetailsRecordsView = new List(); //检索所有产品 List product2Selected = new List(); soql = this.makeSoql(category1,category2,category3,category4,category5,searchCateName,searchProductCodeExt,searchGuranteeType); //size = 20;//系统自定义标签 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '=====soql:'+soql)); size =Integer.valueOf(System.Label.mpddetLimitsize); initStandardController(); product2Selected = Database.query(soql); System.debug('product2Selected size = ' + product2Selected.size()); System.debug('product2Selected = ' + product2Selected); for (Integer i = 0; i < product2Selected.size(); i++) { midMaprecord.put(product2Selected[i].Id, new MaintenanceProductDataDetailsInfo(product2Selected[i])); } //再把map里的值从新赋给ConsumableorderdetailsRecords for(MaintenanceProductDataDetailsInfo bss : midMaprecord.values()){ if(selectedIdMap.containsKey(bss.Prod.id)){ continue; }else{ mpdDetailsRecordsView.add(bss); } } //都显示product2信息 已经加入/在进程中的不可选 getPageInfo(); // 显示数据条数信息 makeMessage(); } // 20231103 chenjingwu Lightning文件修改 Start public void refreshFile(){ if(String.isBlank(id)){ return; } attachmentRecoeds = new List(); List cdlList = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :id]; List fileIDs = new List(); for (ContentDocumentLink docLink : cdlList) { fileIDs.add(docLink.ContentDocumentId); } attachmentinfo=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs]; // attachmentinfo =[SELECT Id, Name,OwnerId FROM Attachment WHERE parentid =:id ]; if(attachmentinfo.size()>0){ for (Integer i = 0; i < attachmentinfo.size(); i++) { attachmentRecoeds.add(new MaintenanceProductDataDetailsInfo(attachmentinfo[i])); } } } // 20231103 chenjingwu Lightning文件修改 End public PageReference save() { Integer FLG = 0; Integer Count = 0; for(MaintenanceProductDataDetailsInfo CheckCount : mpdDetailsRecordsView) { FLG = FLG + 1; if(CheckCount.check == false){ Count = Count + 1; } } if(Count == FLG){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请选择所维护产品')); } Maintenance_Product_Data__c P = new Maintenance_Product_Data__c(); List mpd_Name = new List(); List Ins = New List(); //新建维护时 Savepoint sp = Database.setSavepoint(); try{ Integer i = 1; Integer Roll = 0; if(String.isBlank(id)){ //新增的时候 p.Status__c = '草案中'; p.RecordTypeid = Schema.SObjectType.Maintenance_Product_Data__c.getRecordTypeInfosByDeveloperName().get(RecordTypeName).getRecordTypeId(); try{ insert p; } catch (Exception e) { ApexPages.addMessages(e); } mpd_Name = [SELECT id, Name FROM Maintenance_Product_Data__c WHERE id =:p.id]; id = p.id; }else{ //更新 mpd_Name = [SELECT id,Name FROM Maintenance_Product_Data__c WHERE id =:id]; } List mpdd_Name = [SELECT id,Name FROM Maintenance_Product_Data_Details__c where Maintenance_Product_Data__c =:id order by Name desc Limit 1 ]; if(mpdd_Name.size()>0){ String[] nameI= mpdd_Name[0].Name.split('-'); i = Integer.valueOf(nameI[1])+1; } List GuranteeType = new List();//20200618 类型一致不一致不能保存 add Boolean CanNotCancelledGurantee = false;//20201015 CHAN-BTR67N add start for (MaintenanceProductDataDetailsInfo ass : mpdDetailsRecordsView) { dataselectedId.add(ass.Prod.id); //20200618 类型一致不一致不能保存 add start if(ass.check == true){ switch on RecordTypeName { when 'GuranteeMain'{ if(ass.mpdrdd.GuranteeType__c !=null&&!GuranteeType.contains(ass.mpdrdd.GuranteeType__c)){ GuranteeType.add(ass.mpdrdd.GuranteeType__c); } if(ass.mpdrdd.CanNotCancelledGurantee__c){ CanNotCancelledGurantee = true; } } } } //20200618 类型一致不一致不能保存 add END } if(GuranteeType.size() > 1){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '保存失败,所有多年保修类型选择保持一致!')); return null; }else if(((GuranteeType.size()==1&&!GuranteeType[0].equals('市场'))||GuranteeType.size()==0)&&CanNotCancelledGurantee){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '多年保类型是市场的时候,才可以勾选不可取消多年保修!')); return null; }else{ //20200618 类型一致不一致不能保存 add start Boolean isWarning = false; String contentWarning = ''; for (MaintenanceProductDataDetailsInfo ass : mpdDetailsRecordsView) { Roll = Roll+1; if(ass.check == true){ if(Roll==(FLG-Count)){ } Maintenance_Product_Data_Details__c InsAfterDel = new Maintenance_Product_Data_Details__c(); String str = string.valueOf(i); if(str.length() == 1){ str = '0' + str; } InsAfterDel.Maintenance_Product_Data__c = mpd_Name[0].id; InsAfterDel.Name = mpd_Name[0].Name + '-'+ str; InsAfterDel.ProductsID__c = ass.Prod.id; switch on RecordTypeName { when 'ImportantProduct'{ //InsAfterDel.RecordTypeName__c = 'ImportantProduct'; InsAfterDel.RecordTypeId = Schema.SObjectType.Maintenance_Product_Data_Details__c.getRecordTypeInfosByDeveloperName().get('ImportantProduct').getRecordTypeId(); //InsAfterDel.Tier1_Category__c = ass.mpdrdd.Tier1_Category__c; InsAfterDel.ENG_DeaerProFlag__c = ass.mpdrdd.ENG_DeaerProFlag__c; InsAfterDel.Dealer_special_Object__c = ass.mpdrdd.Dealer_special_Object__c; InsAfterDel.Key_product_147P__c = ass.mpdrdd.Key_product_147P__c; InsAfterDel.Important_Endopartner_product__c = ass.mpdrdd.Important_Endopartner_product__c; //old数据 //InsAfterDel.Tier1_Category_Old__c = ass.Prod.Tier1_Category__c; InsAfterDel.ENG_DeaerProFlag_Old__c = ass.Prod.ENG_DeaerProFlag__c; InsAfterDel.Dealer_special_Object_Old__c = ass.Prod.Dealer_special_Object__c; InsAfterDel.Key_product_147P_Old__c = ass.Prod.Key_product_147P__c; InsAfterDel.Important_Endopartner_product_Old__c = ass.Prod.Important_Endopartner_product__c; // FY23修改 WLIG-CFV4AV 重点产品维护(新)start InsAfterDel.Key_product_155P__c = ass.mpdrdd.Key_product_155P__c; InsAfterDel.Key_product_155P_Old__c = ass.Prod.Key_product_155P__c; InsAfterDel.Celon_Product__c = ass.mpdrdd.Celon_Product__c; InsAfterDel.Celon_Product_Old__c = ass.Prod.Celon_Product__c; // FY23修改 WLIG-CFV4AV 重点产品维护(新)end // 20221020 ljh SWAG-CJ98AJ start InsAfterDel.suitDepartment__c = ass.mpdrdd.suitDepartment__c; InsAfterDel.suitDepartment_Old__c = ass.Prod.suitDepartment__c; // 20221020 ljh SWAG-CJ98AJ end } when 'GuranteeMain'{ //InsAfterDel.RecordTypeName__c = 'GuranteeMain'; InsAfterDel.RecordTypeId = Schema.SObjectType.Maintenance_Product_Data_Details__c.getRecordTypeInfosByDeveloperName().get('GuranteeMain').getRecordTypeId(); InsAfterDel.Entend_gurantee_period__c=ass.mpdrdd.Entend_gurantee_period__c; InsAfterDel.Gurantee_Start_Date__c=ass.mpdrdd.Gurantee_Start_Date__c; InsAfterDel.GuranteeType__c=ass.mpdrdd.GuranteeType__c; InsAfterDel.Gurantee_End_Date__c=ass.mpdrdd.Gurantee_End_Date__c; InsAfterDel.CanNotCancelledGurantee__c=ass.mpdrdd.CanNotCancelledGurantee__c;//20201012 ljh CHAN-BTR67N add //多年保修类型[服务/市场]不同时老数据公式字段 Integer Entend_gurantee_period_all = ass.Prod.Entend_gurantee_period_all__c.intValue(); InsAfterDel.Entend_gurantee_period_Old__c = null; if(Entend_gurantee_period_all==2){InsAfterDel.Entend_gurantee_period_Old__c='两年';} if(Entend_gurantee_period_all==3){InsAfterDel.Entend_gurantee_period_Old__c='三年';} if(Entend_gurantee_period_all==4){InsAfterDel.Entend_gurantee_period_Old__c='四年';} if(Entend_gurantee_period_all==5){InsAfterDel.Entend_gurantee_period_Old__c='五年';} InsAfterDel.Gurantee_Start_Date_Old__c=ass.Prod.Gurantee_Start_Date_F__c; InsAfterDel.GuranteeType_Old__c=ass.Prod.GuranteeType__c; InsAfterDel.Gurantee_End_Date_Old__c=ass.Prod.Gurantee_End_Date_F__c ; // 20211103 ljh WLIG-BXE443 InsAfterDel.CanNotCancelledGurantee_Old__c=ass.Prod.CanNotCancelledGurantee__c ;//20201012 ljh CHAN-BTR67N add //多年保类型相关有变化就清空价格 InsAfterDel.Maintenance_Price_Year__c = ass.Prod.Maintenance_Price_Year__c; //2021/01/19 liying start InsAfterDel.Virtual_Contract__c =ass.Prod.Virtual_Contract__c; //2021/01/19 liying end InsAfterDel.Intra_Trade_Gurantee_RMB__c =ass.Prod.Intra_Trade_Gurantee_RMB__c ; InsAfterDel.Intra_Trade_Service_RMB__c=ass.Prod.Intra_Trade_Service_RMB__c; //维修合同报价 InsAfterDel.Maintenance_Price_Year_Old__c = ass.Prod.Maintenance_Price_Year__c; //多年保修计提价格与NoDiscount价格 //2021/01/19 liying start InsAfterDel.Virtual_Contract_Old__c =ass.Prod.Virtual_Contract__c ; //2021/01/19 liying end InsAfterDel.Intra_Trade_Gurantee_RMB_Old__c =ass.Prod.Intra_Trade_Gurantee_RMB__c ; InsAfterDel.Intra_Trade_Service_RMB_Old__c=ass.Prod.Intra_Trade_Service_RMB__c; //Intra_Trade_Service_RMB_DateFrom_Old__c InsAfterDel.Intra_Trade_Service_RMB_DateFrom_Old__c = ass.Prod.Intra_Trade_Service_RMB_Date1__c; //Intra_Trade_Gurantee_RMB_DateFrom_Old__c InsAfterDel.Intra_Trade_Gurantee_RMB_DateFrom_Old__c = ass.Prod.Intra_Trade_Gurantee_RMB_Date1__c; } when 'GuranteePrice'{ //InsAfterDel.RecordTypeName__c = 'GuranteePrice'; InsAfterDel.RecordTypeId = Schema.SObjectType.Maintenance_Product_Data_Details__c.getRecordTypeInfosByDeveloperName().get('GuranteePrice').getRecordTypeId(); if(ass.Prod.GuranteeType__c==null||ass.Prod.GuranteeType__c.length()==0){ if ((ass.mpdrdd.Intra_Trade_Service_RMB__c != null && ass.mpdrdd.Intra_Trade_Service_RMB__c.format() != '0') || (ass.mpdrdd.Intra_Trade_Gurantee_RMB__c != null && ass.mpdrdd.Intra_Trade_Gurantee_RMB__c.format() != '0') || (ass.mpdrdd.Maintenance_Price_Year__c != null && ass.mpdrdd.Maintenance_Price_Year__c.format() != '0') ){ isWarning = true; contentWarning = '产品编码:【'+ass.Prod.ProductCode_Ext__c+'】多年保类型是【空】时,NoDiscount价格、多年保修计提价格、维修合同报价必须为空!'; } }else{ if(ass.Prod.GuranteeType__c.equals('市场')){ if(ass.mpdrdd.Intra_Trade_Service_RMB__c==null ||ass.mpdrdd.Intra_Trade_Gurantee_RMB__c==null ||ass.mpdrdd.Maintenance_Price_Year__c==null){ isWarning = true; contentWarning = '产品编码:【'+ass.Prod.ProductCode_Ext__c+'】多年保类型是【市场】时,必须填写NoDiscount价格、多年保修计提价格以及维修合同报价!'; } } if(ass.Prod.GuranteeType__c.equals('服务')){ if((ass.mpdrdd.Intra_Trade_Service_RMB__c !=null&& ass.mpdrdd.Intra_Trade_Service_RMB__c.format() !='0') ||ass.mpdrdd.Intra_Trade_Gurantee_RMB__c==null ||ass.mpdrdd.Maintenance_Price_Year__c==null){ isWarning = true; if(ass.mpdrdd.Intra_Trade_Gurantee_RMB__c==null ||ass.mpdrdd.Maintenance_Price_Year__c==null){ contentWarning = '产品编码:【'+ass.Prod.ProductCode_Ext__c+'】多年保类型是【服务】时,必须填写多年保修计提价格、维修合同报价!'; } if(ass.mpdrdd.Intra_Trade_Service_RMB__c !=null && ass.mpdrdd.Intra_Trade_Service_RMB__c.format() !='0'){ contentWarning = '产品编码:【'+ass.Prod.ProductCode_Ext__c+'】多年保类型是【服务】时,NoDiscount价格必须为空!'; } } } } if(isWarning){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, contentWarning)); //return null; }else{ InsAfterDel.Intra_Trade_Service_RMB__c=ass.mpdrdd.Intra_Trade_Service_RMB__c; //2021/01/19 liying start InsAfterDel.Virtual_Contract__c =ass.mpdrdd.Virtual_Contract__c ; //2021/01/19 liying end InsAfterDel.Intra_Trade_Gurantee_RMB__c =ass.mpdrdd.Intra_Trade_Gurantee_RMB__c ; InsAfterDel.Maintenance_Price_Year__c = ass.mpdrdd.Maintenance_Price_Year__c; } //维修合同报价 InsAfterDel.Maintenance_Price_Year_Old__c = ass.Prod.Maintenance_Price_Year__c; //多年保修计提价格与NoDiscount价格 //2021/01/19 liying start InsAfterDel.Virtual_Contract_Old__c =ass.Prod.Virtual_Contract__c; //2021/01/19 liying end InsAfterDel.Intra_Trade_Gurantee_RMB_Old__c =ass.Prod.Intra_Trade_Gurantee_RMB__c; InsAfterDel.Intra_Trade_Service_RMB_Old__c=ass.Prod.Intra_Trade_Service_RMB__c; //Intra_Trade_Service_RMB_DateFrom_Old__c InsAfterDel.Intra_Trade_Service_RMB_DateFrom_Old__c = ass.Prod.Intra_Trade_Service_RMB_Date1__c; //Intra_Trade_Gurantee_RMB_DateFrom_Old__c InsAfterDel.Intra_Trade_Gurantee_RMB_DateFrom_Old__c = ass.Prod.Intra_Trade_Gurantee_RMB_Date1__c; } when 'RepairInfo'{ //InsAfterDel.RecordTypeName__c = 'RepairInfo'; InsAfterDel.RecordTypeId = Schema.SObjectType.Maintenance_Product_Data_Details__c.getRecordTypeInfosByDeveloperName().get('RepairInfo').getRecordTypeId(); InsAfterDel.RepairListPriceLevelA__c=ass.mpdrdd.RepairListPriceLevelA__c; InsAfterDel.RepairListPriceLevelB__c=ass.mpdrdd.RepairListPriceLevelB__c; InsAfterDel.RepairListPriceLevelC__c=ass.mpdrdd.RepairListPriceLevelC__c; InsAfterDel.CanRepairAccsessary__c=ass.mpdrdd.CanRepairAccsessary__c; InsAfterDel.Repair_Product_Code__c=ass.mpdrdd.Repair_Product_Code__c; InsAfterDel.PartSupplyFinishDate__c=ass.mpdrdd.PartSupplyFinishDate__c; InsAfterDel.Maintenance_Price_Year__c=ass.mpdrdd.Maintenance_Price_Year__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 Star InsAfterDel.Can_Repair__c=ass.mpdrdd.Can_Repair__c; InsAfterDel.Service_Category1__c=ass.mpdrdd.Service_Category1__c; InsAfterDel.Service_Category2__c=ass.mpdrdd.Service_Category2__c; InsAfterDel.Service_Category3__c=ass.mpdrdd.Service_Category3__c; InsAfterDel.Service_Category4__c=ass.mpdrdd.Service_Category4__c; InsAfterDel.Service_Category5__c=ass.mpdrdd.Service_Category5__c; InsAfterDel.Service_Category6__c=ass.mpdrdd.Service_Category6__c; InsAfterDel.Service_Category7__c=ass.mpdrdd.Service_Category7__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 End //old数据 InsAfterDel.PartSupplyFinishDate_Old__c=ass.Prod.PartSupplyFinishDate__c; InsAfterDel.RepairListPriceLevelA_Old__c=ass.Prod.RepairListPriceLevelA__c; InsAfterDel.RepairListPriceLevelB_Old__c=ass.Prod.RepairListPriceLevelB__c; InsAfterDel.RepairListPriceLevelC_Old__c=ass.Prod.RepairListPriceLevelC__c; InsAfterDel.CanRepairAccsessary_Old__c=ass.Prod.CanRepairAccsessary__c; InsAfterDel.Repair_Product_Code_Old__c=ass.Prod.Repair_Product_Code__c; InsAfterDel.Maintenance_Price_Year_Old__c=ass.Prod.Maintenance_Price_Year__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 Star InsAfterDel.Can_Repair_Old__c=ass.Prod.Can_Repair__c; InsAfterDel.Service_Category1_Old__c=ass.Prod.Service_Category1__c; InsAfterDel.Service_Category2_Old__c=ass.Prod.Service_Category2__c; InsAfterDel.Service_Category3_Old__c=ass.Prod.Service_Category3__c; InsAfterDel.Service_Category4_Old__c=ass.Prod.Service_Category4__c; InsAfterDel.Service_Category5_Old__c=ass.Prod.Service_Category5__c; InsAfterDel.Service_Category6_Old__c=ass.Prod.Service_Category6__c; InsAfterDel.Service_Category7_Old__c=ass.Prod.Service_Category7__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 End } when 'EquipmentInfo'{ //InsAfterDel.RecordTypeName__c = 'EquipmentInfo'; InsAfterDel.RecordTypeId = Schema.SObjectType.Maintenance_Product_Data_Details__c.getRecordTypeInfosByDeveloperName().get('EquipmentInfo').getRecordTypeId(); InsAfterDel.Asset_loaner_category__c = ass.mpdrdd.Asset_loaner_category__c; InsAfterDel.Special_Model__c = ass.mpdrdd.Special_Model__c; InsAfterDel.Fixture_Model_No__c = ass.mpdrdd.Fixture_Model_No__c; InsAfterDel.Packing_list_Fixture__c = ass.mpdrdd.Packing_list_Fixture__c; InsAfterDel.Default_Fixture_Arrival_Process__c = ass.mpdrdd.Default_Fixture_Arrival_Process__c; InsAfterDel.Default_Fixture_Arrival_Product__c = ass.mpdrdd.Default_Fixture_Arrival_Product__c; //old数据 InsAfterDel.Asset_loaner_category_Old__c = ass.Prod.Asset_loaner_category__c; InsAfterDel.Special_Model_Old__c = ass.Prod.Special_Model__c; InsAfterDel.Fixture_Model_No_Old__c = ass.Prod.Fixture_Model_No__c; InsAfterDel.Packing_list_Fixture_Old__c = ass.Prod.Packing_list_Fixture__c; InsAfterDel.Default_Fixture_Arrival_Process_Old__c = ass.Prod.Default_Fixture_Arrival_Process__c; InsAfterDel.Default_Fixture_Arrival_Product_Old__c = ass.Prod.Default_Fixture_Arrival_Product__c; } } i++; InsAfterDel.Id = ass.mpdrdd.Id; Ins.add(InsAfterDel); } } if(isWarning){ return null; }else{ if(Ins.size()>0){ upsert Ins; return setEditAble(); }else{ return null; } } } }catch(Exception e){ ApexPages.addMessages(e); Database.rollback(sp); return null; } } public PageReference UpdateSave() { List Ins = New List(); try{ if(mpdDetailsRecords.size()>0){ List GuranteeTyped = new List(); Boolean CanNotCancelledGurantee0 = false; //System.debug('===:'+mpdDetailsRecords[0]); for (MpdDetailsInfo assType : mpdDetailsRecords) { //20200618 类型一致不一致不能保存 add start switch on RecordTypeName { when 'GuranteeMain'{ if(assType.mpded.GuranteeType__c !=null&&!GuranteeTyped.contains(assType.mpded.GuranteeType__c)){ GuranteeTyped.add(assType.mpded.GuranteeType__c); } if(assType.mpded.CanNotCancelledGurantee__c){ CanNotCancelledGurantee0 = true; } } } //20200618 类型一致不一致不能保存 add END } system.debug('GuranteeTyped:'+GuranteeTyped); if(GuranteeTyped.size()>1){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '保存失败,所有多年保修类型选择保持一致!')); return null; }else if(((GuranteeTyped.size()==1&&!GuranteeTyped[0].equals('市场'))||GuranteeTyped.size()==0)&&CanNotCancelledGurantee0){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '多年保类型是市场的时候,才可以勾选不可取消多年保修!')); return null; }else{ Boolean isWarning = false; String contentWarning = ''; for (MpdDetailsInfo ass : mpdDetailsRecords){ //if(ass.check == true){ Maintenance_Product_Data_Details__c upMpd = new Maintenance_Product_Data_Details__c(); upMpd.Id = ass.mpded.Id; switch on RecordTypeName { when 'ImportantProduct'{ //upMpd.Tier1_Category__c = ass.mpded.Tier1_Category__c; upMpd.ENG_DeaerProFlag__c = ass.mpded.ENG_DeaerProFlag__c; upMpd.Dealer_special_Object__c = ass.mpded.Dealer_special_Object__c; upMpd.Key_product_147P__c = ass.mpded.Key_product_147P__c; upMpd.Important_Endopartner_product__c = ass.mpded.Important_Endopartner_product__c; // FY23修改 WLIG-CFV4AV 重点产品维护(新)start upMpd.Key_product_155P__c = ass.mpded.Key_product_155P__c; upMpd.Celon_Product__c = ass.mpded.Celon_Product__c; // FY23修改 WLIG-CFV4AV 重点产品维护(新)end // 20221020 ljh SWAG-CJ98AJ start upMpd.suitDepartment__c = ass.mpded.suitDepartment__c; // 20221020 ljh SWAG-CJ98AJ end } when 'GuranteeMain'{ upMpd.Entend_gurantee_period__c=ass.mpded.Entend_gurantee_period__c; upMpd.Gurantee_Start_Date__c=ass.mpded.Gurantee_Start_Date__c; upMpd.GuranteeType__c=ass.mpded.GuranteeType__c; upMpd.Gurantee_End_Date__c=ass.mpded.Gurantee_End_Date__c; upMpd.CanNotCancelledGurantee__c=ass.mpded.CanNotCancelledGurantee__c;//20201012 ljh CHAN-BTR67N add if(mpd.Status__c.equals('服务填写')){ // Boolean isWarning = false; // String contentWarning = ''; if (ass.mpded.GuranteeType__c == null || ass.mpded.GuranteeType__c.length() == 0) { if ((ass.mpded.Intra_Trade_Service_RMB__c != null && ass.mpded.Intra_Trade_Service_RMB__c.format() != '0') || (ass.mpded.Intra_Trade_Gurantee_RMB__c != null && ass.mpded.Intra_Trade_Gurantee_RMB__c.format() != '0') || (ass.mpded.Maintenance_Price_Year__c != null && ass.mpded.Maintenance_Price_Year__c.format() != '0') ) { isWarning = true; contentWarning = '多年保类型是【空】时,NoDiscount价格、多年保修计提价格、维修合同报价必须为空!'; } }else{ if(ass.mpded.GuranteeType__c.equals('市场')){ if(ass.mpded.Intra_Trade_Service_RMB__c==null ||ass.mpded.Intra_Trade_Gurantee_RMB__c==null ||ass.mpded.Maintenance_Price_Year__c==null){ isWarning = true; contentWarning = '多年保类型是【市场】时,必须填写NoDiscount价格、多年保修计提价格以及维修合同报价!'; } } if(ass.mpded.GuranteeType__c.equals('服务')){ if((ass.mpded.Intra_Trade_Service_RMB__c !=null && ass.mpded.Intra_Trade_Service_RMB__c.format() !='0') ||ass.mpded.Intra_Trade_Gurantee_RMB__c==null ||ass.mpded.Maintenance_Price_Year__c==null){ isWarning = true; if(ass.mpded.Intra_Trade_Service_RMB__c !=null && ass.mpded.Intra_Trade_Service_RMB__c.format() !='0'){ contentWarning = '多年保类型是【服务】时,NoDiscount价格必须为空!'; } if(ass.mpded.Intra_Trade_Gurantee_RMB__c==null ||ass.mpded.Maintenance_Price_Year__c==null){ contentWarning = '多年保类型是【服务】时,必须填写多年保修计提价格、维修合同报价!'; } } } } if(isWarning){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, contentWarning)); //return null; }else{ //维修合同报价 upMpd.Maintenance_Price_Year__c = ass.mpded.Maintenance_Price_Year__c; //多年保修计提价格与NoDiscount价格 //2021/01/19 liying start upMpd.Virtual_Contract__c =ass.mpded.Virtual_Contract__c; //2021/01/19 liying end upMpd.Intra_Trade_Gurantee_RMB__c =ass.mpded.Intra_Trade_Gurantee_RMB__c ; upMpd.Intra_Trade_Service_RMB__c=ass.mpded.Intra_Trade_Service_RMB__c; } } } when 'GuranteePrice'{ // Boolean isWarning = false; // String contentWarning = ''; if (ass.mpded.GuranteeTypeP__c == null || ass.mpded.GuranteeTypeP__c.length() == 0) { if ((ass.mpded.Intra_Trade_Service_RMB__c != null && ass.mpded.Intra_Trade_Service_RMB__c.format() != '0') || (ass.mpded.Intra_Trade_Gurantee_RMB__c != null && ass.mpded.Intra_Trade_Gurantee_RMB__c.format() != '0') || (ass.mpded.Maintenance_Price_Year__c != null && ass.mpded.Maintenance_Price_Year__c.format() != '0') ) { isWarning = true; contentWarning = '产品编码:【'+ass.mpded.ProductCode_Ext__c+'】多年保类型是【空】时,NoDiscount价格、多年保修计提价格、维修合同报价必须为空!'; } }else{ if(ass.mpded.GuranteeTypeP__c.equals('市场')){ if(ass.mpded.Intra_Trade_Service_RMB__c==null ||ass.mpded.Intra_Trade_Gurantee_RMB__c==null ||ass.mpded.Maintenance_Price_Year__c==null){ isWarning = true; contentWarning = '产品编码:【'+ass.mpded.ProductCode_Ext__c+'】多年保类型是【市场】时,必须填写NoDiscount价格、多年保修计提价格以及维修合同报价!'; } } if(ass.mpded.GuranteeTypeP__c.equals('服务')){ if((ass.mpded.Intra_Trade_Service_RMB__c !=null&&ass.mpded.Intra_Trade_Service_RMB__c.format() !='0') ||ass.mpded.Intra_Trade_Gurantee_RMB__c==null ||ass.mpded.Maintenance_Price_Year__c==null){ isWarning = true; if(ass.mpded.Intra_Trade_Service_RMB__c !=null && ass.mpded.Intra_Trade_Service_RMB__c.format() !='0'){ contentWarning = '产品编码:【'+ass.mpded.ProductCode_Ext__c+'】多年保类型是【服务】时,NoDiscount价格必须为空!'; } if(ass.mpded.Intra_Trade_Gurantee_RMB__c==null ||ass.mpded.Maintenance_Price_Year__c==null){ contentWarning = '产品编码:【'+ass.mpded.ProductCode_Ext__c+'】多年保类型是【服务】时,必须填写多年保修计提价格、维修合同报价!'; } } } } if(isWarning){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, contentWarning)); }else{ //维修合同报价 upMpd.Maintenance_Price_Year__c = ass.mpded.Maintenance_Price_Year__c; //多年保修计提价格与NoDiscount价格 //2021/01/19 liying start upMpd.Virtual_Contract__c =ass.mpded.Virtual_Contract__c ; //2021/01/19 liying end upMpd.Intra_Trade_Gurantee_RMB__c =ass.mpded.Intra_Trade_Gurantee_RMB__c ; upMpd.Intra_Trade_Service_RMB__c=ass.mpded.Intra_Trade_Service_RMB__c; } } when 'RepairInfo'{ upMpd.RepairListPriceLevelA__c=ass.mpded.RepairListPriceLevelA__c; upMpd.RepairListPriceLevelB__c=ass.mpded.RepairListPriceLevelB__c; upMpd.RepairListPriceLevelC__c=ass.mpded.RepairListPriceLevelC__c; upMpd.CanRepairAccsessary__c=ass.mpded.CanRepairAccsessary__c; upMpd.Repair_Product_Code__c=ass.mpded.Repair_Product_Code__c; upMpd.PartSupplyFinishDate__c=ass.mpded.PartSupplyFinishDate__c; upMpd.Maintenance_Price_Year__c=ass.mpded.Maintenance_Price_Year__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 Star upMpd.Can_Repair__c=ass.mpded.Can_Repair__c; upMpd.Service_Category1__c=ass.mpded.Service_Category1__c; upMpd.Service_Category2__c=ass.mpded.Service_Category2__c; upMpd.Service_Category3__c=ass.mpded.Service_Category3__c; upMpd.Service_Category4__c=ass.mpded.Service_Category4__c; upMpd.Service_Category5__c=ass.mpded.Service_Category5__c; upMpd.Service_Category6__c=ass.mpded.Service_Category6__c; upMpd.Service_Category7__c=ass.mpded.Service_Category7__c; //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210831 End } when 'EquipmentInfo'{ upMpd.Asset_loaner_category__c = ass.mpded.Asset_loaner_category__c; upMpd.Special_Model__c = ass.mpded.Special_Model__c; upMpd.Fixture_Model_No__c = ass.mpded.Fixture_Model_No__c; upMpd.Packing_list_Fixture__c = ass.mpded.Packing_list_Fixture__c; upMpd.Default_Fixture_Arrival_Process__c = ass.mpded.Default_Fixture_Arrival_Process__c; upMpd.Default_Fixture_Arrival_Product__c = ass.mpded.Default_Fixture_Arrival_Product__c; } } Ins.add(upMpd); } if(isWarning){ return null; }else{ if(Ins.size()>0){ update Ins; return UnabletoEdit(); } else{ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请先追加数据到产品主数据维护!')); return null; } } } }else{ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '请先追加数据到产品主数据维护!')); return null; } }catch(Exception e){ ApexPages.addMessages(e); return null ; } } public PageReference deleteMpdd(){ List deleteRecords2 = [select Id FROM Maintenance_Product_Data_Details__c WHERE id = :mpddId]; if(deleteRecords2.size() >0){ delete deleteRecords2; } return setEditAble(); } // 返回不可编辑状态 public PageReference UnabletoEdit(){ PageReference ref = new Pagereference('/apex/MaintenanceProductData?id='+id); ref.setRedirect(true); return ref; } // 编辑按钮 public PageReference setEditAble(){ statusEdit = 'Redirect'; String url = '/apex/MaintenanceProductData?id='+id+'&KeyWords='+statusEdit; if(String.isNotBlank(searchCateName)){ url += '&searchCateName='+searchCateName; } if(String.isNotBlank(searchProductCodeExt)){ url += '&searchProductCodeExt='+searchProductCodeExt; } if(RecordTypeName.equals('GuranteeMain')||RecordTypeName.equals('GuranteePrice')){ if(String.isNotBlank(searchGuranteeType)){ url += '&searchGuranteeType='+searchGuranteeType; } }else{ if(!String.isBlank(category1)){ url += '&category1='+category1; } if(!String.isBlank(category2)){ url += '&category2='+category2; } if(!String.isBlank(category3)){ url += '&category3='+category3; } if(!String.isBlank(category4)){ url += '&category4='+category4; } if(!String.isBlank(category5)){ url += '&category5='+category5; } } PageReference ref = new Pagereference(url); ref.setRedirect(true); return ref; } //上传附件 // 20231103 陈京武 Lightning文件修改 Start public PageReference FilesUpload(){ PageReference ref = new Pagereference('/p/attach/NoteAttach?pid='+id+'&retURL=%2F' + '/apex/MaintenanceProductData?id=' +id); ref.setRedirect(true); return ref; } public PageReference FilesUploadLightning(){ // PageReference ref = new Pagereference('/p/attach/NoteAttach?pid='+id+'&retURL=%2F' + '/apex/MaintenanceProductData?id=' +id); // ref.setRedirect(true); // return ref; PageReference ref = new Pagereference('/lightning/n/LexUploadPage?0.recordId='+id+''); ref.setRedirect(true); return ref; } // 20231103 陈京武 Lightning文件修改 Start // 提交按钮 public PageReference Submitmpd() { //List qs = New List(); Maintenance_Product_Data__c mpdJuge= [SELECT Id,Name,RecordTypeId, RecordType.Name,RecordType.DeveloperName, RepairListPriceLevelA_Sum__c,RepairListPriceLevelB_Sum__c,RepairListPriceLevelC_Sum__c,Intra_Trade_Service_RMB_Sum__c, Status__c,ApplyPersion__c,applyDate__c,GuranteeType_Sum__c,Intra_Trade_Gurantee_RMB_Sum__c,BuchangApprovalRecommend__c, ServiceWritePersion__c,Maintenance_Price_Year_Sum__c,CreatedDate, CreatedById FROM Maintenance_Product_Data__c where Id = :id]; Integer tempRepairInfo = 0,tempGuranteeMainPrice = 0; tempRepairInfo = mpdJuge.RepairListPriceLevelA_Sum__c.intValue()+mpdJuge.RepairListPriceLevelB_Sum__c.intValue()+mpdJuge.RepairListPriceLevelC_Sum__c.intValue()+mpdJuge.Maintenance_Price_Year_Sum__c.intValue(); tempGuranteeMainPrice = mpdJuge.Intra_Trade_Service_RMB_Sum__c.intValue()+ mpdJuge.Intra_Trade_Gurantee_RMB_Sum__c.intValue()+mpdJuge.Maintenance_Price_Year_Sum__c.intValue(); //检查应该有附件的是否有附件 if(RecordTypeName.equals('GuranteePrice') && tempGuranteeMainPrice > 0 &&AttachmentRecoeds.size()==0){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '还没有上传附件,请上传附件!')); return null; }else if(RecordTypeName.equals('RepairInfo') && tempRepairInfo > 0 && AttachmentRecoeds.size()==0){ //RepairInfo ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '还没有上传附件,请上传附件!')); return null; //服务填写价格故提交时不需要判断 /*}else if(RecordTypeName.equals('GuranteeMain') && tempGuranteeMainPrice > 0 &&AttachmentRecoeds.size()==0){ //GuranteeMain ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '还没有上传附件,请上传附件!')); return null;*/ }else{ Savepoint sp = Database.setSavepoint(); Map prodMap = new Map(); Maintenance_Product_Data__c P = new Maintenance_Product_Data__c(); P = new Maintenance_Product_Data__c(); p.Id=id; //p.applyDate__c = Date.today(); p.applyDate__c = Datetime.now(); p.Status__c = '已提交'; p.ApplyPersion__c = UserInfo.getUserId(); User loginUser = [SELECT Id, Name, SalesManager__c, JingliApprovalManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c, TongkuoZongjian__c FROM User WHERE Id = :UserInfo.getUserId()]; //p.BuchangApprovalRecommend__c =loginUser.BuchangApprovalManagerSales__c == null?UserInfo.getUserId():loginUser.BuchangApprovalManagerSales__c; //申请人的部长 p.BuchangApprovalRecommend__c =loginUser.BuchangApprovalManagerSales__c; try{ if(loginUser.BuchangApprovalManagerSales__c != null){ //共享给相应的部长 /*Maintenance_Product_Data__Share mpdShare = new Maintenance_Product_Data__Share(); mpdShare.UserOrGroupId = ml.Engagement__c;//需要共享给的用户 or 小组 mpdShare.ParentId = ml.id;//记录id mpdShare.AccessLevel = 'edit'; //edit:读写/read:只读 list_share.add(share);*/ Maintenance_Product_Data__Share mpdShare = new Maintenance_Product_Data__Share(UserOrGroupId=p.BuchangApprovalRecommend__c, ParentId=p.Id, AccessLevel='Edit'); insert mpdShare; update p; }else{ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '对不起,您无权提交!')); return null; } }catch(Exception e){ ApexPages.addmessages(e); } try { Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); psr.setObjectId(id); psr.setSubmitterId(UserInfo.getUserId()); if(RecordTypeName.equals('GuranteeMain')){ psr.setProcessDefinitionNameOrId('MaintenanceProductDataApprovalProcess1'); } else if(RecordTypeName !=null){ psr.setProcessDefinitionNameOrId('MaintenanceProductDataApprovalProcess'); } Approval.ProcessResult submitResult = Approval.process(psr); if(submitResult.isSuccess()){ return returnMpdPage(); }else{ //return returnMpdPage1(); //提醒没有成功进审批流 ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '未成功提交,请稍后再试!')); return null; } } catch (Exception e) { //ApexPages.addmessages(e); Database.rollback(sp); return null; } } } public PageReference returnMpdPage(){ PageReference ref; if(String.isBlank(id)){ // 20231103 陈京武 Lightning文件修改 Start // ref = new Pagereference(ApexPages.currentPage().getParameters().get('retURL')); ref = new Pagereference('/lightning/o/Maintenance_Product_Data__c/list?filterName=Recent'); // 20231103 陈京武 Lightning文件修改 End }else{ ref = new Pagereference('/'+id); } ref.setRedirect(true); return ref; } //搜索时的sql public String makeSoql(String Family,String Category2,String Category3,String Category4,String Category5,String CateName,String ProductCode_Ext,String GuranteeType){ /*String sqlTail_s = '(\''; for(Integer i = 0 ; i< dataselectedId_s.size();i++){ if(i getPlickList(String objApi, String fieldApi) { Schema.DescribeFieldResult fieldResult = Schema.getGlobalDescribe().get(objApi).getDescribe().fields.getMap().get(fieldApi).getDescribe(); List pickListValuesList= new List(); List ple = fieldResult.getPicklistValues(); pickListValuesList.add(new SelectOption('', NONE)); for( Schema.PicklistEntry pickListVal : ple){ pickListValuesList.add(new SelectOption(pickListVal.getValue(), pickListVal.getLabel())); } return pickListValuesList; } public List getKeyProduct147POps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Key_product_147P__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } // FY23修改 WLIG-CFV4AV 重点产品维护(新)start public List getKeyProduct155POps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Key_product_155P__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getCelonProductOps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Celon_Product__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } // FY23修改 WLIG-CFV4AV 重点产品维护(新)end public List getGuranteeTypeOps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'GuranteeType__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getEntendGuranteePeriodOps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Entend_gurantee_period__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getDefaultFixtureArrivalProcessOps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Default_Fixture_Arrival_Process__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getAssetLoanerCategoryOps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Asset_loaner_category__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 Star public List getCanRepairOps() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Can_Repair__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getServiceCategory1() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Service_Category1__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getServiceCategory2() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Service_Category2__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getServiceCategory3() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Service_Category3__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getServiceCategory4() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Service_Category4__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } public List getServiceCategory5() { List options = getPlickList('Maintenance_Product_Data_Details__c', 'Service_Category5__c'); // 显示为空白,值为'x',适用时保持原样 options.add(0, new SelectOption('x','')); return options; } //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 End class MaintenanceProductDataDetailsInfo { public Boolean check { get; set; } public Boolean oldCheck { get; set; } public Boolean canSelect { get; set; } public Product2 Prod { get; set; } public Maintenance_Product_Data_Details__c mpdrdd {get; set;} // 20231103 chenjingwu Lightning文件修改 Start public ContentDocument Concc { get; set; } // 20231103 chenjingwu Lightning文件修改 End public MaintenanceProductDataDetailsInfo(Maintenance_Product_Data_Details__c e) { check = true; oldCheck = true; mpdrdd = e; Prod = e.ProductsID__r; canSelect = true; } public MaintenanceProductDataDetailsInfo(Product2 e) { check = false; oldCheck = false; mpdrdd = new Maintenance_Product_Data_Details__c(); Prod = e; canSelect = true; } //附件 // 20231103 chenjingwu Lightning文件修改 Start public MaintenanceProductDataDetailsInfo(ContentDocument e) { Concc = e; } // 20231103 chenjingwu Lightning文件修改 End } class MpdDetailsInfo { public Boolean check { get; set; } public Boolean oldCheck { get; set; } public Boolean canSelect { get; set; } public Maintenance_Product_Data_Details__c mpded {get; set;} public MpdDetailsInfo(Maintenance_Product_Data_Details__c e) { check = true; oldCheck = true; mpded = e; canSelect = false; } } }