.husky/pre-commit
File was deleted force-app/main/default/classes/SelectSubstituteControllerLWT.cls
New file @@ -0,0 +1,633 @@ public with sharing class SelectSubstituteControllerLWT { public SelectSubstituteControllerLWT() { } @AuraEnabled public static InitData initFromSelectSubstituteButton(String recordId){ InitData res = new InitData(); try{ Rental_Apply_Equipment_Set__c report=[select Id,Rental_Apply__r.Status__c,Rental_Apply__r.Id from Rental_Apply_Equipment_Set__c where Id= :recordId]; res.id=report.Id; res.RentalApplyId=report.Rental_Apply__r.Id; res.Status=report.Rental_Apply__r.Status__c; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return res; } @AuraEnabled public static Rental_Apply_Equipment_Set__c initFromCustomSubmitButton(String recordId){ try{ Rental_Apply_Equipment_Set__c report=[select Id,Request_extend_day__c ,Extend_request_reason__c ,Rental_End_Date__c, Rental_Apply__c from Rental_Apply_Equipment_Set__c where Id= :recordId]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static InitData initFromLoanerArrangedEmailLButton(String recordId){ InitData res = new InitData(); try{ Rental_Apply_Equipment_Set__c report=[select Id,Rental_Apply__r.Status__c,Rental_Apply__c,Rental_Apply__r.Wei_Assigned_Cnt__c, Assigned_Not_Shipment__c,Rental_Apply__r.Bollow_Date__c from Rental_Apply_Equipment_Set__c where Id= :recordId]; res.id=report.Id; res.RentalApplyC=report.Rental_Apply__c; res.Status=report.Rental_Apply__r.Status__c; res.WeiAssignedCntC=report.Rental_Apply__r.Wei_Assigned_Cnt__c; res.BollowDateC=report.Rental_Apply__r.Bollow_Date__c; res.AssignedNotShipmentC=report.Assigned_Not_Shipment__c; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return res; } @AuraEnabled public static InitData initClearReturnDeliverySlipButton(String recordId){ InitData res = new InitData(); try{ Rental_Apply_Equipment_Set__c report=[select Id,Rental_Apply__r.Status__c,Rental_Apply__c,Rental_Apply__r.Wei_Assigned_Cnt__c, Assigned_Not_Shipment__c,Rental_Apply__r.Bollow_Date__c from Rental_Apply_Equipment_Set__c where Id= :recordId]; res.id=report.Id; res.RentalApplyC=report.Rental_Apply__c; res.Status=report.Rental_Apply__r.Status__c; res.WeiAssignedCntC=report.Rental_Apply__r.Wei_Assigned_Cnt__c; res.BollowDateC=report.Rental_Apply__r.Bollow_Date__c; res.AssignedNotShipmentC=report.Assigned_Not_Shipment__c; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return res; } @AuraEnabled public static Rental_Apply_Equipment_Set__c selectRentalApplyEquipmentSetByID(String recordId){ try{ Rental_Apply_Equipment_Set__c report=[select Cancel_Select__c,Irreplaceable_flag__c,RAES_Status__c,Shippment_loaner_time2__c from Rental_Apply_Equipment_Set__c where Id=:recordId]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Rental_Apply_Equipment_Set_Detail__c> selectRentalApplyEquipmentSetByRACID(String recordId){ try{ list<Rental_Apply_Equipment_Set_Detail__c> report=[select Allow_Adjust_Queue_Flag__c from Rental_Apply_Equipment_Set_Detail__c where Rental_Apply__c = :recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Rental_Apply__c> selectRentalApplyCByName(String recordId){ try{ list<Rental_Apply__c> report=[select Id,Campaign__c,Repair__c,Status__c, Demo_purpose1__c,Contract_pdf_updated__c,Repair_Final_Inspection_Date_F__c,RC_return_to_office__c from Rental_Apply__c where id=:recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Campaign> selectCampaignById(String recordId){ try{ list<Campaign> report=[select Status, Rental_Apply_Flag__c,IF_Approved__c,Meeting_Approved_No__c,Approved_Status__c from Campaign where id =:recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static String getSessionId(){ return UserInfo.getSessionId(); } @AuraEnabled public static list<Rental_Apply_Equipment_Set__c> selectRaesById1(String recordId){ try{ list<Rental_Apply_Equipment_Set__c> report=[select Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and Shippment_loaner_time2__c != null and RAES_Status__c != '已分配' and RAES_Status__c != '取消分配' ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Rental_Apply_Equipment_Set__c> selectRaesById2(String recordId){ try{ list<Rental_Apply_Equipment_Set__c> report=[select Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and RAES_Status__c != '已分配' and RAES_Status__c != '取消分配' ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Rental_Apply__c> selectRacById(String recordId){ try{ list<Rental_Apply__c> report=[SELECT Id, JingliApprovalManager__c, SalesManager__c , BuchangApprovalManager__c , BuchangApprovalManagerSales__c , ZongjianApprovalManager__c FROM Rental_Apply__c WHERE Id = :recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static UpdateResult updateRaesc( String recordId, String JingliApprovalManagerc, String SalesManagerc, String BuchangApprovalManagerc, String BuchangApprovalManagerSalesc, String ZongjianApprovalManagerc, String ExtendStatusc ) { UpdateResult result = new UpdateResult(); result.recordId = recordId; try{ // 更新记录并获取结果 if(recordId==null) return null; Rental_Apply_Equipment_Set__c rac = new Rental_Apply_Equipment_Set__c( id=recordId); if(JingliApprovalManagerc!=null&& JingliApprovalManagerc != ''){ rac.JingliApprovalManager__c=JingliApprovalManagerc; } if(SalesManagerc!=null&&SalesManagerc!=''){ rac.SalesManager__c=SalesManagerc; } if(BuchangApprovalManagerc!=null&&BuchangApprovalManagerc!=''){ rac.BuchangApprovalManager__c=BuchangApprovalManagerc; } if(BuchangApprovalManagerSalesc!=null&&BuchangApprovalManagerSalesc!=''){ rac.BuchangApprovalManagerSales__c=BuchangApprovalManagerSalesc; } if(ZongjianApprovalManagerc!=null&&ZongjianApprovalManagerc!=''){ rac.ZongjianApprovalManager__c=ZongjianApprovalManagerc; } if(ExtendStatusc!=null&&ExtendStatusc!=''){ rac.Extend_Status__c=ExtendStatusc; } if(rac.id==null)return null; update rac; result.success = true; result.errors = new List<String>(); return result; }catch(Exception e){ result.success = false; result.errors = new List<String>(); result.errors.add(e.getMessage()); System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e); } return result; } @AuraEnabled public static UpdateResult updateRaescList( list<Rental_Apply_Equipment_Set_Detail__c> updateList ) { UpdateResult result = new UpdateResult(); try{ for(Rental_Apply_Equipment_Set_Detail__c item : updateList) { item.Return_DeliverySlip__c = null; item.Asset_return_time__c = null; } update updateList; result.success = true; result.errors = new List<String>(); return result; }catch(Exception e){ result.success = false; result.errors = new List<String>(); result.errors.add(e.getMessage()); System.debug(LoggingLevel.INFO,'Rental_Apply__c update Error : ' + e); } return result; } @AuraEnabled public static list<Rental_Apply_Equipment_Set_Detail__c> selectRaesdcId(String recordId){ try{ list<Rental_Apply_Equipment_Set_Detail__c> report=[Select Id From Rental_Apply_Equipment_Set_Detail__c Where Return_DeliverySlip__c != null AND Check_lost_Item_F__c = null AND Rental_Apply_Equipment_Set__c = :recordId AND Cancel_Select__c = false ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply_Equipment_Set__c Cancel Error : ' + e); } return null; } @AuraEnabled public static String approvalCheck(String rentalApplyId) { // check结果 String returnStr = ''; //1388 yc 20211021 跨区域分配不能出库 start String rasdid = ''; system.debug(rentalApplyId+'=='); if(String.isNotBlank(rentalApplyId) && rentalApplyId.indexOf(';') >= 0){//说明是从一览上触发的 rasdid = rentalApplyId.subString(rentalApplyId.indexOf(';') + 1); rentalApplyId = rentalApplyId.subString(0, rentalApplyId.indexOf(';')); } //1388 yc 20211021 跨区域分配不能出库 end //备品借出申请 Rental_Apply__c[] rentalApply = [select Id,repair__r.Repair_Final_Inspection_Date__c,Bollow_Date__c,repair__r.Return_Without_Repair_Date__c, CreatedDate,Rental_Apply_Equipment_Set_Cnt__c,Prepare_Day__c,Cross_Region_Assign__c, demo_purpose2__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c from Rental_Apply__c where Id = :rentalApplyId]; if (rentalApply.size() == 0) { returnStr = '没有备品借出申请,请确认。'; return returnStr; } Rental_Apply__c ra = rentalApply[0]; if (ra.Rental_Apply_Equipment_Set_Cnt__c <= 0) { returnStr = '没有借出备品set一览,请确认。'; return returnStr; } //1822 yc 20211111 start if(ra.demo_purpose2__c=='已购待货' && ra.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c!= null){ returnStr = '已购待货目的,新品已有发货日,不可出库指示'; return returnStr; } if(ra.demo_purpose2__c=='索赔QIS' && ra.next_action__c=='无偿更换' && ra.QIS_number__r.ReplaceDeliveryDate__c!= null){ returnStr = '索赔QIS目的,QIS已有新品发货日,不可出库指示'; return returnStr; } //1822 yc 20211111 end //*************************Insert 20160826 SWAG-AD59Z6 趙徳芳 Start*************************// if(Ra.repair__r.Repair_Final_Inspection_Date__c != null) { return '修理最终检测日不为空,不能做出库指示'; } if(Ra.repair__c!=null&&Ra.repair__r.Return_Without_Repair_Date__c != null) { return '未修理归还日不为空,不能做出库指示'; } //*************************Insert 20160826 SWAG-AD59Z6 趙徳芳 End***************************// //1388 yc 20211021 跨区域分配不能出库 start if(String.isNotBlank(ra.Cross_Region_Assign__c)){ String soql = 'select Id, Name,Rental_Apply__c,Internal_asset_location_before__c'; soql +=' from Rental_Apply_Equipment_Set_Detail__c'; soql +=' where Rental_Apply__c = \'' + ra.Id +'\''; soql +=' and Internal_asset_location_before__c !=null and Internal_asset_location_before__c != \'' + ra.Cross_Region_Assign__c+ '\''; if(String.isNotBlank(rasdid)){ soql +=' and Rental_Apply_Equipment_Set__c = :rasdid'; } List<Rental_Apply_Equipment_Set_Detail__c> raesd = Database.query(soql); if(raesd.size()>0){ returnStr = '分配的备品不是您所属备品中心的备品,不能做出库指示'; return returnStr; } } //1388 yc 20211021 跨区域分配不能出库 end // 20220211 ljh add 备品FY23课题01 start // AggregateResult[] resultsRas = [SELECT Rental_Start_Date__c,count(Id) cnt // FROM Rental_Apply_Equipment_Set__c // WHERE Rental_Apply__c = :rentalApplyId // AND Cancel_Select__c = false // group by Rental_Start_Date__c]; // If(resultsRas.size() > 1){ // returnStr = '所有一览备品预计出货日应一致,不一致不能做出库指示'; // return returnStr; // } // 20220211 ljh add 备品FY23课题01 end //bp2 // 备品借出历史取得 // List<String> equipmentSetList = new List<String>(); // Rental_Apply_Equipment_Set__c[] raes = [ // select Id, Name, Equipment_Set__c, Equipment_Set__r.Name, Rental_Start_Date__c, Rental_End_Date__c, Rental_Apply__c // from Rental_Apply_Equipment_Set__c // where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false]; // // 日历范围,最小的借出开始日到最大的借出终了日 // Date startDate = Date.today(); // Date endDate = Date.today(); // for (Rental_Apply_Equipment_Set__c r : raes) { // equipmentSetList.add(r.Equipment_Set__c); // if (r.Rental_Start_Date__c != null && r.Rental_Start_Date__c < startDate) { // startDate = r.Rental_Start_Date__c; // } // if (r.Rental_End_Date__c != null && r.Rental_End_Date__c > endDate) { // endDate = r.Rental_End_Date__c; // } // } // Integer prepareDay = ra.Prepare_Day__c == null ? Integer.valueOf(System.Label.EquipmentRentalPrepare) : ra.Prepare_Day__c.intValue(); // Date minDate = getWD_addday(startDate, -1 * prepareDay); // Date maxDate = getWD_addday(endDate, prepareDay); // // 其他备品借出申请历史 // Rental_Apply_Equipment_Set__c[] others = [ // select Id, Name, Rental_Start_Date__c, Rental_End_Date__c, Equipment_Set__c, Rental_Apply__r.Status__c ,Rental_Apply__r.Prepare_Day__c // from Rental_Apply_Equipment_Set__c // where Rental_Apply__c != :rentalApplyId // and Equipment_Set__c in :equipmentSetList // and Request_Status__c != '取消' // and Request_Status__c != '删除' // and Cancel_Select__c = false // and ((Rental_Start_Date__c >= :minDate and Rental_Start_Date__c <= :maxDate) // or (Rental_End_Date__c >= :minDate and Rental_End_Date__c <= :maxDate) // or (Rental_Start_Date__c <= :startDate and Rental_End_Date__c >= :endDate))]; // Map<String, List<Rental_Apply_Equipment_Set__c>> othersMap = new Map<String,List<Rental_Apply_Equipment_Set__c>>(); // for (Rental_Apply_Equipment_Set__c other : others) { // if (othersMap.containsKey(other.Equipment_Set__c)) { // othersMap.get(other.Equipment_Set__c).add(other); // } else { // List<Rental_Apply_Equipment_Set__c> l = new List<Rental_Apply_Equipment_Set__c>(); // l.add(other); // othersMap.put(other.Equipment_Set__c, l); // } // } // for (Rental_Apply_Equipment_Set__c r : raes) { // List<Rental_Apply_Equipment_Set__c> other = othersMap.get(r.Equipment_Set__c); // Map<Date, Map<String, String>> dateMap= new Map<Date, Map<String, String>>(); // if (other != null) { // Date sdate = startDate; // Date edate = endDate; // for (Rental_Apply_Equipment_Set__c o : other) { // if (o.Rental_Start_Date__c != null && (sdate == null || o.Rental_Start_Date__c < sdate)) { // sdate = o.Rental_Start_Date__c; // } // if (o.Rental_End_Date__c != null && (edate == null || o.Rental_End_Date__c > edate)) { // edate = o.Rental_End_Date__c; // } // } // if (sdate != null && edate != null) { // RentalApplyWebService raws = new RentalApplyWebService(); // dateMap = raws.getDateMap(sdate, edate, prepareDay); // } // } // if (r.Rental_Start_Date__c == null && r.Rental_End_Date__c == null) { // // 清空该借出历史的出库和回收时间 // } else if (other == null || other.size() == 0) { // // 与其他借出历史没有冲突 // } else { // Date fromDate = r.Rental_Start_Date__c; // Date toDate = r.Rental_End_Date__c; // for (Rental_Apply_Equipment_Set__c o : other) { // if (o.Rental_Apply__r.Status__c != '草案中' && o.Rental_Apply__r.Status__c != '申请中' && o.Rental_Apply__r.Status__c != null) { // Date startD = o.Rental_Start_Date__c; // Date endD = o.Rental_End_Date__c; // Integer prepare = prepareDay; //>= o.Rental_Apply__r.Prepare_Day__c || o.Rental_Apply__r.Prepare_Day__c == null ? prepareDay : o.Rental_Apply__r.Prepare_Day__c.intValue(); // if ((dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) > startD && dateMap.containsKey(endD) && fromDate < Date.valueOf(dateMap.get(endD).get('Next'))) || // (dateMap.containsKey(toDate) && Date.valueOf(dateMap.get(toDate).get('Next')) > startD && dateMap.containsKey(endD) && toDate < Date.valueOf(dateMap.get(endD).get('Next'))) || // (dateMap.containsKey(fromDate) && Date.valueOf(dateMap.get(fromDate).get('Next')) <= startD && dateMap.containsKey(endD) && toDate >= Date.valueOf(dateMap.get(endD).get('Next')))) { // returnStr = '备品' + r.Equipment_Set__r.Name + '的借出日与备品借出历史' + o.Name + '有冲突,请确认。'; // return returnStr; // } // } // } // } // } return '1'; } @AuraEnabled public static String setShipment_requests(String raid, String raesid) { Savepoint sp = Database.setSavepoint(); try { //一览情况下检索一览对应的申请书Id,soql子查询不能和主查询是同一个表,单独检索一次 if (String.isBlank(raid)) { List<Rental_Apply_Equipment_Set__c> raList = [select Id, Rental_Apply__c from Rental_Apply_Equipment_Set__c where id = :raesid]; if (raList.size() > 0) { raid = raList[0].Rental_Apply__c; } else { //应该不会到这里 return '没有可以出库指示的一览'; } } String soql = 'SELECT Id' + ' FROM Rental_Apply_Equipment_Set__c ' + ' WHERE Shippment_loaner_time2__c <> null ' + ' AND Rental_Apply__c = :raid ' + ' ORDER BY Id' ; List<Rental_Apply_Equipment_Set__c> shippedRaesList = Database.query(soql); String raesStrShipped = ''; for (Rental_Apply_Equipment_Set__c raes : shippedRaesList) { raesStrShipped += raes.Id; } //Srring soql = "SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = '{!Rental_Apply__c.Id}' AND Cancel_Select__c = false AND Rental_Num__c > 0 AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 AND Shipment_request__c = false"; soql = 'SELECT Id, Rental_Apply__c, Rental_Apply_Equipment_Set__c' + ' FROM Rental_Apply_Equipment_Set_Detail__c ' + ' WHERE ' + (String.isNotBlank(raesid) ? 'Rental_Apply_Equipment_Set__c = :raesid ' : 'Rental_Apply__c = :raid ') + ' AND Cancel_Select__c = false ' + ' AND Rental_Num__c > 0 ' + ' AND Rental_Apply_Equipment_Set__r.Wei_Assigned_Cnt__c = 0 ' + ' AND Rental_Apply_Equipment_Set__r.Yi_Assigned_Cnt__c > 0 ' + ' AND Shipment_request__c = false' + ' ORDER BY Rental_Apply_Equipment_Set__c, Id'; List<Rental_Apply_Equipment_Set_Detail__c> raesds = Database.query(soql); Map<Id, List<String>> rental_Asset_SerialNumberMap = new Map<Id, List<String>>(); if (raesds.size() < 1) { return '没有可以出库指示的一览'; } else { Set<Id> raesSet = new Set<Id>(); String raesStrRequest = ''; for (Rental_Apply_Equipment_Set_Detail__c raesd : raesds) { if (false == raesSet.contains(raesd.Rental_Apply_Equipment_Set__c)) { raesSet.add(raesd.Rental_Apply_Equipment_Set__c); raesStrRequest += raesd.Rental_Apply_Equipment_Set__c; } raesd.Shipment_request_time2__c = Datetime.now(); raesd.Shipment_request__c = true; } // 出库后, 再次做出库指示的一览, 一定要个出过库的一览一样 if (false == String.isBlank(raesStrShipped) && raesStrRequest != raesStrShipped) { return '不能做出库指示,需要分单后再操作'; } } // add lc 20220927 SFDC-CJ48VE 备品预计出库日逻辑调整 start List<Rental_Apply_Equipment_Set__c> RAESRecords = [ SELECT Id,Rental_Start_Date__c FROM Rental_Apply_Equipment_Set__c WHERE Rental_Apply__c = :raid AND Cancel_Select__c = False]; for (Integer i = 0; i < RAESRecords.size(); i++) { // 备品预计出库日不一致,不可出库指示 if (RAESRecords[i].Rental_Start_Date__c != RAESRecords[0].Rental_Start_Date__c) { return '备品预计出货日不一致,不可出库指示'; } } // add lc 20220927 SFDC-CJ48VE 备品预计出库日逻辑调整 end Rental_Apply__c ra = new Rental_Apply__c(Id = raesds[0].Rental_Apply__c, Status__c = '已出库指示'); update ra; Database.SaveResult[] results = Database.update(raesds); Database.SaveResult dmlResult = results[0]; if (dmlResult.isSuccess()) { //明细更新成功后才更新一览的Rental_Asset_SerialNumber__c soql = 'SELECT Id, SerialNumber_text__c, Rental_Apply_Equipment_Set__c ' +'FROM Rental_Apply_Equipment_Set_Detail__c ' +'WHERE Rental_Apply__c = \'' + raesds[0].Rental_Apply__c + '\'' +'AND Shipment_request_time2__c != null ' +'AND Shipment_request__c = true ' +'AND SerialNumber_text__c != null ' +'ORDER BY Rental_Apply_Equipment_Set__c '; List<Rental_Apply_Equipment_Set_Detail__c> raesdSerialNumbers = Database.query(soql); for (Rental_Apply_Equipment_Set_Detail__c raesd : raesdSerialNumbers) { if (!rental_Asset_SerialNumberMap.containsKey(raesd.Rental_Apply_Equipment_Set__c)) { // Asset__r.SerialNumber + ',' rental_Asset_SerialNumberMap.put(raesd.Rental_Apply_Equipment_Set__c, new List<String>()); } rental_Asset_SerialNumberMap.get(raesd.Rental_Apply_Equipment_Set__c).add(raesd.SerialNumber_text__c); } List<Rental_Apply_Equipment_Set__c> raess = new List<Rental_Apply_Equipment_Set__c>(); for (Id key : rental_Asset_SerialNumberMap.keySet()) { raess.add(new Rental_Apply_Equipment_Set__c(Id = key, Rental_Asset_SerialNumber__c = ',' + String.join(rental_Asset_SerialNumberMap.get(key), ',') + ',')); } if (!raess.isEmpty()) { update raess; } return '状态更新到已出库指示'; } else { Database.rollback(sp); Database.Error emsg = dmlResult.getErrors()[0]; return 'failed to update:' + emsg.getFields() + ' ' + emsg.getMessage(); } } catch (Exception ex) { Database.rollback(sp); return ex.getMessage(); } } @AuraEnabled public static String postponeCheck(String endDate, Integer d) { Date before5day = getWD_addday(date.parse(endDate), d); if (Date.today() > before5day) { return System.Label.EquipmentRentalPostponeOverDeadline; } return 'OK'; } public static Date getWD_addday(Date d, Integer i) { if (d == Date.valueOf('4000-12-31')) { return d; } if (i >= 0) { List<OlympusCalendar__c> workday = [ select Id, Date__c, IsWorkDay__c from OlympusCalendar__c where Date__c >= :d and IsWorkDay__c = 1 order by Date__c limit :(i+1)]; Date selectDate = workday[i].Date__c; return selectDate; } else { i = Math.abs(i); List<OlympusCalendar__c> workday = [ select Id, Date__c, IsWorkDay__c from OlympusCalendar__c where Date__c <= :d and IsWorkDay__c = 1 order by Date__c desc limit :(i+1)]; Date selectDate = workday[i].Date__c; return selectDate; } } public class UpdateResult { @AuraEnabled public String recordId {get;set;} @AuraEnabled public Boolean success {get;set;} @AuraEnabled public List<String> errors {get;set;} } public class InitData{ @AuraEnabled public String id; @AuraEnabled public String RentalApplyId; @AuraEnabled public String Status; @AuraEnabled public String RentalApplyC; @AuraEnabled public Decimal WeiAssignedCntC; @AuraEnabled public Date BollowDateC; @AuraEnabled public Decimal AssignedNotShipmentC; } } force-app/main/default/classes/SelectSubstituteControllerLWT.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>51.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.html
New file @@ -0,0 +1,5 @@ <template> <div class="Holder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js
New file @@ -0,0 +1,53 @@ import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromSelectSubstituteButton'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexCancelSelect extends LightningElement { @api recordId; IsLoading=true; id; RentalApplyId; Status; @wire(CurrentPageReference) getStateParameters(currentPageReference){ console.log("进入页面"); console.log(currentPageReference); if(currentPageReference){ const urvalue=currentPageReference.state.recordId; if(urvalue){ let str=`${urvalue}`; console.log('str'); console.log(str); this.recordId=str; } } } connectedCallback(){ console.log(this.recordId); init({recordId:this.recordId}).then(result=>{ console.log(result); if(result!=null){ this.id=result.id; this.RentalApplyId=result.RentalApplyId; this.Status=result.Status; this.cancelSubmit().then(res=>{ this.IsLoading=false; this.dispatchEvent(new CloseActionScreenEvent()); }); } }).catch(err=>{ console.log("error:"); console.log(err); }).finally(()=>{ }); } async cancelSubmit(){ window.open("/apex/EquipmentRentalCancel?raid="+this.RentalApplyId,'cancelSelect','width=500,height=250'); } } force-app/main/default/lwc/lexCancelSelect/lexCancelSelect.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCancelSelect"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.css
New file @@ -0,0 +1,11 @@ .Holder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display : none !important; } force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.html
New file @@ -0,0 +1,5 @@ <template> <div class="Holder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js
New file @@ -0,0 +1,107 @@ import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId'; import init from '@salesforce/apex/SelectSubstituteControllerLWT.initClearReturnDeliverySlipButton'; import updateRaescList from '@salesforce/apex/SelectSubstituteControllerLWT.updateRaescList'; import selectRacById from '@salesforce/apex/SelectSubstituteControllerLWT.selectRacById'; import selectRaesdcId from '@salesforce/apex/SelectSubstituteControllerLWT.selectRaesdcId'; import { loadScript } from 'lightning/platformResourceLoader'; import { submitForApproval } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexClearReturnDeliverySlip extends LightningElement { @api recordId; id; RentalApplyId; Status; IsLoading=true; @wire(CurrentPageReference) getStateParameters(currentPageReference){ console.log("进入页面"); console.log(currentPageReference); if(currentPageReference){ const urvalue=currentPageReference.state.recordId; if(urvalue){ let str=`${urvalue}`; console.log('str'); console.log(str); this.recordId=str; } } } connectedCallback(){ console.log(this.recordId); init({recordId:this.recordId}).then(result=>{ console.log(result); if(result!=null){ this.Rental_Apply_Equipment_Set__c=result; this.cancelSubmit().then(res=>{ this.IsLoading=false; this.dispatchEvent(new CloseActionScreenEvent()); }); } }).catch(err=>{ console.log("error:"); console.log(err); }).finally(()=>{ }); } async cancelSubmit(){ console.log("hhh1"); var raesId = this.recordId; console.log("hhh2"); var result = await selectRaesdcId({recordId:this.recordId}); console.log("hhh3"); var objs = result; if (objs.length< 1) { // alert('没有需要清空的一览明细'); const event = new ShowToastEvent({ title: '提示信息', message:'没有需要清空的一览明细' }); this.dispatchEvent(event); } else { console.log("hhh4"); var result; console.log("hhh5"); await updateRaescList({updateList:objs}) .then(res=>{ console.log(res); result=res; }); console.log("hhh6"); if (result.success==true) { console.log("hhh7"); // success // alert("回寄运输单信息已清空"); const event = new ShowToastEvent({ title: '提示信息', message:"回寄运输单信息已清空" }); this.dispatchEvent(event); setTimeout(function() { location.href = "/"+this.recordId; }, 100); } else { console.log("hhh8"); // alert("failed to update:" + result.errors.fields + " " + result[0].errors.message); const event = new ShowToastEvent({ title: '提示信息', message:"failed to update:" + result.errors.fields + " " + result[0].errors.message }); this.dispatchEvent(event); } } } } force-app/main/default/lwc/lexClearReturnDeliverySlip/lexClearReturnDeliverySlip.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexClearReturnDeliverySlip"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.css
New file @@ -0,0 +1,11 @@ .Holder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display : none !important; } force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.html
New file @@ -0,0 +1,5 @@ <template> <div class="Holder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js
New file @@ -0,0 +1,158 @@ import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId'; import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromCustomSubmitButton'; import updateRaesc from '@salesforce/apex/SelectSubstituteControllerLWT.updateRaesc'; import selectRacById from '@salesforce/apex/SelectSubstituteControllerLWT.selectRacById'; import postponeCheck from '@salesforce/apex/SelectSubstituteControllerLWT.postponeCheck'; import { loadScript } from 'lightning/platformResourceLoader'; import { submitForApproval } from 'lightning/uiRecordApi'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexCustomSubmit extends LightningElement { @api recordId; id; RentalApplyId; Status; IsLoading=true; @wire(CurrentPageReference) getStateParameters(currentPageReference){ console.log("进入页面"); console.log(currentPageReference); if(currentPageReference){ const urvalue=currentPageReference.state.recordId; if(urvalue){ let str=`${urvalue}`; console.log('str'); console.log(str); this.recordId=str; } } } connectedCallback(){ console.log(this.recordId); init({recordId:this.recordId}).then(result=>{ console.log(result); if(result!=null){ this.Rental_Apply_Equipment_Set__c=result; this.cancelSubmit().then(res=>{ this.IsLoading=false; this.dispatchEvent(new CloseActionScreenEvent()); }); } }).catch(err=>{ console.log("error:"); console.log(err); }).finally(()=>{ }); } async cancelSubmit(){ console.log("hhh1"); if (this.Rental_Apply_Equipment_Set__c.Request_extend_day__c == "" || this.Rental_Apply_Equipment_Set__c.Request_extend_day__c == null || this.Rental_Apply_Equipment_Set__c.Extend_request_reason__c == "" || this.Rental_Apply_Equipment_Set__c.Extend_request_reason__c == null) { // alert("必须填写延期希望结束日,延期申请理由"); const event = new ShowToastEvent({ title: '提示信息', message:"必须填写延期希望结束日,延期申请理由" }); this.dispatchEvent(event); return; } console.log("hhh2"); let rtn; await postponeCheck({ endDate:this.Rental_Apply_Equipment_Set__c.Rental_End_Date__c, d:-5 }).then(res=>{ console.log(res); rtn=res; }).catch(err=>{ console.log("err:",err.message); }) console.log(rtn); if (rtn != "OK") { // alert(rtn); const event = new ShowToastEvent({ title: '提示信息', message:rtn }); this.dispatchEvent(event); return; } console.log("hhh3"); let resultSet = await selectRacById({recordId:this.Rental_Apply_Equipment_Set__c.Rental_Apply__c}) ; let records = resultSet; console.log("hhh4"); let result = await updateRaesc({ recordId:this.Rental_Apply_Equipment_Set__c.Id, JingliApprovalManagerc:records[0].JingliApprovalManager__c, BuchangApprovalManagerc:records[0].SalesManager__c, BuchangApprovalManagerSalesc:records[0].BuchangApprovalManager__c, ZongjianApprovalManagerc:records[0].BuchangApprovalManagerSales__c, ExtendStatusc:'填写完毕', }); console.log("hhh5"); console.log(result); // let messages = getConnectDMLErrorMessages(result); if(result!=null&&result.length>0&&result.errors.length>0){ // alert(result.errors[0].split(",")[1]); const event = new ShowToastEvent({ title: '提示信息', message:result.errors[0].split(",")[1] }); this.dispatchEvent(event); } console.log("hhh7"); // let request = new sforce.ProcessSubmitRequest(); // request.objectId = this.recordId; // let processResults = sforce.connection.process([request]); console.log("hhh8"); // submitForApproval(this.Rental_Apply_Equipment_Set__c.Id).then(result => { // console.log(result); // if (processResults[0].errors != null) { // alert(processResults[0].errors.message); // return; // } // console.log("hhh9"); // window.location.reload(); // }) // .catch(error => { // console.error('Error submitting record for approval:', error.message); // }); // await submitForApproval(this.recordId); const fields = {} const recordInput = { fields }; updateRecord({ fields: recordInput, recordId: this.recordId }) .then(() => { console.log("更新成功"); }) .catch(error => { console.log(error.message); console.log(error); // alert(error.body.message); const event = new ShowToastEvent({ title: '提示信息', message:error.body.message }); this.dispatchEvent(event); return; // 处理异常情况 }); } } force-app/main/default/lwc/lexCustomSubmit/lexCustomSubmit.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexCustomSubmit"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -1,102 +1,258 @@ import { LightningElement, track, wire, api } from 'lwc'; import { CurrentPageReference,NavigationMixin } from 'lightning/navigation'; import { LightningElement,api, track, wire } from 'lwc'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/loanerArrangedEmailController.init'; import getRentalApplyEquipmentSet from '@salesforce/apex/loanerArrangedEmailController.getRentalApplyEquipmentSet'; import approvalCheck from '@salesforce/apex/RentalApplyWebService.approvalCheck'; import setShipment_request from '@salesforce/apex/RentalApplyWebService.approvalCheck'; import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromLoanerArrangedEmailLButton'; import selectRentalApplyCByName from '@salesforce/apex/SelectSubstituteControllerLWT.selectRentalApplyCByName'; import selectRaesById1 from '@salesforce/apex/SelectSubstituteControllerLWT.selectRaesById1'; import selectRaesById2 from '@salesforce/apex/SelectSubstituteControllerLWT.selectRaesById2'; import getSessionId from '@salesforce/apex/SelectSubstituteControllerLWT.getSessionId'; import approvalCheck from '@salesforce/apex/SelectSubstituteControllerLWT.approvalCheck'; import setShipment_requests from '@salesforce/apex/SelectSubstituteControllerLWT.setShipment_requests'; // import { label } from '@salesforce/label'; import STATUS_PROCESS_STATE from '@salesforce/label/c.StatusProcessState'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexLoanerArrangedEmail extends LightningElement { @api recordId; IsLoading = true; @api recordId; id; RentalApplyC; Status; Wei_Assigned_Cnt__c; Bollow_Date__c; Assigned_Not_Shipment__c; IsLoading=true; @track statusStringg = STATUS_PROCESS_STATE; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log("进入页面"); console.log(currentPageReference); if(currentPageReference) { const urlValue = currentPageReference.state.recordId; if(urlValue) { let str = `${urlValue}`; const urvalue=currentPageReference.state.recordId; if(urvalue){ let str=`${urvalue}`; console.log('str'); console.log(str); this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(this.recordId); console.log('result==='+JSON.stringify(result)); init({recordId:this.recordId}).then(result=>{ console.log(result); if(result != null) { if( result.WeiAssignedCnt > 0 ) { alert("申请单内存在未分配的配套,请分配备品或分割申请单"); }else if(result.CampaignStatus == "取消") { alert("学会取消,不可出库指示"); }else if (result.RaStatus == "已出库指示" && result.AssignedNotShipment == 0){ alert("所有的借出备品Set一览都进行过出库指示了"); }else if (result.AssignedNotShipment == 0) { alert("没有可以出库指示的明细"); }else if (result.DemoPurpose1 == "长期借出" && result.ContractPdfUpdated == 0){ alert("长期借出时,必须先上传契约书"); }else if (result.RepairId != '' && (result.RepairFinalInspectionDateF != null && result.RepairFinalInspectionDateF != '') || (result.RCReturnToOffice != null && result.RCReturnToOffice != '')){ alert("修理有最终检测日或修理品返送日,不可出库指示"); }else if (result.IFApproved == "true" && (result.MeetingApprovedNo == null || result.MeetingApprovedNo == "")){ alert("没有决裁号的,暂不能出借,请更新裁决信息。"); }else if (result.IFApproved == "true" && result.MeetingApprovedNo != "" && result.StatusList.indexOf(records[0].Approved_Status__c) != -1){ alert("已申请决裁但决裁状态不符合条件。"); this.id=result.id; this.RentalApplyC=result.RentalApplyC; this.Status=result.Status; this.Wei_Assigned_Cnt__c=result.WeiAssignedCntC; this.Bollow_Date__c=result.BollowDateC; this.Assigned_Not_Shipment__c=result.AssignedNotShipmentC; this.cancelSubmit().then(res=>{ this.IsLoading=false; this.dispatchEvent(new CloseActionScreenEvent()); }); } }).catch(err=>{ console.log("error:"); console.log(err); }).finally(()=>{ }); } async cancelSubmit(){ let campaignStatus = ''; let records = null; // 20220217 ljh OBPM市场活动联动 console.log("Ff"); let statusSting = "{!$Label.StatusProcessState}"; // 20220322 ljh add let statusList = statusSting.split(','); console.log(statusSting); console.log(statusList); console.log(this.statusStringg); let raliveryGood; await selectRentalApplyCByName({recordId:this.RentalApplyC}) .then(res=>{ console.log(res); if (res!=null) { raliveryGood=res; } }).catch(err=>{ console.log("selectRentalApplyCByName err:") console.log(err.message); }); console.log(statusSting); console.log(raliveryGood); console.log("ddd"); let RentalApply = raliveryGood[0]; console.log(RentalApply); if(RentalApply.Campaign__c != null&&RentalApply.Campaign__c != '' ) { console.log(); let DeliveryGood; // 20220217 ljh update OBPM市场活动联动 start // DeliveryGood = sforce.connection.query("select Status, Rental_Apply_Flag__c from Campaign where id ='" + RentalApply.Campaign__c + "'"); // let records= DeliveryGood.getArray("records"); await selectCampaignById({recordId:RentalApply.Campaign__c}).then(res=>{ console.log(res); DeliveryGood=res; }); console.log(RentalApply); records = DeliveryGood; console.log(DeliveryGood); // 20220217 ljh update OBPM市场活动联动 end campaignStatus = records[0].Status; console.log("hh3"); } if(this.Wei_Assigned_Cnt__c > "0") { // alert("申请单内存在未分配的配套,请分配备品或分割申请单"); const event = new ShowToastEvent({ title: '提示信息', message:"申请单内存在未分配的配套,请分配备品或分割申请单" }); this.dispatchEvent(event); }else if(campaignStatus == '取消'){ // alert("学会取消,不可出库指示"); const event = new ShowToastEvent({ title: '提示信息', message:"学会取消,不可出库指示" }); this.dispatchEvent(event); }else if (this.Assigned_Not_Shipment__c == "0") { // alert("没有可以出库指示的明细"); const event = new ShowToastEvent({ title: '提示信息', message:"没有可以出库指示的明细" }); this.dispatchEvent(event); } else if (RentalApply.Demo_purpose1__c == "长期借出" && RentalApply.Contract_pdf_updated__c == "0") { // alert("长期借出时,必须先上传契约书"); const event = new ShowToastEvent({ title: '提示信息', message:"长期借出时,必须先上传契约书" }); this.dispatchEvent(event); } else if(RentalApply.Repair__c != '' && RentalApply.Repair__c != null && (RentalApply.Repair_Final_Inspection_Date_F__c != null && RentalApply.Repair_Final_Inspection_Date_F__c != '') || (RentalApply.RC_return_to_office__c != null && RentalApply.RC_return_to_office__c != '')) { // alert("修理有最终检测日或修理品返送日,不可出库指示"); const event = new ShowToastEvent({ title: '提示信息', message:"修理有最终检测日或修理品返送日,不可出库指示" }); this.dispatchEvent(event); // 20220217 ljh add OBPM市场活动联动 start } else if (records != null && records[0].IF_Approved__c == "true" && (records[0].Meeting_Approved_No__c == null || records[0].Meeting_Approved_No__c == "") ) { // alert("没有决裁号的,暂不能出借,请更新裁决信息。"); const event = new ShowToastEvent({ title: '提示信息', message:"没有决裁号的,暂不能出借,请更新裁决信息。" }); this.dispatchEvent(event); } else if (records != null && records[0].IF_Approved__c == "true" && records[0].Meeting_Approved_No__c != "" && statusList.indexOf(records[0].Approved_Status__c) != -1 ) { // alert("已申请决裁但决裁状态不符合条件。"); const event = new ShowToastEvent({ title: '提示信息', message:"已申请决裁但决裁状态不符合条件。" }); this.dispatchEvent(event); // 20220217 ljh add OBPM市场活动联动 end }else { approvalCheck({ rentalApplyId: this.recordId }).then(res=>{ if (res != '1') { alert(rs1); console.log("hhhh3"); let t=await getSessionId(); console.log(t); window.sforce = window.sforce || {}; window.sforce.connection = window.sforce.connection || {}; window.sforce.connection.sessionId =t; //154p 1388 yc 20211020 console.log("hhhh4"); let raid = RentalApply.Id+";"+this.id; console.log(raid); let rs1 = await approvalCheck({rentalApplyId:raid}); console.log(rs1); if (rs1 != '1') { // alert(rs1); const event = new ShowToastEvent({ title: '提示信息', message:rs1 }); this.dispatchEvent(event); } else { //bp2 var rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid}); //bp2 let rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid}); //bp2 if (rs2 != '1') { //bp2 alert(rs2); //bp2 } else { //var rs1 = sforce.apex.execute("RentalApplyWebService", "setShipment_request", {raid : "{!Rental_Apply__c.Id}"}); setShipment_request({ raid: this.recordId }).then(res=>{ setShipment_requests({raid:null,raesid: this.id}).then(res=>{ if (res == "状态更新到已出库指示") { alert("状态更新到已出库指示"); print(); setTimeout(function() { location.href = "/{!Rental_Apply__c.Id}"; },100); // alert("状态更新到已出库指示"); const event = new ShowToastEvent({ title: '提示信息', message:"状态更新到已出库指示" }); this.dispatchEvent(event); print().then(res=>{ setTimeout(function() {location.href = "/"+this.RentalApplyC;}, 100); }); }else { alert(res); } }).catch(e=>{ console.log('approvalCheck==='+e); }) } }).catch(e=>{ console.log('setShipment_request==='+e); }) } this.dispatchEvent(new CloseActionScreenEvent()); // alert(res); const event = new ShowToastEvent({ title: '提示信息', message:res }); this.dispatchEvent(event); } }) // sforce.apex.execute("RentalApplyWebService", "setRaesShipment_request", // {raesid: this.id} // ,function(res) { // if (res == "状态更新到已出库指示") { // alert("状态更新到已出库指示"); // print().then(res=>{ // setTimeout(function() {location.href = "/"+this.RentalApplyC;}, 100); // }); // } else { // alert(res); // } // }); } } print() { getRentalApplyEquipmentSet({ recordId: this.recordId }).then(result => { window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + result); }) async function print(){ let sqlResult; if(this.Bollow_Date__c != ''){ await selectRaesById1({recordId:RentalApply.Id}).then(res=>{ sqlResult=res; }); }else{ await selectRaesById2({recordId:RentalApply.Id}).then(res=>{ sqlResult=res; }); } let records = sqlResult; let size =records.length; let length = size%10 ==0? size/10 : parseInt(size/10) +1; for(let i =0;i<length;i++){ window.open('/apex/FixtureRentalPDF?raid=' + RentalApply.Id + '&page=' + i); } } fixDate(date){ var Month = fixTime(date.getMonth() + 1); var Day = fixTime(date.getDate()); var UTC = date.toUTCString(); var Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6); var Minutes = fixTime(date.getMinutes()); var Seconds = fixTime(date.getSeconds()); return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time; // function fixTime(time){ // if(time < 10) {time = "0" + time}; // return time; // } // function fixDate(date){ // let Month = fixTime(date.getMonth() + 1); // let Day = fixTime(date.getDate()); // let UTC = date.toUTCString(); // let Time = UTC.substring(UTC.indexOf(':')-2, UTC.indexOf(':')+6); // let Minutes = fixTime(date.getMinutes()); // let Seconds = fixTime(date.getSeconds()); // return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time; // } } } force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
@@ -1,10 +1,10 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexLoanerArrangedEmail"> <apiVersion>51.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__RecordPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets>