force-app/main/default/classes/ApplicationButtonController.cls
New file @@ -0,0 +1,85 @@ public class OppSubmitController { @AuraEnabled public static InitData initSubmitButton (String recordId){ InitData res = new initData(); try{ Request_tedner_doc__c report = [SELECT OwnerId,Id FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1]; res.OwnerId = report.OwnerId; res.Id = report.Id; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //授权申请的提交按钮 @AuraEnabled public static String submit(String recordId) { String messageText = ''; try { Request_tedner_doc__c rac = [SELECT Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1]; rac.Status__c = LightingButtonConstant.STATUS_Application_Submitted; rac.RecordTypeId = rac.RecordTypeId = Schema.SObjectType.Request_tedner_doc__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_Application + LightingButtonConstant.STATUS_Application_Submitted).getRecordTypeId(); rac.Submit_check_flag__c = true; rac.Submit_time__c = Datetime.now(); update rac; messageText = '1'; return messageText; } catch (Exception ex) { System.debug(LoggingLevel.INFO, '*** xu: ' + ex); messageText = ex.getMessage(); return messageText; } } //授权申请的取消提交按钮 @AuraEnabled public static String submitCancel(String recordId) { String messageText = ''; try { Request_tedner_doc__c report = [SELECT Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Request_tedner_doc__c WHERE Id = :recordId LIMIT 1]; report.Status__c = LightingButtonConstant.STATUS_Application_CancelSubmit; report.RecordTypeId = Schema.SObjectType.Request_tedner_doc__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_Application).getRecordTypeId(); report.Submit_check_flag__c = false; report.Submit_time__c = null; update report; messageText = '1'; return messageText; } catch (Exception ex) { System.debug(LoggingLevel.INFO, '*** cancelXu: ' + ex); messageText = ex.getMessage(); return messageText; } } //获取当前登录人的 id @AuraEnabled public static UserResult userInfo_Owner() { UserResult result = new UserResult(); ID myUserID = UserInfo.getUserId(); try { User tempUser = [select id from user where id = : myUserID ]; result.id = tempUser.id; } catch (exception e) { result.result = e.getMessage(); } return result; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String OwnerId; } public class UserResult { @AuraEnabled public string result; public UserResult( ) { result = 'Success'; } @AuraEnabled public string id; } } force-app/main/default/classes/ControllerUtil.cls
New file Diff too large force-app/main/default/classes/ControllerUtil.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>31.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/LightingButtonConstant.cls
New file @@ -0,0 +1,80 @@ global without sharing class LightingButtonConstant { //授权申请的状态‘已提交’ public static final String STATUS_Application_Submitted = '已提交'; //授权申请的状态‘草案中’ public static final String STATUS_Application_CancelSubmit= '草案中'; //授权申请的记录类型名‘授权申请’ public static final String RECORD_TYPE_NAME_Application = '授权申请'; //周报月报的状态‘草案中’ public static final String STATUS_DRAFT = '草案中'; //报告书的状态‘完毕’ public static final String STATUS_COMPLETE = '完毕'; //报告书的状态‘取消’ public static final String STATUS_CANCEL = '取消'; //OCSM报告的状态‘待报告’ public static final String STATUS_TO_BE_REPORTED = '待报告'; //OCSM报告的状态‘无需报告’ public static final String STATUS_TO_NOT_REPORT = '无需报告'; //VOC报告的状态‘结果确认完毕’ public static final String STATUS_VOC_CONFIRMED = '结果确认完毕'; //VOC报告的状态‘回答完毕’ public static final String STATUS_VOC_END_OF_ANSWER = '回答完毕'; //VOC报告的状态‘申请中’ public static final String STATUS_VOC_APPLYING = '申請中'; //VOC报告的状态‘判定完毕’ public static final String STATUS_VOC_CHECK_OVER = '判定完毕'; //VOC报告的状态‘填写完毕’ public static final String STATUS_VOC_WRITE_OVER = '填写完毕'; //VOC报告的状态‘完毕’ public static final String STATUS_VOC_FINISH = '完毕'; //QIS的状态‘OSH检测中’ public static final String STATUS_QIS_OSH_TESTING = 'OSH检测中'; //QIS的状态‘OSH填写完毕’ public static final String STATUS_QIS_OSH_COMPLATED = 'OSH填写完毕'; //QIS的状态‘OSH检测申请’ public static final String STATUS_QIS_OSH_TESTING_APP = 'OSH检测申请'; //QIS的状态‘RC填写完毕’ public static final String STATUS_QIS_RC_COMPLATED = 'RC填写完毕'; //QIS的状态‘取消申请’ public static final String STATUS_QIS_CANCEL = '取消申请'; //QIS的状态‘RC检测中’ public static final String STATUS_QIS_RC_CHECKING = 'RC检测中'; //QIS的状态‘FSE填写完毕’ public static final String STATUS_QIS_FSE_COMPLATED = 'FSE填写完毕'; //QIS的状态‘完毕’ public static final String STATUS_QIS_COMPLATED = '完毕'; //周报月报的记录类型名‘周报’ public static final String RECORD_TYPE_NAME_BY_MONTHLY_REPORT = '周报'; //报告书的记录类型‘提交’ public static final String RECORD_TYPE_NAME_BY_SUBMIT = '提交'; //报告书的记录类型‘跟台’ public static final String RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE = '跟台'; //报告书的记录类型‘OPD’ public static final String RECORD_TYPE_NAME_BY_OPD= 'OPD'; //QIS的记录类型‘3.OSH’ public static final String RECORD_TYPE_NAME_BY_OSH= '3.OSH'; //QIS的记录类型‘4.OSH回答完毕’ public static final String RECORD_TYPE_NAME_BY_OSH_FINASH= '4.OSH回答完毕'; //QIS的记录类型‘9.Final 完毕’ public static final String RECORD_TYPE_NAME_BY_FINAL= '9.Final 完毕'; //QIS的记录类型‘5.现场结案’ public static final String RECORD_TYPE_NAME_BY_COMP= '5.现场结案'; //记录类型的developerName‘ASRCDecision’ public static final String DEVELOPER_NAME_ASRC_DECISION = 'ASRCDecision'; //记录类型的developerName‘ASACDecision’ public static final String DEVELOPER_NAME_ASAC_DECISION = 'ASACDecision'; //工作分类的销售服务 public static final String TYPE_OF_SALES_SERVICES = '销售服务'; //userAccess参数后缀_Edit public static final String USER_ACCESS_EDIT = '_Edit'; //userAccess参数后缀_Read public static final String USER_ACCESS_READ = '_Read'; public static final String CN_YES = '是'; public static final String CN_NO = '否'; public static final String VOC_NAME = 'VOC'; public static final String OK = 'OK'; public static final String SOBJECT_NAME_OF_REPORT_SHARE ='Report__Share'; public static final String SOBJECT_NAME_OF_VOC_SHARE = 'VOCShare__c'; } force-app/main/default/classes/LightingButtonConstant.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/MonthlyReportController.cls
New file @@ -0,0 +1,95 @@ public with sharing class MonthlyReportController { //为取消提交相应的js提供初始化数据 @AuraEnabled public static InitData initForCancelSubmitButton (String recordId){ InitData res = new initData(); try{ Monthly_Report__c report = [SELECT OwnerId,Id,Next_week_plan__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1]; res.OwnerId = report.OwnerId; res.Id = report.Id; res.nextWeekPlan = report.Next_week_plan__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //为创建notes邮箱操作提供初始化数据 @AuraEnabled public static InitData initForCreateNoteEmailButton (String recordId) { InitData res = new initData(); try{ Monthly_Report__c report = [SELECT Owner_email__c, Owner_alias__c, Key_issue__c, Feedback__c, Task_follow__c, Other_issue__c, Next_week_plan__c, Dr_Sum_URL__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1]; String userName = UserInfo.getUserName(); User activeUser = [Select Email From User where Username = : userName limit 1]; String userEmail = activeUser.Email; res.ownerEmail = report.Owner_email__c; res.ownerAlias = report.Owner_alias__c; res.keyIssue = report.Key_issue__c; res.feedBack = report.Feedback__c; res.taskFollow = report.Task_follow__c; res.otherIssue = report.Other_issue__c; res.nextWeekPlan = report.Next_week_plan__c; res.drSumUrl = report.Dr_Sum_URL__c; res.userEmail = activeUser.Email; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //取消提交操作更新相应数据 @AuraEnabled public static void cancel(String recordId) { try { Monthly_Report__c report = [SELECT Id,Status__c,Submit_check_flag__c,RecordTypeId,Submit_time__c FROM Monthly_Report__c WHERE Id = :recordId LIMIT 1]; report.Status__c = LightingButtonConstant.STATUS_DRAFT; report.RecordTypeId = Schema.SObjectType.Monthly_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_MONTHLY_REPORT).getRecordTypeId(); report.Submit_check_flag__c = false; report.Submit_time__c = null; update report; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } finally { } } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String OwnerId; @AuraEnabled public String ownerEmail; @AuraEnabled public String ownerAlias; @AuraEnabled public String keyIssue; @AuraEnabled public String feedBack; @AuraEnabled public String taskFollow; @AuraEnabled public String otherIssue; @AuraEnabled public String nextWeekPlan; @AuraEnabled public String drSumUrl; @AuraEnabled public String userEmail; } } force-app/main/default/classes/MonthlyReportController.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/QISReportController.cls
New file @@ -0,0 +1,471 @@ public with sharing class QISReportController { // Final universal code编辑 @AuraEnabled public static InitData initForQisUniversalFailureCodeButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static InitData sqlForPAE (String qisReportId){ InitData res = new initData(); String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASAC_DECISION; try{ PAE_DecisionRecord__c RCPAEDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId And RecordType.DeveloperName = :recordTypeId limit 1]; res.pAEid = RCPAEDIdList.id; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //Intake universal code编辑 @AuraEnabled public static InitData initForlexQISIntakeuniversalcodeButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static InitData sqlForPAE1 (String qisReportId){ InitData res = new initData(); String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASRC_DECISION; try{ PAE_DecisionRecord__c ASRCDIdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId And RecordType.DeveloperName = :recordTypeId Limit 1]; res.pAEid = ASRCDIdList.id; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //OSH现品收到 @AuraEnabled public static InitData initForOSHRecievedButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.QIStatus = report.QIS_Status__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQis (String recordId){ String re = '成功'; try{ ID myUserID = UserInfo.getUserId(); User tempUser = [select id,Alias,Email from user where id = : myUserID ]; QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_OSH_TESTING; rac.OSHRecievedDate__c = Date.today(); rac.OSH_Receive_staff__c = tempUser.Alias; rac.OSH_staff__c = tempUser.Alias; rac.OSH_staff_email__c = tempUser.email; rac.Is_ProductGot__c = true; rac.OSH_GotProductPeople__c = tempUser.id; User resultSet = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID]; if (resultSet!=null && resultSet.JingliApprovalManager__c != null && resultSet.BuchangApprovalManager__c != null ) { rac.OSH_Manager__c = resultSet.JingliApprovalManager__c; rac.OSH_Buzhang__c = resultSet.BuchangApprovalManager__c; }else{ rac.OSH_Manager__c= myUserID; rac.OSH_Buzhang__c= myUserID; } Oly_TriggerHandler.bypass('QIS_ReportTrigger'); update rac; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } //提交待审批1 @AuraEnabled public static InitData initForOSHSubmitButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id,QIS_Status__c,OSH_staff__c,OSH_staff_email__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.QIStatus = report.QIS_Status__c; res.OSHstaff = report.OSH_staff__c; res.OSHstaffEmail = report.OSH_staff_email__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQis1 (String recordId){ String re = '成功'; try{ QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_OSH_COMPLATED; update rac; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } //提交待审批 @AuraEnabled public static InitData initForRCSubmitButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id,RC_problem_not_found__c,QIS_Reply_day__c,RC_inspection_date__c,QIS_Status__c,Cancel_QIS_Reason__c,OSH_staff__c,OSH_staff_email__c,RC__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.QIStatus = report.QIS_Status__c; res.OSHstaff = report.OSH_staff__c; res.OSHstaffEmail = report.OSH_staff_email__c; res.CancelQISReason = report.Cancel_QIS_Reason__c; res.RCid = report.RC__c; res.RCinspectionDate = report.RC_inspection_date__c; res.QISReplyDay = report.QIS_Reply_day__c; res.RCproblemnotfound = report.RC_problem_not_found__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQisWithRC (String recordId,String type,String oldQIStatus){ String re = '成功'; ID myUserID = UserInfo.getUserId(); User userinfo = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c, BuchangApprovalManagerSales__c, SalesManager__c FROM User WHERE Id = :myUserID LIMIT 1]; QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; if (type == '1') { QIS_Report__c report1 = [SELECT id,RC_problem_not_found__c,RC_FixedJudgement__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_RC_COMPLATED; if (report1.RC_problem_not_found__c == true && report1.RC_FixedJudgement__c == false) { QIS_Report__c qisreport = [SELECT Id, Reason_bloken__c, Special_follow__c, next_action__c, QIS_Reply_Comment__c, OCM_judgement__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; if (qisreport != null) { rac.Reason_bloken1__c = qisreport.Reason_bloken__c; rac.Special_follow1__c = qisreport.Special_follow__c; rac.next_action1__c = qisreport.next_action__c; rac.QIS_Reply_Comment1__c = qisreport.QIS_Reply_Comment__c; rac.OCM_judgement1__c = qisreport.OCM_judgement__c; } } } if (type == '2') { rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_CANCEL; rac.QIS_Cancel_Submit_day__c = Date.today(); } try{ if (userinfo!=null && userinfo.BuchangApprovalManagerSales__c != null) { rac.RC_Manager__c = userinfo.BuchangApprovalManagerSales__c; }else{ rac.RC_Manager__c = myUserID; } if (userinfo!=null) { if (oldQIStatus == LightingButtonConstant.STATUS_QIS_RC_CHECKING) { rac.RC__c = myUserID; } if (userinfo.SalesManager__c != null ) { rac.ApproveManager__c = userinfo.SalesManager__c; }else{ rac.ApproveManager__c = myUserID; } if (userinfo.BuchangApprovalManagerSales__c != null ) { rac.ApproveBuZhang__c = userinfo.BuchangApprovalManagerSales__c ; }else{ rac.ApproveBuZhang__c = myUserID; } if (userinfo.ZongjianApprovalManager__c != null ) { rac.AppeoveZongJian__c = userinfo.ZongjianApprovalManager__c ; }else{ rac.AppeoveZongJian__c = myUserID; } } update rac; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } // 提交 @AuraEnabled public static InitData initForOCMSubmitButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id,is_aohui_product__c,QIS_Status__c,OCM_Manager_Mail_F__c,QISInstallDate__c,contract_number__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.QIStatus = report.QIS_Status__c; res.QISInstallDate = report.QISInstallDate__c; res.contractnumber = report.contract_number__c; res.isaohuiproduct = report.is_aohui_product__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQisWithOCM (String recordId){ String re = '成功'; QIS_Report__c report = [SELECT id,QIS_Status__c,QISInstallDate__c,contract_number__c,OCM_Manager_Mail_F__c ,OCM_Member_Mail_F__c,OCM_Repair_Mail_F__c,OCM_Repair_Mail1_F__c,FSE_Special_Mail_F__c,FSE_Special_Manager_Mail_F__c ,WorkLocation_CC_Mail_F__c,is_aohui_product__c,QuolityApproveResult__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; try{ QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_FSE_COMPLATED; rac.OCM_Manager_Mail__c = report.OCM_Manager_Mail_F__c; rac.OCM_Member_Mail__c = report.OCM_Member_Mail_F__c; rac.OCM_Repair_Mail__c = report.OCM_Repair_Mail_F__c; rac.OCM_Repair_Mail1__c = report.OCM_Repair_Mail1_F__c; rac.FSE_Special_Mail__c = report.FSE_Special_Mail_F__c; rac.FSE_Special_Manager_Mail__c = report.FSE_Special_Manager_Mail_F__c; rac.WorkLocation_CC_Mail__c = report.WorkLocation_CC_Mail_F__c; rac.Cancel_QIS_Reason__c = null; if (report.is_aohui_product__c == true) { rac.OCM_judgement__c = '质量问题'; rac.next_action__c = '无偿维修'; rac.RecordTypeId = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OSH).getRecordTypeId(); rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_OSH_TESTING_APP; } if (report.QuolityApproveResult__c == null || report.QuolityApproveResult__c == '') { rac.QuolityApproveResult__c = '3.已审核,一般质量问题'; } update rac; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } // QIS结果跟进完毕 @AuraEnabled public static InitData initForQisAgreeButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id ,OwnerId FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.ownerId = report.OwnerId; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQisForQisAgree (String recordId){ String re = '成功'; ID myUserID = UserInfo.getUserId(); String answerComp = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OSH_FINASH).getRecordTypeId(); String fina = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_FINAL).getRecordTypeId(); String comp = Schema.SObjectType.QIS_Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_COMP).getRecordTypeId(); // RecordType rectyp = [SELECT id ,name FROM RecordType where id = '01210000000gFTH']; QIS_Report__c report = [SELECT id,OwnerId,RecordTypeId FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; try{ if (report.ownerid == myUserID) { QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; rac.QIS_Status__c = LightingButtonConstant.STATUS_QIS_COMPLATED; if (report.RecordTypeId == answerComp) { rac.RecordTypeId = fina; }else{ rac.RecordTypeId = comp; } rac.QIS_Complete_Day__c = Date.today(); update rac; } }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } //OCSM服务本部CDS完毕 @AuraEnabled public static InitData initForRCCDScompleteButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id ,CDS_date__c,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.cdsdate = report.CDS_date__c; res.QIStatus = report.QIS_Status__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQisForRCCDScomplete (String recordId){ String re = '成功'; ID myUserID = UserInfo.getUserId(); User userinfo = [SELECT id,Alias__c FROM User WHERE Id = :myUserID LIMIT 1]; QIS_Report__c report = [SELECT id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; try{ QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; rac.CDS_date__c = Date.today(); rac.RC_CDS_staff__c = userinfo.Alias__c; update rac; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } //OCSM不要报告 @AuraEnabled public static InitData initForlexOCSMNoToReportLightingButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id ,OCSMAdministrativeReportNumber__c,OCSMAdministrativeReportDate__c,Aware_date__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.oCSMAdministrativeReportNumber = report.OCSMAdministrativeReportNumber__c; res.oCSMAdministrativeReportDate = report.OCSMAdministrativeReportDate__c; res.Awaredate = report.Aware_date__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQisForlexOCSMNoToReportLighting (String recordId){ String re = '成功'; QIS_Report__c report = [SELECT id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; try{ QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; rac.OCSMAdministrativeReportStatus__c = '无需报告'; update rac; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } //OCSM要报告 @AuraEnabled public static InitData initForlexOCSMToReportLightingButton (String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT id ,OCSMAdministrativeReportStatus__c,Aware_date__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; res.Id = report.Id; res.oCSMAdministrativeReportStatus = report.OCSMAdministrativeReportStatus__c; res.Awaredate = report.Aware_date__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } @AuraEnabled public static String updateQisForlexOCSMToReportLighting (String recordId){ String re = '成功'; QIS_Report__c report = [SELECT id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1]; try{ QIS_Report__c rac = new QIS_Report__c(); rac.id = recordId; rac.OCSMAdministrativeReportStatus__c = '待报告'; update rac; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); re = e.getMessage(); } return re; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String ownerId; @AuraEnabled public String qisRecordTypeId; @AuraEnabled public String qisRecordName; @AuraEnabled public String profileName; @AuraEnabled public String isAEProfile; @AuraEnabled public String isPAEProfile; @AuraEnabled public String isCNBuy; @AuraEnabled public String pAEid; @AuraEnabled public String oCSMAdministrativeReportNumber; @AuraEnabled public String oCSMAdministrativeReportStatus; @AuraEnabled public String qIStatus; @AuraEnabled public String oSHstaff; @AuraEnabled public String oSHstaffEmail; @AuraEnabled public String cancelQISReason; @AuraEnabled public String rCid; @AuraEnabled public String contractnumber; @AuraEnabled public Date rCinspectionDate; @AuraEnabled public Date qISReplyDay; @AuraEnabled public Date qISInstallDate; @AuraEnabled public Date cdsdate; @AuraEnabled public Date awaredate; @AuraEnabled public Date oCSMAdministrativeReportDate; @AuraEnabled public Boolean rCproblemnotfound; @AuraEnabled public Boolean isaohuiproduct; @AuraEnabled public Boolean isSendQIS; } } force-app/main/default/classes/QISReportController.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>50.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/RentalApplyControllerLWT.cls
New file @@ -0,0 +1,290 @@ public with sharing class RentalApplyControllerLWT { public RentalApplyControllerLWT() { } @AuraEnabled public static Rental_Apply__c initFromCancelSubmitButton(String recordId){ InitData res = new InitData(); try{ Rental_Apply__c report=[select Status__c,Yi_loaner_arranged__c,Id,RA_Status__c, demo_purpose2__c,Follow_UP_Opp__c,Statu_Achievements__c,Statu_Achievements_ID__c, Request_shipping_day__c,Demo_purpose1__c,Repair__c,RecordTypeId,SupplementCreated__c, OPDPlan__c,Campaign__c,QIS_number__c,OwnerId, // QIS_numberId__c,CampaignId__c,applyUserId__c, Re_repair__c, QIS_ID_Line__c, applyUser__c from Rental_Apply__c where Id= :recordId]; return report; // res.StatusC=report.Status__c; // res.Id=report.Id; // res.YiLoanerArrangedC=report.Yi_loaner_arranged__c; // res.RAStatusC=report.RA_Status__c; // res.DemoPurpose2C=report.demo_purpose2__c; // res.FollowUPOppC=report.Follow_UP_Opp__c; // res.StatuAchievementsC=report.Statu_Achievements__c; // res.StatuAchievementsIDC=report.Statu_Achievements_ID__c; // res.RequestShippingDayC=report.Request_shipping_day__c; // res.DemoPurpose1C=report.Demo_purpose1__c; // res.RepairC=report.Repair__c; // res.RecordTypeId=report.RecordTypeId; // res.SupplementCreatedC=report.SupplementCreated__c; // res.OPDPlanC=report.OPDPlan__c; // res.CampaignC=report.Campaign__c; // res.QISNumberC=report.QIS_number__c; // res.QISNumberIdc=report.QIS_numberId__c; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Rental_Apply_Equipment_Set_Detail__c> selectRentalApplyEquipmentSetDetailByRacId(String recordId){ InitData res = new InitData(); try{ list<Rental_Apply_Equipment_Set_Detail__c> report=[select Id, Fixture_Model_No_F__c, Product_Status_Flag_F__c from Rental_Apply_Equipment_Set_Detail__c where Rental_Apply__c = :recordId]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<QIS_Report__c> selectQISReportById(String recordId){ InitData res = new InitData(); try{ list<QIS_Report__c> report=[select Id, nonyushohin__r.Product2.Fixture_Model_No_T__c from QIS_Report__c where id = :recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Repair__c> selectRepairById(String recordId){ InitData res = new InitData(); try{ list<Repair__c> report=[select Id, Repair_Rank__c, DW_Sign_Txt__c, FSE_ApplyForRepair_Day__c, Delivered_Product__r.Product2.Fixture_Model_No_T__c , ReRepairObject_F__c,Status1__c,Agreed_Date__c,Repair_Estimated_date_formula__c,Repair_Ordered_Date__c , IfCheckFixture__c , Repair_Final_Inspection_Date__c,Repair_Shipped_Date__c,Number_of_EffectiveContract__c, NewProductGuaranteeObject__c, Delivered_Product__r.Product2.Asset_Model_No__c from Repair__c where id = :recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Campaign> selectCampaignById(String recordId){ InitData res = new InitData(); 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__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Rental_Apply_Equipment_Set__c> selectRentalApplyEquipmentSetByRacId(String recordId){ InitData res = new InitData(); try{ list<Rental_Apply_Equipment_Set__c> report=[select Id from Rental_Apply_Equipment_Set__c where RetalFSetDetail_Cnt__c = 0 AND Rental_Apply__c = :recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<Rental_Apply__c> selectRentalApplyById(String recordId){ InitData res = new InitData(); try{ list<Rental_Apply__c> report=[select id,OPDPlan__c,OPDPlan__r.SalesManager_Txt__c,OPDPlan__r.BuchangApprovalManagerSales_Txt__c from Rental_Apply__c where id = :recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<User> selectUserById(String recordId){ InitData res = new InitData(); try{ list<User> report=[select id,JingliEquipmentManager__c,JingliEquipmentManager__r.Name,Buzhang_Equipment_Manager__c, Buzhang_Equipment_Manager__r.Name from User where id = :recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static list<QIS_report__c> selectQISreportById2(String recordId){ InitData res = new InitData(); try{ list<QIS_report__c> report=[select id,next_action__c from QIS_report__c where id =:recordId ]; return report; }catch(Exception e){ System.debug(LoggingLevel.INFO,'Rental_Apply__c Cancel Error : ' + e); } return null; } @AuraEnabled public static String getUserId(){ return UserInfo.getUserId(); } @AuraEnabled public static String getProfileId(){ return UserInfo.getProfileId(); } @AuraEnabled public static String setSObjectShare(String sobjectName, String rowCause, String parentId, List<String> userAccess, String ownerId) { try { List<SObject> sObjList = new List<SObject>(); for (String ua : userAccess) { String userid = ua.split('_')[0]; String access = ua.split('_')[1]; SObject sObj = Schema.getGlobalDescribe().get(sobjectName).newSObject(); if (String.isBlank(userid) == false && userid.substring(0, 15) != ownerId.substring(0, 15)) { sObj.put('RowCause', rowCause); sObj.put('ParentId', parentId); sObj.put('UserOrGroupId', userid); sObj.put('AccessLevel', access); sObjList.add(sObj); } } if (sObjList.size() > 0) insert sObjList; return 'OK'; } catch (Exception e) { return e.getMessage(); } } @AuraEnabled public static UpdateResult updateRentalApplyC( String recordId, String SalesManagerSubmitC, String StatusC, String OPDManagerApproverC, String BuchangApprovalManagerSalesSubmitC, String OPDBuchangApproverC ) { UpdateResult result = new UpdateResult(); result.recordId = recordId; try{ // 更新记录并获取结果 if(recordId==null) return null; Rental_Apply__c rac = new Rental_Apply__c( id=recordId); if(SalesManagerSubmitC!=null&& SalesManagerSubmitC != ''){ rac.SalesManagerSubmit__c=SalesManagerSubmitC; } if(StatusC!=null&&StatusC!=''){ rac.Status__c=StatusC; } if(OPDManagerApproverC!=null&&OPDManagerApproverC!=''){ rac.OPDManagerApprover__c=OPDManagerApproverC; } if(BuchangApprovalManagerSalesSubmitC!=null&&BuchangApprovalManagerSalesSubmitC!=''){ rac.BuchangApprovalManagerSalesSubmit__c=BuchangApprovalManagerSalesSubmitC; } if(OPDBuchangApproverC!=null&&OPDBuchangApproverC!=''){ rac.OPDBuchangApprover__c=OPDBuchangApproverC; } 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; } 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 StatusC; @AuraEnabled public Decimal YiLoanerArrangedC; @AuraEnabled public String Id; @AuraEnabled public String RAStatusC; @AuraEnabled public String DemoPurpose2C; @AuraEnabled public String FollowUPOppC; @AuraEnabled public String StatuAchievementsC; @AuraEnabled public String StatuAchievementsIDC; @AuraEnabled public Date RequestShippingDayC; @AuraEnabled public String DemoPurpose1C; @AuraEnabled public String RepairC; @AuraEnabled public String RecordTypeId; @AuraEnabled public Boolean SupplementCreatedC; @AuraEnabled public String OPDPlanC; @AuraEnabled public String CampaignC; @AuraEnabled public String QISNumberC; @AuraEnabled public String QISNumberIdc; } } force-app/main/default/classes/RentalApplyControllerLWT.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/classes/RentalApplyWebService.cls
New file @@ -0,0 +1,2069 @@ global class RentalApplyWebService { // TODO please use public okStatus public final static Integer okStatus = 99; public final static String okStatus2 = '引当済'; //bp2 // /** // * check meisai // * @param rentalApplyId 备品借出申请ID // * @param rentalApplys 备品借出申请 // * @param rentalApplyEquipmentSets 备品申请借出历史(备品借出申请 和 备品Set 的Link表) // * @param equipmentSetIdList Equipment_Set__c.id // * @param idmap Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id // * @return 成功: 1、or 错误内容 // */ // private static String privateCheck(String rentalApplyId, // Map<String, List<List<Rental_Apply__c>>> mRentalApplys, // Map<String, List<List<Rental_Apply_Equipment_Set__c>>> mRentalApplyEquipmentSets, // Map<String, List<List<Id>>> mEquipmentSetIdList, // Map<String, List<Map<Id, Id>>> mIdmap // ) { // List<Rental_Apply__c> rentalApplys = mRentalApplys.get('rentalApplys')[0]; // List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSets = mRentalApplyEquipmentSets.get('rentalApplyEquipmentSets')[0]; // List<Id> equipmentSetIdList = mEquipmentSetIdList.get('equipmentSetIdList')[0]; // Map<Id, Id> idmap = mIdmap.get('idmap')[0]; // //返回结果,1:成功。 // String checkRS = '1'; // //备品借出申请 // rentalApplys = [select Rental_Apply_Equipment_Set_Cnt__c from Rental_Apply__c where Id = :rentalApplyId]; // if (rentalApplys.size() == 0) { // checkRS = '没有备品借出申请,请确认。'; // return checkRS; // } // Rental_Apply__c rentalApply = rentalApplys[0]; // if (rentalApply.Rental_Apply_Equipment_Set_Cnt__c <= 0) { // //返回结果,2:message-没有备品Set,请确认。 // checkRS = '没有借出备品set一览,请确认。'; // return checkRS; // } // //备品申请借出历史 // equipmentSetIdList = new List<Id>(); // rentalApplyEquipmentSets = [ // select Equipment_Set__c,Equipment_Set__r.Active_judgement__c // from Rental_Apply_Equipment_Set__c // where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false]; // for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) { // equipmentSetIdList.add(rentalApplyEquipmentSet.Equipment_Set__c); // } // // Equipment_Set_Detail__c,空更新 (TODO 今後batchになる!?) // List<Equipment_Set_Detail__c> updDetailList = [ // select id // from Equipment_Set_Detail__c // where Equipment_Set__c in :equipmentSetIdList]; // update updDetailList; // //备品申请借出历史、再取得 // List<Rental_Apply_Equipment_Set__c> raesList = new List<Rental_Apply_Equipment_Set__c>(); // equipmentSetIdList = new List<Id>(); // rentalApplyEquipmentSets = [ // select Id,Name,Equipment_Set__c,ES_Stock_Status__c,Loaner_name_text__c,Loaner_code_text__c,SerialNumber_text__c, // Salesdepartment_text__c,Salesprovince_text__c,Equipment_Type_text__c,Equipment_Set_Borrowed__c,Product_Class_Bor__c, // Equipment_Set__r.Name,Equipment_Set__r.ES_Status__c,Equipment_Set__r.Active_judgement2__c, // Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c,Rental_Start_Date__c, // Equipment_Set__r.Already_Stock_Out__c, Equipment_Set__r.Loaner_name__c, // Equipment_Set__r.Loaner_code__c,Equipment_Set__r.Salesdepartment__c, // Equipment_Set__r.SalesProvince__c,Equipment_Set__r.Equipment_Type__c,Equipment_Set__r.SerialNumber__c, // Equipment_Set__r.Contents_number__c,Equipment_Set__r.Product_category__c // from Rental_Apply_Equipment_Set__c // where Rental_Apply__c = :rentalApplyId and Cancel_Select__c = false]; // idmap = new Map<Id,Id>(); // Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id // for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) { // if (rentalApplyEquipmentSet.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c != rentalApplyEquipmentSet.Id) { // raesList.add(rentalApplyEquipmentSet); // equipmentSetIdList.add(rentalApplyEquipmentSet.Equipment_Set__c); // } // } // for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : raesList) { // /* // if (rentalApplyEquipmentSet.Rental_Start_Date__c <= Date.today()) { // checkRS = '借出开始日必须大于今日。借出备品set一览:' + rentalApplyEquipmentSet.Name; // return checkRS; // } // */ // /* // if (rentalApplyEquipmentSet.Equipment_Set__r.Active_judgement2__c != okStatus) { // //返回结果,1:message-请确认备品Set状态。 // checkRS = '备品set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 的' + Schema.SObjectType.Equipment_Set__c.fields.Asset_Set_status2__c.label + '不是 99.等待预约 ,现在是 ' + rentalApplyEquipmentSet.Equipment_Set__r.Asset_Set_status2__c + ' 请确认'; // return checkRS; // } // */ // // ////bp2 if (rentalApplyEquipmentSet.Equipment_Set__r.Contents_number__c == 0) { ////bp2 checkRS = '备品set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 没有选择借出的明细,请确认'; ////bp2 return checkRS; ////bp2 } ////bp2 if (rentalApplyEquipmentSet.Equipment_Set__r.ES_Status__c != okStatus2) { ////bp2 checkRS = '备品set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 的' + Schema.SObjectType.Equipment_Set__c.fields.ES_Status__c.label + '不是 ' + okStatus2 + ',现在是 ' + rentalApplyEquipmentSet.Equipment_Set__r.ES_Status__c + ' 请确认'; ////bp2 return checkRS; ////bp2 } ////bp2 if (rentalApplyEquipmentSet.Equipment_Set__r.Already_Stock_Out__c == true) { ////bp2 checkRS = '备品set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 没有上架,请确认'; ////bp2 return checkRS; ////bp2 } ////bp2 if (rentalApplyEquipmentSet.ES_Stock_Status__c == '不能出库') { ////bp2 checkRS = '备品set ' + rentalApplyEquipmentSet.Equipment_Set__r.Name + ' 在预约期间外不能出库,请确认'; ////bp2 return checkRS; ////bp2 } // idmap.put(rentalApplyEquipmentSet.Equipment_Set__c, rentalApplyEquipmentSet.Id); // } // mRentalApplys.get('rentalApplys')[0] = rentalApplys; // mRentalApplyEquipmentSets.get('rentalApplyEquipmentSets')[0] = raesList; // mEquipmentSetIdList.get('equipmentSetIdList')[0] = equipmentSetIdList; // mIdmap.get('idmap')[0] = idmap; // return checkRS; // } //bp2 // /** // *@param : String 备品借出申请ID // *@return : String (成功: 1、or 错误内容) // */ // WebService static String reserveCheck(String rentalApplyId) { // //备品借出申请 // List<Rental_Apply__c> rentalApplys = new List<Rental_Apply__c>(); // //备品申请借出历史 // List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSets = new List<Rental_Apply_Equipment_Set__c>(); // List<Id> equipmentSetIdList = new List<Id>(); // Map<Id, Id> idmap = new Map<Id,Id>(); // Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id // Map<String, List<List<Rental_Apply__c>>> mRentalApplys = // new Map<String, List<List<Rental_Apply__c>>>{'rentalApplys' => new List<List<Rental_Apply__c>>{rentalApplys}}; // Map<String, List<List<Rental_Apply_Equipment_Set__c>>> mRentalApplyEquipmentSets = // new Map<String, List<List<Rental_Apply_Equipment_Set__c>>>{'rentalApplyEquipmentSets' => new List<List<Rental_Apply_Equipment_Set__c>>{rentalApplyEquipmentSets}}; // Map<String, List<List<Id>>> mEquipmentSetIdList = // new Map<String, List<List<Id>>>{'equipmentSetIdList' => new List<List<Id>>{equipmentSetIdList}}; // Map<String, List<Map<Id, Id>>> mIdmap = // new Map<String, List<Map<Id, Id>>>{'idmap' => new List<Map<Id, Id>>{idmap}}; // String rt1 = RentalApplyWebService.approvalCheck(rentalApplyId); // if (rt1 != '1') { // return rt1; // } // //返回结果,1:成功。 //// return RentalApplyWebService.privateCheck(rentalApplyId, mRentalApplys, mRentalApplyEquipmentSets, mEquipmentSetIdList, mIdmap); // String rt2 = RentalApplyWebService.privateCheck(rentalApplyId, mRentalApplys, mRentalApplyEquipmentSets, mEquipmentSetIdList, mIdmap); // if (rt2 != '1') { // return rt2; // } // return '1'; // } //bp2 // /** // *@param : String 备品借出申请ID // *@return : String (成功: 1、or 错误内容) // */ // WebService static String reserve(String rentalApplyId) { // //备品借出申请 // List<Rental_Apply__c> rentalApplys = new List<Rental_Apply__c>(); // //备品申请借出历史 // List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSets = new List<Rental_Apply_Equipment_Set__c>(); // List<Id> equipmentSetIdList = new List<Id>(); // Map<Id, Id> idmap = new Map<Id,Id>(); // Equipment_Set__c.Id => Rental_Apply_Equipment_Set__c.Id // Map<String, List<List<Rental_Apply__c>>> mRentalApplys = // new Map<String, List<List<Rental_Apply__c>>>{'rentalApplys' => new List<List<Rental_Apply__c>>{rentalApplys}}; // Map<String, List<List<Rental_Apply_Equipment_Set__c>>> mRentalApplyEquipmentSets = // new Map<String, List<List<Rental_Apply_Equipment_Set__c>>>{'rentalApplyEquipmentSets' => new List<List<Rental_Apply_Equipment_Set__c>>{rentalApplyEquipmentSets}}; // Map<String, List<List<Id>>> mEquipmentSetIdList = // new Map<String, List<List<Id>>>{'equipmentSetIdList' => new List<List<Id>>{equipmentSetIdList}}; // Map<String, List<Map<Id, Id>>> mIdmap = // new Map<String, List<Map<Id, Id>>>{'idmap' => new List<Map<Id, Id>>{idmap}}; // //返回结果,1:成功。 // String checkRS = RentalApplyWebService.privateCheck(rentalApplyId, mRentalApplys, mRentalApplyEquipmentSets, mEquipmentSetIdList, mIdmap); // if (checkRS != '1') return checkRS; // rentalApplys = mRentalApplys.get('rentalApplys')[0]; // rentalApplyEquipmentSets = mRentalApplyEquipmentSets.get('rentalApplyEquipmentSets')[0]; // equipmentSetIdList = mEquipmentSetIdList.get('equipmentSetIdList')[0]; // idmap = mIdmap.get('idmap')[0]; // Rental_Apply__c rentalApply = rentalApplys[0]; // //备品Set // List<Equipment_Set__c> equipmentSetUpdateList = new List<Equipment_Set__c>(); // //备品Set明细 // List<Equipment_Set_Detail__c> equipmentSetDetailList = new List<Equipment_Set_Detail__c>(); // List<Equipment_Set_Detail__c> equipmentSetDetailList2 = new List<Equipment_Set_Detail__c>(); // //备品申请借出明细历史 // List<Rental_Apply_Equipment_Set_Detail__c> rentalApplyEquipmentSetDetailList = new List<Rental_Apply_Equipment_Set_Detail__c>(); // for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) { // // 已做出库指示flag⇒前回の申請はまだ終わってない⇒出库しない // if (rentalApplyEquipmentSet.Equipment_Set__r.Already_Stock_Out__c == false) { // //更新备品Set // Equipment_Set__c equipmentSet = new Equipment_Set__c( // Id = rentalApplyEquipmentSet.Equipment_Set__c, // Last_Reserve_Rental_Apply_Equipment_Set__c = rentalApplyEquipmentSet.Id, // Pre_Reserve_Rental_Apply_Equipment_Set__c = rentalApplyEquipmentSet.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c, // StockDown__c = false, // StockDown_time__c = null, // Shipment_request_time__c = System.now(), //出库指示时间 // Shippment_loaner_time__c = null, //备品中心出库时间 // Forecast_arrival_day__c = null, //预计到货日 // //Loaner_received_day__c = null, //现场签收日 // Return_wh_chenk_staff__c = null, // Request_asset_extend_time__c = null, //延期申请时间 // asset_extend_approval_time__c = null, //延期申请批准时间 // //Asset_return_day__c = null, //物流提货日 // Received_loaner_time__c = null, //备品中心回收时间 // delivery_company__c = null, // Fedex_number__c = null, // Distributor_method__c = null, // Return_to_wh_staff__c = null, // Return_delivery_company__c = null, // Return_Fedex_number__c = null, // Return_Distributor_method__c = null, // Received_confirmation_staff__c = null, // Customer_install_explanation_sign__c = null, //是否回收CDS确认单 // Send_to_return_email__c = false, //发送回收结果反馈邮件 // Return_comment_anoucment__c = null, //发送回收结果反馈内容(NG理由和欠品情况) ////bp2 CDS_complete__c = false, // Arrival_in_wh__c = false, // Arrival_wh_time2__c = null, // Already_Stock_Out__c = true, // Repair_Sum_Update__c = 0 // ); // //更新备品Set // equipmentSetUpdateList.add(equipmentSet); // } // } // //借出设备机身号码 // Map<String, String> assetSerialNumberMap = new Map<String, String>(); // //备品Set明细 // Equipment_Set_Detail__c[] equipmentSetDetails = [select Equipment_Set__c,Asset__c,Asset__r.SerialNumber, // Check_lost_Item__c,Pre_disinfection__c,Water_leacage_check__c, // Inspection_result_after__c,Arrival_in_wh__c, // Lost_item_check_staff__c,CDS_staff__c,Inspection_staff_After__c, // Return_wh_chenk_staff__c,Pre_inspection_time__c,Lost_item_check_time__c, // After_Inspection_time__c,Arrival_wh_time__c, // Inspection_result__c,Inspection_staff__c,Last_Reserve_RAES_Detail__c, // Equipment_Set__r.Already_Stock_Out__c ////bp2 , CDS_complete__c, CDS_complete_time__c // from Equipment_Set_Detail__c // where Equipment_Set__c in :equipmentSetIdList and Select_rental__c = true]; // for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails) { // // 已做出库指示flag⇒前回の申請はまだ終わってない⇒出库しない // if (equipmentSetDetail.Equipment_Set__r.Already_Stock_Out__c == false) { // //插入备品申请借出明细历史 // Rental_Apply_Equipment_Set_Detail__c rentalApplyEquipmentSetDetail = new Rental_Apply_Equipment_Set_Detail__c(); // rentalApplyEquipmentSetDetail.Rental_Apply__c = rentalApply.Id;//备品借出申请 // rentalApplyEquipmentSetDetail.Rental_Apply_Equipment_Set__c = idmap.get(equipmentSetDetail.Equipment_Set__c);//备品Set借出历史 // rentalApplyEquipmentSetDetail.Equipment_Set__c = equipmentSetDetail.Equipment_Set__c;//备品Set // rentalApplyEquipmentSetDetail.Asset__c = equipmentSetDetail.Asset__c;//保有设备 // //插入备品申请借出明细历史 // rentalApplyEquipmentSetDetailList.add(rentalApplyEquipmentSetDetail); // //更新备品Set明细 // equipmentSetDetail.Check_lost_Item__c = null;//欠品确认结果 // equipmentSetDetail.Lost_item_giveup__c = false; // equipmentSetDetail.Pre_disinfection__c = null;//清洗前 // equipmentSetDetail.Water_leacage_check__c = null;//测漏检查结果 // equipmentSetDetail.Inspection_result_after__c = null;//回收后-检测结果 // equipmentSetDetail.Arrival_in_wh__c = false;//回库确认 // equipmentSetDetail.Lost_item_check_staff__c = null;//欠品确认者 // equipmentSetDetail.CDS_staff__c = null;//消毒人员 // equipmentSetDetail.Inspection_staff_After__c = null;//回收后-检测人员 // equipmentSetDetail.Return_wh_chenk_staff__c = null;//回库确认者 // equipmentSetDetail.Inspection_result__c = null;//发货前-检测结果 // equipmentSetDetail.Inspection_staff__c = null;//发货前-检测人员 // equipmentSetDetail.Pre_inspection_time__c = null;//备品Set用,发货前-检测合格时间 // equipmentSetDetail.Lost_item_check_time__c = null;//备品Set用,欠品确认时间 ////bp2 equipmentSetDetail.CDS_complete_time__c = null;//备品Set用,CDS完毕时间 // equipmentSetDetail.After_Inspection_time__c = null;//备品Set用,回收后-检测完毕时间 // equipmentSetDetail.Arrival_wh_time__c = null;//备品Set用,回库确认完毕时间 // equipmentSetDetail.Inspection_result_after_ng__c = null;//回收后-检测NG区分 // equipmentSetDetail.Inspection_result_ng__c = null;//发货前-检测NG区分 ////bp2 equipmentSetDetail.CDS_complete__c = false;//CDS完毕 // //更新备品Set明细 // equipmentSetDetailList.add(equipmentSetDetail); // //借出设备机身号码 // if (String.isNotBlank(equipmentSetDetail.Asset__r.SerialNumber)) { // if (assetSerialNumberMap.containsKey(equipmentSetDetail.Equipment_Set__c) == false) { // assetSerialNumberMap.put(equipmentSetDetail.Equipment_Set__c, ',' + equipmentSetDetail.Asset__r.SerialNumber + ','); // } else { // String tmp = assetSerialNumberMap.get(equipmentSetDetail.Equipment_Set__c); // tmp += equipmentSetDetail.Asset__r.SerialNumber + ','; // assetSerialNumberMap.put(equipmentSetDetail.Equipment_Set__c, tmp); // } // } // } // } // // TODO liang 1つsqlにまとめてください // Equipment_Set_Detail__c[] equipmentSetDetails2 = [select Id, Last_Reserve_RAES_Detail__c ////bp2 ,CDS_complete__c // from Equipment_Set_Detail__c // where Equipment_Set__c in :equipmentSetIdList and Select_rental__c = false]; // for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails2) { // equipmentSetDetail.Pre_Reserve_RAES_Detail__c = equipmentSetDetail.Last_Reserve_RAES_Detail__c; // equipmentSetDetail.Last_Reserve_RAES_Detail__c = null; ////bp2 equipmentSetDetail.CDS_complete__c = false;//CDS完毕 // equipmentSetDetailList2.add(equipmentSetDetail); // } // //更新借出设备机身号码 // List<Rental_Apply_Equipment_Set__c> rentalApplyEquipmentSetUpdateList = new List<Rental_Apply_Equipment_Set__c>(); // for (Rental_Apply_Equipment_Set__c rentalApplyEquipmentSet : rentalApplyEquipmentSets) { // if (assetSerialNumberMap.containsKey(rentalApplyEquipmentSet.Equipment_Set__c)) { // rentalApplyEquipmentSet.Rental_Asset_SerialNumber__c = assetSerialNumberMap.get(rentalApplyEquipmentSet.Equipment_Set__c); // // xiongyl-start // } // rentalApplyEquipmentSet.Loaner_name_text__c =rentalApplyEquipmentSet.Equipment_Set__r.Loaner_name__c; //备品名称 // rentalApplyEquipmentSet.Loaner_code_text__c = rentalApplyEquipmentSet.Equipment_Set__r.Loaner_code__c; //備品型番 // rentalApplyEquipmentSet.Salesdepartment_text__c = rentalApplyEquipmentSet.Equipment_Set__r.Salesdepartment__c; // 所在地区(本部) // rentalApplyEquipmentSet.Salesprovince_text__c = rentalApplyEquipmentSet.Equipment_Set__r.SalesProvince__c; //所在地区(省) // rentalApplyEquipmentSet.Equipment_Type_text__c = rentalApplyEquipmentSet.Equipment_Set__r.Equipment_Type__c; //分类 // rentalApplyEquipmentSet.Equipment_Set_Borrowed__c = rentalApplyEquipmentSet.Equipment_Set__r.Name;//备品set // rentalApplyEquipmentSet.Product_Class_Bor__c = rentalApplyEquipmentSet.Equipment_Set__r.Product_category__c; // rentalApplyEquipmentSet.SerialNumber_text__c = rentalApplyEquipmentSet.Equipment_Set__r.SerialNumber__c; // rentalApplyEquipmentSetUpdateList.add(rentalApplyEquipmentSet); // // xiongyl-end // } // Savepoint sp = Database.setSavepoint(); // try { // if (equipmentSetUpdateList.size() > 0) { // update equipmentSetUpdateList; // } // if (rentalApplyEquipmentSetDetailList.size() > 0) { // insert rentalApplyEquipmentSetDetailList; // } // if (equipmentSetDetailList.size() > 0) { // for (Integer i=0; i<equipmentSetDetailList.size(); i++) { // equipmentSetDetailList[i].Pre_Reserve_RAES_Detail__c = equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c; // equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c = rentalApplyEquipmentSetDetailList[i].Id; // } // update equipmentSetDetailList; // } // if (equipmentSetDetailList2.size() > 0) { // update equipmentSetDetailList2; // } // if (rentalApplyEquipmentSetUpdateList.size() > 0) { // update rentalApplyEquipmentSetUpdateList; // } // eSetRefreshStatus(equipmentSetIdList); // } catch (System.Exception e) { // Database.rollback(sp); // return e.getMessage(); // } // //返回结果 // return checkRS; // } // 备品借出时间check @AuraEnabled WebService 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'; } // 延期审批Check @AuraEnabled WebService static String extension_approval_processCheck(String rentalApplyId) { try { List<Rental_Apply__c> raList = [SELECT Id,Name , Demo_purpose1__c , Demo_purpose2__c , Loaner_received_ng_num__c , ExtensionApprovalTime_Initial__c , ExtensionApplicationTime_Final__c , ExtensionApprovalTime_Final__c , NewRepair__c , NewRepair__r.Agreed_Date__c , NewRepair__r.Status__c , NewRepair__r.ReRepairObject_F__c , NewRepair__r.Repair_Shipped_Date__c , AgreementBorrowingExtensionDate__c , next_action__c , RC_Ordered_Date__c , Bollow_Date_Add_10_WD__c , Root_Rental_Apply__c , Assign_Person__c , Return_dadeline_final__c , RA_Status__c , ExtensionApplicationTime_Initial__c , RecordType.DeveloperName , RecordType.id , ExtensionStatus__c FROM Rental_Apply__c WHERE Id = :rentalApplyId]; if (raList.size() == 0) { return '没有备品借出申请,请确认。'; } //add wangweipeng 2021/11/26 start /*List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(raList[0],'1'); return '1';*/ String ErrorMessageStr = unifyGetRentalApply(raList[0]); //add wangweipeng 2021/11/26 end return ErrorMessageStr; } catch(Exception e) { return e.getMessage(); } } //add wangweipeng 2021/11/26 start /** * @param rentalApplyId 备品id * @return 备品配套数据 * * 延期整体逻辑: * 1:试用目的2不为:有询价和无询价,做特殊处理 * 2:其他情况:逻辑不变 * 上面第一个条件满足: * 1:从原单点击延期申请按钮,没有分割单 * 2:从原单点击延期申请按钮,有分割单 * 3:从单点击延期申请按钮 * * 第一种情况:按照原来的逻辑走,不需要做特殊处理 * 第二种情况: * (1):记录类型为:备品中心,判断分配人是否为空,办事处分配人不可能为空 * (2):获取原单和原单下所有的分单,因为批量延期不光查看自己申请单情况,如果是主单进来的,还需要查看当前单子,和他下面的所有从单 * (2):走一个方法,这是一个延期通用的方法,用于判断此次延期的申请单是否有可以延期的一览,会在下面具体介绍 * (3):走上面通用的方法,没有获取到可以延期的一览,那么做提示,不能延期 * (4):跳转页面为:此次为批量延期自定义开发的页面 * 第三种情况: * (1):如果是从单延期,那么需要查看此单,此单的原单,此单原单下所有的从单是否满足延期条件 * (2):以上的单子必须满足:已出库的--已回收(不含)之间状态,且最新预定归还日≥ 今天。 * (3):走一个方法,这是一个延期通用的方法,用于判断此次延期的申请单是否有可以延期的一览,会在下面具体介绍 * (4):由于通用的方法会返回所有申请单可延期的一览,所以需要判断此单是否有可以延期的一览 * (5):由于通用的方法会跳过 ok并且回寄时间不为空的一览,所以此时判断这个条件,满足就不能延期 * (6):跳转页面为原来延期开发的自定义页面 * * 通用是否可以延期的方法:(试用(有询价)、试用(无询价)) * (1):此方法参数为list,如果超过1条数据,默认为走批量延期的条件 * (2):申请单:如果size大于1,跳过一些验证:未完成到货确认不验证和延期批准时间(最初)不能延期 * (3):一览:如果size大于1,ok并且回寄时间不为空的一览不验证 * */ public static String unifyGetRentalApply(Rental_Apply__c rentalApply){ Rental_Apply__c rac = rentalApply; //如果申请单的 使用目2为 有询价或无询价的,那么需要特殊处理一下 if(rac.Demo_purpose1__c == '产品试用' && (rac.demo_purpose2__c == '试用(无询价)' || rac.demo_purpose2__c == '试用(有询价)')){ if(rac.ExtensionStatus__c == '已批准'){ return '产品试用的申请不能提交第二次延期申请。'; }else{ return muchRentalApply(rac); } }else{ //办事处目前只能延期有询价或无询价 if(rac.RecordType.DeveloperName == 'AgencyRequest'){ return '办事处申请单,非试用(无询价)、 试用(有询价)不可延期。'; }else{ List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(new List<Rental_Apply__c>{rac}); return '1'; } } } /** * * @param rac [延期入口] * @return [description] * * 逻辑解释: * 原单(没有从单):走原来的逻辑 * 从单:判断此从单的原单、原单下所有的从单是否满足第一条,并且当前从单必须有一条满足第二条才能延期 * 原单(有从单):判断此申请单和原单下所有的从单是否满足第一条,并且这些申请单最少有一个申请单满足第二个条件,才能延期 */ public static String muchRentalApply(Rental_Apply__c rac){ //获取所有的申请单 List<Rental_Apply__c> rentalApplyData = getAllRentalApply(rac); if(rentalApplyData != null && rentalApplyData.size() > 0){ //如果只查到一条数据,那么证明他是原单,并且没有分割单,那么就走原来延期的逻辑 if(rentalApplyData.size() == 1){ List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(rentalApplyData); return '1'; }else{ //如果为多条,证明他有从单或当前要延期的单子是从单,那么就需要做特殊处理 List<Rental_Apply__c> racList = new List<Rental_Apply__c>(); //判断他是原单还是从单 System.debug('--345----------'+rac.Root_Rental_Apply__c); if(String.isNotBlank(rac.Root_Rental_Apply__c)){ //可延期的申请单应满足:已出库的--已回收(不含)之间状态,且最新预定归还日≥ 今天。 //当前日期 Date today = Date.today(); //预定归还日不能为空 if(rac.Return_dadeline_final__c != null){ //最新预定归还日≥ 今天。 if(rac.Return_dadeline_final__c >= today){ //可延期的申请单应满足:已出库的--已回收(不含)之间状态 if(rac.RA_Status__c == '申请者已收货' || rac.RA_Status__c == '医院已装机确认' || rac.RA_Status__c == '已出库') { //能走到这里,证明延期入口的申请单不是已经延过的,所有现在判断其他的申请单是否已经延期,如果延过,那么不需要验证 //if(rac.ExtensionApplicationTime_Initial__c == null){ racList = rentalApplyData; //} }else{ if(rac.RA_Status__c != '取消' && rac.RA_Status__c != '删除'){ return '申请单:'+rac.Name+'的状态为【'+rac.RA_Status__c+'】 不可以进行延期。'; } } }else{ return '申请单:'+rac.Name+'的最新预定归还日小于当前时间,不可以进行延期。'; } }else{ return '申请单:'+rac.Name+' 的预定归还日不能为空。'; } }else{ //备品中心 if(rac.RecordType.DeveloperName == 'StandardRequest'){ //a. 原单上分配人=空,点击原单上的【延期申请】按钮时,提示【原单未分配或已取消,请在分单上操作延期】 //注:原单未分配已取消或未分配时,原单分配人为空 if(String.isBlank(rac.Assign_Person__c)){ return '原单未分配或已取消,请在分单上操作延期。'; } } //如果是原单,直接判断是否满足第一和第二条,第三条不需要现在判断 racList = rentalApplyData; } if(racList != null && racList.size() > 0){ System.debug('-----------543---'+racList); //此方法主要验证第一和第二个条件 List<Rental_Apply_Equipment_Set__c> raesList = RentalApplyTriggerHandler.getCan_Extend_RequestList(racList); if(raesList.size() == 0){ return '无任何申请单满足。'; }else{ //如果从单为延期入口,会判断他的原单和此原单下所有从单满足延期条件 //如果满足条件,那么判断当前从单是否满足延期条件,如果是其他申请单满足,那么不能延期, //如果此申请单有一个配套满足,那么可以延期,走单独延期逻辑(原来延期逻辑) if(String.isNotBlank(rac.Root_Rental_Apply__c)){ Integer indexI = 0; String racIds = rac.Id; racIds = racIds.substring(0,15); //循环判断此单是否有可以延期的配套吗? for(Rental_Apply_Equipment_Set__c raesc : raesList){ String raescId = raesc.Rental_Apply__c; raescId = raescId.substring(0,15); if(racIds.equals(raescId)){ indexI++; } } if(indexI > 0) { //如果从单为延期入口,他会走通用的批量延期验证,所以需要验证以下的条件,如果满足就不然延期 //判断是此申请单是否存在 ok并且回寄时间不为空的一览 List<Rental_Apply_Equipment_Set__c> raescc = getAllRentalApplyEs(rac); if(raescc != null && raescc.size() > 0){ for(Rental_Apply_Equipment_Set__c rr : raescc){ if ((rr.Received_Confirm__c == 'OK' || rr.Received_Confirm__c == '默认签收-OK') && rr.Asset_return_time__c != null) { return '此单不满足延期条件。'; } } return '1'; } }else{ return '此单不满足延期条件。'; } }else{ return '2'; } } } } } return null; } /** * 根据传过来的备品id获取所有的从单和原单 * @param rea 延期的入口申请单 * @return 返回所有的原单和从单 * 参数有可能是原单id或从单id */ public static List<Rental_Apply__c> getAllRentalApply(Rental_Apply__c rea){ List<Rental_Apply__c> allRentalApply = [SELECT id, Name, RA_Status__c, Request_return_day__c, demo_purpose1__c,demo_purpose2__c, ExtensionApprovalTime_Final__c, RC_Ordered_Date__c, Bollow_Date_Add_10_WD__c, Loaner_received_ng_num__c, ExtensionApprovalTime_Initial__c, next_action__c, NewRepair__c, NewRepair__r.Agreed_Date__c, NewRepair__r.Status__c, NewRepair__r.ReRepairObject_F__c, NewRepair__r.Repair_Shipped_Date__c, AgreementBorrowingExtensionDate__c, Return_dadeline_final__c, ExtensionApplicationTime_Initial__c, Root_Rental_Apply__c, ExtensionStatus__c FROM Rental_Apply__c WHERE id = :rea.Id OR id = :rea.Root_Rental_Apply__c OR (Root_Rental_Apply__c = :rea.Id AND Root_Rental_Apply__c != NULL) OR (Root_Rental_Apply__c = :rea.Root_Rental_Apply__c AND Root_Rental_Apply__c != NULL) limit 1000]; return allRentalApply; } /** * [getAllRentalApplyEs 获取一览] * @param rea [description] * @return [description] * * 只有从单为延期入口的时候,才会去查询一览 */ public static List<Rental_Apply_Equipment_Set__c> getAllRentalApplyEs(Rental_Apply__c rea){ List<Rental_Apply_Equipment_Set__c> raes = [SELECT Id,name , Rental_Apply__c , Rental_Apply__r.Repair__r.Agreed_Date__c , Rental_Apply__r.Repair__r.Repair_Estimated_date_formula__c , Rental_Apply__r.NewRepair__c , Rental_Apply__r.NewRepair__r.Agreed_Date__c , Rental_Apply__r.NewRepair__r.Status__c , Rental_Apply__r.NewRepair__r.ReRepairObject_F__c , Rental_Apply__r.NewRepair__r.Repair_Shipped_Date__c , Rental_Apply__r.QISRepair__r.Repair_Shipped_Date__c , Rental_Apply__r.RC_return_to_office__c , Rental_Apply__r.AgreementBorrowingExtensionDate__c , Rental_Apply__r.ExtensionApprovalTime_Initial__c , Rental_Apply__r.ExtensionApplicationTime_Final__c , Rental_Apply__r.RcUnexpectExpiryDelay__c , Final_reply_day__c , Asset_return_time__c , Bollow_Date__c , demo_purpose2__c , demo_purpose1__c , Request_demo_time__c , Loaner_received_time__c , Received_Confirm__c , Loaner_received_day2__c , RcUnexpectExpiryDelay__c FROM Rental_Apply_Equipment_Set__c WHERE Rental_Apply__c = :rea.Id AND Cancel_Reason__c = null // 取消重新分配的话需要做为NG重新分配的情况所以不能用Cancel_Select__c ]; return raes; } //add wangweipeng 2021/11/26 start //bp2 // // 备品借出时间check // WebService static String approvalCheck2(String raesId) { // // check结果 // String returnStr = ''; // // 备品借出历史取得 // 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, Rental_Apply__r.Prepare_Day__c // from Rental_Apply_Equipment_Set__c // where Id = :raesId and Cancel_Select__c = false]; // Rental_Apply_Equipment_Set__c r = raes[0]; // // 日历范围,最小的借出开始日到最大的借出终了日 // Date startDate = r.Rental_Start_Date__c; // Date endDate = r.Rental_End_Date__c; // Integer prepareDay = r.Rental_Apply__r.Prepare_Day__c == null ? Integer.valueOf(System.Label.EquipmentRentalPrepare) : r.Rental_Apply__r.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 Id != :raesId // and Equipment_Set__c = :r.Equipment_Set__c // 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); // } // } // 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(); // Date minD = startD.addDays(-1 * prepare); // Date maxD = endD.addDays(prepare); // 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'; // } //bp2 // WebService static String reserve2(String raesId) { // String checkRS = '1'; // Rental_Apply_Equipment_Set__c raes = [ // select Id,Name,Rental_Apply__c,Rental_Start_Date__c,ES_Stock_Status__c, // Equipment_Set__c, // Equipment_Set__r.Name, // Equipment_Set__r.Active_judgement2__c, // Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c, // Equipment_Set__r.Pre_Reserve_Rental_Apply_Equipment_Set__c // from Rental_Apply_Equipment_Set__c where Id = :raesId and Cancel_Select__c = false // ]; // if (raes.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c == raes.Id) { // checkRS = '该借出备品set一览已经做过出库指示:' + raes.Name; // return checkRS; // } // if (raes.ES_Stock_Status__c == '不能出库') { // checkRS = '备品set ' + raes.Equipment_Set__r.Name + ' 在预约期间外不能出库,请确认'; // return checkRS; // } // checkRS = RentalApplyWebService.approvalCheck2(raesId); // if (checkRS != '1') { // return checkRS; // } // /* // if (raes.Rental_Start_Date__c <= Date.today()) { // checkRS = '借出开始日必须大于今日。借出备品set一览:' + raes.Name; // return checkRS; // } // if (raes.Equipment_Set__r.Active_judgement2__c != okStatus) { // checkRS = '备品set ' + raes.Equipment_Set__r.Name + ' 的' + Schema.SObjectType.Equipment_Set__c.fields.Asset_Set_status2__c.label + '不是 99.等待预约 ,现在是 ' + raes.Equipment_Set__r.Asset_Set_status2__c + ' 请确认'; // return checkRS; // } // */ // //备品Set明细 // List<Equipment_Set_Detail__c> equipmentSetDetailList = new List<Equipment_Set_Detail__c>(); // List<Equipment_Set_Detail__c> equipmentSetDetailList2 = new List<Equipment_Set_Detail__c>(); // //备品申请借出明细历史 // List<Rental_Apply_Equipment_Set_Detail__c> rentalApplyEquipmentSetDetailList = new List<Rental_Apply_Equipment_Set_Detail__c>(); // //更新备品Set // Equipment_Set__c equipmentSet = new Equipment_Set__c( // Id = raes.Equipment_Set__c, // Last_Reserve_Rental_Apply_Equipment_Set__c = raes.Id, // Pre_Reserve_Rental_Apply_Equipment_Set__c = raes.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c == null ? raes.Equipment_Set__r.Pre_Reserve_Rental_Apply_Equipment_Set__c : raes.Equipment_Set__r.Last_Reserve_Rental_Apply_Equipment_Set__c, // StockDown__c = false, // StockDown_time__c = null, // Shipment_request_time__c = System.now(), //出库指示时间 // Shippment_loaner_time__c = null, //备品中心出库时间 // Forecast_arrival_day__c = null, //预计到货日 // //Loaner_received_day__c = null, //现场签收日 // Request_asset_extend_time__c = null, //延期申请时间 // asset_extend_approval_time__c = null, //延期申请批准时间 // //Asset_return_day__c = null, //物流提货日 // Received_loaner_time__c = null, //备品中心回收时间 // delivery_company__c = null, // Fedex_number__c = null, // Distributor_method__c = null, // Return_to_wh_staff__c = null, // Return_delivery_company__c = null, // Return_Fedex_number__c = null, // Return_Distributor_method__c = null, // Received_confirmation_staff__c = null, // Customer_install_explanation_sign__c = null, //是否回收CDS确认单 // Send_to_return_email__c = false, //发送回收结果反馈邮件 // Return_comment_anoucment__c = null, //发送回收结果反馈内容(NG理由和欠品情况) ////bp2 CDS_complete__c = false, // Arrival_in_wh__c = false, // Arrival_wh_time2__c = null, // Repair_Sum_Update__c = 0 // ); // //借出设备机身号码 // String assetSerialNumber = ''; // Boolean assetFirst = false; // //备品Set明细 // Equipment_Set_Detail__c[] equipmentSetDetails = [select Equipment_Set__c,Asset__c,Asset__r.SerialNumber, // Check_lost_Item__c,Pre_disinfection__c,Water_leacage_check__c, // Inspection_result_after__c,Arrival_in_wh__c, // Lost_item_check_staff__c,CDS_staff__c,Inspection_staff_After__c, // Return_wh_chenk_staff__c,Pre_inspection_time__c,Lost_item_check_time__c, // After_Inspection_time__c,Arrival_wh_time__c, // Inspection_result__c,Inspection_staff__c,Last_Reserve_RAES_Detail__c ////bp2 CDS_complete_time__c, // from Equipment_Set_Detail__c // where Equipment_Set__c = :equipmentSet.Id and Select_rental__c = true]; // for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails) { // //插入备品申请借出明细历史 // Rental_Apply_Equipment_Set_Detail__c rentalApplyEquipmentSetDetail = new Rental_Apply_Equipment_Set_Detail__c(); // rentalApplyEquipmentSetDetail.Rental_Apply__c = raes.Rental_Apply__c;//备品借出申请 // rentalApplyEquipmentSetDetail.Rental_Apply_Equipment_Set__c = raes.Id;//备品Set借出历史 // rentalApplyEquipmentSetDetail.Equipment_Set__c = equipmentSetDetail.Equipment_Set__c;//备品Set // rentalApplyEquipmentSetDetail.Asset__c = equipmentSetDetail.Asset__c;//保有设备 // //插入备品申请借出明细历史 // rentalApplyEquipmentSetDetailList.add(rentalApplyEquipmentSetDetail); // //更新备品Set明细 // equipmentSetDetail.Check_lost_Item__c = null;//欠品确认结果 // equipmentSetDetail.Pre_disinfection__c = null;//清洗前 // equipmentSetDetail.Water_leacage_check__c = null;//测漏检查结果 // equipmentSetDetail.Inspection_result_after__c = null;//回收后-检测结果 // equipmentSetDetail.Arrival_in_wh__c = false;//回库确认 // equipmentSetDetail.Lost_item_check_staff__c = null;//欠品确认者 // equipmentSetDetail.CDS_staff__c = null;//消毒人员 // equipmentSetDetail.Inspection_staff_After__c = null;//回收后-检测人员 // equipmentSetDetail.Return_wh_chenk_staff__c = null;//回库确认者 // equipmentSetDetail.Inspection_result__c = null;//发货前-检测结果 // equipmentSetDetail.Inspection_staff__c = null;//发货前-检测人员 // equipmentSetDetail.Pre_inspection_time__c = null;//备品Set用,发货前-检测合格时间 // equipmentSetDetail.Lost_item_check_time__c = null;//备品Set用,欠品确认时间 ////bp2 equipmentSetDetail.CDS_complete_time__c = null;//备品Set用,CDS完毕时间 // equipmentSetDetail.After_Inspection_time__c = null;//备品Set用,回收后-检测完毕时间 // equipmentSetDetail.Arrival_wh_time__c = null;//备品Set用,回库确认完毕时间 // //更新备品Set明细 // equipmentSetDetailList.add(equipmentSetDetail); // //借出设备机身号码 // if (String.isNotBlank(equipmentSetDetail.Asset__r.SerialNumber)) { // if (assetFirst == false) { // assetSerialNumber += ',' + equipmentSetDetail.Asset__r.SerialNumber + ','; // assetFirst = true; // } else { // assetSerialNumber += equipmentSetDetail.Asset__r.SerialNumber + ','; // } // } // } // Equipment_Set_Detail__c[] equipmentSetDetails2 = [select Id, Last_Reserve_RAES_Detail__c // from Equipment_Set_Detail__c // where Equipment_Set__c = :equipmentSet.Id and Select_rental__c = false]; // for (Equipment_Set_Detail__c equipmentSetDetail : equipmentSetDetails2) { // equipmentSetDetail.Pre_Reserve_RAES_Detail__c = equipmentSetDetail.Last_Reserve_RAES_Detail__c; // equipmentSetDetail.Last_Reserve_RAES_Detail__c = null; // equipmentSetDetailList2.add(equipmentSetDetail); // } // //更新借出设备机身号码 // raes.Rental_Asset_SerialNumber__c = assetSerialNumber; // Savepoint sp = Database.setSavepoint(); // try { // if (equipmentSet != null) { // update equipmentSet; // } // if (rentalApplyEquipmentSetDetailList.size() > 0) { // insert rentalApplyEquipmentSetDetailList; // } // if (equipmentSetDetailList.size() > 0) { // for (Integer i=0; i<equipmentSetDetailList.size(); i++) { // equipmentSetDetailList[i].Pre_Reserve_RAES_Detail__c = equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c; // equipmentSetDetailList[i].Last_Reserve_RAES_Detail__c = rentalApplyEquipmentSetDetailList[i].Id; // } // update equipmentSetDetailList; // } // if (equipmentSetDetailList2.size() > 0) { // update equipmentSetDetailList2; // } // if (String.isNotBlank(assetSerialNumber)) { // update raes; // } // eSetRefreshStatus(equipmentSet.Id); // } catch (System.Exception e) { // Database.rollback(sp); // return e.getMessage(); // } // //返回结果 // return checkRS; // } // 借出备品配套一览状态即时更新 WebService static String eSetRefreshStatus(String raeSetId) { return eSetRefreshStatus(new List<String> {raeSetId}); } public static String eSetRefreshStatus(List<String> raeSetIds) { List<Rental_Apply_Equipment_Set__c> updateList1 = new List<Rental_Apply_Equipment_Set__c>(); if (!raeSetIds.isEmpty()) { for (Rental_Apply_Equipment_Set__c raes: [ select Id,Repair_Status1__c,Repair_Status_Text__c,Final_reply_day__c,Final_reply_day_text__c, Received_Confirm_NG_Not_Return__c,Received_Confirm_NG_Not_Return_Text__c, Received_Confirm_Status_Text__c, Received_Confirm_Status_F__c , NG_Final_reply_day_Text__c , NG_Final_reply_day_F__c , Yizhouweixiu_Final_reply_day_Text__c , Yizhouweixiu_Final_reply_day_F__c , Extend_Final_reply_day_Text__c , Extend_Final_reply_day_F__c , QIS_Final_reply_day_Text__c , QIS_Final_reply_day_F__c , Repair_cancel_Final_reply_day_Text__c , Repair_cancel_Final_reply_day_F__c , Return_to_office_Final_reply_day_Text__c , Return_to_office_Final_reply_day_F__c , Repair_delete_Final_reply_day_Text__c , Repair_delete_Final_reply_day_F__c , Yigoudaihuo_Final_reply_day_Text__c , Yigoudaihuo_Final_reply_day_F__c , Guzhangpaicha_Final_reply_day_Text__c , Guzhangpaicha_Final_reply_day_F__c , Repair_Agreed_Quotation_Text__c , Repair_Agreed_Quotation_F__c , Return_to_office_Final_reply_day_U_RC__c , Return_to_office_Final_reply_day_U_RC_F__c , Extend_Date__c , Extend_Date_F__c , Received_NG_ReAssign_Text__c , Received_NG_ReAssign__c //【FY23大及巨大课题】长假备品借用延期开发 2022/12/27 start xxf , Final_reply_day_Holiday_backup__c , NG_Final_reply_day_F_Holiday_backup__c , NG_Final_reply_day_Text_Holiday_backup__c , Yizhouweixiu_Final_reply_day_F_Holiday__c , Yizhouweixiu_Final_reply_day_TextHoliday__c , Extend_Final_reply_day_F_Holiday_backup__c , Extend_Final_reply_day_Text_Holiday_back__c , QIS_Final_reply_day_F_Holiday_backup__c , QIS_Final_reply_day_Text_Holiday_backup__c , Repair_cancel_Final_reply_day_F_Holiday__c , Repair_cancel_Final_reply_day_Text_Holid__c , Return_to_office_Final_reply_day_F_Ho__c , Return_to_office_Final_reply_day_Text_Ho__c , Repair_delete_Final_reply_day_F_Holiday__c , Repair_delete_Final_reply_day_Text_Ho__c , Yigoudaihuo_Final_reply_day_F_Holiday__c , Yigoudaihuo_Final_reply_day_Text_Holiday__c , FGuzhangpaicha_Final_reply_day_F_Holiday__c , Guzhangpaicha_Final_reply_day_Text_Holid__c , Return_to_office_Final_reply_day_U_RC_Ho__c , Return_to_office_Final_reply_day_U_RC_FH__c //【FY23大及巨大课题】长假备品借用延期开发 2022/12/27 end xxf from Rental_Apply_Equipment_Set__c where Id IN :raeSetIds ]) { Rental_Apply_Equipment_Set__c upd = UpdateRentalApplyEquipmentSetBatch.setRAES(raes); if (upd != null) { updateList1.add(upd); } } } //bp2 // List<Equipment_Set_Detail__c> esdList = [ // select Id,Asset_condition__c,Asset_condition_Text__c, // Serial_Lot__c,Serial_Lot_text__c, // Asset__r.Loaner_accsessary__c, Loaner_accsessary_text__c, // Active_judgement__c,Active_judgement_select__c,Active_judgement_text__c, // Last_Reserve_RAES_Detail_RAES_F__c,Last_Reserve_RAES_Detail_RAES_Id__c, // Equipment_Set_Last_Reserve_RAES_F__c,Equipment_Set_Last_Reserve_RAES_Id__c // from Equipment_Set_Detail__c // where Equipment_Set__c IN :eSetIds]; // List<Equipment_Set_Detail__c> updateList2 = UpdateRentalApplyEquipmentSetBatch.setESD(esdList); Savepoint sp = Database.setSavepoint(); try { if (!updateList1.isEmpty()) update updateList1; //bp2 if (updateList2.size() > 0) update updateList2; return '1'; } catch (System.Exception e) { Database.rollback(sp); return e.getMessage(); } return '1'; } //bp2 //数出一共有多少个备品Set,出库指示,全部发货会用到 // Webservice static Integer CntEquipmentSet(String Raid){ // List<Rental_Apply_Equipment_Set__c> Raesc = [Select Equipment_Set__c from Rental_Apply_Equipment_Set__c where Rental_Apply__c=:Raid and Cancel_Select__c = false]; // return Raesc.size(); // } // 分配验证 Webservice static String AssignBtn(String Rid){ List<String> statusList = System.Label.StatusProcessState.split(','); List<Rental_Apply__c> raList = [select demo_purpose2__c,next_action__c,QIS_number__r.ReplaceDeliveryDate__c,Follow_UP_Opp__r.Shipping_Finished_Day_Func__c,repair__r.Repair_Final_Inspection_Date__c,repair__r.Return_Without_Repair_Date__c,Campaign__c,Campaign__r.Status,Repair__r.Repair_Shipped_Date__c,Campaign__r.IF_Approved__c,Campaign__r.Meeting_Approved_No__c,Campaign__r.Approved_Status__c from Rental_Apply__c where id = :Rid]; // 20210803 ljh SFDC-C5HDC7 add 查询添加 Campaign__c,Campaign__r.Status,Repair__r.Repair_Shipped_Date__c if(raList.size()>0){ Rental_Apply__c Ra = raList[0]; // 20210803 ljh SFDC-C5HDC7 update 判断增加 Ra.repair__c != null && start // if(Ra.repair__r.Repair_Final_Inspection_Date__c!=null){ // return '修理最终检测日不为空,不能分配'; // }else if(Ra.repair__r.Return_Without_Repair_Date__c !=null){ // return '未修理归还日不为空,不能分配'; if(Ra.Campaign__c != null && Ra.Campaign__r.Status == '取消'){ return '学会取消,不可分配'; }else if(Ra.repair__c != null && (Ra.repair__r.Repair_Final_Inspection_Date__c!=null || Ra.Repair__r.Repair_Shipped_Date__c != null)){ return '修理有最终检测日或修理品返送日,不可分配'; }else if(Ra.repair__c != null && Ra.repair__r.Return_Without_Repair_Date__c !=null){ return '未修理归还日不为空,不能分配'; // 20210803 ljh SFDC-C5HDC7 add end }//1822 yc 20211021 start else if(Ra.demo_purpose2__c=='已购待货' && Ra.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c!= null){ return '已购待货目的,新品已有发货日,不可分配'; }else if(Ra.demo_purpose2__c=='索赔QIS' && Ra.next_action__c=='无偿更换' && Ra.QIS_number__r.ReplaceDeliveryDate__c!= null){ return '索赔QIS目的,QIS已有新品发货日,不可分配'; }//1822 yc 20211108 end else if(Ra.Campaign__r.IF_Approved__c && Ra.Campaign__r.Meeting_Approved_No__c == null){ return '已申请决裁但决裁编码为空'; }//20220301 sx obpm修改 else if(Ra.Campaign__r.IF_Approved__c && Ra.Campaign__r.Meeting_Approved_No__c != null && statusList.contains(Ra.Campaign__r.Approved_Status__c)){ return '已申请决裁但决裁状态不符合条件'; }//20220315 sx obpm备品决裁状态相关修改 else{ return 'Fin'; } }else{ return '该借出申请不存在'; } } //bp2 // // 补充附属品 // WebService static String fillOtherDetail(String eSetId) { // // 不打勾的不要补充,所以看 Active_judgement_select__c // List<Equipment_Set_Detail__c> sesd = [select Id from Equipment_Set_Detail__c where Equipment_Set__c = :eSetId and Asset__r.Loaner_accsessary__c = false and Active_judgement_select__c != :okStatus]; // if (sesd.size() > 0) { // // 要等主机回来了才能补 // return '请确认备品中主机状态'; // } // List<Equipment_Set_Detail__c> oesd = [select Id, Last_Reserve_RAES_Detail__c from Equipment_Set_Detail__c where Equipment_Set__c = :eSetId and Asset__r.Loaner_accsessary__c = true and Equipment_Set__r.ES_Status__c not in ('引当可','引当済') and Select_rental__c = true]; // // 因为有参照备品set的字段,所以为了达到状态变成99的目的,在这里做了入库的操作,而不是全清空。 // for (Equipment_Set_Detail__c esd : oesd) { // if (esd.Last_Reserve_RAES_Detail__c != null) { // esd.Pre_Reserve_RAES_Detail__c = esd.Last_Reserve_RAES_Detail__c; // esd.Last_Reserve_RAES_Detail__c = null; // } // esd.Inspection_result_ng__c = null; // esd.Pre_inspection_time__c = null; // esd.Inspection_staff__c = null; // esd.Inspection_result__c = 'OK'; // esd.Check_lost_Item__c = 'OK'; // esd.Lost_item_check_time__c = null; // esd.Lost_item_check_staff__c = null; // esd.Lost_item_giveup__c = false; // esd.Inspection_result_after_ng__c = null; // esd.After_Inspection_time__c = null; // esd.Inspection_staff_After__c = null; // esd.Inspection_result_after__c = 'OK'; // esd.Arrival_in_wh__c = true; // esd.Arrival_wh_time__c = null; // esd.Return_wh_chenk_staff__c = null; // esd.Pre_disinfection__c = null; // esd.Water_leacage_check__c = null; ////bp2 esd.CDS_staff__c = null; ////bp2 esd.CDS_complete_time__c = null; // } // Savepoint sp = Database.setSavepoint(); // try { // update oesd; // return '1'; // } catch (System.Exception e) { // Database.rollback(sp); // return e.getMessage(); // } // return '1'; // } Webservice 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'; } // TODO please use public public static Date getWD_now(Date d) { 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 1]; Date selectDate = workday[0].Date__c; return selectDate; } // TODO please use public 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; } } // pd:0代表当天,1代表第二天 public Map<Date, Map<String, String>> getDateMap(Date sd, Date ed, Integer pd) { Map<Date, Map<String, String>> returnMap = new Map<Date, Map<String, String>>(); List<OlympusCalendar__c> workdayList = [ select Id, Date__c, IsWorkDay__c from OlympusCalendar__c where Date__c >= :sd and Date__c <= :ed.addDays(15 + pd) // +15 的目的是、为了取得ed の 下一个工作日 order by Date__c]; for (Integer i = 0; i < workdayList.size(); i++) { OlympusCalendar__c wd = workdayList[i]; if (wd.Date__c > ed) break; Integer nextWordDays = 0; Map<String, String> valueMap = new Map<String, String>(); valueMap.put('WorkDay', String.valueOf(wd.IsWorkDay__c)); Integer maxJ = 15 + i + pd; if (maxJ > workdayList.size()) maxJ = workdayList.size(); for (Integer j = i; j < maxJ; j++) { OlympusCalendar__c oc = workdayList[j]; if (oc.IsWorkDay__c == 1) { nextWordDays++; if (nextWordDays == pd + 1) { valueMap.put('Next', String.valueOf(oc.Date__c)); break; } } } returnMap.put(wd.Date__c, valueMap); } return returnMap; } //bp2 //// TODO katsu select in for, why?、getBetweenWD をなくす方向、Countだけなら、getOlympusWorkDayCount のメソッドがあります。 // //工作日 // WebService static String getBetweenWD(String sd, String ed) { // String betweenWD = '0'; // if (sd != '' && ed != '') { // Date sdate = Date.valueof(sd.replace('/','-')); // Date edate = Date.valueof(ed.replace('/','-')); // List<OlympusCalendar__c> workdayList = [ // select Id, Date__c, IsWorkDay__c // from OlympusCalendar__c // where Date__c >= :sdate // and Date__c <= :edate // and IsWorkDay__c = 1 // order by Date__c]; // betweenWD = String.valueOf(workdayList.size()); // } // return betweenWD; // } //bp2 OLY_OCM-113 ////自然日 //Webservice static String getBetweenNaturalDay(String sd, String ed){ // String betweenND = '0'; // if(sd != '' && ed != ''){ // Date sdate = Date.valueof(sd.replace('/','-')); // Date edate = Date.valueof(ed.replace('/','-')); // Integer days = sdate.daysBetween(edate); // betweenND = String.valueOf(days); // } // return betweenND; //} //WebService static String sendAll(String raid) { // return '1'; //} ////bp2 OLY_OCM-81 //*************************Create 20160825 SWAG-AD59Z6 趙徳芳 Start*************************// // //全部发货 // WebService static String DeliverAll(String raid){ // List<Rental_Apply__c> raList = [select id,repair__r.Repair_Final_Inspection_Date__c,Bollow_Date__c,repair__r.Return_Without_Repair_Date__c, delivery_company__c, Return_to_wh_staff__c, Distributor_method__c, Tracking_Number__c, // Shippment_loaner_time__c,Status__c,All_Delivery_Flag_c__c // from Rental_Apply__c // where id = :raid]; // Rental_Apply__c Ra = new Rental_Apply__c(); // System.debug(raList); // if(raList.size()>0){ // Ra = raList[0]; // if(Ra.delivery_company__c == null|| // Ra.Return_to_wh_staff__c == null || // Ra.Distributor_method__c == null || // Ra.Tracking_Number__c == null){ // return '请补全发货物流信息'; // }else if(Ra.Status__c !='出库指示完了'){ // return '请先做出库指示后,再进行出库'; // } // //else if(Ra.repair__c.Repair_Final_Inspection_Date__c<Ra.Bollow_Date__c){ // // return '修理最终检测日早于发货日,不能发货'; // //} // else if(Ra.repair__c!=null&&Ra.repair__r.Repair_Final_Inspection_Date__c!=null){ // return '修理最终检测日不为空,不能发货'; // }else if(Ra.repair__c!=null&&Ra.repair__r.Return_Without_Repair_Date__c!=null){ // return '未修理归还日不为空,不能发货'; // }else{ // List<Rental_Apply_Equipment_Set__c> DeliveryGoodDetail = new List<Rental_Apply_Equipment_Set__c>(); // DeliveryGoodDetail = [select id,name,Equipment_Set__c from Rental_Apply_Equipment_Set__c where Shippment_loaner_time__c =null and Rental_Apply__c =:raid and Cancel_Select__c = false]; // if(DeliveryGoodDetail.size()>0){ // List<Rental_Apply_Equipment_Set__c> ExistSet = new List<Rental_Apply_Equipment_Set__c>(); // ExistSet = [select id,name,Equipment_Set__c from Rental_Apply_Equipment_Set__c where Rental_Apply__c =:raid and Cancel_Select__c = false]; // List<String> sqlLine = new List<String>(); // for(Rental_Apply_Equipment_Set__c RAESC : DeliveryGoodDetail){ // sqlLine.add(RAESC.Equipment_Set__c); // } // List<Equipment_Set__c> ResultSet = new List<Equipment_Set__c>(); // ResultSet = [select id,Pre_inspection_time__c,Shippment_loaner_time__c from Equipment_Set__c where id in:sqlLine]; // System.debug(ResultSet); // Integer Ncnt =0; // for(Equipment_Set__c ESC : ResultSet){ // if(ESC.Shippment_loaner_time__c!=null){ // Ncnt=Ncnt+1; // } // } // Savepoint sp = Database.setSavepoint(); // List<Equipment_Set__c> UpsertEsc = new List<Equipment_Set__c>(); // if(Ncnt==0){ // for(Equipment_Set__c ESC : ResultSet){ // Equipment_Set__c EscEle = new Equipment_Set__c(); // EscEle.id=ESC.id; // EscEle.delivery_company__c = Ra.delivery_company__c; // EscEle.Return_to_wh_staff__c = Ra.Return_to_wh_staff__c; // EscEle.Distributor_method__c = Ra.Distributor_method__c; // EscEle.Fedex_number__c = Ra.Tracking_Number__c; // EscEle.StockDown__c = true; // UpsertEsc.add(EscEle); // } // if(UpsertEsc.size()>0){ // Ra.All_Delivery_Flag_c__c = true; // try{ // update Ra; // update UpsertEsc; // return 'Fin'; // }catch (System.Exception e){ // Database.rollback(sp); // return e.getMessage(); // } // }else{ // return '所选备品Set,已全部出库,无法再次出库'; // } // }else{ // return '备品已出库'; // } // }else{ // return '本借出申请无需要出库的备品'; // } // } // }else{ // return '无效的备品借出申请'; // } // } ////bp2 OLY_OCM-81 ////*************************Create 20160825 SWAG-AD59Z6 趙徳芳 End***************************// // WebService static String receiveAll(String raid) { // List<Rental_Apply__c> raList = [select id, Return_Track_Company__c, Return_Distrubutor_Method__c, Return_Trake_Staff__c, Return_Track_Number__c, // Shippment_loaner_time__c // from Rental_Apply__c // where id = :raid]; // if (raList.size() == 0) { // return '无效的备品借出申请'; // } // Rental_Apply__c ra = raList[0]; // if (ra.Return_Track_Company__c == null || // ra.Return_Distrubutor_Method__c == null || // ra.Return_Trake_Staff__c == null || // ra.Return_Track_Number__c == '' || ra.Return_Track_Number__c == null) { // return '请补全回库物流信息'; // } // if (ra.Shippment_loaner_time__c == null) { // return '备品还没出库'; // } // List<Rental_Apply_Equipment_Set__c> raesList = [select id, Equipment_Set__c from Rental_Apply_Equipment_Set__c where Shippment_loaner_time__c != null and Rental_Apply__c = :raid and Cancel_Select__c = false]; // if (raesList.size() == 0) { // return '备品还没出库'; // } // Map<id,id> RaesEsIdMap = new Map<Id,id>(); // List<String> esidList = new List<String>(); // for (Rental_Apply_Equipment_Set__c raes : raesList) { // esidList.add(raes.Equipment_Set__c); // RaesEsIdMap.put(raes.Equipment_Set__c, raes.Id); // } // List<Equipment_Set__c> esList = [select id,Return_Fedex_number__c,Last_Reserve_Rental_Apply_Equipment_Set__c from Equipment_Set__c where id in :esidList]; // List<Equipment_Set__c> updList = new List<Equipment_Set__c>(); // for (Equipment_Set__c es : esList) { // if ((es.Return_Fedex_number__c == null || es.Return_Fedex_number__c == '') && es.Last_Reserve_Rental_Apply_Equipment_Set__c == RaesEsIdMap.get(es.Id)) { // Equipment_Set__c tmp = new Equipment_Set__c( // id = es.id, // Return_delivery_company__c = ra.Return_Track_Company__c, // Received_confirmation_staff__c = ra.Return_Trake_Staff__c, // Return_Distributor_method__c = ra.Return_Distrubutor_Method__c, // Return_Fedex_number__c = ra.Return_Track_Number__c // ); // updList.add(tmp); // } // } // if (updList.size() == 0) { // return '备品已经全部回库'; // } else { // try { // update updList; // } catch (Exception ex) { // return ex.getMessage(); // } // } // return '1'; // } WebService static String RentalApplyCancel(String raid, Boolean autoCancel) { List<Rental_Apply__c> raList = [select id, Shipment_request_Cnt__c, Status__c, RA_Status__c, Shippment_loaner_cnt__c, Loaner_cancel_request__c, Arrival_wh_cnt__c, Cancel_Reason__c from Rental_Apply__c where id = :raid]; List<Rental_Apply_Equipment_Set__c> raesList = [select id, StockDown_time__c //bp2 , Equipment_Set__c from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :raid and Cancel_Select__c = false]; List<Rental_Apply_Equipment_Set__c> updList = new List<Rental_Apply_Equipment_Set__c>(); // List<Rental_Apply_Equipment_Set_Detail__c> delList = new List<Rental_Apply_Equipment_Set_Detail__c>(); Set<Id> esIdSet = new Set<Id>(); if (raList.size() <= 0) { return '备品申请书不存在。'; } Rental_Apply__c ra = raList[0]; if (ra.Status__c == '取消') { return '备品申请书已经取消。'; } if (ra.Status__c == '删除') { return '备品申请书已经删除。'; } if (ra.RA_Status__c == FixtureUtil.raStatusMap.get(FixtureUtil.RaStatus.Yi_Chu_Ku.ordinal()) || ra.Arrival_wh_cnt__c > 0) { return '备品已经出库,不能取消。'; } User loginUser = [Select Id, Name, ProfileId From User where Id = :Userinfo.getUserId()]; if(loginUser.ProfileId != System.Label.ProfileId_SystemAdmin && loginUser.ProfileId != System.Label.ProfileId_EquipmentCenter && !System.Label.ProfileId_EquCenCheckAndDepot.contains(loginUser.ProfileId) && !System.Label.ProfileId_EquCenAdmin.contains(loginUser.ProfileId) && loginUser.ProfileId != System.Label.ProfileId_IThelp && ra.Shipment_request_Cnt__c > 0 ){ return '不能取消申请,请联系备品中心窗口取消。'; } if (autoCancel == false && String.isBlank(ra.Cancel_Reason__c)) { return '必须输入取消理由。'; } ra.Status__c = '取消'; if (autoCancel) { ra.Cancel_Reason__c = '被动取消'; } // Map<Id, Asset> assetMap = new Map<Id, Asset>(); // for (Rental_Apply_Equipment_Set__c raes : raesList) { // // if (raes.StockDown_time__c != null) { // raes.Cancel_Select__c = true; // raes.Cancel_Reason__c = ra.Loaner_cancel_request__c; // if (autoCancel) { // raes.Cancel_Reason__c = '被动取消'; // } // updList.add(raes); //bp2 esIdSet.add(raes.Equipment_Set__c); // } else { // delList.add(raes); //bp2 esIdSet.add(raes.Equipment_Set__c); // } // Asset ass = new Asset(Id = raes.Asset__c, Last_Reserve_RAES_Detail__c = null); // assetMap.put(raes.Asset__c, ass); // } Savepoint sp = Database.setSavepoint(); try { Set<Id> assetIdSet = new Set<Id>(); for (Rental_Apply_Equipment_Set_Detail__c raesd : [SELECT Id, Asset__c FROM Rental_Apply_Equipment_Set_Detail__c WHERE Rental_Apply__c = :raid FOR UPDATE] ) { if (String.isNotBlank(raesd.Asset__c)) { assetIdSet.add(raesd.Asset__c); } } if (assetIdSet.size() > 0) { List<Asset> assetList = [SELECT Id FROM Asset WHERE Id = :assetIdSet FOR UPDATE]; } update ra; //if (updList.size() > 0) update updList; // if (!assetMap.isEmpty()) update assetMap.values(); //bp2 ControllerUtil.setEquipmentSetProvisionFlg(esIdSet); } catch (Exception ex) { return ex.getMessage(); Database.rollback(sp); } return '1'; } // 一覧単位 @AuraEnabled WebService static String setRaesShipment_request(String raesid) { return setShipment_requests(null, raesid); } // 申請書単位 @AuraEnabled WebService static String setShipment_request(String raid) { return setShipment_requests(raid, null); } //出库指示按钮js一次最多更新200条,所以改在WebService做出库指示 @AuraEnabled WebService 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(); } } /** * 注残申请备品的管控 */ WebService static String RentalApplyCheckForSAoneEle(String SaID) { Statu_Achievements__c Sac = [select id, SalesChannel__c, Opportunity__r.Sales_Root__c, Status_1__c, Status_2_Formula__c, Opp_Number__c, ContractNO__c, FirstApproveDate__c, CreatedDate, X30_Deposit_Day__c, Deposit_In_Full_Day__c, DeliveryDate__c, Backorder_complete_day__c, DeliveryStatus__c from Statu_Achievements__c where id = :SaID]; if(Sac.Opportunity__r.Sales_Root__c == '販売店'){ if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET') ){ //modify by lyh 20220606 start 已购待货逻辑调整 //客户GIR订单,注残状态2是“12付全款-14已发货“这个区间且发货状态为”未交付、和部分交付“时,自付款日起第31天未生成”客户订单最终发货日“时,方可以提交”已购待货“目的的备品申请 //if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-30)>Sac.Deposit_In_Full_Day__c)&&Sac.DeliveryDate__c == null){ if((Sac.Status_2_Formula__c == '12 已订货・付全款' || Sac.Status_2_Formula__c == '13 待发货' || Sac.Status_2_Formula__c == '14 已发货') && (Sac.DeliveryStatus__c == '未交付' || Sac.DeliveryStatus__c == '部分交付')) { if((Date.today().addDays(-30) > Sac.Deposit_In_Full_Day__c) && Sac.Backorder_complete_day__c == null) { //modify by lyh 20220606 end 已购待货逻辑调整 return 'Fin'; } else { return '经销商内科订单不在申请期内,不能申请备品'; } }else{ return '经销商内科订单状态不符合备品申请资格,不能申请备品'; } }else if(Sac.Opp_Number__c.contains('SP')){ //modify by lyh 20220606 start 已购待货逻辑调整 //客户SP订单,注残状态2是“11付定金-14已发货“这个区间且发货状态为”未交付、和部分交付“时,自付款日起第61天未生成”客户订单最终发货日“时,方可以提交”已购待货“目的的备品申请 //if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-60)>Sac.X30_Deposit_Day__c )&&Sac.DeliveryDate__c == null){ if((Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货'||Sac.Status_2_Formula__c=='14 已发货') && (Sac.DeliveryStatus__c == '未交付' || Sac.DeliveryStatus__c == '部分交付')) { if((Date.today().addDays(-60) > Sac.X30_Deposit_Day__c ) && Sac.Backorder_complete_day__c == null){ //modify by lyh 20220606 end 已购待货逻辑调整 return 'Fin'; }else{ return '经销商SP订单不在申请期内,不能申请备品'; } }else{ return '经销商SP订单状态不符合备品申请资格,不能申请备品'; } }else{ return '注残销售渠道类别不在可申请备品范围内'; } }else if(Sac.Opportunity__r.Sales_Root__c == 'OCM直接販売'){ if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET')){ //modify by lyh 20220606 start 已购待货逻辑调整 //注残状态2是“9已录订单未付款-14已发货“这个区间且发货状态为”未交付、和部分交付“且“销售渠道为直销时”,GIR订单自订单录入日起第31天/未生成”客户订单最终发货日“时,方可以提交”已购待货“目的的备品申请 //if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '09 已录入订单未付款'||Sac.Status_2_Formula__c == '10 库存已预留・未付款'||Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-30)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){ if((Sac.Status_2_Formula__c == '09 已录入订单未付款'||Sac.Status_2_Formula__c == '10 库存已预留・未付款'||Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货'||Sac.Status_2_Formula__c=='14 已发货') && (Sac.DeliveryStatus__c == '未交付' || Sac.DeliveryStatus__c == '部分交付')){ if((Date.today().addDays(-30) > Sac.FirstApproveDate__c ) && Sac.Backorder_complete_day__c == null) { //modify by lyh 20220606 end 已购待货逻辑调整 return 'Fin'; }else{ return 'OCM直销内科订单不在申请期内,不能申请备品'; } }else{ return 'OCM直销内科订单状态不符合备品申请资格,不能申请备品'; } }else if(Sac.Opp_Number__c.contains('SP')){ //modify by lyh 20220606 start 已购待货逻辑调整 //注残状态2是“9已录订单未付款-14已发货“这个区间且发货状态为”未交付、和部分交付“且“销售渠道为直销时”,SP订单61天未生成”客户订单最终发货日“时,方可以提交”已购待货“目的的备品申请 //if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '09 已录入订单未付款'||Sac.Status_2_Formula__c == '10 库存已预留・未付款'||Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-60)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){ if((Sac.Status_2_Formula__c == '09 已录入订单未付款'||Sac.Status_2_Formula__c == '10 库存已预留・未付款'||Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货'||Sac.Status_2_Formula__c=='14 已发货') && (Sac.DeliveryStatus__c == '未交付' || Sac.DeliveryStatus__c == '部分交付')) { if((Date.today().addDays(-60) > Sac.FirstApproveDate__c ) && Sac.Backorder_complete_day__c == null) { //modify by lyh 20220606 end 已购待货逻辑调整 return 'Fin'; }else{ return 'OCM直销SP订单不在申请期内,不能申请备品'; } }else{ return 'OCM直销SP订单状态不符合备品申请资格,不能申请备品'; } }else{ return '注残销售渠道类别不在可申请备品范围内。'; } }else{ return '销售渠道未知,不能新建'; } } //bp2 //public static String RentalApplyCheckForSA(String raid,String SaID) { // List<String> ProList = new List<String>(); // if(raid!=null){ // Rental_Apply__c Ra = [select id, // Product_category__c, // ProductNameNum1__c, // ProductNameNum10__c, // ProductNameNum2__c, // ProductNameNum3__c, // ProductNameNum4__c, // ProductNameNum5__c, // ProductNameNum6__c, // ProductNameNum7__c, // ProductNameNum8__c, // ProductNameNum9__c // from // Rental_Apply__c // where // id=: Raid]; // ProList.add(Ra.ProductNameNum1__c); // ProList.add(Ra.ProductNameNum2__c); // ProList.add(Ra.ProductNameNum3__c); // ProList.add(Ra.ProductNameNum4__c); // ProList.add(Ra.ProductNameNum5__c); // ProList.add(Ra.ProductNameNum6__c); // ProList.add(Ra.ProductNameNum7__c); // ProList.add(Ra.ProductNameNum8__c); // ProList.add(Ra.ProductNameNum9__c); // ProList.add(Ra.ProductNameNum10__c); // List<asset> ast = [select // id, // Backorder__c // from // asset // where // Backorder__c =:SaID]; // for(asset asl : ast){ // for(String proStr : ProList){ // if(asl.Id == proStr){ // return '产品已发货,不能申请备品'; // } // } // } // } // Statu_Achievements__c Sac = [select id, // SalesChannel__c, // Status_1__c, // Status_2_Formula__c, // Opp_Number__c, // CreatedDate, // FirstApproveDate__c, // Opportunity__r.Sales_Root__c, // X30_Deposit_Day__c, // Deposit_In_Full_Day__c, // DeliveryDate__c // from Statu_Achievements__c where id = :SaID]; // if(Sac.Opportunity__r.Sales_Root__c == '販売店'){ // if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET') ){ // if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-30)>Sac.Deposit_In_Full_Day__c)&&Sac.DeliveryDate__c == null){ // return 'Fin'; // }else{ // return '经销商内科订单不在申请期内,不能申请备品'; // } // }else{ // return '经销商内科订单状态不符合备品申请资格,不能申请备品'; // } // }else if(Sac.Opp_Number__c.contains('SP')){ // if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-60)>Sac.X30_Deposit_Day__c )&&Sac.DeliveryDate__c == null){ // return 'Fin'; // }else{ // return '经销商SP订单不在申请期内,不能申请备品'; // } // }else{ // return '经销商SP订单状态不符合备品申请资格,不能申请备品'; // } // }else{ // return 'Denied'; // } // }else if(Sac.Opportunity__r.Sales_Root__c == 'OCM直接販売'){ // if(Sac.Opp_Number__c.contains('GI')||Sac.Opp_Number__c.contains('BF')||Sac.Opp_Number__c.contains('ET')){ // if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '09 已录入订单未付款'||Sac.Status_2_Formula__c == '10 库存已预留・未付款'||Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-30)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){ // return 'Fin'; // }else{ // return 'OCM直销内科不在申请期内,不能申请备品'; // } // }else{ // return 'OCM直销内科订单状态不符合备品申请资格,不能申请备品'; // } // }else if(Sac.Opp_Number__c.contains('SP')){ // if(Sac.Status_1__c == '注残' && (Sac.Status_2_Formula__c == '09 已录入订单未付款'||Sac.Status_2_Formula__c == '10 库存已预留・未付款'||Sac.Status_2_Formula__c == '11 已订货・付订金'||Sac.Status_2_Formula__c == '12 已订货・付全款'||Sac.Status_2_Formula__c == '13 待发货')){ // if((Date.today().addDays(-60)>Sac.FirstApproveDate__c )&&Sac.DeliveryDate__c == null){ // return 'Fin'; // }else{ // return '直销SP订单不在申请期内,不能申请备品'; // } // }else{ // return 'OCM直销SP订单状态不符合备品申请资格,不能申请备品'; // } // }else{ // return 'Fin'; // } // }else{ // return '销售渠道未知,不能新建'; // } //} // bp2 ///** //备品是否可以继续操作的管控 //*/ //public static String rentalContiuneCheck(List<Rental_Apply__c> newList,Map<Id, Rental_Apply__c> oldMap){ // List<String> RaidList = new List<String>(); // for(Rental_Apply__c ra : newList){ // RaidList.add(ra.id); // } // List<Rental_Apply__c> RaTarList = [select Campaign__c,Repair__c, // Campaign__r.Status,Repair__r.Repair_Final_Inspection_Date__c,Repair__r.Repair_Shipped_Date__c // from Rental_Apply__c // where id=:RaidList]; // for(Rental_Apply__c RaTar : RaTarList){ // String RsStr = ''; // if( RaTar.Campaign__r.Status == '取消'|| // RaTar.Campaign__r.Status == '取消申请中'|| // RaTar.Campaign__r.Status == '已提交报告'|| // RaTar.Campaign__r.Status == '已结束'){ // RsStr = RentalApplyWebService.rentalContiuneinfoCheck(newList,oldMap); // if(RsStr == 'Denied'){ // return '学会已结束,申请单不能继续操作了'; // }else{ // return 'Fin'; // } // }else if( RaTar.Repair__r.Repair_Final_Inspection_Date__c!=null){ // RsStr = RentalApplyWebService.rentalContiuneinfoCheck(newList,oldMap); // if(RsStr == 'Denied'){ // return '存在修理最终检测日,申请单不能继续了'; // }else{ // return 'Fin'; // } // }else if( RaTar.Repair__r.Repair_Shipped_Date__c!=null){ // RsStr = RentalApplyWebService.rentalContiuneinfoCheck(newList,oldMap); // if(RsStr == 'Denied'){ // return '存在RC修理返送日,申请单不能继续了'; // }else{ // return 'Fin'; // } // }else{ // return 'Fin'; // } // } // return 'Fin'; //} //bp2 // public static String rentalContiuneinfoCheck(List<Rental_Apply__c> newList,Map<Id, Rental_Apply__c> oldMap){ // for(Rental_Apply__c Rac : newList){ // if( // //bp2 Trigger.oldMap.get(Rac.Id).get('HP_received_ng_num__c') != Rac.HP_received_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('StockDown_ng_num__c') != Rac.StockDown_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('Asset_return_time__c') != Rac.Asset_return_time__c || // Trigger.oldMap.get(Rac.Id).get('Count_Extend__c') != Rac.Count_Extend__c || // Trigger.oldMap.get(Rac.Id).get('Max_Extend_workday__c') != Rac.Max_Extend_workday__c || // //bp2 Trigger.oldMap.get(Rac.Id).get('Lost_item_ng_num__c') != Rac.Lost_item_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('Lost_item_finish__c') != Rac.Lost_item_finish__c || // Trigger.oldMap.get(Rac.Id).get('Last_Assigned_Date__c') != Rac.Last_Assigned_Date__c || // Trigger.oldMap.get(Rac.Id).get('Return_dadeline_final__c') != Rac.Return_dadeline_final__c || // Trigger.oldMap.get(Rac.Id).get('Rental_Apply_Equipment_Set_Cnt__c') != Rac.Rental_Apply_Equipment_Set_Cnt__c || // Trigger.oldMap.get(Rac.Id).get('Pre_inspection_ng_num__c') != Rac.Pre_inspection_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('Shippment_ng_num__c') != Rac.Shippment_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('ShelfUp_ng_num__c') != Rac.ShelfUp_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('Loaner_received_ng_num__c') != Rac.Loaner_received_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('Arrival_wh_cnt__c') != Rac.Arrival_wh_cnt__c || // Trigger.oldMap.get(Rac.Id).get('Shippment_loaner_cnt__c') != Rac.Shippment_loaner_cnt__c || // Trigger.oldMap.get(Rac.Id).get('Shipment_requested_cnt__c') != Rac.Shipment_requested_cnt__c || // Trigger.oldMap.get(Rac.Id).get('Pre_inspection_ng_cnt2__c') != Rac.Pre_inspection_ng_cnt2__c || // Trigger.oldMap.get(Rac.Id).get('Pre_inspection_ng_cnt__c') != Rac.Pre_inspection_ng_cnt__c || // Trigger.oldMap.get(Rac.Id).get('Shippment_loaner_time__c') != Rac.Shippment_loaner_time__c || // Trigger.oldMap.get(Rac.Id).get('Asset_loaner_closed_date__c') != Rac.Asset_loaner_closed_date__c || // Trigger.oldMap.get(Rac.Id).get('Asset_loaner_start_date__c') != Rac.Asset_loaner_start_date__c || // Trigger.oldMap.get(Rac.Id).get('Disposal_num__c') != Rac.Disposal_num__c || // Trigger.oldMap.get(Rac.Id).get('Asset_return_ng_num__c') != Rac.Asset_return_ng_num__c || // Trigger.oldMap.get(Rac.Id).get('Received_Confirm_NG_amount__c') != Rac.Received_Confirm_NG_amount__c || // Trigger.oldMap.get(Rac.Id).get('Received_Confirm_NG_Not_Return__c') != Rac.Received_Confirm_NG_Not_Return__c || ////bp2 Trigger.oldMap.get(Rac.Id).get('Loaner_received_time__c') != Rac.Loaner_received_time__c || // Trigger.oldMap.get(Rac.Id).get('Return_Track_Company__c') != Rac.Return_Track_Company__c || // Trigger.oldMap.get(Rac.Id).get('Return_Distrubutor_Method__c') != Rac.Return_Distrubutor_Method__c || // Trigger.oldMap.get(Rac.Id).get('Return_Trake_Staff__c') != Rac.Return_Trake_Staff__c || // Trigger.oldMap.get(Rac.Id).get('Return_Track_Number__c') != Rac.Return_Track_Number__c || // Trigger.oldMap.get(Rac.Id).get('HP_received_sign_day__c') != Rac.HP_received_sign_day__c || // Trigger.oldMap.get(Rac.Id).get('HP_received_sign_rich__c') != Rac.HP_received_sign_rich__c || // Trigger.oldMap.get(Rac.Id).get('HP_received_sign_text__c') != Rac.HP_received_sign_text__c || // Trigger.oldMap.get(Rac.Id).get('HP_received_sign_NG__c') != Rac.HP_received_sign_NG__c || // Trigger.oldMap.get(Rac.Id).get('HP_received_sign_NG_Reason__c') != Rac.HP_received_sign_NG_Reason__c || // Trigger.oldMap.get(Rac.Id).get('AssetManageConfirm__c') != Rac.AssetManageConfirm__c || // Trigger.oldMap.get(Rac.Id).get('Loaner_cancel_request__c') != Rac.Loaner_cancel_request__c || // Trigger.oldMap.get(Rac.Id).get('Status__c') != Rac.Status__c // ){ // return 'Fin'; // } //} // return 'Denied'; // } } force-app/main/default/classes/RentalApplyWebService.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>40.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/ReportController.cls
New file @@ -0,0 +1,536 @@ /* 用于给lwc的js初始化数据和对记录进行dml操作,此controller属于报告书 */ public with sharing class ReportController { //给VOC完毕相应的js提供初始化数据 @AuraEnabled public static InitData initForVOCFinishButton (String recordId) { InitData res = new initData(); try { Report__c report = [select Status__c from Report__c where Id = :recordId]; res.status = report.Status__c; res.profileId = UserInfo.getProfileId(); System.debug(LoggingLevel.INFO, '*** res: ' + res); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给VOC判定相应的js提供初始化数据 @AuraEnabled public static InitData initForVOCCheckButton (String recordId) { InitData res = new initData(); try { Report__c report = [select Status__c,IsVOC__c,Responsible_Person__r.Id from Report__c where Id = :recordId]; res.status = report.Status__c; res.isVOC = report.IsVOC__c; res.personId = report.Responsible_Person__r.Id; res.profileId = UserInfo.getProfileId(); System.debug(LoggingLevel.INFO, '*** res: ' + res); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给VOC提出相应的js提供初始化数据 @AuraEnabled public static Initdata initForVOCSubmitButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select Status__c,Owner.Id,CreatedBy.Id from Report__c where Id = :recordId]; res.status = report.Status__c; res.ownerId = report.Owner.Id; res.createdById = report.CreatedBy.Id; System.debug(LoggingLevel.INFO, '*** res: ' + res); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给VOC回答相应的js提供初始化数据 @AuraEnabled public static Initdata initForVOCAnswerButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select Status__c from Report__c where Id = :recordId]; res.status = report.Status__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给VOC结果确认相应的js提供初始化数据 @AuraEnabled public static InitData initForVOCConfirmButton (String recordId) { InitData res = new initData(); try { Report__c report = [select Status__c,VOC_Satisfy__c,VOC_Satisfy1__c from Report__c where Id = :recordId]; res.status = report.Status__c; res.Satisfy = report.VOC_Satisfy__c; res.Satisfy1 = report.VOC_Satisfy1__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给取消相应的js提供初始化数据 @AuraEnabled public static InitData initForCancelButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select Status__c from Report__c where Id = :recordId]; res.status = report.Status__c; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给OCSM不要报告相应的js提供初始化数据 @AuraEnabled public static InitData initForOCSMNoToReportButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select OCSMAdministrativeReportNumber__c,OCSMAdministrativeReportDate__c,Aware_date__c from Report__c where Id = :recordId]; res.OCSMAdministrativeReportDate = report.OCSMAdministrativeReportDate__c; res.OCSMAdministrativeReportNumber = report.OCSMAdministrativeReportNumber__c; res.awareDate = report.Aware_date__c; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给SIStoOPD相应的js提供初始化数据 @AuraEnabled public static InitData initForSIStoOPDButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select Status__c,Owner.Id from Report__c where Id = :recordId]; res.status = report.Status__c; res.ownerId = report.Owner.Id; res.userId = UserInfo.getUserId(); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给OCSM要报告相应的js提供初始化数据 @AuraEnabled public static InitData initForOCSMToReportButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select OCSMAdministrativeReportStatus__c,AwareDate__C from Report__c where Id = :recordId]; res.OCSMAdministrativeReportStatus = report.OCSMAdministrativeReportStatus__c; res.awareDate = report.AwareDate__C; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给完毕相应的js提供初始化数据 @AuraEnabled public static InitData initForCompleteButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select Status__c from Report__c where Id = :recordId]; res.status = report.Status__c; res.profileId = UserInfo.getProfileId(); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给Intake universal code编辑相应的js提供初始化数据 @AuraEnabled public static InitData initForASRCEditorButton(String recordId){ InitData res = new InitData(); String developerName = LightingButtonConstant.DEVELOPER_NAME_ASRC_DECISION; try { PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = :recordId And RecordType.DeveloperName = :developerName Order by LastModifiedDate desc]; if (report != null && !report.isEmpty()) { res.LastModifiedDate = report[0].LastModifiedDate; res.Id = report[0].Id; res.Name = report[0].Name; res.LastModifiedById = report[0].LastModifiedById; res.DeveloperName = report[0].RecordType.DeveloperName; } } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给Final universal code编辑相应的js提供初始化数据 @AuraEnabled public static InitData initForASACEditorButton(String recordId){ InitData res = new InitData(); String recordTypeId = LightingButtonConstant.DEVELOPER_NAME_ASAC_DECISION; try { PAE_DecisionRecord__c[] report = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = :recordId And RecordType.DeveloperName = :recordTypeId Order by LastModifiedDate desc]; if (report != null && !report.isEmpty()) { res.LastModifiedDate = report[0].LastModifiedDate; res.Id = report[0].Id; res.Name = report[0].Name; res.LastModifiedById = report[0].LastModifiedById; res.DeveloperName = report[0].RecordType.DeveloperName; } } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给OPDtoSIS相应的js提供初始化数据 @AuraEnabled public static InitData initForOPDtoSISButton(String recordId){ InitData res = new InitData(); try { Report__c report = [select Status__c,Owner.Id from Report__C where Id = :recordId]; res.status = report.Status__c; res.ownerId = report.Owner.Id; res.userId = UserInfo.getUserId(); } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } //给提交(对手活动报告)相应的js提供初始化数据 @AuraEnabled public static InitData initForSubmitCompetitorReportButton(String recordId){ InitData res = null; try { res = new InitData(); } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } return res; } //给提交相应的js提供初始化数据 @AuraEnabled public static void updateForSubmitButton(String reocrdId){ try { Report__c rac = new Report__c(); rac.Id = reocrdId; rac.Status__c = LightingButtonConstant.RECORD_TYPE_NAME_BY_SUBMIT; rac.Submit_time__c = Datetime.now(); rac.Submit_report_day__c = Date.today(); update rac; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } //OPDtoSIS操作更新相应数据 @AuraEnabled public static void updateForOPDtoSISButton(String recordId){ try { Report__c rac = new Report__c(); rac.Id = recordId; rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_OPD).getRecordTypeId(); update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //取消提交操作更新相应数据 @AuraEnabled public static void updateForCancelSubmitReportButton(String recordId){ try { Report__c rac = new Report__c(); rac.Id = recordId; rac.Status__c = LightingButtonConstant.STATUS_DRAFT; rac.Submit_report_day__c = null; rac.Submit_time__c = null; update rac; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } //完毕操作更新相应数据 @AuraEnabled public static void updateForCompleteButton(String recordId){ Report__c rac = new Report__c(); try { rac.Id = recordId; rac.Status__c = LightingButtonConstant.STATUS_COMPLETE; rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.VOC_NAME).getRecordTypeId(); update rac; } catch (Exception e) { throw new AuraHandledException(e.getMessage()); } } //OCSM要报告操作更新相应数据 @AuraEnabled public static void updateForOCSMToReportButton(String recordId){ try { Report__c rac = new Report__c(); rac.Id = recordId; rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_BE_REPORTED; update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //SIStoOPD操作更新相应数据 @AuraEnabled public static String updateForSIStoOPDButton(String recordId){ Report__c rac = new Report__c(); try { rac.Id = recordId; rac.RecordTypeId = Schema.SObjectType.Report__c.getRecordTypeInfosByName().get(LightingButtonConstant.RECORD_TYPE_NAME_BY_FOLLOW_THE_STAGE).getRecordTypeId(); update rac; return null; } catch (Exception e) { return e.getMessage(); } } //DispatchOCSMQARA操作更新相应数据 @AuraEnabled public static void updateForDispatchOCSMQARAButton(String recordId){ try { Report__c rac = new Report__c(); rac.Id = recordId; rac.Dispatch_OCSM_QARA__c = true; update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //OCSM不要报告操作更新相应数据 @AuraEnabled public static void updateForOCSMNoToReportButton(String recordId){ try { Report__c rac = new Report__c(); rac.Id = recordId; rac.OCSMAdministrativeReportStatus__c = LightingButtonConstant.STATUS_TO_NOT_REPORT; update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //取消操作更新相应数据 @AuraEnabled public static void updateForCancelButton(String recordId){ try { Report__c rac = new Report__c(); rac.Id = recordId; rac.Status__c = LightingButtonConstant.STATUS_CANCEL; update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //VOC结果确认更新相应数据 @AuraEnabled public static void updateForVOCConfirmButton(String recordId,String Satisfy,String Satisfy1){ try { Report__c rac = new Report__c(); rac.Id = recordId; if (Satisfy == LightingButtonConstant.CN_YES) { rac.Status__c = LightingButtonConstant.STATUS_VOC_CONFIRMED; } else if (Satisfy == LightingButtonConstant.CN_NO) { // 対応結果(一回目)に値なければ、一回目の「否」と見なす if (Satisfy1 != LightingButtonConstant.CN_NO) { Report__c[] records = [SELECT Id, VOC_Satisfy__c, VOC_Unsatisfy_Reason__c, VOC_follow_up_result__c, VOC_solution_category__c FROM Report__c WHERE Id = :recordId]; rac.VOC_Satisfy__c = null; rac.VOC_Unsatisfy_Reason__c = null; rac.VOC_follow_up_result__c = null; rac.VOC_solution_category__c = null; rac.VOC_Satisfy1__c= records[0].VOC_Satisfy__c; rac.VOC_Unsatisfy_Reason1__c = records[0].VOC_Unsatisfy_Reason__c; rac.VOC_follow_up_result1__c = records[0].VOC_follow_up_result__c; rac.VOC_solution_category1__c = records[0].VOC_solution_category__c; rac.Status__c = LightingButtonConstant.STATUS_DRAFT; } // 対応結果(一回目)に値あれば、二回目の「否」と見なす else { rac.Status__c = LightingButtonConstant.STATUS_VOC_CONFIRMED; } } update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //VOC回答更新相应数据 @AuraEnabled public static String updateForVOCAnswerButton(String recordId){ try { Report__c rac = [select Status__c from Report__c where Id = :recordId]; rac.Status__c = LightingButtonConstant.STATUS_VOC_END_OF_ANSWER; update rac; return null; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); String exc = '' + e.getMessage(); Integer left = exc.indexOf(':') + 1; Integer right = exc.lastIndexOf(':'); String str = exc.substring(left,right); left = str.indexOf(',') + 1; String newStr = str.substring(left); return newStr; } } //提交竞争对手报告更新相应数据 @AuraEnabled public static void updateForSubmitCompetitorReportButton(String recordId){ try { Report__c rac = new Report__c(); rac.Id = recordId; rac.Status__c = LightingButtonConstant.STATUS_VOC_APPLYING; rac.Submit_time__c = Datetime.now(); rac.Submit_report_day__c = Date.today(); rac.Date__c = Date.today(); update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //VOC回答更新相应数据 @AuraEnabled public static void updateForVOCSubmitButton(String recordId ,String createdById){ try { Report__c rac = [select Status__c,JingliApprovalManager__r.Id,BuchangApprovalManager__r.Id,SalesManager__r.Id,BuchangApprovalManagerSales__r.Id,ZongjianApprovalManager__c,Submit_time__c,Submit_report_day__c,Owner.Id from Report__c where Id = :recordId]; // share rac.Id = recordId; User[] records = [SELECT Job_Category__c FROM User WHERE Id = :createdById]; List<String> userAccess = new List<String>(); if (records[0].Job_Category__c == LightingButtonConstant.TYPE_OF_SALES_SERVICES) { userAccess.add(rac.JingliApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ); userAccess.add(rac.BuchangApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ); rac.VOC_CreatedBy_jingli__c = rac.JingliApprovalManager__c; rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManager__c; } else { userAccess.add(rac.SalesManager__c + LightingButtonConstant.USER_ACCESS_READ); userAccess.add(rac.BuchangApprovalManagerSales__c + LightingButtonConstant.USER_ACCESS_READ); rac.VOC_CreatedBy_jingli__c = rac.SalesManager__c; rac.VOC_CreatedBy_buzhang__c = rac.BuchangApprovalManagerSales__c; } userAccess.add(rac.ZongjianApprovalManager__c + LightingButtonConstant.USER_ACCESS_READ); String rtn = ControllerUtil.setSObjectShare(LightingButtonConstant.SOBJECT_NAME_OF_REPORT_SHARE,LightingButtonConstant.SOBJECT_NAME_OF_VOC_SHARE,recordId,userAccess,rac.Owner.Id); if (rtn != LightingButtonConstant.OK) { return; } rac.Status__c = LightingButtonConstant.STATUS_VOC_WRITE_OVER; rac.Submit_time__c = Date.today(); rac.Submit_report_day__c = Date.today(); update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } //VOC判定更新相应数据 @AuraEnabled public static String updateForVOCCheckButton (String recordId,String isVOC,String personId) { try { Report__c rac = [select Owner.Id,VOC_jingli__r.Id,VOC_buzhang__r.Id,VOC_zongjian__r.Id,VOC_Finish__c,VOC_share_date__c,Responsible_Person__r.Id from Report__c where Id = :recordId]; if (isVOC == LightingButtonConstant.VOC_NAME) { // VOC対応者の経理部長総監を設定 User[] records = [SELECT Id, Job_Category__c, JingliApprovalManager__c, SalesManager__c, BuchangApprovalManager__c, BuchangApprovalManagerSales__c, ZongjianApprovalManager__c FROM User WHERE Id = :personId]; if (records[0].job_Category__c == LightingButtonConstant.TYPE_OF_SALES_SERVICES) { rac.VOC_jingli__c = records[0].JingliApprovalManager__c == null ? '' : records[0].JingliApprovalManager__c; rac.VOC_buzhang__c = records[0].BuchangApprovalManager__c == null ? '' : records[0].BuchangApprovalManager__c; } else { rac.VOC_jingli__c = records[0].SalesManager__c == null ? '' : records[0].SalesManager__c; rac.VOC_buzhang__c = records[0].BuchangApprovalManagerSales__c == null ? '' : records[0].BuchangApprovalManagerSales__c; } rac.VOC_zongjian__c = records[0].ZongjianApprovalManager__c == null ? '' : records[0].ZongjianApprovalManager__c; rac.Status__c = LightingButtonConstant.STATUS_VOC_CHECK_OVER; rac.VOC_Finish__c = false; Date serverTimestamp = Date.today(); rac.VOC_share_date__c = serverTimestamp; // share List<String> userAccess = new List<String>(); userAccess.add(rac.Responsible_Person__c + LightingButtonConstant.USER_ACCESS_EDIT); userAccess.add(rac.VOC_jingli__c + LightingButtonConstant.USER_ACCESS_READ); userAccess.add(rac.VOC_buzhang__c + LightingButtonConstant.USER_ACCESS_READ); userAccess.add(rac.VOC_zongjian__c + LightingButtonConstant.USER_ACCESS_READ); String rtn = ControllerUtil.setSObjectShare(LightingButtonConstant.SOBJECT_NAME_OF_REPORT_SHARE,LightingButtonConstant.SOBJECT_NAME_OF_VOC_SHARE,recordId,userAccess,rac.Owner.Id); if (rtn != LightingButtonConstant.OK) { return null; } update rac; } else { rac.Status__c = LightingButtonConstant.STATUS_VOC_FINISH; rac.VOC_Finish__c = true; update rac; } return null; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); String exc = e.getMessage(); return exc; } } //VOC完毕操作更新相应数据 @AuraEnabled public static void updateForVOCFinishButton (String recordId) { try { Report__c report = [select Id,Status__C from Report__c where Id = :recordId]; report.Status__c = LightingButtonConstant.STATUS_VOC_FINISH; update report; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } public class InitData{ @AuraEnabled public String status; @AuraEnabled public String isVOC; @AuraEnabled public String personId; @AuraEnabled public String createdById; @AuraEnabled public String ownerId; @AuraEnabled public String Satisfy; @AuraEnabled public String Satisfy1; @AuraEnabled public String profileId; @AuraEnabled public String OCSMAdministrativeReportNumber; @AuraEnabled public Date OCSMAdministrativeReportDate; @AuraEnabled public Date awareDate; @AuraEnabled public String OCSMAdministrativeReportStatus; @AuraEnabled public Datetime LastModifiedDate; @AuraEnabled public String Id; @AuraEnabled public String Name; @AuraEnabled public String LastModifiedById; @AuraEnabled public String DeveloperName; @AuraEnabled public String userId; } } force-app/main/default/classes/ReportController.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/SubmitExtensionApprovalProcessController.cls
New file @@ -0,0 +1,42 @@ public with sharing class SubmitExtensionApprovalProcessController { public SubmitExtensionApprovalProcessController() { } @AuraEnabled public static InitData init(String recordId) { InitData res = new InitData(); try { Rental_Apply__c rac = [SELECT Id, ExtensionStatus__c, demo_purpose2__c, AgreementBorrowingExtensionDate__c, Return_dadeline_final__c from Rental_Apply__c where Id = :recordId]; res.Id = rac.Id; res.ExtensionStatus = rac.ExtensionStatus__c; res.RootRentalApply = rac.Root_Rental_Apply__c; res.demoPurpose2 = rac.demo_purpose2__c; res.AgreementBorrowingExtensionDate = rac.AgreementBorrowingExtensionDate__c; res.ReturnDadelineFinal = rac.Return_dadeline_final__c; } catch (Exception e) { System.debug(LoggingLevel.INFO, '****e:' + e); } return res; } public class InitData { @AuraEnabled public String Id; @AuraEnabled public String ExtensionStatus; @AuraEnabled public String RootRentalApply; @AuraEnabled public String demoPurpose2; @AuraEnabled public Date AgreementBorrowingExtensionDate; @AuraEnabled public Date ReturnDadelineFinal; } } force-app/main/default/classes/SubmitExtensionApprovalProcessController.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>50.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/TenderWebService.cls
New file @@ -0,0 +1,83 @@ global class TenderWebService { public TenderWebService() { } @AuraEnabled //招投标反逻辑删除 WebService static String ContraryLogicalDel(String DTenId) { Tender_information__c DTenInfo = [Select Id, InfoId__c, Logical_delete__c, ProjectId__c, Retain_Tender__c From Tender_information__c Where id = : DTenId]; // 更新删除招投标 List<Tender_information__c> updateTenInfoList = new List<Tender_information__c>(); // 更新保留招投标 // List<Tender_information__c> updateBTenList = new List<Tender_information__c>(); if (String.isNotBlank(DTenInfo.Retain_Tender__c)) { // System.debug('11111111' + TenInfo.Retain_Tender__c); //要保留的招投标 Tender_information__c BTen = [select Id, InfoId__c From Tender_information__c Where Id = : DTenInfo.Retain_Tender__c]; // 删除招投标关联的询价 // List<Tender_Opportunity_Link__c> DTenLinkList = [select Opportunity__c // from Tender_Opportunity_Link__c // where Tender_information__c = :DTenId and IsRelated__c = true]; // System.debug('---------2---------' + DTenLinkList); // Set<Id> DTenLinkOppIdSet = new Set<Id>(); // if (DTenLinkList.size() > 0) { // for (Tender_Opportunity_Link__c DTenlink : DTenLinkList) { // DTenLinkOppIdSet.add(DTenlink.Opportunity__c); // } // System.debug('---------3---------' + DTenLinkOppIdSet); // // 删除项目关联并且与保留项目关联的询价关联信息 // List<Tender_Opportunity_Link__c> DelD_BTenLinkList = [select id, Opportunity__c, Tender_information__c // from Tender_Opportunity_Link__c // where Tender_information__c = :BTen.Id and Opportunity__c in : DTenLinkOppIdSet]; // System.debug('---------1---------' + DelD_BTenLinkList); // if (DelD_BTenLinkList.size() > 0) { // Delete DelD_BTenLinkList; // } // } // 保留项目通过软删除逻辑关联来的询价 List<Tender_Opportunity_Link__c> DelD_BTenLinkList = [select id, Opportunity__c, Tender_information__c from Tender_Opportunity_Link__c where Tender_information__c = :BTen.Id and IsRelated__c = true]; // 判断link是否为空 if (DelD_BTenLinkList != null && DelD_BTenLinkList.size() > 0) { // 逻辑有大坑 暂时只把打标记的删掉 不做回写的操作了 // List<Tender_Opportunity_Link__c> add_list = new List<Tender_Opportunity_Link__c>(); // for (Tender_Opportunity_Link__c link : DelD_BTenLinkList) { // Tender_Opportunity_Link__c add_link = new Tender_Opportunity_Link__c(); // add_link.Tender_information__c = DTenInfo.Id; // add_link.Opportunity__c = link.Opportunity__c; // add_link.Tender_Opportunity_Uniq__c = DTenInfo.Id + '' + link.Opportunity__c; // add_link.IsRelated__c = false; // add_list.add(add_link); // } // 删掉保留项目上的关联询价 delete DelD_BTenLinkList; // 删除项目上的关联加回来 // if (add_list.size() > 0) { // insert add_list; // } } // 互换保留招投标与删除招投标的信息Id DTenInfo.Retain_Tender__c = BTen.Id; String BTenInfo = BTen.InfoId__c; BTen.InfoId__c = DTenInfo.InfoId__c;//保留招投标的信息Id赋给删除招投标的信息Id DTenInfo.InfoId__c = BTenInfo;//删除招投标的信息Id赋给保留招投标的信息Id // 点击保存后 删除招投标上的逻辑删除字段变为true DTenInfo.Logical_delete__c = false; // update TenInfo; // 一起更新就行了 updateTenInfoList.add(DTenInfo); updateTenInfoList.add(BTen); update updateTenInfoList; // updateBTenList.add(BTen); // update updateBTenList; } return 'OK'; } } force-app/main/default/classes/TenderWebService.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>45.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/TenderingButtonController.cls
New file @@ -0,0 +1,54 @@ public class TenderingButtonController { @AuraEnabled public static InitData initTenderingController(String recordId) { InitData res = new initData(); try{ Tender_information__c report = [SELECT OpportunityNum__c,OwnerId,Id,status__c,Name,IsRelateProject__c FROM Tender_information__c WHERE Id = :recordId LIMIT 1]; res.OwnerId = report.OwnerId; res.Id = report.Id; res.status = report.status__c; res.name = report.Name; res.opportunityNum = String.valueOf(report.OpportunityNum__c); res.isRelateProject = report.IsRelateProject__c; res.profileId = UserInfo.getProfileId(); res.Environment_Url = System.Label.Environment_Url; System.debug(LoggingLevel.INFO, '*** xu: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** xu: ' + e); } return res; } // 招标项目失单 TenderOpportunityLink // 调用该接口var sql = "select id from Tender_Opportunity_Link__c where Tender_information__c='" + '{!Tender_information__c.Id}'+ "'"; @AuraEnabled public static List<Tender_Opportunity_Link__c> sqlResult (String id) { try { List<Tender_Opportunity_Link__c> TenderOpportunityLink = [SELECT id FROM Tender_Opportunity_Link__c WHERE Tender_information__c = :id]; System.debug(LoggingLevel.INFO, '*** xu1: ' + TenderOpportunityLink); return TenderOpportunityLink; } catch (exception e) { System.debug(LoggingLevel.INFO, '*** xu1111111: ' + e); throw new AuraHandledException(e.getMessage()); } } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String OwnerId; @AuraEnabled public String status; @AuraEnabled public String name; @AuraEnabled public String opportunityNum; @AuraEnabled public String isRelateProject; @AuraEnabled public String profileId; @AuraEnabled public String Environment_Url; } } force-app/main/default/classes/TenderingButtonController.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/UpdateTenderInformationBatch.cls
New file @@ -0,0 +1,1310 @@ /*2021-05-08 mzy * 更新招标信息的询价状态和询价的数量 * 更新招标信息的5个医院 * 当医院发生变化/招投标项目OCSM省发生变化时,空更新一下招投标 */ global class UpdateTenderInformationBatch implements Database.Batchable<sObject>, Database.Stateful { Boolean IsNeedExecute = false; String tempTenderId =''; Boolean IsOnlyTrue = true; List<String> tempTenderList = new List<String>(); //邮件信息 List<String> emailMessages = new List<String>(); //招投标: 报错的招投标Id String TenderlogStr = '招标项目 : '; //招投标: 报错信息 String TendererrorStr = ''; //招投标: 总件数 Integer TendertotalCount = 0; //招投标: 失败件数 Integer TenderfailedCount = 0; //执行符合条件的指定招投标项目 global UpdateTenderInformationBatch(String tempTenderId) { this.tempTenderId = tempTenderId; } //执行指定招标项目里符合条件的招投标项目 global UpdateTenderInformationBatch(List<String> tempTenderList) { this.tempTenderList = tempTenderList; } //处理历史数据 IsOnlyTrue = false 执行所有的招标项目 global UpdateTenderInformationBatch(String tempOppId, Boolean IsOnlyTrue) { this.IsOnlyTrue = IsOnlyTrue; } // IsOnlyTrue = false 可以手动 无条件执行多条招投标项目 global UpdateTenderInformationBatch(String tempOppId, Boolean IsOnlyTrue,List<String> tempTenderList) { this.IsOnlyTrue = IsOnlyTrue; this.tempTenderList = tempTenderList; } //Batch 链 时使用 global UpdateTenderInformationBatch(Boolean IsNeedExecute) { this.IsNeedExecute = IsNeedExecute; } global UpdateTenderInformationBatch() { } global Database.QueryLocator start(Database.BatchableContext bc) { String query = 'SELECT Id,IsBid__c,NotBidApprovalStatus__c,IsReactionOpp__c,Hospital__c,Hospital1__c,Hospital2__c,Hospital3__c,Hospital4__c, '; query += 'Hospital__r.Assume_Change__c,Hospital1__r.Assume_Change__c,Hospital2__r.Assume_Change__c,Hospital3__r.Assume_Change__c,Hospital4__r.Assume_Change__c '; query += 'FROM Tender_information__c '; if(IsOnlyTrue){ query += 'WHERE ((IsReactionOpp__c = true ) '; //2021-07-29 mzy update 当医院发生变化/招投标项目OCSM省发生变化时,空更新一下招投标 start // 2022-04-08 ssm SWAG-CC58ME 增加所有人无效的判断 start query += 'OR (Owner.IsActive = false) '; // 2022-04-08 ssm SWAG-CC58ME end query += 'OR (BiddingOCSMAdministration__c = true) OR (Hospital__r.Assume_Change__c = true) '; query += 'OR (Hospital1__r.Assume_Change__c = true) OR (Hospital2__r.Assume_Change__c = true) '; query += 'OR (Hospital3__r.Assume_Change__c = true) OR (Hospital4__r.Assume_Change__c = true) )'; //2021-07-29 mzy update 当医院发生变化/招投标项目OCSM省发生变化时,空更新一下招投标 end // DepartmentChanges__c 全部换成 Assume_Change__c } if(String.isNotBlank(this.tempTenderId)){ if(IsOnlyTrue){ query += ' AND '; }else { query += ' Where '; } query += 'Id = :tempTenderId '; } if(tempTenderList.size()>0){ if(IsOnlyTrue){ query += ' AND '; }else { query += ' Where '; } query += ' Id In :tempTenderList '; } System.debug('sql语句:'+query); return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, list<Tender_information__c> TenderList) { //定义List封装需要空更新的招投标项目 List<Tender_information__c> EmptyUpdateTenderList = new List<Tender_information__c>(); Map<String,Tender_information__c> EmptyUpdateTenderMap = new Map<String,Tender_information__c>(); //定义List封装需要更新的招标项目 List<Tender_information__c> updateTenderList = new List<Tender_information__c>(); //定义Map保存招投标信息 Map<String,Tender_information__c> tenderMap = new Map<String,Tender_information__c>(); //定义List封装所有询价的招标项目Id Set<String> BiddingProjectID = new Set<String>(); for(Tender_information__c tempTender : TenderList){ //2021-07-29 mzy update 当医院发生变化/招投标项目OCSM省发生变化时,空更新一下招投标 start if(tempTender.IsReactionOpp__c){ //如果是 是否反应询价 为 true 则需要进行 反应询价 ,否则就空更新一下 BiddingProjectID.add(tempTender.Id); tenderMap.put( String.valueOf( tempTender.Id ).substring(0,15) ,tempTender); }else { //需要空更新的招投标 EmptyUpdateTenderList.add(tempTender); EmptyUpdateTenderMap.put(String.valueOf( tempTender.Id ).substring(0,15) ,tempTender); } //2021-07-29 mzy update 当医院发生变化/招投标项目OCSM省发生变化时,空更新一下招投标 end } //2021-07-29 mzy update 空更新失败的话不清空医院的标识 start // System.debug('EmptyUpdateTenderList: ' + EmptyUpdateTenderList); if(EmptyUpdateTenderList.size()>0){ //空更新招投标 // fxk 2021/9/28 Star StaticParameter.EscapeOtherUpdateTenOwner = false; Database.SaveResult[] EmptySaveTenderResult = Database.update(EmptyUpdateTenderList,false); StaticParameter.EscapeOtherUpdateTenOwner = true; // fxk 2021/9/28 End //更新成功的招投标需要将医院的标识清空 //保存更新失败的医院 Set<String> faildHospIdSet = new Set<String>(); //查看失败的医院 for(Integer i = 0;i<EmptySaveTenderResult.size();i++){ if(!EmptySaveTenderResult.get(i).isSuccess()){ String faildTenderId = String.valueOf(EmptyUpdateTenderList.get(i).id).substring(0,15); Tender_information__c faildtender = EmptyUpdateTenderMap.get(faildTenderId); if(faildtender.Hospital__c != null && faildtender.Hospital__r.Assume_Change__c == true){ faildHospIdSet.add(faildtender.Hospital__c); } if(faildtender.Hospital1__c != null && faildtender.Hospital1__r.Assume_Change__c == true){ faildHospIdSet.add(faildtender.Hospital1__c); } if(faildtender.Hospital2__c != null&& faildtender.Hospital2__r.Assume_Change__c == true){ faildHospIdSet.add(faildtender.Hospital2__c); } if(faildtender.Hospital3__c != null&& faildtender.Hospital3__r.Assume_Change__c == true){ faildHospIdSet.add(faildtender.Hospital3__c); } if(faildtender.Hospital4__c != null&& faildtender.Hospital4__r.Assume_Change__c == true){ faildHospIdSet.add(faildtender.Hospital4__c); } } } //查看需要清空标识的医院id Set<String> HospitalId = new Set<String>(); //需要清空标识的医院i List<Account> needUpdateHPList = new List<Account>(); for(Integer i = 0;i<EmptySaveTenderResult.size();i++){ String tenderId = String.valueOf(EmptyUpdateTenderList.get(i).id).substring(0,15); Tender_information__c tender = EmptyUpdateTenderMap.get(tenderId); //如果失败的Set里没有这个医院,则清空这个医院的标识 if(tender.Hospital__c != null && tender.Hospital__r.Assume_Change__c == true && (!faildHospIdSet.contains(tender.Hospital__c)) ){ HospitalId.add(tender.Hospital__c); } if(tender.Hospital1__c != null && tender.Hospital1__r.Assume_Change__c == true && (!faildHospIdSet.contains(tender.Hospital1__c)) ){ HospitalId.add(tender.Hospital1__c); } if(tender.Hospital2__c != null && tender.Hospital2__r.Assume_Change__c == true && (!faildHospIdSet.contains(tender.Hospital2__c)) ){ HospitalId.add(tender.Hospital2__c); } if(tender.Hospital3__c != null && tender.Hospital3__r.Assume_Change__c == true && (!faildHospIdSet.contains(tender.Hospital3__c)) ){ HospitalId.add(tender.Hospital3__c); } if(tender.Hospital4__c != null && tender.Hospital4__r.Assume_Change__c == true && (!faildHospIdSet.contains(tender.Hospital4__c)) ){ HospitalId.add(tender.Hospital4__c); } } Iterator<String> HospitalIds = HospitalId.iterator(); while(HospitalIds.hasNext()){ Account acc = new Account(); acc.id = HospitalIds.next(); acc.Assume_Change__c = false; needUpdateHPList.add(acc); } if(needUpdateHPList.size()>0){ update needUpdateHPList; } } //2021-07-29 mzy update 空更新失败的话不清空医院的标识 end //2021-07-29 mzy update 如果有需要反应询价的在走下面逻辑 start if(BiddingProjectID.size()> 0){ //查询招标项目下的所有询价 Map<String,List<Opportunity>> BiddingProjectOppMap = findTenderRelativeOpp(BiddingProjectID); //计算询价数量 List<Tender_information__c> updateTenderNumList = updateOpportunityNum(BiddingProjectOppMap); //计算询价状态 List<Tender_information__c> updateTenderNumStatusList = updateOpportunityStatus(BiddingProjectOppMap,updateTenderNumList,tenderMap); updateTenderList.addAll(updateTenderNumStatusList); } //更新招投标 询价数量和状态 if(updateTenderList.size()>0){ //一个招投标项目更新失败 List<String> failedTenderList = new List<String>(); Database.SaveResult[] saveTenderResults = Database.update(updateTenderList,false); //招投标项目的总数 TendertotalCount += saveTenderResults.size(); for(Integer i = 0;i<saveTenderResults.size();i++) { if(!saveTenderResults.get(i).isSuccess() ){ /*if(TenderlogStr.equals('')){ TenderlogStr = '' ; } */ TenderlogStr += updateTenderList.get(i).id +' ,'; //String statusCode = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1]; //String errorMsg = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1]; TendererrorStr += '失败招标项目 :'+updateTenderList.get(i).id+' 失败原因:'+ String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1] +' : '+String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1] + '\r\n'; TenderfailedCount++ ; //将更新失败的招投标项目添加掉集合中 failedTenderList.add(String.valueOf( updateTenderList.get(i).id ).substring(0,15)); } } //更新成功后,清除招投标的反应询价标识 List<Tender_information__c> successTenderList = new List<Tender_information__c>(); for(Tender_information__c tempTender:TenderList){ if(failedTenderList.contains( String.valueOf( tempTender.id ).substring(0,15) )){ //更新失败,则不清除标识 }else { //更新成功,清除标识 tempTender.IsReactionOpp__c = false; successTenderList.add(tempTender); } } //清除标识 if(successTenderList.size()>0){ update successTenderList; } } // 2021-07-29 mzy update 如果有需要反应询价的在走下面逻辑 end } global void finish(Database.BatchableContext BC) { UpdateTenderInformationSchedule.assignOneHours(); BatchIF_Log__c TenderIfLog = new BatchIF_Log__c(); TenderIfLog.Type__c = 'UpdateTenderInformationBatchByTenderErrorLog'; if (TenderlogStr.length() > 60000) { TenderlogStr = TenderlogStr.substring(0, 60000); } TenderIfLog.Log__c = TenderlogStr; TenderIfLog.Log__c += '\n end'; if (TendererrorStr.length() > 60000) { TenderIfLog.ErrorLog__c = TendererrorStr.substring(0, 60000); } else { TenderIfLog.ErrorLog__c = TendererrorStr.substring(0, TendererrorStr.length()); } insert TenderIfLog; emailMessages.add('失败日志ID为:' + TenderIfLog.Id + '\r\n失败信息:\r\n'+TendererrorStr); //发送邮件 sendFieldEmail(); } //批量更新招投标的询价信息 @AuraEnabled WebService static String updateOpportunityInformation(List<String> TenderIdList){ //存储错误信息 String errorMessage = ''; //目的 : 如果Batch执行失败,则整体rollback,标识不进行清除 //定义List封装需要更新的招标项目 List<Tender_information__c> updateTenderList = new List<Tender_information__c>(); try{ Set<String> BiddingProjectID = new Set<String>(); for(String TenderId:TenderIdList){ BiddingProjectID.add(TenderId); } //查询招投标信息 List<Tender_information__c> tenderList = [SELECT Id,IsBid__c,NotBidApprovalStatus__c FROM Tender_information__c where id in :BiddingProjectID]; Map<String,Tender_information__c> tenderMap = new Map<String,Tender_information__c>(); for(Tender_information__c tempTender :tenderList){ tenderMap.put( String.valueOf( tempTender.Id ).substring(0,15) ,tempTender); } //查询招标项目下的所有询价 Map<String,List<Opportunity>> BiddingProjectOppMap = findTenderRelativeOpp(BiddingProjectID); //计算询价数量 List<Tender_information__c> updateTenderNumList = updateOpportunityNum(BiddingProjectOppMap); //计算询价状态 List<Tender_information__c> updateTenderNumStatusList = updateOpportunityStatus(BiddingProjectOppMap,updateTenderNumList,tenderMap); updateTenderList.addAll(updateTenderNumStatusList); //更新 if(updateTenderList.size()>0){ List<String> failedTenderList = new List<String>(); // add 只有空更新招投标的时候走招投标触发器 fxk 2021/9/28 Star StaticParameter.EscapeOtherUpdateTenOwner = false; Database.SaveResult[] saveTenderResults = Database.update(updateTenderList,false); StaticParameter.EscapeOtherUpdateTenOwner = true; // add 只有空更新招投标的时候走招投标触发器 fxk 2021/9/28 End for(Integer i = 0;i<saveTenderResults.size();i++) { if(!saveTenderResults.get(i).isSuccess()){ //String statusCode = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1]; //String errorMsg = String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1]; errorMessage += '失败招标项目 :'+updateTenderList.get(i).id+' 失败原因:' + String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[2].split('=')[1] +' : '+String.ValueOf(saveTenderResults.get(i).getErrors()[0]).split(';')[1].split('=')[1] + '\r\n'; //将更新失败的招投标项目添加掉集合中 failedTenderList.add(String.valueOf( updateTenderList.get(i).id ).substring(0,15)); } } //更新成功后,清除招投标的反应询价标识 List<Tender_information__c> successTenderList = new List<Tender_information__c>(); for(String tempTenderId:TenderIdList){ if(failedTenderList.contains( String.valueOf( tempTenderId ).substring(0,15) )){ //更新失败,则不清除标识 }else { //更新成功,清除标识 Tender_information__c tempTender = new Tender_information__c(); tempTender.Id = String.valueOf( tempTenderId ).substring(0,15); tempTender.IsReactionOpp__c = false; successTenderList.add(tempTender); } } //清除标识 if(successTenderList.size()>0){ update successTenderList; } } //询价流程改善 fy start System.debug('batch2开始'); Id execBTId = Database.executeBatch(new UpdateTenderInformationBatch2(TenderIdList),100); System.debug('batch2结束'); //询价流程改善 fy end }catch(NullPointerException ex){ system.debug('aa1:'+ex.getMessage()); return '空指针 :'+ex.getLineNumber(); }catch(Exception ex2){ system.debug('aa2:'+ex2.getMessage()); return '出错了!'+ex2.getMessage(); } if(String.isNotBlank(errorMessage)){ return errorMessage; } system.debug('aa'); return 'OK'; } //0.计算询价数量 public static List<Tender_information__c> updateOpportunityNum(Map<String,List<Opportunity>> tempMap){ // 招标-询价关联修改 获取招标信息修改 20210817 start // List<Tender_information__c> updateTenderNumList = new List<Tender_information__c>(); // //遍历Map的key // for(String k : tempMap.keySet()){ // Tender_information__c tempTender = new Tender_information__c(); // tempTender.id = k; // String fifteenId = String.valueOf(tempTender.Id).subString(0,15); // tempTender.OpportunityNum__c = tempMap.get(fifteenId).size(); // updateTenderNumList.add(tempTender); // } List<String> tenders = new List<String>(); //遍历Map的key for(String k : tempMap.keySet()){ tenders.add(k); } // 获得招标数据 把从询价里查询的招标字段挪到这里 List<Tender_information__c> updateTenderNumList = [SELECT Id, Hospital__c, Hospital1__c, Hospital2__c, Hospital3__c, Hospital4__c, OwnerId, IsRelateProject__c, IsBid__c, department__c, subDepartment1__c, subDepartment2__c, subDepartment3__c, subDepartment4__c, NotBidApprovalStatus__c, OpportunityNum__c, OpportunityStatus__c //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start ,OlyNumberHosts__c, RivalHostsNumber__c, TotalNumberHosts__c //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end FROM Tender_information__c WHERE Id IN :tenders]; // 招标-询价关联修改 20210817 end return updateTenderNumList; } //1.计算询价状态 //2.赋值医院 //3.赋值战略科室 // 1) 如果招投标项目的关联医院为空,那么就更新为询价的医院; // 2) 如果招投标项目的关联主战略科室为空,那么就更新为询价创建时间最早的询价的战略科室; // 3) 如果招投标项目的关联副战略科室为空,那么就更新为排名优先级高的战略科室之外的其他询价的战略科室,也是以创建时间更早为先后顺序; // 4) 如果更新满了,多的战略科室就不更新; public static List<Tender_information__c> updateOpportunityStatus(Map<String,List<Opportunity>> BiddingProjectOppMap,List<Tender_information__c> updateTenderNumList,Map<String,Tender_information__c> tenderMap){ //询价状态 //定义List封装需要更新的招标项目 List<Tender_information__c> updateTenderList = new List<Tender_information__c>(); //遍历Map的key for(Tender_information__c tempTender : updateTenderNumList){ String fifteenId = String.valueOf(tempTender.Id).subString(0,15); //获取当前招投标下的询价 List<Opportunity> BiddingDownOppList= BiddingProjectOppMap.get(fifteenId) == null ? new List<Opportunity>() : BiddingProjectOppMap.get(fifteenId); //获取当前招投标下的询价的医院 List<String> OppHospitalList = new List<String>(); //判断状态 if(BiddingDownOppList.size() > 0){ //<!---- 所有人 ----> //2021-08-09 mzy 如果招标的ownerid是奥林巴斯系统用户 就把询价的所有人写上去 // 20210817 是不是应该直接判断tender上的? // if(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.OwnerId == '00510000000gmxH'){ if(tempTender.OwnerId == '00510000000gmxH'){ tempTender.OwnerId = BiddingDownOppList.get(0).ownerId; } //2021-08-09 mzy 如果招标的ownerid是奥林巴斯系统用户 就把询价的所有人写上去 //<!---- 所有人 ----> //<!---- 询价状态 start ---> //<!--询价状态--> //WIN num Integer WinNum = 0; //失单 num Integer SHDNum = 0; //XLIU-CG98L5【委托】【评估】新需求-招标项目/询价对应流标、废标改善 fy start //取消 num Integer QuxNum = 0; //XLIU-CG98L5【委托】【评估】新需求-招标项目/询价对应流标、废标改善 fy end //中标 2022-6-29 yjk Integer bidNum = 0; //对手中标 2022-6-29 yjk Integer loseNum = 0; //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start tempTender.OlyNumberHosts__c = 0; tempTender.RivalHostsNumber__c = 0; tempTender.TotalNumberHosts__c = 0; Decimal OlyNum = 0; Decimal RivalNum = 0; Decimal TotalNum = 0; //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end //获取当前key的List for(Opportunity tempOp :BiddingDownOppList){ //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start System.debug('lt123---------------------------------------'); if(tempOp.OlyNumberHosts__c == null){ tempOp.OlyNumberHosts__c = 0; } if(tempOp.RivalHostsNumber__c == null){ tempOp.RivalHostsNumber__c = 0; } OlyNum += tempOp.OlyNumberHosts__c; RivalNum += tempOp.RivalHostsNumber__c; TotalNum += tempOp.InquireNumberHosts__c; //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end // 李慧娟备注 : 这里请替换成<SAP上传(WIN)>标识判断 //<!--询价状态--> if(tempOp.SAP_Send_OK__c || '完毕'.equals(tempOp.StageName__c)){ // 2022-6-2 yjk SWAG-CEP9G8 //win WinNum += 1; } //XLIU-CG98L5【委托】【评估】新需求-招标项目/询价对应流标、废标改善 fy start // else if(tempOp.StageName__c.equals('失单') || tempOp.StageName__c.equals('取消')){ //2022-5-23 yjk SWAG-CEP9G8 // //失单 // SHDNum += 1; // } else if(tempOp.StageName__c.equals('失单')){ //2022-5-23 yjk SWAG-CEP9G8 //失单 SHDNum += 1; } else if(tempOp.StageName__c.equals('取消')){ //2022-5-23 yjk SWAG-CEP9G8 //失单 QuxNum += 1; } //XLIU-CG98L5【委托】【评估】新需求-招标项目/询价对应流标、废标改善 fy end //获取询价的医院(相关性时用) if(!OppHospitalList.contains(tempOp.Hospital__c)&&tempOp.Hospital__c!=null){ OppHospitalList.add(tempOp.Hospital__c); } //2022-6-29 yjk 中标确认赋值 start if('OLY中标'.equals(tempOp.ConfirmationofAward__c)){ bidNum++; }else if('竞争对手中标'.equals(tempOp.ConfirmationofAward__c)){ loseNum++; } //2022-6-29 yjk 中标确认赋值 end } //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start tempTender.OlyNumberHosts__c = OlyNum; tempTender.RivalHostsNumber__c = RivalNum; tempTender.TotalNumberHosts__c = TotalNum; //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end //<!--询价状态--> if(WinNum == BiddingDownOppList.size()){ //全部为Win,OLY确认状态 为 成交 tempTender.OpportunityStatus__c = '成交'; }else if(SHDNum == BiddingDownOppList.size()){ //全部为失单.状态为 失单 tempTender.OpportunityStatus__c = '失单'; }else if(WinNum>0&&SHDNum>0&&(WinNum + SHDNum) == BiddingDownOppList.size() ){ //部分Win,部分失单时, 状态为 部分成交 tempTender.OpportunityStatus__c = '部分成交'; } //XLIU-CG98L5【委托】【评估】新需求-招标项目/询价对应流标、废标改善 fy start else if(QuxNum == BiddingDownOppList.size()){ //全部为取消.状态为 取消 tempTender.OpportunityStatus__c = '取消'; } //XLIU-CG98L5【委托】【评估】新需求-招标项目/询价对应流标、废标改善 fy end else if(tempTender.OpportunityNum__c > 0){ //如果询价数量大于0的话就是 跟进中 tempTender.OpportunityStatus__c = '跟进中'; }else{ //其他都是 '' tempTender.OpportunityStatus__c = ''; } //<!---- 询价状态 end ---> //2022-6-29 yjk 中标确认赋值 start if(bidNum > 0 && loseNum == 0){ tempTender.ConfirmationofAward__c = 'OLY中标'; }else if(loseNum > 0 && bidNum == 0){ tempTender.ConfirmationofAward__c = '竞争对手中标'; }else if(bidNum > 0 && loseNum > 0){ tempTender.ConfirmationofAward__c = '部分OLY中标'; } //2022-6-29 yjk 中标确认赋值 end //<!------ 相关性 信息 start ----> //定义Map存放当前招投标项目的五个医院 Map<String,String> fiveHospitalMap = new Map<String,String>(); // 招标-询价关联修改 这里是不是可以直接从当前招标里初始化?询价上不再关联单一的招标项目了 20210818 start // fiveHospitalMap.put('Hospital__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital__c); // fiveHospitalMap.put('Hospital1__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital1__c); // fiveHospitalMap.put('Hospital2__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital2__c); // fiveHospitalMap.put('Hospital3__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital3__c); // fiveHospitalMap.put('Hospital4__c',BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.Hospital4__c); fiveHospitalMap.put('Hospital__c', tempTender.Hospital__c); fiveHospitalMap.put('Hospital1__c', tempTender.Hospital1__c); fiveHospitalMap.put('Hospital2__c', tempTender.Hospital2__c); fiveHospitalMap.put('Hospital3__c', tempTender.Hospital3__c); fiveHospitalMap.put('Hospital4__c', tempTender.Hospital4__c); // 招标-询价关联修改 20210818 end //如果招投标项目的 是否相关 字段不为否 , 并且 相关医院 相关战略科室 相关普通科室 为空时,则更新 为询价的 医院 战略科室 客户名 // 招标-询价关联修改 同上修改 从当前招标的数据里获得判断条件 20210818 start // if(!'否'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsRelateProject__c)){ if(!'否'.equals(tempTender.IsRelateProject__c)){ // 招标-询价关联修改 20210818 end //一.关联医院 //遍历招投标项目下所有询价的医院,给招投标项目的5个医院赋值 ---start //遍历招投标项目下所有询价的医院 if(OppHospitalList.size()>0){ for(Integer i = 0; i<OppHospitalList.size();i++){ //当招投标项目的五个医院赋值完成后不再赋值 Boolean HospitalIsNeedBreak = false; for(String ApiName :fiveHospitalMap.keySet()){ HospitalIsNeedBreak = fiveHospitalMap.get(ApiName)==null?false:true; } if(HospitalIsNeedBreak){ break; } //给招投标项目的5个医院设值 for(String ApiName : fiveHospitalMap.keySet()){ String tempTenderHospId = fiveHospitalMap.get(ApiName)==null?'':fiveHospitalMap.get(ApiName); String oppHospId = OppHospitalList.get(i); //如果招标项目已经有该医院就判断下一个询价的医院 if(tempTenderHospId.contains(oppHospId)){ break; } //医院为空,赋值医院(赋值之后进行赋值下一个医院) if(String.isBlank( fiveHospitalMap.get(ApiName) )){ fiveHospitalMap.put(ApiName,oppHospId); break; } } } } //赋值医院 tempTender.Hospital__c = fiveHospitalMap.get('Hospital__c'); tempTender.Hospital1__c = fiveHospitalMap.get('Hospital1__c'); tempTender.Hospital2__c = fiveHospitalMap.get('Hospital2__c'); tempTender.Hospital3__c = fiveHospitalMap.get('Hospital3__c'); tempTender.Hospital4__c = fiveHospitalMap.get('Hospital4__c'); //遍历招投标项目下所有询价的医院,给招投标项目的5个医院赋值 ---end } //如果 是否相关 字段已经选择否, 就不应该更新相关及相关的相关信息 // 招标-询价关联修改 同上修改 从当前招标的数据里获得判断条件 20210818 start // if(!'否'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsRelateProject__c) // &&!'是'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsRelateProject__c)){ // tempTender.IsRelateProject__c = '是'; // } if(!'否'.equals(tempTender.IsRelateProject__c) &&!'是'.equals(tempTender.IsRelateProject__c)){ tempTender.IsRelateProject__c = '是'; } // 招标-询价关联修改 20210818 end //<!------ 相关性 信息 end ----> //<!------ 应标 信息 start----> //2021-08-09 mzy 关联询价成功后,不需要设置是否应标 为 是 //如果 是否应标 字段已经选择否,就不应该更新应标及相关的相关信息 //if(!'否'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsBid__c) // &&!'是'.equals(BiddingDownOppList.get(0).Bidding_Project_Name_Bid__r.IsBid__c)){ // tempTender.IsBid__c = '是'; //} //2021-08-09 mzy 关联询价成功后,不需要设置是否应标 为 是 //<!------ 应标 信息 end----> }else { //清空 tempTender.OpportunityStatus__c = ''; } updateTenderList.add(tempTender); } return updateTenderList; } //查询招标项目下的所有询价 //param : 需要查询的招标项目Id //return Map<招投标项目Id,List<询价>> public static Map<String,List<Opportunity>> findTenderRelativeOpp(Set<String> BiddingProjectID){ //定义Map封装数据 Map<String,List<Opportunity>> BiddingProjectOppMap = new Map<String,List<Opportunity>>(); //查询招标项目下的所有询价 // 招标-询价关联修改 多对多关系对应 从关联表中获取询价 20210818 start List<Tender_Opportunity_Link__c> links = [SELECT Id, Tender_information__c, Opportunity__c FROM Tender_Opportunity_Link__c WHERE Tender_information__c in :BiddingProjectID]; List<String> oppIds = new List<String>(); for (Tender_Opportunity_Link__c link : links) { // 多对多关系 需要去重 if (oppIds.contains(link.Opportunity__c)) { continue; } oppIds.add(link.Opportunity__c); } List<Opportunity> allRelativeOppList = [SELECT Id ,AccountId,Hospital__c,Department_Class__c,SAP_Send_OK__c,CreatedDate, Whether_Bidding__c, Old_BiddingProject_Bid__c, OwnerId, StageName__c, Bidding_Project_Name_Bid__c, ConfirmationofAward__c //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 start ,OlyNumberHosts__c, RivalHostsNumber__c, InquireNumberHosts__c //20221010 lt SWAG-CHL5XA【FY23询价改善】-统计主机台数 end FROM Opportunity WHERE Id in :oppIds ORDER By createdDate ASC]; // List<Opportunity> allRelativeOppList = [SELECT Id ,AccountId,Hospital__c,Department_Class__c,SAP_Send_OK__c,CreatedDate, Whether_Bidding__c, // Old_BiddingProject_Bid__c,Bidding_Project_Name_Bid__c ,StageName__c ,Bidding_Project_Name_Bid__r.Hospital__c,Bidding_Project_Name_Bid__r.Hospital1__c, // Bidding_Project_Name_Bid__r.Hospital2__c,Bidding_Project_Name_Bid__r.Hospital3__c,Bidding_Project_Name_Bid__r.Hospital4__c, // Bidding_Project_Name_Bid__r.OwnerId,OwnerId, // Bidding_Project_Name_Bid__r.IsRelateProject__c ,Bidding_Project_Name_Bid__r.IsBid__c ,Bidding_Project_Name_Bid__r.department__c, // Bidding_Project_Name_Bid__r.subDepartment1__c,Bidding_Project_Name_Bid__r.subDepartment2__c,Bidding_Project_Name_Bid__r.subDepartment3__c, // Bidding_Project_Name_Bid__r.subDepartment4__c FROM Opportunity WHERE Bidding_Project_Name_Bid__c in :BiddingProjectID ORDER By createdDate ASC]; //遍历询价集合 //2.按创建时间排序(正序),创建map for(Opportunity tempOp :allRelativeOppList){ // 循环link,找到询价对应的招标 for (Tender_Opportunity_Link__c link : links) { if (link.Opportunity__c == tempOp.Id) { String fifteenTenderId = String.valueOf(link.Tender_information__c).subString(0,15); //Map里面没有保存当前询价的招标项目下的询价 if(!BiddingProjectOppMap.containsKey(fifteenTenderId)){ //第一次存放 List<Opportunity> tempOppList = new List<Opportunity>(); tempOppList.add(tempOp); BiddingProjectOppMap.put(fifteenTenderId,tempOppList); }else { //以后存放 List<Opportunity> tempOppListE = BiddingProjectOppMap.get(fifteenTenderId); tempOppListE.add(tempOp); BiddingProjectOppMap.put(fifteenTenderId,tempOppListE); } } } //判断当前询价是否有招标项目 // if(tempOp.Bidding_Project_Name_Bid__c!=null){ // String fifteenTenderId = String.valueOf(tempOp.Bidding_Project_Name_Bid__c).subString(0,15); // //Map里面没有保存当前询价的招标项目下的询价 // if(!BiddingProjectOppMap.containsKey(fifteenTenderId)){ // //第一次存放 // List<Opportunity> tempOppList = new List<Opportunity>(); // tempOppList.add(tempOp); // BiddingProjectOppMap.put(fifteenTenderId,tempOppList); // }else { // //以后存放 // List<Opportunity> tempOppListE =BiddingProjectOppMap.get(fifteenTenderId); // tempOppListE.add(tempOp); // BiddingProjectOppMap.put(fifteenTenderId,tempOppListE); // } // } } //完善Map : 询价为0的招投标项目应该也有一列 for(String TenderId : BiddingProjectID){ String fifteenTenderId = TenderId.subString(0,15); if(!BiddingProjectOppMap.containsKey(fifteenTenderId)){ List<Opportunity> tempOppList = new List<Opportunity>(); BiddingProjectOppMap.put(fifteenTenderId,tempOppList); } } return BiddingProjectOppMap; } // 发送提醒邮件 private void sendFieldEmail() { PretechBatchEmailUtil be = new PretechBatchEmailUtil(); String[] toList = new String[] {UserInfo.getUserEmail()}; String title = '招标项目询价状态和询价数量更新失败'; //String[] ccList = new String[] {'Xiaochen_You@olympus.com.cn'}; String[] ccList = new String[] {'miaoziyang@prec-tech.com'}; if (System.Test.isRunningTest()) { be.successMail('', 1); } if (emailMessages.size() > 0 && TenderfailedCount > 0) { be.failedMail(toList, ccList, title, this.emailMessages.get(0)+'\n', TendertotalCount, TendertotalCount - TenderfailedCount, TenderfailedCount,'',true); if(!Test.isRunningTest()){ be.send(); } } } public static void justForTest() { Integer i = 0; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; i++; } } force-app/main/default/classes/UpdateTenderInformationBatch.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>45.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/loanerArrangedEmailController.cls
New file @@ -0,0 +1,95 @@ public with sharing class loanerArrangedEmailController { public loanerArrangedEmailController() { } @AuraEnabled public static InitData init(String recordId) { String statusSting = Label.StatusProcessState; List<String> status = statusSting.split(','); InitData res = new InitData(); try { Rental_Apply__c rac = [SELECT Id, Status__c, Campaign__c, RC_return_to_office__c, Repair_Final_Inspection_Date_F__c, Repair__c, Assigned_Not_Shipment__c, Demo_purpose1__c, Contract_pdf_updated__c, Wei_Assigned_Cnt__c from Rental_Apply__c where Id = :recordId]; if( rac.Campaign__c != null ){ //获取学会对象 Campaign camp = [select Id, Status, Rental_Apply_Flag__c,IF_Approved__c,Approved_Status__c, Meeting_Approved_No__c from Campaign where id = :rac.Campaign__c]; res.CampaignId = camp.Id; res.CampaignStatus = camp.Status; res.IFApproved = camp.IF_Approved__c; res.MeetingApprovedNo = camp.Meeting_Approved_No__c; res.ApprovedStatus = camp.Approved_Status__c; } res.Id = recordId; res.RaStatus = rac.Status__c; res.WeiAssignedCnt = Integer.valueOf(rac.Wei_Assigned_Cnt__c); res.AssignedNotShipment = Integer.valueOf(rac.Assigned_Not_Shipment__c); res.DemoPurpose1 = rac.Demo_purpose1__c; res.ContractPdfUpdated = rac.Contract_pdf_updated__c; res.RepairId = rac.Repair__c; res.RepairFinalInspectionDateF = rac.Repair_Final_Inspection_Date_F__c; res.RCReturnToOffice = rac.RC_return_to_office__c; res.StatusList = status; } catch (Exception e) { System.debug(LoggingLevel.INFO, '****e:' + e); } system.debug('res======'+res); return res; } //获取备品借出一栏 @AuraEnabled public static Integer getRentalApplyEquipmentSet(String recordId) { Rental_Apply__c tempRa = [SELECT Id, Bollow_Date__c from Rental_Apply__c where Id = :recordId]; List<Rental_Apply_Equipment_Set__c> tempRaEquipSetList = new List<Rental_Apply_Equipment_Set__c>(); Integer pageLength ; if(tempRa.Bollow_Date__c != null) { tempRaEquipSetList = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId AND Shippment_loaner_time__c != null and RAES_Status__c != '已分配' and RAES_Status__c != '取消分配']; }else { tempRaEquipSetList = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId AND RAES_Status__c != '已分配' and RAES_Status__c != '取消分配']; } // if(tempRaEquipSetList.size()>0) { Integer setLength = tempRaEquipSetList.size(); pageLength = Math.mod(setLength,10) == 0 ? setLength/10 : Math.round(setLength) + 1; } return pageLength; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String CampaignStatus; //学会状态 @AuraEnabled public String CampaignId; //学会Id @AuraEnabled public String RaStatus; //备品借出申请状态 @AuraEnabled public Integer WeiAssignedCnt; //未分配件数 Wei_Assigned_Cnt__c @AuraEnabled public Integer AssignedNotShipment; //已分配未出库指示 Assigned_Not_Shipment__c @AuraEnabled public String DemoPurpose1; //使用目的1 Demo_purpose1__c @AuraEnabled public Boolean ContractPdfUpdated; //合同书已上传 Contract_pdf_updated__c @AuraEnabled public String RepairId; //学会.修理Id @AuraEnabled public Date RepairFinalInspectionDateF; //修理最终检测日F Repair_Final_Inspection_Date_F__c @AuraEnabled public Date RCReturnToOffice; //RC修理品返送日 RC_return_to_office__c @AuraEnabled public Boolean IFApproved; //学会.是否需要申请决裁 @AuraEnabled public String MeetingApprovedNo; //学会.会议决裁编码 @AuraEnabled public String ApprovedStatus; //学会.决裁状态 Approved_Status__c @AuraEnabled public List<String> StatusList; } } force-app/main/default/classes/loanerArrangedEmailController.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/classes/otherButtonMaintenanceContractCtl.cls
New file @@ -0,0 +1,87 @@ public with sharing class otherButtonMaintenanceContractCtl { public otherButtonMaintenanceContractCtl() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ Maintenance_Contract__c report = [SELECT MC_approval_status__c,Payment_Plan_Sum_First__c,Contract_quotation_or_not__c,Name,notRenew__c,Contract_print_completed__c,Maintenance_Contract_No__c,upload_to_sap_time__c,old_Is_RecognitionModel__c,upload_to_RM_time__c,Is_Recognition_Model_True__c,Id,URF_Contract_F__c,RecordType_DeveloperName__c,Estimate_Target__c FROM Maintenance_Contract__c WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.MCApprovalStatusC = report.MC_approval_status__c; res.MaintenanceContractNoC = report.Maintenance_Contract_No__c; res.uploadToSapTimeC = report.upload_to_sap_time__c; res.oldIsRecognitionModelC = report.old_Is_RecognitionModel__c; res.uploadToRMTimeC = report.upload_to_RM_time__c; res.IsRecognitionModelTrueC = report.Is_Recognition_Model_True__c; res.Id = report.Id; res.URFContractFC = report.URF_Contract_F__c; res.RecordTypeDeveloperNameC = report.RecordType_DeveloperName__c; res.EstimateTargetC = report.Estimate_Target__c; res.ContractprintCompletedC = report.Contract_print_completed__c; res.notRenewC = report.notRenew__c; res.Name = report.Name; res.ContractQuotationOrNotC = report.Contract_quotation_or_not__c; res.PaymentPlanSumFirstC = report.Payment_Plan_Sum_First__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 维修合同失单报告 @AuraEnabled public static List<Lost_Report__c> selectRecords(String recordId){ List<Lost_Report__c> res = new List<Lost_Report__c>(); try{ res = [SELECT Id,Status__c,Other_Reasons__c,Other__c,Third_Party_Company__c,Third_Party_Contract_Price__c,To_Where__c,Specific_Reasons__c,Maintenance_Contract__c from Lost_Report__c where Maintenance_Contract__c =: recordId ]; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 工作流状态 @AuraEnabled public static void processResults(String recordId){ Approval.ProcessSubmitRequest psr = new Approval.ProcessSubmitRequest(); psr.setobjectid(recordId); Approval.ProcessResult submitResult = Approval.process(psr); } public class InitData{ @AuraEnabled public String MCApprovalStatusC; @AuraEnabled public String MaintenanceContractNoC; @AuraEnabled public Datetime uploadToSapTimeC; @AuraEnabled public Boolean oldIsRecognitionModelC; @AuraEnabled public Datetime uploadToRMTimeC; @AuraEnabled public Boolean IsRecognitionModelTrueC; @AuraEnabled public String Id; @AuraEnabled public String URFContractFC; @AuraEnabled public String RecordTypeDeveloperNameC; @AuraEnabled public String EstimateTargetC; @AuraEnabled public Datetime ContractprintCompletedC; @AuraEnabled public Boolean notRenewC; @AuraEnabled public String Name; @AuraEnabled public String ContractQuotationOrNotC; @AuraEnabled public Double PaymentPlanSumFirstC; } } force-app/main/default/classes/otherButtonMaintenanceContractCtl.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/otherButtonPreparationReportController.cls
New file @@ -0,0 +1,30 @@ public with sharing class otherButtonPreparationReportController { public otherButtonPreparationReportController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ Maintenance_Contract__c report = [SELECT Id,RecordType_DeveloperName__c,Estimate_Target__c FROM Maintenance_Contract__c WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.Id = report.Id; res.RecordTypeDeveloperNameC = report.RecordType_DeveloperName__c; res.EstimateTargetC = report.Estimate_Target__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String RecordTypeDeveloperNameC; @AuraEnabled public String EstimateTargetC; } } force-app/main/default/classes/otherButtonPreparationReportController.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/otherButtonRepairController.cls
New file @@ -0,0 +1,392 @@ public with sharing class otherButtonRepairController { public otherButtonRepairController() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ Repair__c report = [SELECT Status1__c,Rental_Apply_Equipment_Set_Detail__c,Rental_Apply_Equipment_Set_Detail_Id__c,Latest_Collect_Date_Priority__c,if_Rental_Apply__c,Offer_Rental_New__c,ProduceCompany_hand__c,CFDA_No_Hand__c,MBC_AwareDate__c,InsReport__c,QIS_ID__c,On_Call_ID__c,RepairSubOrder__c,ProductFailureRelated__c,Delay15Min__c,ProblemOccurredSelect__c,Repair_Source__c ,Failure_Occurrence_Date__c ,MaintenanceContractType__c ,OperationOrExaminationName__c ,WhatProject__c ,FailureQInHospital__c ,ReportAdverseEvents__c ,InformationFrom__c ,AfterFailureInformation__c ,ProblemOccurred__c ,SupportingProducts__c ,ifDeadHurt__c ,UseFailProductFinish__c ,DelayReportReason__c ,BreakORFallOff__c ,DateReceiptQuestions__c ,DeliveryLogisticsAnnotation__c ,DeliveryLogisticsNo__c ,engineerSendDate__c ,DeliveryLogisticsMode__c ,RepairApplicantDepartment__c ,RepairApplicantHospital__c ,RepairApplicant__c ,Repair_Detail__c ,Returns_Product_way__c ,work_location_select__c ,On_site_repair__c ,SalesOfficeCode_selection__c ,Incharge_Staff_Contact__c ,Incharge_Staff__c ,Dealer__c ,RepairCostType__c ,Account__c,Department_Class__c ,Hospital__c ,PaperRepairRequestNo__c ,part_arrangement_complete__c,Repair_Shipped_Date__c,OCSMAdministrativeReportStatus__c,Incharge_Staff_Email__c,Name,HP_Name__c,Delivered_Product__c, Repair_Product_Serial_No__c,Service_Repair_No__c,Repair_Firstestimated_Date__c, Repair_Estimated_Date__c,RC_information__c,Id,OCSMAdministrativeReportNumber__c, OCSMAdministrativeReportDate__c,Aware_date__c,PAE_Determine__c,ETQ_UPLOAD_STATUS__c, AE_DetermineResult__c,PAE_DetermineAC__c,Repair_Inspection_Date__c,Contain_UseRSA__c FROM Repair__c WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.Status1C = report.Status1__c; res.ProblemOccurredSelectC = report.ProblemOccurredSelect__c; res.Delay15MinC = report.Delay15Min__c; res.ProductFailureRelatedC = report.ProductFailureRelated__c; res.RepairSubOrderC = report.RepairSubOrder__c; res.OnCallIDC = report.On_Call_ID__c; res.QISIDC = report.QIS_ID__c; res.InsReportC = report.InsReport__c; res.MBCAwareDateC = report.MBC_AwareDate__c; res.CFDANoHandC = report.CFDA_No_Hand__c; res.ProduceCompanyHandC = report.ProduceCompany_hand__c; res.OfferRentalNewC = report.Offer_Rental_New__c; res.ifRentalApplyC = report.if_Rental_Apply__c; res.LatestCollectDatePriorityC = report.Latest_Collect_Date_Priority__c; res.RentalApplyEquipmentSetDetailIdC = report.Rental_Apply_Equipment_Set_Detail_Id__c; res.RentalApplyEquipmentSetDetailC = report.Rental_Apply_Equipment_Set_Detail__c; res.PaperRepairRequestNoC = report.PaperRepairRequestNo__c; res.HospitalC = report.Hospital__c; res.DepartmentClassC = report.Department_Class__c; res.AccountC = report.Account__c; res.RepairCostTypeC = report.RepairCostType__c; res.DealerC = report.Dealer__c ; res.InchargeStaffC = report.Incharge_Staff__c ; res.InchargeStaffContactC = report.Incharge_Staff_Contact__c ; res.SalesOfficeCodeSelectionC = report.SalesOfficeCode_selection__c ; res.OnSiteRepairC = report.On_site_repair__c ; res.workLocationSelectC = report.work_location_select__c ; res.ReturnsProductWayC = report.Returns_Product_way__c ; res.RepairDetailC = report.Repair_Detail__c ; res.RepairApplicantC = report.RepairApplicant__c ; res.RepairApplicantHospitalC = report.RepairApplicantHospital__c ; res.RepairApplicantDepartmentC = report.RepairApplicantDepartment__c ; res.DeliveryLogisticsModeC = report.DeliveryLogisticsMode__c ; res.engineerSendDateC = report.engineerSendDate__c ; res.DeliveryLogisticsNoC = report.DeliveryLogisticsNo__c ; res.DeliveryLogisticsAnnotationC = report.DeliveryLogisticsAnnotation__c ; res.DateReceiptQuestionsC = report.DateReceiptQuestions__c ; res.BreakORFallOffC = report.BreakORFallOff__c ; res.DelayReportReasonC = report.DelayReportReason__c ; res.UseFailProductFinishC = report.UseFailProductFinish__c ; res.ifDeadHurtC = report.ifDeadHurt__c ; res.SupportingProductsC = report.SupportingProducts__c ; res.ProblemOccurredC = report.ProblemOccurred__c ; res.AfterFailureInformationC = report.AfterFailureInformation__c ; res.InformationFromC = report.InformationFrom__c ; res.ReportAdverseEventsC = report.ReportAdverseEvents__c ; res.FailureQInHospitalC = report.FailureQInHospital__c ; res.WhatProjectC = report.WhatProject__c ; res.OperationOrExaminationNameC = report.OperationOrExaminationName__c ; res.MaintenanceContractTypeC = report.MaintenanceContractType__c ; res.FailureOccurrenceDateC = report.Failure_Occurrence_Date__c ; res.RepairSourceC = report.Repair_Source__c ; res.Id = report.Id; res.partArrangementCompleteC = report.part_arrangement_complete__c; res.RepairShippedDateC = report.Repair_Shipped_Date__c; res.OCSMAdministrativeReportNumberC = report.OCSMAdministrativeReportNumber__c; res.OCSMAdministrativeReportDateC = report.OCSMAdministrativeReportDate__c; res.AwareDateC = report.Aware_date__c; res.PAEDetermineC = report.PAE_Determine__c; res.ETQUPLOADSTATUSC = report.ETQ_UPLOAD_STATUS__c; res.AEDetermineResultC = report.AE_DetermineResult__c; res.PAEDetermineACC = report.PAE_DetermineAC__c; res.RepairInspectionDateC = report.Repair_Inspection_Date__c; res.ContainUseRSAC = report.Contain_UseRSA__c; res.InchargeStaffEmailC = report.Incharge_Staff_Email__c; res.Name = report.Name; res.HPNameC = report.HP_Name__c; res.DeliveredProductC = report.Delivered_Product__c; res.RepairProductSerialNoC = report.Repair_Product_Serial_No__c; res.ServiceRepairNoC = report.Service_Repair_No__c; res.RepairFirstestimatedDateC = report.Repair_Firstestimated_Date__c; res.RepairEstimatedDateC = report.Repair_Estimated_Date__c; res.RCInformationC = report.RC_information__c; res.OCSMAdministrativeReportStatusC = report.OCSMAdministrativeReportStatus__c; res.userID = UserInfo.getUserId(); res.profileId = UserInfo.getProfileId(); res.userEmail = UserInfo.getUserEmail(); System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 根据ID查找修理表 @AuraEnabled public static List<Repair__c> selectRecords(String recordId){ List<Repair__c> res = new List<Repair__c>(); try{ res = [SELECT Id,AsyncData__c,Complaint_Number__c,ETQ_UPLOAD_STATUS__c FROM Repair__c WHERE id =: recordId ]; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 根据ID修改修理 @AuraEnabled public static void updateRepair(String recordId){ try { Repair__c repair = new Repair__c(); repair.Id = recordid; repair.OCSMAdministrativeReportStatus__c = '无需报告'; update repair; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } // 修改验收单 @AuraEnabled public static String updateYanshoudan(String recordId){ String res; try { Repair__c repair = new Repair__c(); repair.Id = recordid; repair.Request_yanshoudan_PDF__c = true; repair.Facility_Return_Receipt_Collection_reque__c = Datetime.now().date(); update repair; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); res = e.getMessage(); } return res; } // 查找PAE判定记录 @AuraEnabled public static List<PAE_DecisionRecord__c> selectPAEDecisionRecord(String recordId,String recordTypeId){ List<PAE_DecisionRecord__c > res = new List<PAE_DecisionRecord__c >(); try{ res = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Repair__c =: recordId And RecordType.DeveloperName =: recordTypeId Order by LastModifiedDate desc]; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 发送邮件 @AuraEnabled public static String sendToETQ(String iflog_Id,BatchIF_Log__c rowDataSFDC, List<String> repairIds,String statu){ List<QIS_Report__c> temp = [select id from QIS_Report__c where id in :repairIds ]; if(temp != null && temp.size() > 0){ try { Database.executeBatch(new QISToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu),50); //生成PDF } catch (Exception e) { return '更新QIS报错:'+ e.getMessage(); } }else{ BatchIF_Log__c iflog = new BatchIF_Log__c(); iflog.Type__c = 'sendToETQ'; iflog.ErrorLog__c = ''; iflog.Log__c = 'NFM401WebService start--'; Repair__c updateRe = new Repair__c(); updateRe.Id = repairIds[0]; updateRe.INTERFACE_RECORD_ID__c = null; updateRe.ETQ_UPLOAD_STATUS__c = null; updateRe.ETQ_UPLOAD_MESSAGE__c = null; updateRe.OSH_ConfirmationDate__c = Date.today(); updateRe.OSH_Affirmant__c = UserInfo.getUserId(); updateRe.AWS_Interface_Time__c = Datetime.now(); updateRe.AsyncData__c = true; try{ update updateRe; Database.executeBatch(new RepairToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu)); //生成PDF iflog.Log__c += '\n修理:'+updateRe+' 更新成功'; iflog.Log__c = '\nNFM401WebService end--'; insert iflog; }catch(Exception ex){ iflog.ErrorLog__c += '修理:'+updateRe+' 更新失败,因为::'+ex.getMessage(); iflog.Log__c = '\nNFM401WebService end--'; insert iflog; return '更新修理报错:'+ ex.getMessage(); } } return '发送成功!'; } // 查找AssetID @AuraEnabled public static String selectAssetID(String recordId){ List<Repair__c> res = new List<Repair__c>(); try{ res = [SELECT Delivered_Product__c from Repair__c WHERE Id =: recordId]; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res[0].Delivered_Product__c; } // 查找删除ID @AuraEnabled public static List<Repair__c> selectCustomDeleteById(String recordId){ List<Repair__c > res = new List<Repair__c >(); try{ res = [SELECT Id, Status__c,SAP_Transfer_time__c, Repair_Ordered_Date__c, CreatedById, Acc_OwnerId__c,FSE_ownerid__c FROM Repair__c WHERE Id =: recordId]; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 查找删除ID @AuraEnabled public static String deleteRepair(String rid) { try { Repair__c r = new Repair__c(Id = rid); delete r; return 'OK'; } catch (Exception e) { return e.getMessage(); } } public class InitData{ @AuraEnabled public String Status1C; @AuraEnabled public String RepairSubOrderC; @AuraEnabled public String OnCallIDC; @AuraEnabled public String QISIDC; @AuraEnabled public String InsReportC; @AuraEnabled public Datetime MBCAwareDateC; @AuraEnabled public String CFDANoHandC; @AuraEnabled public String ProduceCompanyHandC; @AuraEnabled public Boolean OfferRentalNewC; @AuraEnabled public Boolean ifRentalApplyC; @AuraEnabled public Datetime LatestCollectDatePriorityC; @AuraEnabled public String RentalApplyEquipmentSetDetailIdC; @AuraEnabled public String RentalApplyEquipmentSetDetailC; @AuraEnabled public String ProblemOccurredSelectC; @AuraEnabled public String Delay15MinC; @AuraEnabled public String ProductFailureRelatedC; @AuraEnabled public String Id; @AuraEnabled public String OCSMAdministrativeReportNumberC; @AuraEnabled public Datetime OCSMAdministrativeReportDateC; @AuraEnabled public Datetime AwareDateC; @AuraEnabled public String PAEDetermineC; @AuraEnabled public String ETQUPLOADSTATUSC; @AuraEnabled public String AEDetermineResultC; @AuraEnabled public String PAEDetermineACC; @AuraEnabled public Datetime RepairInspectionDateC; @AuraEnabled public boolean ContainUseRSAC; @AuraEnabled public String InchargeStaffEmailC; @AuraEnabled public String Name; @AuraEnabled public String HPNameC; @AuraEnabled public String DeliveredProductC; @AuraEnabled public String RepairProductSerialNoC; @AuraEnabled public String ServiceRepairNoC; @AuraEnabled public Datetime RepairFirstestimatedDateC; @AuraEnabled public Datetime RepairEstimatedDateC; @AuraEnabled public String RCInformationC; @AuraEnabled public String OCSMAdministrativeReportStatusC; @AuraEnabled public Datetime RepairShippedDateC; @AuraEnabled public Datetime partArrangementCompleteC; @AuraEnabled public String userID; @AuraEnabled public String profileId; @AuraEnabled public String userEmail; @AuraEnabled public String PaperRepairRequestNoC; @AuraEnabled public String HospitalC; @AuraEnabled public String AccountC; @AuraEnabled public String DepartmentClassC; @AuraEnabled public String RepairCostTypeC; @AuraEnabled public String DealerC; @AuraEnabled public String InchargeStaffC; @AuraEnabled public String InchargeStaffContactC; @AuraEnabled public String SalesOfficeCodeSelectionC; @AuraEnabled public String OnSiteRepairC; @AuraEnabled public String workLocationSelectC; @AuraEnabled public String ReturnsProductWayC; @AuraEnabled public String RepairDetailC; @AuraEnabled public String RepairApplicantC; @AuraEnabled public String RepairApplicantHospitalC; @AuraEnabled public String RepairApplicantDepartmentC; @AuraEnabled public String DeliveryLogisticsModeC; @AuraEnabled public Datetime engineerSendDateC; @AuraEnabled public String DeliveryLogisticsNoC; @AuraEnabled public String DeliveryLogisticsAnnotationC; @AuraEnabled public Datetime DateReceiptQuestionsC; @AuraEnabled public String BreakORFallOffC; @AuraEnabled public String DelayReportReasonC; @AuraEnabled public String UseFailProductFinishC; @AuraEnabled public String ifDeadHurtC; @AuraEnabled public String SupportingProductsC; @AuraEnabled public String ProblemOccurredC; @AuraEnabled public String AfterFailureInformationC; @AuraEnabled public String InformationFromC; @AuraEnabled public String ReportAdverseEventsC; @AuraEnabled public String FailureQInHospitalC; @AuraEnabled public String WhatProjectC; @AuraEnabled public String OperationOrExaminationNameC; @AuraEnabled public String MaintenanceContractTypeC; @AuraEnabled public Datetime FailureOccurrenceDateC; @AuraEnabled public String RepairSourceC; } } force-app/main/default/classes/otherButtonRepairController.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/otherButtonSpotInspectionReportCtl.cls
New file @@ -0,0 +1,28 @@ public with sharing class otherButtonSpotInspectionReportCtl { public otherButtonSpotInspectionReportCtl() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ Inspection_Report__c report = [SELECT Id,RecordTypeId FROM Inspection_Report__c WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.Id = report.Id; res.RecordTypeId = report.RecordTypeId; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String RecordTypeId; } } force-app/main/default/classes/otherButtonSpotInspectionReportCtl.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>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.cls
New file @@ -0,0 +1,25 @@ public with sharing class rentalApplyEquipmentRentalPDFController { public rentalApplyEquipmentRentalPDFController() { } @AuraEnabled public static InitData initJumptoPDFButton(String recordId) { InitData res = new InitData(); try { List<Rental_Apply_Equipment_Set__c> raeSet = [SELECT Id from Rental_Apply_Equipment_Set__c where Rental_Apply__c = :recordId and Yi_Shipment_request__c > 0 and RAES_Status__c != '取消']; Integer setLength = raeSet.size(); res.pageLength = Math.mod(setLength,10)== 0 ? setLength/10 : Math.round(setLength) +1 ; }catch(Exception e){ System.debug(LoggingLevel.INFO, '****e:' + e); } return res; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public Integer pageLength; } } force-app/main/default/classes/rentalApplyEquipmentRentalPDFController.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/lexASACEditor/lexASACEditor.css
New file @@ -0,0 +1,10 @@ .inASACEditorHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexASACEditor/lexASACEditor.html
New file @@ -0,0 +1,5 @@ <template> <div class="inASACEditorHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexASACEditor/lexASACEditor.js
New file @@ -0,0 +1,73 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForASACEditorButton'; export default class LexASACEditor extends LightningElement { @api recordId; LastModifiedDate Id Name LastModifiedById DeveloperName IsLoading = true; url; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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 != undefined) { console.log("if"); this.LastModifiedById = result.LastModifiedById; this.LastModifiedDate = result.LastModifiedDate; this.Id = result.Id; this.Name = result.Name; this.DeveloperName = result.DeveloperName; console.log(this.Id); this.editor(); this.dispatchEvent(new CloseActionScreenEvent()); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); }else{ console.log("else"); this.IsLoading = false; this.editor(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); //this.updateRecordView(this.recordId); } editor(){ if (this.Id != undefined){ this.url = "/apex/RepPAEDecisionRecord?Id="+this.Id+"&ReportId="+this.recordId+"&RecordTypeIds="+"ASACDecision"; console.log(this.url); } else { this.url = "/apex/RepPAEDecisionRecord?ReportId="+this.recordId+"&RecordTypeIds="+"ASACDecision"; console.log(this.url); } window.open(this.url,"_self"); } } force-app/main/default/lwc/lexASACEditor/lexASACEditor.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.css
New file @@ -0,0 +1,10 @@ .inASRCEditorHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.html
New file @@ -0,0 +1,5 @@ <template> <div class="inASRCEditorHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.js
New file @@ -0,0 +1,74 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForASRCEditorButton'; export default class LexASRCEditor extends LightningElement { @api recordId; LastModifiedDate Id Name LastModifiedById DeveloperName IsLoading = true; url; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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 != undefined) { console.log("if"); this.LastModifiedById = result.LastModifiedById; this.LastModifiedDate = result.LastModifiedDate; this.Id = result.Id; this.Name = result.Name; this.DeveloperName = result.DeveloperName; console.log(this.Id); this.editor(); this.dispatchEvent(new CloseActionScreenEvent()); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); }else{ console.log("else"); this.IsLoading = false; this.editor(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); //this.updateRecordView(this.recordId); } editor(){ if (this.Id != undefined){ this.url = "/apex/RepPAEDecisionRecord?Id="+this.Id+"&ReportId="+this.recordId+"&RecordTypeIds="+"ASRCDecision"; console.log(this.url); } else { this.url = "/apex/RepPAEDecisionRecord?ReportId="+this.recordId+"&RecordTypeIds="+"ASRCDecision"; console.log(this.url); } window.open(this.url,"_self"); } } force-app/main/default/lwc/lexASRCEditor/lexASRCEditor.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexASRCEditorRepair/__tests__/lexASRCEditorRepair.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexASRCEditorRepair from 'c/lexASRCEditorRepair'; describe('c-lex-asrc-editor-repair', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-asrc-editor-repair', { is: LexASRCEditorRepair }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.js
New file @@ -0,0 +1,75 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; import selectPAEDecisionRecord from '@salesforce/apex/otherButtonRepairController.selectPAEDecisionRecord'; export default class LexASRCEditorRepair extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.RecordTypeId = result.RecordTypeId; this.ASRCEditor(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // Intake universal code编辑 ASRCEditor() { var RecordTypeId = "ASRCDecision"; var RepairId = this.Id; var url = ''; selectPAEDecisionRecord({ recordId: RepairId, recordTypeId: RecordTypeId }).then(result => { if (result != null) { if (result.length > 0) { url = "/apex/PAEDecisionRecord?Id=" + result[0].Id + "&RepairId=" + RepairId + "&RecordTypeIds=" + RecordTypeId; } else { url = "/apex/PAEDecisionRecord?RepairId=" + RepairId + "&RecordTypeIds=" + RecordTypeId; } window.open(url, '_self'); } }).catch(error => { console.log(error); }) } } force-app/main/default/lwc/lexASRCEditorRepair/lexASRCEditorRepair.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.html
New file @@ -0,0 +1,5 @@ <template> <div class="CancelSubmitHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js
New file @@ -0,0 +1,74 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ApplicationButtonController.initSubmitButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import submitCancel from '@salesforce/apex/ApplicationButtonController.submitCancel'; import userInfo_Owner from '@salesforce/apex/ApplicationButtonController.userInfo_Owner'; export default class lexApplicationCancelSubmit extends LightningElement { @api recordId;//OwnerId ownerId; monthlyReportId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.ownerId = result.OwnerId; this.monthlyReportId = result.Id; this.cancelSubmit(); }) } //授权申请 取消提交 cancelSubmit(){ //'获取当前登陆人id' userInfo_Owner({}).then(result=>{ if(this.ownerId == result.id){ submitCancel({ recordId: this.recordId }).then(requst=>{ if(requst == '1'){ this.showToast("取消提交授权信息成功","success"); } if(requst != "1"){ var messageage = ""; messageage = requst.split(',')[1]; this.showToast(messageage,"error"); } }) }else{ this.showToast("只授权申请书所有人可以取消提交","error"); } }) } updateRecordView() { updateRecord({fields: { Id: this.recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); if(type == 'success'){ this.updateRecordView(); } this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexApplicationCancelSubmit/lexApplicationCancelSubmit.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="CancelSubmitHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.js
New file @@ -0,0 +1,83 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ApplicationButtonController.initSubmitButton'; import userInfo_Owner from '@salesforce/apex/ApplicationButtonController.userInfo_Owner'; import submit from '@salesforce/apex/ApplicationButtonController.submit'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexApplicationSubmitButton extends LightningElement { @api recordId;//OwnerId ownerId;//所有人id id;//返回值的id IsLoading = true; arrMessage = []; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { if (result != null) { this.IsLoading = false; this.ownerId = result.OwnerId; this.id = result.Id; this.Submit(); } }) } Submit(){ this.arrMessage = []; //获取获取当前登陆人 userInfo_Owner({}).then(result=>{ if(this.ownerId == result.id){ submit({ recordId: this.recordId }).then(requst=>{ if(requst == '1'){ this.showToast("提交授权信息成功","success"); } if(requst != "1"){ var messageage = ""; for(let i=0;i<this.arrMessage.length;i++){ if(this.arrMessage.length-1 == i){ break; } messageage += this.arrMessage[i+1]; } this.showToast(messageage,"error"); } }) }else{ this.showToast("只授权申请书所有人可以提交","error"); } }) } updateRecordView() { updateRecord({fields: { Id: this.recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); if(type == 'success'){ this.updateRecordView(); } this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexApplicationSubmitButton/lexApplicationSubmitButton.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCancel/lexCancel.css
New file @@ -0,0 +1,10 @@ .cancelHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexCancel/lexCancel.html
New file @@ -0,0 +1,6 @@ <template> <div class="cancelHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexCancel/lexCancel.js
New file @@ -0,0 +1,103 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:00:54 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForCancelButton'; import updateForCancelButton from '@salesforce/apex/ReportController.updateForCancelButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexCancel extends LightningElement { @api recordId; status; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.status = result.status; console.log(this.status); this.cancel(); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } cancel () { if (this.status == "取消") { ShowToastEvent("已经取消!","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.status == "批准") { ShowToastEvent("已经批准,不能删除!","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.status == "完毕") { ShowToastEvent("已经完毕,不能删除!","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.status == "提交") { ShowToastEvent("已经提交,不能删除!","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } updateForCancelButton({ recordId: this.recordId }).then(result =>{ this.showToast("取消成功!","success"); this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } } force-app/main/default/lwc/lexCancel/lexCancel.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.css
New file @@ -0,0 +1,10 @@ .cancelSubmitHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.html
New file @@ -0,0 +1,6 @@ <template> <div class="cancelSubmitHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={showSuccess}></lightning-button> </div> </template> force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.js
New file @@ -0,0 +1,89 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:05:05 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import init from '@salesforce/apex/MonthlyReportController.initForCancelSubmitButton'; import cancel from '@salesforce/apex/MonthlyReportController.cancel'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexCancelSubmit extends LightningElement { @api recordId;//OwnerId ownerId; monthlyReportId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.ownerId = result.ownerId; this.monthlyReportId = result.Id; this.cancelSubmit(); console.log("end"); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Monthly_Report__c/" + this.monthlyReportId + "/view"); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } cancelSubmit () { //需要完善 if(this.ownerId == UserInfo_Owner.Id) { cancel({ recordId: this.recordId }).then(result=>{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.dispatchEvent(new CloseActionScreenEvent()); }); console.log("321"); } else { this.showToast("只有周报的所有人可以取消","error"); this.dispatchEvent(new CloseActionScreenEvent()); } } } force-app/main/default/lwc/lexCancelSubmit/lexCancelSubmit.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.css
New file @@ -0,0 +1,10 @@ .cancelSubmitReportHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.html
New file @@ -0,0 +1,6 @@ <template> <div class="cancelSubmitReportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.js
New file @@ -0,0 +1,66 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:06:00 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import cancel from '@salesforce/apex/ReportController.updateForCancelSubmitReportButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexCancelSubmitReport extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback(){ console.log(this.recordId); this.cancelSubmit(); } cancelSubmit(){ cancel({ recordId: this.recordId }).then(result =>{ this.showToast("取消提交成功!","success"); this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }).catch(error=>{ this.showToast(error,"error"); }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexCancelSubmitReport/lexCancelSubmitReport.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexComplete/lexComplete.css
New file @@ -0,0 +1,10 @@ .completeHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexComplete/lexComplete.html
New file @@ -0,0 +1,6 @@ <template> <div class="completeHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexComplete/lexComplete.js
New file @@ -0,0 +1,94 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:06:48 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForCompleteButton'; import updateForCompleteButton from '@salesforce/apex/ReportController.updateForCompleteButton'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexComplete extends LightningElement { @api recordId; profileId; status; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.status = result.status; this.profileId = result.profileId; this.complete(); this.dispatchEvent(new CloseActionScreenEvent()); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); //this.updateRecordView(this.recordId); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } complete () { // 陆胜,胡迪安,系统管理员以外没有权限 if (UserInfo_Owner.Id != "00510000004reg2" && UserInfo_Owner.Id != "00510000000gWAE" && this.profileId != "00e10000000Y3o5") { ShowToastEvent("你没有权限","error"); return; } if (this.status == "完毕") { ShowToastEvent("已经完毕!","error"); return; } updateForCompleteButton({ recordId: this.recordId }).then(result =>{ this.IsLoading = false; this.updateRecordView(this.recordId); this.showToast("完毕成功!","success"); }); } } force-app/main/default/lwc/lexComplete/lexComplete.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCopyPIInspectionReport/__tests__/lexCopyPIInspectionReport.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexCopyPIInspectionReport from 'c/lexCopyPIInspectionReport'; describe('c-lex-copy-pi-inspection-report', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-copy-pi-inspection-report', { is: LexCopyPIInspectionReport }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.js
New file @@ -0,0 +1,57 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init'; export default class LexCopyPIInspectionReport extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.RecordTypeId = result.RecordTypeId; this.CopyPI(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 复制 CopyPI() { window.location.href = '/' + this.Id + '/e?newclone=1'; } } force-app/main/default/lwc/lexCopyPIInspectionReport/lexCopyPIInspectionReport.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.css
New file @@ -0,0 +1,10 @@ .createEmailHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.html
New file @@ -0,0 +1,5 @@ <template> <div class="createEmailHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.js
New file @@ -0,0 +1,97 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-03-27 13:53:40 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-10 14:22:27 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import init from '@salesforce/apex/MonthlyReportController.initForCreateNoteEmailButton'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; export default class LexCreateNotesEmail extends LightningElement { @api recordId; ownerEmail; ownerAlias; keyIssue; feedBack; taskFollow; otherIssue; nextWeekPlan; drSumUrl; IsLoading = true; url; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.IsLoading = false; this.ownerEmail = result.ownerEmail; this.ownerAlias = result.ownerAlias; this.keyIssue = result.keyIssue; this.feedBack = result.feedBack; this.taskFollow = result.taskFollow; this.otherIssue = result.otherIssue; this.nextWeekPlan = result.nextWeekPlan; this.drSumUrl = result.drSumUrl; this.userEmail = result.userEmail; this.createEmail(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } createEmail() { console.log("start"); window.location.href = ("mailto:" + this.ownerEmail +"?bcc=" + this.userEmail +"&subject=【周报:" + this.ownerAlias + "】" + "&body=先生/女士" + "%0D%0A" + "%0D%0A" + "主要报告事项:" + this.keyIssue +"%0D%0A" + "下属事项/状态报告:" + this.feedBack +"%0D%0A" + "课题及对应结果/提案:" + this.taskFollow +"%0D%0A" + "其他事项:" + this.otherIssue +"%0D%0A" + "下周计划:" + this.nextWeekPlan +"%0D%0A" + "连接:" + this.drSumUrl +"%0D%0A").substring(0,320).split("<br>").join("%0D%0A"); } } force-app/main/default/lwc/lexCreateNotesEmail/lexCreateNotesEmail.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCreateReportMaintenanceContract/__tests__/lexCreateReportMaintenanceContract.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexCreateReportMaintenanceContract from 'c/lexCreateReportMaintenanceContract'; describe('c-lex-create-report-maintenance-contract', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-create-report-maintenance-contract', { is: LexCreateReportMaintenanceContract }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.js
New file @@ -0,0 +1,69 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; export default class LexCreateReportMaintenanceContract extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeDeveloperNameC; EstimateTargetC; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC; this.EstimateTargetC = result.EstimateTargetC; this.CreateReport(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 制作报告书 CreateReport() { var MaintenanceContractId = this.Id; var RecordTypeName = this.RecordTypeDeveloperNameC; var EstimateTarget = this.EstimateTargetC; var url = ''; if (EstimateTarget == "经销商" && (RecordTypeName == "NewMaintenance_Contract" || RecordTypeName == "VM_Contract")) { url = "/apex/MoreMaintenanceContractPop?Id=" + MaintenanceContractId + "&RecordTypeName=" + RecordTypeName; } else { url = "http://powerbi.olympus.com.cn/Home/Login"; } window.open(url, '_bank'); } } force-app/main/default/lwc/lexCreateReportMaintenanceContract/lexCreateReportMaintenanceContract.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexCustomNewCopy2/__tests__/lexCustomNewCopy2.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexCustomNewCopy2 from 'c/lexCustomNewCopy2'; describe('c-lex-custom-new-copy2', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-custom-new-copy2', { is: LexCustomNewCopy2 }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.js
New file @@ -0,0 +1,77 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexCustomNewCopy2 extends LightningElement { @api recordId; str; IsLoading = true; Id; notRenewC; Name; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.notRenewC = result.notRenewC; this.Name = result.Name; this.CustomNewCopy2(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 继续新服务合同 CustomNewCopy2() { if (this.notRenewC) { this.ShowToastEvent("请联系服务商品部!", "error"); // alert("请联系服务商品部!"); } else { window.open("/" + this.Id + "/e?clone=1&Name=&00N10000002Dx5D=&00N10000002Dx5S=%e5%bc%95%e5%90%88%e4%b8%ad&00NO00000010sDc=&CF00NO00000010hyI=&CF00NO00000010hyI_lkid=&CF00NO00000010hyX=&CF00NO00000010hyX_lkid=&CF00NO00000010hyN=&CF00NO00000010hyN_lkid=&RecordType=01210000000gTYq&00N10000002pmOp=&00N10000006gZDd=&00N10000006gZDe=&00NO00000010hy4=&00N10000002Dx4j=&00N10000002Dx4m=&00N10000002Dx4w=&00N10000002Dx4k=&00N10000002Dx5J=&00N10000002Dx5M=&00N10000002Dx4i=&00N10000002Dx4h=&00N10000002Dx5K=&00N10000003OXdT=&00N100000048zfn=&00N10000002FMsq=&00N10000003OlGF=&00N10000002Dx4r=&00N100000047AY1=&00N100000047AYB=&00N100000047AY6=&00N10000003PCeB=&00N10000005HBNe=&00N10000006plAl=&00N10000002Dx5C=&retURL=%2F" + this.Id + "&saveURL=%2Fapex/SaveMaintenanceByCopy?mid=" + this.Id + "&CF00N100000048Paw=" + this.Name + "&CF00N100000048Paw_lkid=" + this.Id, "_blank"); } } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexCustomNewCopy2/lexCustomNewCopy2.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.css
New file @@ -0,0 +1,10 @@ .dispatchOCSMQARAHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.html
New file @@ -0,0 +1,6 @@ <template> <div class="dispatchOCSMQARAHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
New file @@ -0,0 +1,67 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:07:34 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import updateForDispatchOCSMQARAButton from '@salesforce/apex/ReportController.updateForDispatchOCSMQARAButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexDispatchOCSMQARA extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback(){ console.log(this.recordId); this.DispatchOCSMQARA(); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } DispatchOCSMQARA () { updateForDispatchOCSMQARAButton({ recordId: this.recordId }).then(result =>{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } } force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexInsPageBtn/__tests__/lexInsPageBtn.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexInsPageBtn from 'c/lexInsPageBtn'; describe('c-lex-ins-page-btn', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-ins-page-btn', { is: LexInsPageBtn }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.js
New file @@ -0,0 +1,62 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonSpotInspectionReportCtl.init'; export default class LexInsPageBtn extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.RecordTypeId = result.RecordTypeId; this.insPageBtn(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 报告书明细编辑 insPageBtn() { var url; if (this.RecordTypeId == '01210000000aLii') { url = '/apex/OFSInsReportLayoutForVm'; } else { url = '/apex/OFSInsReportLayout'; } window.open(url += '?id=' + this.Id) } } force-app/main/default/lwc/lexInsPageBtn/lexInsPageBtn.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.css
New file @@ -0,0 +1,10 @@ .exampleHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.html
New file @@ -0,0 +1,5 @@ <template> <div class="EquipmentRentalPDF" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
New file @@ -0,0 +1,102 @@ import { LightningElement, track, wire, api } from 'lwc'; import { CurrentPageReference,NavigationMixin } 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'; export default class lexLoanerArrangedEmail extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if(currentPageReference) { const urlValue = currentPageReference.state.recordId; if(urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(this.recordId); console.log('result==='+JSON.stringify(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("已申请决裁但决裁状态不符合条件。"); }else { approvalCheck({ rentalApplyId: this.recordId }).then(res=>{ if (res != '1') { alert(rs1); } else { //bp2 var 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=>{ if (res == "状态更新到已出库指示") { alert("状态更新到已出库指示"); print(); setTimeout(function() { location.href = "/{!Rental_Apply__c.Id}"; },100); }else { alert(res); } }).catch(e=>{ console.log('approvalCheck==='+e); }) } }).catch(e=>{ console.log('setShipment_request==='+e); }) } this.dispatchEvent(new CloseActionScreenEvent()); } }) } print() { getRentalApplyEquipmentSet({ recordId: this.recordId }).then(result => { window.open("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + result); }) } 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; } } force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexMailMessege/__tests__/lexMailMessege.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexMailMessege from 'c/lexMailMessege'; describe('c-lex-mail-messege', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-mail-messege', { is: LexMailMessege }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexMailMessege/lexMailMessege.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexMailMessege/lexMailMessege.js
New file @@ -0,0 +1,89 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; export default class LexMailMessege extends LightningElement { @api recordId; str; IsLoading = true; Id;; InchargeStaffEmailC; Name; HPNameC; DeliveredProductC; RepairProductSerialNoC; ServiceRepairNoC; RepairFirstestimatedDateC; RepairEstimatedDateC; RCInformationC; userEmail; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.InchargeStaffEmailC = result.InchargeStaffEmailC; this.Name = result.Name; this.HPNameC = result.HPNameC; this.DeliveredProductC = result.DeliveredProductC; this.RepairProductSerialNoC = result.RepairProductSerialNoC; this.ServiceRepairNoC = result.ServiceRepairNoC; this.RepairFirstestimatedDateC = result.RepairFirstestimatedDateC; this.RepairEstimatedDateC = result.RepairEstimatedDateC; this.RCInformationC = result.RCInformationC; this.userEmail = result.userEmail; this.mailMessege(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 报价附件更新的邮件通知 mailMessege() { var Link = "https://ocsm--partial.sandbox.my.salesforce.com/" + this.Id; console.log(Link); location.href = 'mailto:' + this.InchargeStaffEmailC + '?bcc=' + this.userEmail + '&subject=【报价附件更新通知:' + this.Name + '】' + this.HPNameC + this.DeliveredProductC + this.RepairProductSerialNoC + this.ServiceRepairNoC + '&body=先生/女士%0D%0A' + '%0D%0A' + '关于主题的修理,修理报价的附件更新好了%0D%0A' + '请确认并跟进一下%0D%0A' + '%0D%0A' + '初次报价日:' + this.RepairFirstestimatedDateC + '%0D%0A' + '此次报价日:' + this.RepairEstimatedDateC + '%0D%0A' + '%0D%0A' + 'RC联络事项:' + this.RCInformationC + '%0D%0A' + '%0D%0A' + Link + ''; } } force-app/main/default/lwc/lexMailMessege/lexMailMessege.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; }/* sample css file */ force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.js
New file @@ -0,0 +1,133 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForOCMSubmitButton'; import updateQis from '@salesforce/apex/QISReportController.updateQisWithOCM'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class lexOCMSubmit extends LightningElement { @api recordId; IsLoading = true; qisReportId; QISInstallDate; qisStatus; contractnumber; isaohuiproduct; err; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.qisReportId = result.Id; this.qisStatus = result.qIStatus; this.QISInstallDate = result.qISInstallDate; this.contractnumber = result.contractnumber; this.isaohuiproduct = result.isaohuiproduct; if (this.qisStatus!='草案中' && this.qisStatus!='取消') { const evt = new ShowToastEvent({ title : '已经提交', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; }else{ if (this.qisStatus == '取消') { const evt = new ShowToastEvent({ title : '取消后的QIS不允许再提交,如果需要提交请点击\"复制\"按钮重新生成一个QIS', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } } if (this.QISInstallDate == null) { const evt = new ShowToastEvent({ title : '【购买日期/安装日期】为空时不能提交申请', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.contractnumber == null) { const evt = new ShowToastEvent({ title : '【销售合同上订单号码】为空时不能提交申请', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent()); return; } this.updateQisSubmit(); if (this.isaohuiproduct == 'true') { this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId }).then(result =>{ console.log('result'+result); if (result!='成功') { this.err = result; const evt = new ShowToastEvent({ title : '更新失败', message: this.err, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexOCMSubmit/lexOCMSubmit.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="lexOCMSubmit"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.html
New file @@ -0,0 +1,6 @@ <template> <div class="reportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.js
New file @@ -0,0 +1,96 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-03-28 15:59:44 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:08:30 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForOCSMNoToReportButton'; import updateForOCSMNoToReportButton from '@salesforce/apex/ReportController.updateForOCSMNoToReportButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexOCSMNoToReportForReport extends LightningElement { @api recordId; IsLoading = true; OCSMAdministrativeReportNumber; OCSMAdministrativeReportDate; AwareDate; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback(){ console.log("123"); init({ recordId: this.recordId }).then(result=>{ console.log(result); this.OCSMAdministrativeReportDate = result.OCSMAdministrativeReportDate; this.OCSMAdministrativeReportNumber = result.OCSMAdministrativeReportNumber; this.AwareDate = result.awareDate; this.noToReport(); }).catch(error=>{ console.log(error); }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } noToReport(){ if (!confirm("不要报告后无法撤回,是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent()); return; } if(this.OCSMAdministrativeReportNumber != undefined || this.OCSMAdministrativeReportDate != undefined ){ this.showToast("已经报告的QIS,不可以点击OCSM不要报告。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if(this.AwareDate != undefined ){ updateForOCSMNoToReportButton({ recordId: this.recordId }).then(result=>{ this.showToast("OCSM不要报告成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); }else{ this.showToast("没有AwareDate或已经OCSM行政报告,请确认。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } } } force-app/main/default/lwc/lexOCSMNoToReportForReport/lexOCSMNoToReportForReport.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; } force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.js
New file @@ -0,0 +1,105 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForlexOCSMNoToReportLightingButton'; import updateQis from '@salesforce/apex/QISReportController.updateQisForlexOCSMNoToReportLighting'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class lexOCSMNoToReportLighting extends LightningElement { @api recordId; IsLoading = true; qisReportId; OCSMAdministrativeReportNumber; OCSMAdministrativeReportDate; Awaredate; err; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.OCSMAdministrativeReportNumber = result.oCSMAdministrativeReportNumber; this.OCSMAdministrativeReportDate = result.oCSMAdministrativeReportDate; this.qisReportId = result.Id; this.Awaredate = result.awaredate; if (!confirm("不要报告后无法撤回,是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.OCSMAdministrativeReportDate != null || this.OCSMAdministrativeReportNumber != null) { const evt = new ShowToastEvent({ title : '已经报告的QIS,不可以点击OCSM不要报告', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.Awaredate!=null) { this.updateQisSubmit(); }else{ const evt = new ShowToastEvent({ title : '没有AwareDate或已经OCSM行政报告,请确认', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } }).catch(error => { console.log('error='+error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId }).then(result =>{ console.log('result'+result); this.err = result; if (result!='成功') { const evt = new ShowToastEvent({ title : '更新失败', message: this.err, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexOCSMNoToReportLighting/lexOCSMNoToReportLighting.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="lexOCSMNoToReportLighting"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOCSMNoToReportRepair/__tests__/lexOCSMNoToReportRepair.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexOCSMNoToReportRepair from 'c/lexOCSMNoToReportRepair'; describe('c-lex-ocsm-no-to-report-repair', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-ocsm-no-to-report-repair', { is: LexOCSMNoToReportRepair }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.js
New file @@ -0,0 +1,102 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; import updateRepair from '@salesforce/apex/otherButtonRepairController.updateRepair'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexOCSMNoToReportRepair extends LightningElement { @api recordId; str; IsLoading = true; Id;; OCSMAdministrativeReportNumberC; OCSMAdministrativeReportDateC; AwareDateC; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.OCSMAdministrativeReportNumberC = result.OCSMAdministrativeReportNumberC; this.OCSMAdministrativeReportDateC = result.OCSMAdministrativeReportDateC; this.AwareDateC = result.AwareDateC; this.OCSMNoToReport(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // OCSM不要报告 OCSMNoToReport() { if (!confirm("不要报告后无法撤回,是否继续?")) { return; } if (this.OCSMAdministrativeReportNumberC != undefined || this.OCSMAdministrativeReportDateC != undefined) { this.ShowToastEvent("已经报告的QIS,不可以点击OCSM不要报告。", "error") // alert("已经报告的QIS,不可以点击OCSM不要报告。"); return; } if (this.AwareDateC != undefined) { updateRepair({ recordId: this.Id }).catch(error => { if (error.body.pageErrors.length > 0) { var errmsg = error.body.pageErrors[0].message.toString(); this.ShowToastEvent(errmsg.join("\n"), "error") // alert(errmsg.join("\n")); return; } }) window.location.reload(); } else { this.ShowToastEvent("没有AwareDate或已经OCSM行政报告,请确认。", "error") // alert("没有AwareDate或已经OCSM行政报告,请确认。"); return; } } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexOCSMNoToReportRepair/lexOCSMNoToReportRepair.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.css
New file @@ -0,0 +1,10 @@ .toReportHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.html
New file @@ -0,0 +1,6 @@ <template> <div class="toReportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.js
New file @@ -0,0 +1,95 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:09:14 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForOCSMToReportButton'; import updateForOCSMToReportButton from '@salesforce/apex/ReportController.updateForOCSMToReportButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexOCSMToReport extends LightningElement { @api recordId; IsLoading = true; OCSMAdministrativeReportStatus; awareDate; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.OCSMAdministrativeReportStatus = result.OCSMAdministrativeReportStatus; this.awareDate = result.awareDate; this.toReport(); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } toReport () { if (!confirm("报告后无法撤回,是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent()); return; } if(this.OCSMAdministrativeReportStatus == undefined && this.awareDate != undefined ){ updateForOCSMToReportButton({ recordId: this.recordId }).then(result =>{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); }else{ this.showToast("没有AwareDate或已经OCSM行政报告,请确认。","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } } } force-app/main/default/lwc/lexOCSMToReport/lexOCSMToReport.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.css
New file @@ -0,0 +1,10 @@ .toReportHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; }/* sample css file *//* sample css file */ force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.js
New file @@ -0,0 +1,89 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForlexOCSMToReportLightingButton'; import updateQis from '@salesforce/apex/QISReportController.updateQisForlexOCSMToReportLighting'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class lexOCSMToReportLighting extends LightningElement { @api recordId; str; err; IsLoading = true; qisReportId; OCSMAdministrativeReportStatus; Awaredate; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); this.IsLoading = false; this.OCSMAdministrativeReportStatus = result.oCSMAdministrativeReportStatus; this.qisReportId = result.Id; this.Awaredate = result.awaredate; if (!confirm("不要报告后无法撤回,是否继续?")) { this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.OCSMAdministrativeReportStatus == null && this.Awaredate!=null) { this.updateQisSubmit(); }else{ const evt = new ShowToastEvent({ title : '没有AwareDate或已经OCSM行政报告,请确认', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } }).catch(error => { console.log(error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId }).then(result =>{ console.log('result'+result); this.err = result; if (result!='成功') { const evt = new ShowToastEvent({ title : '更新失败', message: this.err, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexOCSMToReportLighting/lexOCSMToReportLighting.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="lexOCSMToReportLighting"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOCSMToReportRepair/__tests__/lexOCSMToReportRepair.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexOCSMToReportRepair from 'c/lexOCSMToReportRepair'; describe('c-lex-ocsm-to-report-repair', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-ocsm-to-report-repair', { is: LexOCSMToReportRepair }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.js
New file @@ -0,0 +1,92 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; import updateRepair from '@salesforce/apex/otherButtonRepairController.updateRepair'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexOCSMToReportRepair extends LightningElement { @api recordId; str; IsLoading = true; Id; AwareDateC; OCSMAdministrativeReportStatusC; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.AwareDateC = result.AwareDateC; this.OCSMAdministrativeReportStatusC = result.OCSMAdministrativeReportStatusC; this.OCSMToReport(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // OCSM要报告 OCSMToReport() { if (!confirm("报告后无法撤回,是否继续?")) { return; } if (this.OCSMAdministrativeReportStatusC == undefined && this.AwareDateC != undefined) { updateRepair({ recordId: this.Id }).catch(error => { if (error.body.pageErrors.length > 0) { // alert(messages.join("\n")); var errmsg = error.body.pageErrors[0].message.toString(); this.ShowToastEvent(errmsg.join("\n"), "error") return; } }) window.location.reload(); } else { this.ShowToastEvent("没有AwareDate或已经OCSM行政报告,请确认。", "error") return; } } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexOCSMToReportRepair/lexOCSMToReportRepair.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.css
New file @@ -0,0 +1,10 @@ .opdToSISHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.html
New file @@ -0,0 +1,6 @@ <template> <div class="opdToSISHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.js
New file @@ -0,0 +1,93 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:10:06 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import updateForOPDtoSISButton from '@salesforce/apex/ReportController.updateForOPDtoSISButton'; import init from '@salesforce/apex/ReportController.initForOPDtoSISButton'; import { updateRecord } from 'lightning/uiRecordApi'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexOPDtoSIS extends LightningElement { @api recordId; IsLoading = true; ownerId; status; userId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback(){ console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); console.log("123"); if (result != null) { this.ownerId = result.ownerId; this.status = result.status; this.userId = result.userId; this.OPDtoSIS(); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } OPDtoSIS () { if(this.ownerId == this.userId && this.status == "草案中") { updateForOPDtoSISButton({ recordId: this.recordId }).then(result =>{ this.updateRecordView(this.recordId); this.showToast("成功!","success"); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } else { this.showToast("只草案中状态及OPD/SIS报告书的所有人可以提交","error"); this.dispatchEvent(new CloseActionScreenEvent()); } } } force-app/main/default/lwc/lexOPDtoSIS/lexOPDtoSIS.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.css
New file @@ -0,0 +1,10 @@ .opdToSISHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; }/* sample css file */ force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.html
New file @@ -0,0 +1,5 @@ <template> <div class="opdToSISHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
New file @@ -0,0 +1,107 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import init from '@salesforce/apex/QISReportController.initForOSHSubmitButton'; import updateQis from '@salesforce/apex/QISReportController.updateQis1'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class lexOSHSubmit extends LightningElement { @api recordId; IsLoading = true; qisReportId; qisStatus; OSHstaff; OSHstaffEmail; err; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.qisReportId = result.Id; this.qisStatus = result.qIStatus; this.OSHstaff = result.oSHstaff; this.OSHstaffEmail = result.oSHstaffEmail; console.log('this.qisStatus='+this.qisStatus); console.log('this.OSHstaff='+this.OSHstaff); console.log('this.OSHstaffEmail='+this.OSHstaffEmail); if (this.qisStatus=='OSH检测申请' && this.qisStatus=='完毕') { alert('需要先点击[OSH检查受理]'); return; } if (this.qisStatus!='OSH检测中') { alert('已经提交审批'); return; } if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { return; } if (this.OSHstaff==null||this.OSHstaffEmail==null) { alert("OSH担当必须填写"); return; } try{ this.updateQisSubmit(); }catch(err){ if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) { alert('当前网页已登出,请您重新登录后刷新该网页!'); } else { alert(err.faultstring); } return; } }).catch(error => { console.log('error='+error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId }).then(result =>{ console.log('result'+result); if (result!='成功') { this.err = result; const evt = new ShowToastEvent({ title : '更新失败', message: this.err, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.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="lexOSHSubmit"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexPDFMaintenanceCommission/__tests__/lexPDFMaintenanceCommission.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexPDFMaintenanceCommission from 'c/lexPDFMaintenanceCommission'; describe('c-lex-pdf-maintenance-commission', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-pdf-maintenance-commission', { is: LexPDFMaintenanceCommission }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.js
New file @@ -0,0 +1,54 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; export default class LexPDFMaintenanceCommission extends LightningElement { @api recordId; str; IsLoading = true; Id;; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.PDFMaintenanceCommission(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 打印维修委托书 PDFMaintenanceCommission() { window.open('/apex/MaintenanceCommissionPDF?id=' + this.Id, 'MaintenanceCommissionPDF'); } } force-app/main/default/lwc/lexPDFMaintenanceCommission/lexPDFMaintenanceCommission.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexPreContractSubmit/__tests__/lexPreContractSubmit.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexPreContractSubmit from 'c/lexPreContractSubmit'; describe('c-lex-pre-contract-submit', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-pre-contract-submit', { is: LexPreContractSubmit }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.js
New file @@ -0,0 +1,116 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import processResults from '@salesforce/apex/otherButtonMaintenanceContractCtl.processResults'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexPreContractSubmit extends LightningElement { @api recordId; str; IsLoading = true; oldIsRecognitionModelC; uploadToRMTimeC; IsRecognitionModelTrueC; MCApprovalStatusC; ContractprintCompletedC; Id; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.oldIsRecognitionModelC = result.oldIsRecognitionModelC; this.uploadToRMTimeC = result.uploadToRMTimeC; this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC; this.MCApprovalStatusC = result.MCApprovalStatusC; this.ContractprintCompletedC = result.ContractprintCompletedC; this.Id = result.Id; this.preContractSubmit(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 合同复核 preContractSubmit() { if (this.oldIsRecognitionModelC) { if (this.uploadToRMTimeC == null) { this.ShowToastEvent('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能复核。', "error") // alert('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能复核。'); return; } else { if (!this.IsRecognitionModelTrueC) { this.ShowToastEvent('当前维修合同没有完成认款,不能进行复核。', "error") // alert('当前维修合同没有完成认款,不能进行复核。'); return; } } } var status = this.MCApprovalStatusC; if (status != 'Draft' && status != 'Reject' && status != undefined) { this.ShowToastEvent('复核已经提交,请确认状态。', "success") // alert('复核已经提交,请确认状态。'); return; } var con_no = this.ContractprintCompletedC; if (con_no == '') { this.ShowToastEvent('合同盖章完毕为空,不能提交合同复核申请。', "error") // alert('合同盖章完毕为空,不能提交合同复核申请。'); return; } if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { return; } processResults({ recordId: this.recordId }).catch(error => { if (error.body.pageErrors[0] != null) { var errmsg = error.body.pageErrors[0].message.toString(); // alert(errmsg + '_sys'); this.ShowToastEvent(errmsg + '_sys', "error") return; } }) } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexPreContractSubmit/lexPreContractSubmit.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexProductRepairQuoteRepair/__tests__/lexProductRepairQuoteRepair.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexProductRepairQuoteRepair from 'c/lexProductRepairQuoteRepair'; describe('c-lex-product-repair-quote-repair', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-product-repair-quote-repair', { is: LexProductRepairQuoteRepair }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.js
New file @@ -0,0 +1,67 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; import selectAssetID from '@salesforce/apex/otherButtonRepairController.selectAssetID'; export default class LexProductRepairQuoteRepair extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeId; AssetOwnerC; DeliveredProductC; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.RecordTypeId = result.RecordTypeId; this.ProductRepairQuoteRepair(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 修理报价预估 ProductRepairQuoteRepair() { selectAssetID({ recordId: this.Id }).then(result => { this.DeliveredProductC = result; window.open('/apex/ProductRepairQuote?productid=' + this.DeliveredProductC + '&flag=asset', '', 'height=250, width=500, top=300, left=350,location=no') }).catch(error => { console.log(error); }) } } force-app/main/default/lwc/lexProductRepairQuoteRepair/lexProductRepairQuoteRepair.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexQISAgree/lexQISAgree.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; }/* sample css file *//* sample css file */ force-app/main/default/lwc/lexQISAgree/lexQISAgree.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexQISAgree/lexQISAgree.js
New file @@ -0,0 +1,85 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForQisAgreeButton'; import updateQis from '@salesforce/apex/QISReportController.updateQisForQisAgree'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class lexQISAgree extends LightningElement { @api recordId; IsLoading = true; qisReportId; OwnerId; err; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.qisReportId = result.Id; this.OwnerId = result.ownerId; if (this.OwnerId != UserInfo_Owner.Id) { const evt = new ShowToastEvent({ title : '只有所有者可以按QIS结果跟进完毕的按钮', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); }else{ this.updateQisSubmit(); } }).catch(error => { console.log('error='+error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId }).then(result =>{ console.log('result'+result); this.err = result; if (result!='成功') { const evt = new ShowToastEvent({ title : '更新失败', message: this.err, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexQISAgree/lexQISAgree.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="lexQISAgree"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; } force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.js
New file @@ -0,0 +1,64 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForlexQISIntakeuniversalcodeButton'; import sqlForPAE from '@salesforce/apex/QISReportController.sqlForPAE1'; export default class lexQISIntakeuniversalcode extends LightningElement { @api recordId; IsLoading = true; qisReportId; paeId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.qisReportId = result.Id; var RecordTypeId = "ASRCDecision"; sqlForPAE({ qisReportId: this.qisReportId }).then(result => { if (result!=null) { this.paeId = result.PAEid; console.log('result='+this.paeId); } var url = ''; if (result!=null&&result.length>0){ url = "/apex/PAEDecisionRecord?Id="+this.paeId+"&QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId ; } else { url = "/apex/PAEDecisionRecord?QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId; } console.log('url='+url); window.location.replace(url); }); } }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexQISIntakeuniversalcode/lexQISIntakeuniversalcode.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="lexQISIntakeuniversalcode"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexQuarterlyReport/__tests__/lexQuarterlyReport.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexQuarterlyReport from 'c/lexQuarterlyReport'; describe('c-lex-quarterly-report', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-quarterly-report', { is: LexQuarterlyReport }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.js
New file @@ -0,0 +1,69 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; export default class LexQuarterlyReport extends LightningElement { @api recordId; str; IsLoading = true; Id; RecordTypeDeveloperNameC; EstimateTargetC; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.RecordTypeDeveloperNameC = result.RecordTypeDeveloperNameC; this.EstimateTargetC = result.EstimateTargetC; this.QuarterlyReport(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 制作季报 QuarterlyReport() { var MaintenanceContractId = this.Id; var RecordTypeName = this.RecordTypeDeveloperNameC; var EstimateTarget = this.EstimateTargetC; var url = ''; if (EstimateTarget == "经销商" && (RecordTypeName == "NewMaintenance_Contract" || RecordTypeName == "VM_Contract")) { url = "/apex/MoreMaintenanceContractPop?Id=" + MaintenanceContractId + "&RecordTypeName=" + RecordTypeName; } else { url = "http://powerbi.olympus.com.cn/Home/Login"; } window.open(url, '_bank'); } } force-app/main/default/lwc/lexQuarterlyReport/lexQuarterlyReport.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; } force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.js
New file @@ -0,0 +1,98 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForRCCDScompleteButton'; import updateQis from '@salesforce/apex/QISReportController.updateQisForRCCDScomplete'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class lexRCCDScomplete extends LightningElement { @api recordId; IsLoading = true; qisReportId; cdsdate; QIStatus; err; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.qisReportId = result.Id; this.cdsdate = result.cdsdate; this.QIStatus = result.qIStatus; if (this.QIStatus == 'RC检测申请') { const evt = new ShowToastEvent({ title : '需要先点击[OCM服务本部收到实物]', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.cdsdate != null) { const evt = new ShowToastEvent({ title : 'OCM服务本部CDS已经完毕', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } this.updateQisSubmit(); }).catch(error => { console.log('error='+error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId }).then(result =>{ console.log('result'+result); this.err = result; if (result!='成功') { const evt = new ShowToastEvent({ title : '更新失败', message: this.err, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexRCCDScomplete/lexRCCDScomplete.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="lexRCCDScomplete"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.css
New file @@ -0,0 +1,22 @@ .outerBorderCss{ border: 1px solid #D4D4D4; border-radius : 5px; border-top : 3px solid #565959; } .borderCss{ border: 1px solid #D4D4D4; border-radius : 5px; margin-bottom : 7px; border-top : 3px solid #565959; } .headerDorderCss{ border-top: 1px solid #565959; border-bottom: 1px solid #D4D4D4; padding:3px; } .centerCss{ text-align: center; } .centerCss .left{ margin-left: 100px; } force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.html
New file @@ -0,0 +1,5 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.js
New file @@ -0,0 +1,160 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForRCSubmitButton'; import updateQis from '@salesforce/apex/QISReportController.updateQisWithRC'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; export default class lexRCSubmit extends LightningElement { @api recordId; IsLoading = true; qisReportId; qisStatus; OSHstaff; OSHstaffEmail; CancelQISReason; Rcid; RCinspectionDate; QISReplyDay; RCproblemnotfound; type; err; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.qisReportId = result.Id; this.qisStatus = result.qIStatus; this.OSHstaff = result.oSHstaff; this.OSHstaffEmail = result.oSHstaffEmail; this.CancelQISReason = result.cancelQISReason; this.Rcid = result.rCid; this.RCinspectionDate = result.rCinspectionDate; this.QISReplyDay = result.qISReplyDay; this.RCproblemnotfound = result.rCproblemnotfound; if (this.qisStatus!='RC检测中') { const evt = new ShowToastEvent({ title : '已经提交审批', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.CancelQISReason!=null) { if (this.qisStatus == 'RC检测申请') { const evt = new ShowToastEvent({ title : '需要先点击[OCM服务本部收到实物]', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.Rcid ==null) { const evt = new ShowToastEvent({ title : '判定担当必须填写', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.RCinspectionDate == null) { const evt = new ShowToastEvent({ title : 'OCM服务本部还没有检测完毕', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.QISReplyDay!=null && this.RCproblemnotfound == 'true') { const evt = new ShowToastEvent({ title : '最终判定时,请取消[故障未发现留下继续观察]并选择[对应方法]', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { this.type = '1'; }else{ this.dispatchEvent(new CloseActionScreenEvent()); return; } }else{ if (confirm("一旦提交关闭此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { this.type = '2'; }else{ this.dispatchEvent(new CloseActionScreenEvent()); return; } } console.log('this.type='+this.type); // this.dispatchEvent(new CloseActionScreenEvent()); this.updateQisSubmit(); }).catch(error => { console.log('error='+error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId, type: this.type, oldQIStatus: this.qisStatus }).then(result =>{ console.log('result'+result); this.err = result; if (result!='成功') { const evt = new ShowToastEvent({ title : '更新失败', message: this.err, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/lexRCSubmit/lexRCSubmit.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="lexRCSubmit"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.css
New file @@ -0,0 +1,10 @@ .sisToOPDHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.html
New file @@ -0,0 +1,6 @@ <template> <div class="sisToOPDHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.js
New file @@ -0,0 +1,99 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:10:42 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import updateForSIStoOPDButton from '@salesforce/apex/ReportController.updateForSIStoOPDButton'; import init from '@salesforce/apex/ReportController.initForSIStoOPDButton'; import { updateRecord } from 'lightning/uiRecordApi'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexSIStoOPD extends LightningElement { @api recordId; IsLoading = true; ownerId; status; userId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.ownerId = result.ownerId; this.status = result.status; this.userId = result.userId; this.SIStoOPD(); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } SIStoOPD () { if(this.ownerId == this.userId && this.status == "草案中") { updateForSIStoOPDButton({ recordId: this.recordId }).then(result=>{ console.log(result); if(result){ this.showToast(result,"error"); }else{ this.showToast("成功","success"); this.updateRecordView(this.recordId); } this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } } // ifError(result){ // console.log(result); // if(result){ // this.showToast(result,"error"); // } // } } force-app/main/default/lwc/lexSIStoOPD/lexSIStoOPD.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexSendRepairsToEtQ/__tests__/lexSendRepairsToEtQ.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexSendRepairsToEtQ from 'c/lexSendRepairsToEtQ'; describe('c-lex-send-repairs-to-et-q', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-send-repairs-to-et-q', { is: LexSendRepairsToEtQ }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.js
New file @@ -0,0 +1,192 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; import selectRecords from '@salesforce/apex/otherButtonRepairController.selectRecords'; import sendToETQ from '@salesforce/apex/otherButtonRepairController.sendToETQ'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexSendRepairsToEtQ extends LightningElement { @api recordId; str; IsLoading = true; Id;; PAEDetermineC; ETQUPLOADSTATUSC; AEDetermineResultC; PAEDetermineACC; RepairInspectionDateC; ContainUseRSAC; userID; profileId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.PAEDetermineC = result.PAEDetermineC; this.ETQUPLOADSTATUSC = result.ETQUPLOADSTATUSC; this.AEDetermineResultC = result.AEDetermineResultC; this.PAEDetermineACC = result.PAEDetermineACC; this.RepairInspectionDateC = result.RepairInspectionDateC; this.ContainUseRSAC = result.ContainUseRSAC; this.userID = result.userID; this.profileId = result.profileId; this.myDate(); this.myReload(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 根据日期构建MessageGroupNumber myDate() { let messageNumber = ''; let today = new Date(); messageNumber = today.getFullYear() + '' + (today.getMonth() + 1) + '' + today.getDate() + '' + today.getHours() + '' + today.getMinutes() + '' + today.getSeconds(); return messageNumber; } // 按钮点击后触发,判断是否发送过ETQ,如果发送过给出提示并灰掉按钮 // 如果没有发送过调用发送方法 myReload() { selectRecords({ recordId: this.Id }).then(result => { console.log(result); if (result.AsyncData__c == 'true' && result.ETQ_UPLOAD_STATUS__c != '3' || result.Complaint_Number__c != null) { var btns = document.getElementsByName("sendrepairstoetq"); for (var i = 0; i < btns.length; i++) { btns[i].disabled = true; btns[i].className = 'btnDisabled'; } this.ShowToastEvent('该修理之前已经发送过了', "error"); // alert('该修理之前已经发送过了') } else { this.SendRepairsToEtQ(); } }).catch(error => { console.log(error); }).finally(() => { }); } // 发送ETQ SendRepairsToEtQ() { console.log(this.userID); console.log(this.profileId); var uid = this.userID; if (this.profileId != "00e10000000xnoO" && this.profileId != "00e10000000hl7w" && this.profileId != '00e10000000Y3o5') { this.ShowToastEvent("您没有发送修理到EtQ的权限。", "error"); // alert("您没有发送修理到EtQ的权限。"); return; } var statu = ''; if (this.PAEDetermineC == undefined) { this.ShowToastEvent("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。", "error"); // alert("OCSM QARA的PAE判定是空的时候,不可以发送到EtQ。"); return; } if (this.ETQUPLOADSTATUSC == "3") { if (!confirm("是否清空EtQ同步状态,重新同步数据?")) { return; } } if (this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE" && uid != "005100000068zJ6") { this.ShowToastEvent("Close Complait的时候,不可以发送到EtQ", "error"); // alert("Close Complait的时候,不可以发送到EtQ"); return; } if (this.PAEDetermineC != undefined && this.AEDetermineResultC != undefined && this.PAEDetermineACC == undefined) { statu = "R1"; } else if ((this.AEDetermineResultC != undefined && this.PAEDetermineC != undefined && this.PAEDetermineACC != undefined) && !(this.PAEDetermineC == "nonPAE" && this.AEDetermineResultC == "nonAE" && this.PAEDetermineACC == "nonPAE")) { statu = "R2"; if (this.RepairInspectionDateC == "") { this.ShowToastEvent("5.修理检测日是空的时候,不可以发送到EtQ。", "error"); // alert("5.修理检测日是空的时候,不可以发送到EtQ。"); return; } if (this.ContainUseRSAC == 1) { this.ShowToastEvent("Final universal code为空,或者包含UseRSA,请确认。", "error"); // alert("Final universal code为空,或者包含UseRSA,请确认。"); return; } } var result; try { var repairids = new Array() repairids[0] = this.Id; var statuArr = new Array(); statuArr.push(statu); sendToETQ({ iflog_Id: "", rowDataSFDC: "", repairIds: repairids, statu: statuArr[0] }).then(result => { this.ShowToastEvent(result, "error"); // alert(result); }).catch(error => { console.log(error); }) var btns = document.getElementsByName("sendrepairstoetq"); for (var i = 0; i < btns.length; i++) { btns[i].disabled = true; btns[i].className = 'btnDisabled'; } location.reload(); } catch (error) { this.ShowToastEvent("发送修理到EtQ失败" + error.faultstring + ' code:' + error.faultcode, "error"); // alert("发送修理到EtQ失败" + error.faultstring + ' code:' + error.faultcode); } } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexSendRepairsToEtQ/lexSendRepairsToEtQ.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.css
New file @@ -0,0 +1,10 @@ .submitHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.html
New file @@ -0,0 +1,6 @@ <template> <div class="submitHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.js
New file @@ -0,0 +1,70 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-04-07 09:02:03 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-11 09:11:11 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import otherButtonInSubmitCompetitorReport from '@salesforce/apex/ReportController.updateForSubmitCompetitorReportButton'; import { updateRecord } from 'lightning/uiRecordApi'; import init from '@salesforce/apex/ReportController.initForSubmitCompetitorReportButton'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexSubmitCompetitorReport extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } connectedCallback(){ init({ recordId: this.recordId }).then(result=>{ this.submit(); }); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } submit(){ otherButtonInSubmitCompetitorReport({ recordId: this.recordId }).then(result=>{ this.showToast("提交对手竞争报告成功","success") this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } } force-app/main/default/lwc/lexSubmitCompetitorReport/lexSubmitCompetitorReport.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.css
New file @@ -0,0 +1,10 @@ .exampleHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.html
New file @@ -0,0 +1,5 @@ <template> <div class="EquipmentRentalPDF" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js
New file @@ -0,0 +1,67 @@ import { LightningElement, track, wire, api } from 'lwc'; import { CurrentPageReference,NavigationMixin } from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/SubmitExtensionApprovalProcessController.init'; export default class lexSubmitExtensionApprovalProcess extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference){ if(currentPageReference) { const urlValue = currentPageReference.state.recordId; if(urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId:this.recordId }).then(result=>{ var today = new Date(); //追加备品申请状态确认,已经提交过的申请,不能重复提交Status__c if(result.ExtensionStatus == '填写完毕' || result.ExtensionStatus == '申请中') { alert('请确认延期申请状态,已经提交过的申请,不能重复提交'); return; } var rs1 = sforce.apex.execute("RentalApplyWebService", "extension_approval_processCheck", {rentalApplyId: this.recordId}); if(rs1 != '1'){ if(rs1 == '2'){ //返回值为2,判断入口为从单还是主单,如果是从单,那么就需要跳原来的单个延期页面 if(result.RootRentalApply == '' || result.RootRentalApply == null){ window.open("/apex/RentalApplyMultiPostpone?parentId=" + this.recordId); }else { window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); } }else{ alert(rs1); return } }else{ if(result.demoPurpose2 == '协议借用'){ alert('请在[附件]内上传新的合同附件,并依据合同内期限进行日期填写,之后提交审批'); return; } if(result.AgreementBorrowingExtensionDate =='' || result.AgreementBorrowingExtensionDate == null){ alert('协议借用的延期申请的【协议借用延期日期】不能为空'); return; } if(result.AgreementBorrowingExtensionDate <= result.ReturnDadelineFinal){ alert('协议借用的延期申请的【协议借用延期日期】必须大于最新预定归还日'); return; } if(result.AgreementBorrowingExtensionDate <= today ){ alert('协议借用的延期申请的【协议借用延期日期】必须大于今天'); return; } } window.open("/apex/RentalApplyExtensions?parentId=" + this.recordId); }) } } force-app/main/default/lwc/lexSubmitExtensionApprovalProcess/lexSubmitExtensionApprovalProcess.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexSubmitForApproval/__tests__/lexSubmitForApproval.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexSubmitForApproval from 'c/lexSubmitForApproval'; describe('c-lex-submit-for-approval', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-submit-for-approval', { is: LexSubmitForApproval }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.js
New file @@ -0,0 +1,71 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import selectRecords from '@salesforce/apex/otherButtonMaintenanceContractCtl.selectRecords'; export default class LexSubmitForApproval extends LightningElement { @api recordId; str; IsLoading = true; Id; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.SubmitForApproval(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 关闭询价/关闭续签 SubmitForApproval() { var url = ''; selectRecords({ recordId: this.Id }).then(result => { console.log(result); if (result.length > 0) { url = "/apex/SubmitForApprovalPage?id=" + result[0].Id; } else { url = "/apex/SubmitForApprovalPage?mcId=" + this.Id; } window.open(url, '', 'height=350, width=600, top=200, left=350,location=no'); }).catch(error => { console.log("error"); }).finally(() => { }); } } force-app/main/default/lwc/lexSubmitForApproval/lexSubmitForApproval.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="AntiLogicButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js
New file @@ -0,0 +1,52 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import ContraryLogicalDel from '@salesforce/apex/TenderWebService.ContraryLogicalDel'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexTenderingAntiLogicButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.AntiLogicButton(); this.dispatchEvent(new CloseActionScreenEvent()); }) } //招标项目反逻辑删除 AntiLogicButton(){ ContraryLogicalDel({DTenId : this.id}).then(result =>{ if(result == 'OK'){ this.showToast("反逻辑删除成功","success"); } this.dispatchEvent(new CloseActionScreenEvent()); }) } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingAntiLogicButton/lexTenderingAntiLogicButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="AttachmentButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js
New file @@ -0,0 +1,45 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexTenderingAttachmentButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.AttachmentButton(); this.dispatchEvent(new CloseActionScreenEvent()); }) } //招标项目查看附件 AttachmentButton(){ window.open(`/apex/TenderInformationUploadPdf?id=${this.id}`); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexTenderingAttachmentButton/lexTenderingAttachmentButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="EnquiryButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js
New file @@ -0,0 +1,62 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import updateOpportunityInformation from '@salesforce/apex/UpdateTenderInformationBatch.updateOpportunityInformation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexTenderingEnquiryButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id IsLoading = true; isRelateProject;//判断是否反应 @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { if (result != null) { this.IsLoading = false; this.id = result.Id; this.isRelateProject = result.isRelateProject; this.EnquiryButton(); this.dispatchEvent(new CloseActionScreenEvent()); } }) } //招标项目 反应询价状态 EnquiryButton(){ if(this.isRelateProject == "否"){ this.showToast('招投标项目不相关后不能反应询价状态!','error'); return; } var listss = []; listss.push(this.id); updateOpportunityInformation({TenderIdList : listss}).then(result=>{ if(result != 'OK'){ this.showToast(result,'error'); }else { this.showToast('反映完了','success'); } }) } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingEnquiryButton/lexTenderingEnquiryButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="HospitalButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js
New file @@ -0,0 +1,48 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; export default class lexTenderingHospitalButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id name;//招标项目名 Environment_Url;//新建医院地址 IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.name = result.name; this.Environment_Url = result.Environment_Url; this.HospitalButton(); this.dispatchEvent(new CloseActionScreenEvent()); }).catch(() => { }).finally(() => { }); } //招标项目新建医院 HospitalButton(){ var url = this.Environment_Url+'001/e?CF00N10000009I0o7='+encodeURIComponent(this.name) +'&CF00N10000009I0o7_lkid='+encodeURIComponent(this.id) +'&00N10000009HFQT='+encodeURIComponent('招标项目') +'&RecordType=01210000000QemG' +'&retURL='+ encodeURIComponent(this.id); window.location.href = url; } } force-app/main/default/lwc/lexTenderingHospitalButton/lexTenderingHospitalButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="IntentionButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js
New file @@ -0,0 +1,52 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexTenderingIntentionButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { if (result != null) { this.IsLoading = false; this.id = result.Id; this.IntentionButton(); this.dispatchEvent(new CloseActionScreenEvent()); } }) } //招标项目新建意向 IntentionButton(){ // alert('填写失单报告请直接点击招标页面【失单】按钮'); this.showToast('填写失单报告请直接点击招标页面【失单】按钮','success'); var url = '/apex/NewAndEditLead?' + '00N10000009HKS5=' + this.id + '&LeadSource=招标网' + '&RecordTypeId=01210000000QiRf' + '&retURL=%2F' + this.id ; window.open(url); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingIntentionButton/lexTenderingIntentionButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="LogicButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js
New file @@ -0,0 +1,39 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; export default class lexTenderingLogicButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { if (result != null) { this.IsLoading = false; this.id = result.Id; this.LogicButton(); this.dispatchEvent(new CloseActionScreenEvent()); } }) } //招标项目逻辑删除 LogicButton(){ window.open (`/apex/TenderDeletePagelwc?id=${this.id}`, '', 'height=350, width=600, top=200, left=350'); } } force-app/main/default/lwc/lexTenderingLogicButton/lexTenderingLogicButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="LostButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js
New file @@ -0,0 +1,71 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import sqlResult from '@salesforce/apex/TenderingButtonController.sqlResult'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexTenderingLostButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id status;//状态 profileId;//profileId id IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.status = result.status; this.profileId = result.profileId.slice(0,15); this.LoseButton(); this.dispatchEvent(new CloseActionScreenEvent()); }) } //招标项目失单 LoseButton(){ sqlResult({id: this.id}).then(result=>{ //简档权限 2S1_销售医院担当 2S4_销售管理者 系统管理员 if (this.profileId != '00e10000000xnp2' && this.profileId != '00e10000000xnpH' && this.profileId != '00e10000000Y3o5') { this.showToast("您没有权限,无法创建询价提交失单。","error"); return; } // 判断内部确认状态 if(this.status == '01.待确认'|| this.status == '02.不相关'){ this.showToast("状态为待确认或不相关,不可以做失单。","error"); return; } // 判断是否需要新建询价 if(this.status == '05.询价中'|| this.status == '06.成交' || this.status == '07.部分成交' || this.status == '08.失单' || result.length > 0){ if(confirm('此项目已关联询价,请确实是否新建询价提交失单。')) { }else{ return; } } window.open(`/apex/TenderLostPage?id=${this.id}`,'','height=500,width=800,top=200,left=250,location=no'); }) } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingLostButton/lexTenderingLostButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="NoStandardButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js
New file @@ -0,0 +1,49 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexTenderingNoStandardButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id opportunityNum; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.opportunityNum = result.opportunityNum; this.NoStandardButton(); this.dispatchEvent(new CloseActionScreenEvent()); }) } //招标项目不应标申请 NoStandardButton(){ if(Number(this.opportunityNum) > 0) { this.showToast('项目已关联过询价,请到询价里做不应标申请','error'); return; } window.open ('/apex/Bidding?id='+this.id, '', 'height=350, width=600, top=200, left=350,location=no'); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingNoStandardButton/lexTenderingNoStandardButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="NotarizeButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js
New file @@ -0,0 +1,72 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexTenderingNotarizeButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id status;//状态 profileId;//profileId id IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.status = result.status; this.profileId = result.profileId.slice(0,15); this.NotarizeButton(); this.dispatchEvent(new CloseActionScreenEvent()); }) } //招标项目 相关性确认 NotarizeButton(){ if( this.ProfileId!= '00e1m000000MSci' && this.ProfileId!= '00e10000000Y3o5' && this.ProfileId!= '00e10000000xnpR' && this.ProfileId!= '00e10000000xyK6' && this.ProfileId!= '00e10000000xnpW' && this.ProfileId!= '00e10000000xnpb' && this.ProfileId!= '00e10000000xyKB' && this.ProfileId!= '00e10000000a7NY' && this.ProfileId!= '00e10000000s2fZ' && this.ProfileId!= '00e10000000s3Jp' ){ this.showToast("只有助理才能进行相关性确认!","error"); return; } if(this.status== '01.待确认' || this.status== '02.不相关' || this.status == '03.不应标' || this.status== '04.待关联询价' ){ window.open (`/apex/Relevance?id=${this.id}`, '', 'height=500, width=800, top=200, left=250,location=no'); } else{ this.showToast("关联询价后不能进行相关性确认!","error"); } } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingNotarizeButton/lexTenderingNotarizeButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="RelevancyButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js
New file @@ -0,0 +1,60 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexTenderingRelevancyButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id ProfileId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.ProfileId = result.profileId.slice(0,15); this.RelevancyButton(); this.dispatchEvent(new CloseActionScreenEvent()); }) } //招标项目 关联已有询价 RelevancyButton(){ if( this.ProfileId != '00e1m000000MSci' && this.ProfileId != '00e10000000Y3o5' && this.ProfileId != '00e10000000xnp2' && this.ProfileId != '00e10000000xzQ0' && this.ProfileId != '00e10000000xnp7'&& this.ProfileId != '00e10000001220i' && this.ProfileId != '00e10000000xnpH' && this.ProfileId != '00e10000000xzQA' && this.ProfileId != '00e10000000hkas' && this.ProfileId != '00e10000000xnpR' && this.ProfileId != '00e10000000xyK6' && this.ProfileId != '00e10000000xnpW' && this.ProfileId != '00e10000000Nb7i' ){ this.showToast('只有担当和助理才能关联询价','error'); return; } window.open ('/apex/Enquiry?id='+this.recordId, '_blank'); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingRelevancyButton/lexTenderingRelevancyButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.html
New file @@ -0,0 +1,5 @@ <template> <div class="NotarizeButton" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js
New file @@ -0,0 +1,46 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/TenderingButtonController.initTenderingController'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class lexTenderingUsedAttachmentButton extends LightningElement { @api recordId;//当前这条数据的id id;//返回值的id Tender_information__c招标项目的id IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback(){ init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.id = result.Id; this.AttachmentButton(); this.dispatchEvent(new CloseActionScreenEvent()); }) } //招标项目 查看附件(旧) AttachmentButton(){ window.open(`/apex/QLMAttachmentPreview?parentId=${this.id}`); } showToast(msg,type) { const event = new ShowToastEvent({ message: msg, variant: type }); this.dispatchEvent(event); this.dispatchEvent(new CloseActionScreenEvent()); } } force-app/main/default/lwc/lexTenderingUsedAttachmentButton/lexTenderingUsedAttachmentButton.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexUploadToRecognitionModel/__tests__/lexUploadToRecognitionModel.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexUploadToRecognitionModel from 'c/lexUploadToRecognitionModel'; describe('c-lex-upload-to-recognition-model', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-upload-to-recognition-model', { is: LexUploadToRecognitionModel }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.js
New file @@ -0,0 +1,133 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import updateColunm from '@salesforce/apex/MaintenanceContractSetColunmWebService.updateColunm'; import up2sap from '@salesforce/apex/MaintenanceContractWebService.up2sap'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexUploadToRecognitionModel extends LightningElement { @api recordId; str; IsLoading = true; Id; ContractQuotationOrNotC; oldIsRecognitionModelC; MaintenanceContractNoC; uploadToRMTimeC; uploadToSapTimeC; PaymentPlanSumFirstC; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.ContractQuotationOrNotC = result.ContractQuotationOrNotC; this.oldIsRecognitionModelC = result.oldIsRecognitionModelC; this.MaintenanceContractNoC = result.MaintenanceContractNoC; this.uploadToSapTimeC = result.uploadToSapTimeC; this.uploadToRMTimeC = result.uploadToRMTimeC; this.PaymentPlanSumFirstC = result.PaymentPlanSumFirstC; this.uploadToRecognitionModel(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 上传认款合同 uploadToRecognitionModel() { if (this.ContractQuotationOrNotC == '还没做报价') { this.ShowToastEvent("您还没有做合同报价,不能上传认款合同。", "error") // alert("您还没有做合同报价,不能上传认款合同。"); } else if (this.MaintenanceContractNoC == undefined) { this.ShowToastEvent('合同号码为空,不能上传认款合同。', "error") // alert('合同号码为空,不能上传认款合同。'); } else if (this.uploadToSapTimeC != undefined) { this.ShowToastEvent('已经上传SAP,不能再次上传认款合同。', "error") // alert('已经上传SAP,不能再次上传认款合同。'); } else if (this.uploadToRMTimeC != undefined) { this.ShowToastEvent('已经上传认款合同,不能再次上传认款合同。', "error") // alert('已经上传认款合同,不能再次上传认款合同。'); } else { if (!this.oldIsRecognitionModelC) { this.ShowToastEvent('经销商为空或经销商不是先款对象,不需要上传认款合同。', "error") // alert('经销商为空或经销商不是先款对象,不需要上传认款合同。'); } else if (this.PaymentPlanSumFirstC == undefined) { this.ShowToastEvent('第一次计划付款金额不能为空。', "error") // alert('第一次计划付款金额不能为空。'); } else { if (!confirm('请确认是否要上传认款合同。')) { return; } updateColunm({ mcid: this.Id }).then(result => { console.log(result); if (result != '1') { this.ShowToastEvent('上传认款合同失败,因为 来年合同相关信息修改失败', "error") // alert('上传认款合同失败,因为 来年合同相关信息修改失败'); location.href = "/" + this.Id; } }).catch(error => { console.log(error); }) up2sap({ mcid: this.Id }).then(rtn => { console.log(rtn); if (rtn == '1') { this.ShowToastEvent("上传认款合同成功", "success") // alert("上传认款合同成功"); location.href = "/" + this.Id; } else { this.ShowToastEvent(rtn, "error") // alert(rtn); } }).catch(error => { console.log(error); }) } } } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexUploadToRecognitionModel/lexUploadToRecognitionModel.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexUploadToSap/__tests__/lexUploadToSap.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexUploadToSap from 'c/lexUploadToSap'; describe('c-lex-upload-to-sap', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-upload-to-sap', { is: LexUploadToSap }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.js
New file @@ -0,0 +1,155 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; import updateColunm from '@salesforce/apex/MaintenanceContractSetColunmWebService.updateColunm'; import updateFirstContract from '@salesforce/apex/updateFirstServiceContractWebService.updateFirstContract'; import Check_plan from '@salesforce/apex/MaintenanceContractWebService.Check_plan'; import up2sap from '@salesforce/apex/MaintenanceContractWebService.up2sap'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexUploadToSap extends LightningElement { @api recordId; str; IsLoading = true; MCApprovalStatusC; MaintenanceContractNoC; uploadToSapTimeC; oldIsRecognitionModelC; uploadToRMTimeC; IsRecognitionModelTrueC; Id; URFContractFC; urfFlag; rtn1; rtn; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.MCApprovalStatusC = result.MCApprovalStatusC; this.MaintenanceContractNoC = result.MaintenanceContractNoC; this.uploadToSapTimeC = result.uploadToSapTimeC; this.oldIsRecognitionModelC = result.oldIsRecognitionModelC; this.uploadToRMTimeC = result.uploadToRMTimeC; this.IsRecognitionModelTrueC = result.IsRecognitionModelTrueC; this.Id = result.Id; this.URFContractFC = result.URFContractFC; this.uploadToSap(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 上传SAP uploadToSap() { if (this.MCApprovalStatusC != 'Pass') { this.ShowToastEvent("合同复核批准后才可以上传SAP。", "error") // alert("合同复核批准后才可以上传SAP。"); } else if (this.MaintenanceContractNoC == undefined) { this.ShowToastEvent('维修合同管理编码为空,不能上传SAP。', "error") // alert('维修合同管理编码为空,不能上传SAP。'); } else if (this.uploadToSapTimeC != undefined) { this.ShowToastEvent('已经上传SAP,不能重复上传。', "error") // alert('已经上传SAP,不能重复上传。'); } else { if (this.oldIsRecognitionModelC) { if (this.uploadToRMTimeC == undefined) { this.ShowToastEvent('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能上传SAP。', "error") // alert('当前维修合同的经销商是先款对象,需要先【上传认款合同】,然后完成认款以后才能上传SAP。'); return; } else { if (!this.IsRecognitionModelTrueC) { this.ShowToastEvent('当前维修合同没有完成认款,不能上传SAP。', "error") // alert('当前维修合同没有完成认款,不能上传SAP。'); return; } } } updateColunm({ mcid: this.Id }).then(result => { if (result != '1') { this.ShowToastEvent('上传SAP失败,因为 来年合同相关信息修改失败', "error") // alert('上传SAP失败,因为 来年合同相关信息修改失败'); } }); updateFirstContract({ mcid: this.Id }).then(result => { if (result != '1') { this.ShowToastEvent(result, "error") // alert(result); } }); this.urfFlag = this.URFContractFC; this.rtn1 = '1'; this.rtn = '1'; if (this.urfFlag == 'false') { Check_plan({ mcidList: this.Id }).then(result => { this.rtn1 = result; }); } if (this.rtn1 == '1') { up2sap({ mcid: this.Id }).then(result => { this.rtn = result; }); if (this.rtn == '1') { this.ShowToastEvent("上传SAP成功", "success") // alert("上传SAP成功"); window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Maintenance_Contract__c/" + this.recordId + "/view"); } else { this.ShowToastEvent(this.rtn, "error") // alert(this.rtn); } } else { this.ShowToastEvent(this.rtn1, "error") // alert(this.rtn1); } } } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexUploadToSap/lexUploadToSap.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.css
New file @@ -0,0 +1,10 @@ .answerHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.html
New file @@ -0,0 +1,7 @@ <template> <div class="answerHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.js
New file @@ -0,0 +1,92 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-03-27 14:05:59 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-10 17:56:04 */ import { LightningElement, wire, track, api } from "lwc"; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from "lightning/actions"; import { NavigationMixin } from "lightning/navigation"; import init from "@salesforce/apex/ReportController.initForVOCAnswerButton"; import updateForVOCAnswerButton from "@salesforce/apex/ReportController.updateForVOCAnswerButton"; import { updateRecord } from "lightning/uiRecordApi"; import { ShowToastEvent } from "lightning/platformShowToastEvent"; export default class LexVOCAnswer extends LightningElement { @api recordId; status; Isloading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.status = result.status; this.update(); } }) .catch((error) => { console.log("error"); console.log(error); }) .finally(() => {}); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); } showToast(msg, type) { const event = new ShowToastEvent({ title: "", message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({ fields: { Id: recordId } }); } update() { if (this.status != "已分配") { this.showToast("不是已分配不能点击", "error"); return; } updateForVOCAnswerButton({ recordId: this.recordId }).then(result => { if (result == null) { this.showToast("成功", "success"); } else { console.log(result); this.showToast(result,"error"); } this.updateRecordView(this.recordId); this.Isloading = false; this.dispatchEvent(new CloseActionScreenEvent()); }).catch(error=>{ console.log(error); }); } } force-app/main/default/lwc/lexVOCAnswer/lexVOCAnswer.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.css
New file @@ -0,0 +1,10 @@ .checkHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.html
New file @@ -0,0 +1,6 @@ <template> <div class="checkHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.js
New file @@ -0,0 +1,110 @@ import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForVOCCheckButton'; import VOCCheck from '@salesforce/apex/ReportController.updateForVOCCheckButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexVOCCheck extends LightningElement { @api recordId; status; isVOC; personId; profileId; Isloading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.status = result.status; this.isVOC = result.isVOC; this.personId = result.personId; this.profileId = result.profileId; console.log(this.status); this.check(); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } showToast(msg, type) { const event = new ShowToastEvent({ title: "", message: msg, variant: type }); this.dispatchEvent(event); } check (){ // 陆胜,胡迪安,系统管理员可点(需要调整) if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") { this.showToast("你没有判定VOC的权限","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.status != "跟进中") { this.showToast("不是跟进中不能点击","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.isVOC == undefined) { this.showToast("必须选择是否VOC","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } VOCCheck( { recordId:this.recordId, isVOC:this.isVOC, personId:this.personId } ).then(result =>{ if(result == null){ this.showToast("成功","success"); this.updateRecordView(this.recordId); }else { this.showToast(result,"error"); } this.Isloading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); //location.reload(); } } force-app/main/default/lwc/lexVOCCheck/lexVOCCheck.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.css
New file @@ -0,0 +1,10 @@ .confirmHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.html
New file @@ -0,0 +1,6 @@ <template> <div class="confirmHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.js
New file @@ -0,0 +1,104 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-03-27 14:08:56 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-10 17:49:00 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import init from '@salesforce/apex/ReportController.initForVOCConfirmButton'; import updateForVOCConfirmButton from '@salesforce/apex/ReportController.updateForVOCConfirmButton'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexVOCConfirm extends LightningElement { @api recordId; status; VOCSatisfy; VOCSatisfy1; Isloading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.status = result.status; this.VOCSatisfy = result.Satisfy; this.VOCSatisfy1 = result.Satisfy1; console.log(this.VOCSatisfy); console.log(this.VOCSatisfy1); console.log(this.status); this.update(); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); this.updateRecordView(this.recordId); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } update(){ if (this.status != "已回答") { this.showToast("不是已回答不能点击","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.VOCSatisfy == undefined) { this.showToast("请选择是否满意","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } updateForVOCConfirmButton({ recordId: this.recordId, Satisfy: this.VOCSatisfy, Satisfy1: this.VOCSatisfy1 }).then(result=>{ this.updateRecordView(this.recordId); this.showToast("成功","success"); this.Isloading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } } force-app/main/default/lwc/lexVOCConfirm/lexVOCConfirm.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.css
New file @@ -0,0 +1,10 @@ .vocFinishHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.html
New file @@ -0,0 +1,6 @@ <template> <div class="vocFinishHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.js
New file @@ -0,0 +1,94 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-03-27 14:11:17 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-10 17:52:00 */ import { api, wire,LightningElement } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForVOCFinishButton'; import update from '@salesforce/apex/ReportController.updateForVOCFinishButton'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexVOCFinish extends LightningElement { @api recordId; status; IsLoading = true; profileId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.status = result.status; this.profileId = result.profileId; this.VOCFinish(); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); //this.updateRecordView(this.recordId); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } VOCFinish () { if (UserInfo_Owner.Id != "00510000000gWAE" && UserInfo_Owner.Id != "00510000004reg2" && this.profileId != "00e10000000Y3o5AAC") { this.showToast("你没有完毕VOC的权限","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } if (this.status != "结果确认完毕") { this.showToast("不是结果确认完毕不能点击","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } update({ recordId: this.recordId }).then(result =>{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } } force-app/main/default/lwc/lexVOCFinish/lexVOCFinish.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.css
New file @@ -0,0 +1,10 @@ .vocSubmitHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.html
New file @@ -0,0 +1,6 @@ <template> <div class="vocSubmitHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.js
New file @@ -0,0 +1,89 @@ /* * @Description: * @version: * @Author: chen jing wu * @Date: 2023-03-27 13:39:23 * @LastEditors: chen jing wu * @LastEditTime: 2023-04-10 17:57:16 */ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/ReportController.initForVOCSubmitButton'; import VOCSubmit from '@salesforce/apex/ReportController.updateForVOCSubmitButton'; import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner'; import { updateRecord } from 'lightning/uiRecordApi'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexVOCSubmit extends LightningElement { @api recordId; createdById; status; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; 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.status = result.status; this.createdById = result.createdById; this.Submit(); //window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/Report__c/" + this.recordId + "/view"); } }).catch(error => { console.log("error"); console.log(error); }).finally(() => { }); //this.updateRecordView(this.recordId); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } showToast(msg,type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } Submit () { if (this.status != "草案中") { this.showToast("不是草案中不能点击","error"); this.dispatchEvent(new CloseActionScreenEvent()); return; } VOCSubmit({ recordId: this.recordId, createdById: this.createdById }).then(result =>{ this.showToast("成功","success"); this.updateRecordView(this.recordId); this.IsLoading = false; this.dispatchEvent(new CloseActionScreenEvent()); }); } } force-app/main/default/lwc/lexVOCSubmit/lexVOCSubmit.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/lexYanshoudanRequest/__tests__/lexYanshoudanRequest.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexYanshoudanRequest from 'c/lexYanshoudanRequest'; describe('c-lex-yanshoudan-request', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-yanshoudan-request', { is: LexYanshoudanRequest }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.js
New file @@ -0,0 +1,79 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonRepairController.init'; import updateYanshoudan from '@salesforce/apex/otherButtonRepairController.updateYanshoudan'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexYanshoudanRequest extends LightningElement { @api recordId; str; IsLoading = true; Id; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { console.log(this.recordId); init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.YanshoudanRequest(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }).finally(() => { }); } // 验收单回收申请 YanshoudanRequest() { updateYanshoudan({ recordId: this.Id }).then(result => { console.log(result); if (result.length > 0) { var indexs = result.indexOf(": ") var resolves = result.substring(indexs + 1, result.length); alert(resolves); } location.reload(); }) } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexYanshoudanRequest/lexYanshoudanRequest.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"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/oshRecieved/oshRecieved.css
New file @@ -0,0 +1,10 @@ .VOCSubmitHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; }/* sample css file */ force-app/main/default/lwc/oshRecieved/oshRecieved.html
New file @@ -0,0 +1,5 @@ <template> <div class="VOCSubmitHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/oshRecieved/oshRecieved.js
New file @@ -0,0 +1,83 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import { updateRecord } from 'lightning/uiRecordApi'; import init from '@salesforce/apex/QISReportController.initForOSHRecievedButton'; import updateQis from '@salesforce/apex/QISReportController.updateQis'; export default class oshRecieved extends LightningElement { @api recordId; IsLoading = true; qisReportId; qisStatus; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { this.IsLoading = false; this.qisReportId = result.Id; this.qisStatus = result.qIStatus; console.log('this.qisStatus='+this.qisStatus); if (this.qisStatus!='OSH检测申请' && this.qisStatus!='完毕') { const evt = new ShowToastEvent({ title : 'OSH已经收到实物', message: '', variant: 'error' }); this.dispatchEvent(evt); this.dispatchEvent(new CloseActionScreenEvent()); return; }else{ this.updateQisSubmit(); } }).catch(error => { console.log('error='+error); }).finally(() => { }); } updateRecordView(recordId) { updateRecord({fields: { Id: recordId }}); } updateQisSubmit(){ updateQis({ recordId: this.recordId }).then(result =>{ console.log('result'+result); if (result!='成功') { const evt = new ShowToastEvent({ title : '更新失败', message: result, variant: 'error' }); this.dispatchEvent(evt); } this.dispatchEvent(new CloseActionScreenEvent()); this.updateRecordView(this.recordId); }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/oshRecieved/oshRecieved.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="oshRecieved"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.css
New file @@ -0,0 +1,10 @@ .exampleHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; }/* sample css file */ force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.js
New file @@ -0,0 +1,63 @@ import { LightningElement,wire,track,api} from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import { NavigationMixin } from 'lightning/navigation'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; import init from '@salesforce/apex/QISReportController.initForQisUniversalFailureCodeButton'; import sqlForPAE from '@salesforce/apex/QISReportController.sqlForPAE'; export default class qisUniversalFailureCode extends LightningElement { @api recordId; IsLoading = true; qisReportId; paeId; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(111); console.log(currentPageReference); if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback () { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.qisReportId = result.Id; var RecordTypeId = "ASACDecision"; sqlForPAE({ qisReportId: this.qisReportId }).then(result => { if (result!=null) { this.paeId = result.PAEid; console.log('result='+this.paeId); } var url = ''; if (result!=null&&result.length>0){ url = "/apex/PAEDecisionRecord?Id="+this.paeId+"&QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId ; } else { url = "/apex/PAEDecisionRecord?QISReportId="+this.qisReportId +"&RecordTypeIds="+RecordTypeId; } console.log('url='+url); // window.open(url,'_self'); window.location.replace(url); }); } }).catch(error => { console.log('error='+error); }).finally(() => { }); } } force-app/main/default/lwc/qisUniversalFailureCode/qisUniversalFailureCode.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="qisUniversalFailureCode"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.css
New file @@ -0,0 +1,10 @@ .exampleHolder{ position: relative; display: inline-block; width: 80px; height: 80px; text-align: center; } .container .uiContainerManager{ display: none !important; } force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.html
New file @@ -0,0 +1,5 @@ <template> <div class="EquipmentRentalPDF" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js
New file @@ -0,0 +1,44 @@ import { LightningElement, track, wire, api } from 'lwc'; import {CurrentPageReference,NavigationMixin} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/rentalApplyEquipmentRentalPDFController.initJumptoPDFButton'; export default class rentalApplyEquipmentRentalPDF extends LightningElement { @api recordId; IsLoading = true; @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log(currentPageReference); if(currentPageReference) { const urlValue = currentPageReference.state.recordId; if(urlValue) { let str = `${urlValue}`; console.log("str"); console.log(str); this.recordId = str; } } } connectedCallback() { console.log('this.recordId' + this.recordId); init({ recordId : this.recordId }).then(result => { if(result != null) { this.IsLoading = false; let num = result.pageLength; console.log("======"+this.recordId + ' ' +num); console.log("https://ocsm--partial.sandbox.lightning.force.com/lightning/r/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num) window.location.replace("https://ocsm--partial.sandbox.lightning.force.com/apex/FixtureRentalPDF?raid=" + this.recordId + "&page=" + num); } }) .catch( error =>{ console.log(error); }) } } force-app/main/default/lwc/rentalApplyEquipmentRentalPDF/rentalApplyEquipmentRentalPDF.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__RecordPage</target> <target>lightning__AppPage</target> <target>lightning__HomePage</target> <target>lightning__RecordAction</target> </targets> </LightningComponentBundle> force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.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/rentalApplyLWT/rentalApplyLWT.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/rentalApplyLWT/rentalApplyLWT.js
New file @@ -0,0 +1,659 @@ import { LightningElement,api, track, wire } from 'lwc'; import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId'; import getProfileId from '@salesforce/apex/RentalApplyControllerLWT.getProfileId'; import init from '@salesforce/apex/RentalApplyControllerLWT.initFromCancelSubmitButton'; import selectRentalApplyEquipmentSetDetailByRacId from '@salesforce/apex/RentalApplyControllerLWT.selectRentalApplyEquipmentSetDetailByRacId'; import selectQISReportById from '@salesforce/apex/RentalApplyControllerLWT.selectQISReportById'; import selectRepairById from '@salesforce/apex/RentalApplyControllerLWT.selectRepairById'; import selectCampaignById from '@salesforce/apex/RentalApplyControllerLWT.selectCampaignById'; import selectRentalApplyEquipmentSetByRacId from '@salesforce/apex/RentalApplyControllerLWT.selectRentalApplyEquipmentSetByRacId'; import selectRentalApplyById from '@salesforce/apex/RentalApplyControllerLWT.selectRentalApplyById'; import selectUserById from '@salesforce/apex/RentalApplyControllerLWT.selectUserById'; import selectQISreportById2 from '@salesforce/apex/RentalApplyControllerLWT.selectQISreportById2'; import setSObjectShare from '@salesforce/apex/RentalApplyControllerLWT.setSObjectShare'; import updateRentalApplyC from '@salesforce/apex/RentalApplyControllerLWT.updateRentalApplyC'; import {CurrentPageReference} from 'lightning/navigation'; import { CloseActionScreenEvent } from 'lightning/actions'; import STATUS_PROCESS_STATE from '@salesforce/label/c.StatusProcessState'; export default class rentalApplyLWT extends LightningElement { contactFirstName = 'Yan'; contactLastName = 'Khang'; opportunityName = 'Possible deal'; clickedButtonLabel; @api recordId; @track StatusProcessState=STATUS_PROCESS_STATE; Rental_Apply__c; Status__c; Id; Yi_loaner_arranged__c; RA_Status__c; IsLoading=true; demo_purpose2__c; Follow_UP_Opp__c; Statu_Achievements__c; Statu_Achievements_ID__c; Request_shipping_day__c; Demo_purpose1__c; Repair__c; RecordTypeId; SupplementCreated__c; OPDPlan__c; Campaign__c; QIS_number__c; RepairId__c; @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; } } } async connectedCallback(){ console.log(this.recordId); await init({recordId:this.recordId}).then(result=>{ console.log(result); if(result!=null){ this.Rental_Apply__c=result; this.Status__c=result.Status__c; this.Yi_loaner_arranged__c=result.Yi_loaner_arranged__c; this.Id=result.Id; this.RA_Status__c=result.RA_Status__c; // this.Rental_Apply__c.demo_purpose2__c=result.DemoPurpose2C; // this..Follow_UP_Opp__c=result.FollowUPOppC; // this.Rental_Apply__c.Statu_Achievements__c=result.StatuAchievementsC; // this.Rental_Apply__c.Statu_Achievements_ID__c=result.StatuAchievementsIDC; // this.Rental_Apply__c.Request_shipping_day__c=result.RequestShippingDayC; // this.Rental_Apply__c.Demo_purpose1__c=result.DemoPurpose1C; // this.Rental_Apply__c.Repair__c=result.RepairC; // this.Rental_Apply__c.RecordTypeId=result.RecordTypeId; // this.Rental_Apply__c.SupplementCreated__c=result.SupplementCreatedC; // this.Rental_Apply__c.OPDPlan__c=result.OPDPlanC; // this.Rental_Apply__c.Campaign__c=result.CampaignC; // this.Rental_Apply__c.QIS_number__c=result.QISNumberC; this.sumit().then(res=>{ console.log("关闭窗口"); this.IsLoading=false; this.dispatchEvent(new CloseActionScreenEvent()); }).catch(err=>{ console.log("error:"); console.log(err.message); alert("操作失败,错误信息:"+err.message); }); console.log("end"); } }).catch(err=>{ console.log("error:"); console.log(err.message); console.log("报错结束"); }).finally(()=>{ console.log("finally"); }); } handleClick(event) { this.clickedButtonLabel = event.target.label; } handleContactFirstNameInputChange(event) { this.contactFirstName = event.target.value; } cancelSubmit(){ console.log('djwaijd'); if (this.Rental_Apply__c.Status__c == "取消") { alert("已经取消!"); console.log('1'); return; } if (this.Rental_Apply__c.Status__c == "删除") { alert("已经删除!"); console.log('2'); return; } if(this.RA_Status__c == "已出库" || this.Yi_loaner_arranged__c > 0) { alert("备品已经出库,不能取消!"); console.log('2'); return; } let raid = this.Id; window.open("/apex/RentalApplyCancel?objId="+raid, 'RentalApplyCancel', 'width=500,height=250'); } async sumit(){ let buttons = document.getElementsByName('submit_approval_process'.toLowerCase()); for (let i=0; i<buttons.length; i++) { buttons[i].className = "btnDisabled"; buttons[i].disabled = true; } //kk if (!confirm("一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?")) { return; } //1540 you 试用(无询价)目的的备品申请单,不能关联询价信息! if(this.Rental_Apply__c.demo_purpose2__c == '试用(无询价)' && this.Rental_Apply__c.Follow_UP_Opp__c !=null && this.Rental_Apply__c.Follow_UP_Opp__c != ''){ alert('试用(无询价)目的的备品申请单,不能关联询价信息!'); return; } // 已购待货的申请单审批时,需要check注残的状态 if (this.Rental_Apply__c.Statu_Achievements__c!=null&&this.Rental_Apply__c.Statu_Achievements__c!='') { let SaID=this.Rental_Apply__c.Statu_Achievements_ID__c; let rtn = sforce.apex.execute("RentalApplyWebService","RentalApplyCheckForSAoneEle",{SaID:SaID}); if(rtn!='Fin'){ alert(rtn); return; } } // 希望到货日不能早于申请提交日-0418追加 let d=new Date(); if (this.Rental_Apply__c.Request_shipping_day__c < d ) { alert('希望到货日不能早于申请提交日'); return; } let raesdList = new Array(); await selectRentalApplyEquipmentSetDetailByRacId({recordId:this.recordId}).then(result=>{ console.log(result); if(result!=null){ raesdList=result; let modelSet = new Set(); let stoppedSet = new Set(); for(let i=0;i<raesdList.length;i++){ modelSet.add(raesdList[i].Fixture_Model_No_F__c); if('false' == raesdList[i].Product_Status_Flag_F__c && (this.Rental_Apply__c.demo_purpose2__c == '试用(有询价)' || this.Rental_Apply__c.demo_purpose2__c == '试用(无询价)')){ stoppedSet.add(raesdList[i].Fixture_Model_No_F__c); } } if(stoppedSet.size> 0) { alert( Array.from(stoppedSet).join(',') + ' 产品注册证状态为停止,不可申请'); return; } } }).catch(err=>{ console.log("selectRentalApplyEquipmentSetDetailByRacId error:"); console.log(err.message); console.log("报错结束"); }).finally(()=>{ }); if(this.Rental_Apply__c.demo_purpose2__c == '索赔QIS'){ let DeliveryGood = new Array(); await selectQISReportById({recordId:this.Rental_Apply__c.QIS_number__c}).then(result=>{ console.log(result); DeliveryGood=result; }).catch(err=>{ console.log("selectQISReportById error:"); console.log(err.message); }).finally(()=>{ }); console.log(DeliveryGood); let records= DeliveryGood; if(records.length == 0 || !modelSet.has(records[0].nonyushohin__r.Product2.Fixture_Model_No_T__c)){ alert('申请的型号必须与QIS申请型号一致'); return; } } if(this.Rental_Apply__c.Repair__c==null){ console.log("Repair__c为空") }else{ if( this.Rental_Apply__c.Repair__c != ''){ console.log("hhh7.1.1"); let DeliveryGood ; let records; await selectRepairById({recordId:this.Rental_Apply__c.Repair__c}).then(result=>{ console.log(result); DeliveryGood=result; records=result; }).catch(err=>{ console.log("selectRepairById error:"); console.log(err.message); }).finally(()=>{ }); if(records==null||records.length==0){ console.log("records为空"); }else{ if(this.Rental_Apply__c.Demo_purpose1__c == '维修代用' && this.Rental_Apply__c.demo_purpose2__c != '索赔QIS') { if(!modelSet.has(records[0].Delivered_Product__r.Product2.Fixture_Model_No_T__c)){ alert('申请的型号必须与送修的型号一致'); return; } } if(this.Rental_Apply__c.Demo_purpose1__c==null){ console.log("Demo_purpose1__c为空"); }else if(this.Rental_Apply__c.Demo_purpose1__c == '维修代用' && this.Rental_Apply__c.demo_purpose2__c == '一般用户' ){ if (records[0].Repair_Estimated_date_formula__c == null) { alert('一般维修无报价日,不可借用备品'); return; } else if (records[0].Repair_Estimated_date_formula__c < '2019-07-01' && records[0].Agreed_Date__c == null) { alert('报价日在2019/7/1之前且户同意日为空,不可借用备品'); return; } //20210608 ljh SFDC-C3CCN4 start if(records[0].Repair_Rank__c == '' || records[0].Repair_Rank__c == null){ alert('报价等级为空不能申请备品'); return; }else{ if(records[0].DW_Sign_Txt__c == 'false' && records[0].Repair_Rank__c == 'DW'){ alert('DW报价等级下此型号不符合备品申请借用条件'); return; } if(records[0].Repair_Rank__c == 'D1' ||records[0].Repair_Rank__c == 'D2' ||records[0].Repair_Rank__c == 'D3' ||records[0].Repair_Rank__c == 'E2'){ alert('报价等级不符合备品申请借用条件'); return; } } //20210608 ljh SFDC-C3CCN4 end } if(this.Rental_Apply__c.Demo_purpose1__c ==null){ console.log("Demo_purpose1__c为空"); }else if(this.Rental_Apply__c.Demo_purpose1__c == '维修代用' && this.Rental_Apply__c.demo_purpose2__c == '市场多年保修' ){ if (records[0].FSE_ApplyForRepair_Day__c == null) { alert('市场多年保修,没有[FSE修理申请日],不可借用备品'); return; } } if(this.Rental_Apply__c.Demo_purpose1__c == '维修代用' && this.Rental_Apply__c.demo_purpose2__c == '故障排查' ){ if (records[0].FSE_ApplyForRepair_Day__c == null) { alert('故障排查,没有[FSE修理申请日],不可借用备品'); return; } if(records[0].Repair_Ordered_Date__c != null) { alert('故障排查,[4.修理品RC受理日]必须为空'); return; } if(records[0].IfCheckFixture__c == 'false'){ alert('不满足故障排查目的'); return; } } let profileId=""; await getProfileId().then(result=>{ console.log(result); profileId=result; }).catch(err=>{ console.log("getProfileId error:"); console.log(err.message); }).finally(()=>{ }); if(this.Rental_Apply__c.RecordTypeId==null){ console.log("RecordTypeId为空"); }else if (this.Rental_Apply__c.RecordTypeId != "01210000000RHIn" && profileId != '00e10000000Y3o5' && records[0].NewProductGuaranteeObject__c == '8: 市场多年保修' && this.Rental_Apply__c.demo_purpose2__c != '市场多年保修') { alert('无偿区别标志为8: 市场多年保修,必须选择市场多年保修。'); } if(records[0].Repair_Final_Inspection_Date__c != null){ alert('存在修理最终检测日,不可借用备品'); return; } if(records[0].Repair_Shipped_Date__c != null){ alert('存在RC修理返送日,不可借用备品'); return; } if(records[0].Status1__c =='0.删除' ||records[0].Status1__c =='0.取消' ||records[0].Status1__c =='5.完毕' ){ alert('修理已经结束,不能申请备品'); return; } if ( this.Rental_Apply__c.demo_purpose2__c == '再修理' && records[0].ReRepairObject_F__c == 'false') { alert('不属于再受理参考对象,不可借用备品'); return; } if (this.Rental_Apply__c.RecordTypeId != '01210000000RHIn' && this.Rental_Apply__c.demo_purpose2__c != '保修用户' && this.Rental_Apply__c.demo_purpose2__c != '市场多年保修' && records[0].Number_of_EffectiveContract__c == '有' ) { alert('有维修合同,必须选择保修用户.'); return; } let AssetModelNo = records[0].Delivered_Product__r.Product2.Asset_Model_No__c; if (this.Rental_Apply__c.RecordTypeId != '01210000000RHIn' && records[0].Number_of_EffectiveContract__c == '无' && (records[0].NewProductGuaranteeObject__c == '2: 服务多年保修' && (AssetModelNo == 'LTF-190-10-3D' || AssetModelNo == 'LTF-S190-5' || AssetModelNo == 'CYF-VHA' || AssetModelNo == 'CYF-VA2' || AssetModelNo == 'CYF-5A'|| AssetModelNo == 'LTF-S190-10'|| AssetModelNo == 'OER-AW'|| AssetModelNo == 'URF-V'|| AssetModelNo == 'URF-V2'|| AssetModelNo == 'URF-P6')) && this.Rental_Apply__c.demo_purpose2__c != '保修用户' ) { alert('此设备型号多年保修,请选择保修用户.'); return; } if (this.Rental_Apply__c.RecordTypeId != '01210000000RHIn' && records[0].NewProductGuaranteeObject__c == '2: 服务多年保修' && (AssetModelNo == 'CV-V1' || AssetModelNo == 'CV-V1(A)' || AssetModelNo == 'CV-V1(B)' || AssetModelNo == 'GIF-LV1' || AssetModelNo == 'CF-LV1L' || AssetModelNo == 'CF-LV1I' || AssetModelNo == 'MAJ-1910') && (this.Rental_Apply__c.demo_purpose2__c == '一般用户' || this.Rental_Apply__c.demo_purpose2__c == '再修理') ) { alert('奥辉设备,保修期内不提供备品.'); return; } } } } if(this.Rental_Apply__c.SupplementCreated__c==null){ console.log("SupplementCreated__c为空"); }else if (this.Rental_Apply__c.SupplementCreated__c == '1' && this.Rental_Apply__c.OPDPlan__c != '') { let raId = this.Id; //kk let raesCountCheck = sforce.apex.execute("OpdPlanWebService", "raesCountCheck", {rentalApplyId: raId}); if(raesCountCheck != 'OK'){ alert(raesCountCheck); return; } } console.log("hhh10"); if(this.Rental_Apply__c.Campaign__c==null){ console.log("Campaign__c为空"); }else if( this.Rental_Apply__c.Campaign__c != ''){ let DeliveryGood = new Array(); // 20220324 ljh obpm update start //kk1 let statusSting = this.StatusProcessState; let statusList = statusSting.split(','); // DeliveryGood = sforce.connection.query("select Status, Rental_Apply_Flag__c from Campaign where id ='{!Rental_Apply__c.Campaign__c}'"); // DeliveryGood = await selectCampaignById(this.Rental_Apply__c.Campaign__c); await selectCampaignById({recordId:this.Rental_Apply__c.Campaign__c}).then(result=>{ console.log(result); DeliveryGood=result; }).catch(err=>{ console.log("selectCampaignById error:"); console.log(err.message); }).finally(()=>{ }); // 20220324 ljh obpm update start //kk let records= DeliveryGood; let interval = records[0].Status; let records_Date = records[0].Rental_Apply_Flag__c; if (interval==null ) { alert("请确认学会状态"); return; } else if (interval == '草案中') { alert('学会状态为草案中,不能提交'); return; } else if (interval == '申请中') { alert('学会状态为申请中,不能提交'); return; } else if (interval == '已结束') { alert('学会状态为已结束,不能提交'); return; } else if (interval == '已提交报告') { alert('学会状态为已提交报告,不能提交'); return; } else if (interval == '取消申请中') { alert('学会状态为取消申请中,不能提交'); return; } else if (interval == '取消') { alert('学会状态为取消,不能提交'); return; } //kk if(this.Rental_Apply__c.Request_shipping_day__c==null){ alert("请确认希望到货日期"); return; }else{ if (d >= this.Rental_Apply__c.Request_shipping_day__c -7) { alert("必须提前于希望到货日7天以上提交申请"); return; } // 20220324 ljh obpm add start if (records != null && records[0].IF_Approved__c == "true" && (records[0].Meeting_Approved_No__c == null || records[0].Meeting_Approved_No__c == "") ) { alert("没有决裁号的,暂不能出借,请更新裁决信息。"); return; } if (records != null && records[0].IF_Approved__c == "true" && records[0].Meeting_Approved_No__c != "" && statusList.indexOf(records[0].Approved_Status__c) != -1 && records[0].Approved_Status__c != '草稿' ) { alert("已申请决裁但决裁状态不符合条件。"); return; } } // 20220324 ljh obpm add end } if (this.Rental_Apply__c.QIS_number__c == null) { console.log("QIS_number__c 是空的"); }else{ if( this.Rental_Apply__c.QIS_number__c != ''){ let DeliveryGood = new Array(); // DeliveryGood =await selectQISreportById2(this.Rental_Apply__c.QIS_ID_Line__c); await selectQISreportById2({recordId:this.Rental_Apply__c.QIS_ID_Line__c}).then(result=>{ console.log(result); DeliveryGood=result; }).catch(err=>{ console.log("selectQISreportById2 error:"); console.log(err.message); }).finally(()=>{ }); let records= DeliveryGood; let interval = records[0].next_action__c; if (interval == '送回') { alert("QIS 已送回,不能再申请备品了"); return; } } } // share let userAccess = new Array(); //kk let t=this.Rental_Apply__c.applyUser__c+'_Edit'; userAccess.push(t); let rtn ; await setSObjectShare({sobjectName:'Rental_Apply__Share',rowCause:'ApplyUserShare__c',parentId:this.Rental_Apply__c.Id,userAccess:userAccess,ownerId:this.Rental_Apply__c.OwnerId}).then(result=>{ console.log(result); rtn=result; }).catch(err=>{ console.log("setSObjectShare error:"); console.log(err.message); }).finally(()=>{ }); if(rtn==null){ alert("rtn为空"); return; }else{ if (rtn != 'OK') { alert(rtn); return; } } if(this.Rental_Apply__c.Status__c == null){ alert('请备品申请状态确认,不能为空'); return; }else{ if (this.Rental_Apply__c.Status__c == '填写完毕' || this.Rental_Apply__c.Status__c == '申请中' || this.Rental_Apply__c.Status__c == '已批准' || //现在申请书的Status__c已经没有引当完了状态。所以这里不需要判断 //'{!Rental_Apply__c.Status__c}' == '引当完了' || this.Rental_Apply__c.Status__c == '已出库指示' || this.Rental_Apply__c.Status__c == '删除' || this.Rental_Apply__c.Status__c == '取消' ) { alert('请备品申请状态确认,已经提交过的申请,不能重复提交'); return; } } // 没有明细的一览check let raesList = new Array(); // raesList = selectRentalApplyEquipmentSetByRacId(this.recordId); await selectRentalApplyEquipmentSetByRacId({recordId:this.recordId}).then(result=>{ console.log(result); raesList=result; }).catch(err=>{ console.log("selectRentalApplyEquipmentSetByRacId error:"); console.log(err.message); }).finally(()=>{ }); let records= raesList; if(records.length > 0){ alert('有没有明细的借出备品配套一览,不能提交'); return; } let racs ; await selectRentalApplyById({recordId:this.recordId}).then(result=>{ console.log(result); racs=result; }).catch(err=>{ console.log("selectRentalApplyById error:"); console.log(err.message); }).finally(()=>{ }); let racNew = racs[0]; let id=this.Rental_Apply__c.Id; let Status__c="填写完毕"; let userId; await getUserId().then(result=>{ console.log(result); userId=result; }).catch(err=>{ console.log("getUserId error:"); console.log(err.message); }).finally(()=>{ }); let manageUsers; await selectUserById({recordId:userId}).then(result=>{ console.log(result); manageUsers=result; }).catch(err=>{ console.log("selectUserById error:"); console.log(err.message); }).finally(()=>{ }); let SalesManagerSubmit__c; let OPDManagerApprover__c; let BuchangApprovalManagerSalesSubmit__c; let OPDBuchangApprover__c; if(manageUsers[0].JingliEquipmentManager__c != null){ SalesManagerSubmit__c = manageUsers[0].JingliEquipmentManager__r.Name; // 20220930 ljh SWAG-CJR8S7 start if(racNew.OPDPlan__c != null){ OPDManagerApprover__c = SalesManagerSubmit__c == racNew.OPDPlan__r.SalesManager_Txt__c?SalesManagerSubmit__c:' '; } // 20220930 ljh SWAG-CJR8S7 end } if(manageUsers[0].Buzhang_Equipment_Manager__c != null){ BuchangApprovalManagerSalesSubmit__c = manageUsers[0].Buzhang_Equipment_Manager__r.Name; //2022-07-22 zyh // 20220930 ljh SWAG-CJR8S7 start if(racNew.OPDPlan__c != null){ OPDBuchangApprover__c = BuchangApprovalManagerSalesSubmit__c == racNew.OPDPlan__r.BuchangApprovalManagerSales_Txt__c?BuchangApprovalManagerSalesSubmit__c:' '; } // 20220930 ljh SWAG-CJR8S7 end } let resultt; await updateRentalApplyC({ recordId:id, SalesManagerSubmitC:SalesManagerSubmit__c, StatusC:Status__c, OPDManagerApproverC:OPDManagerApprover__c, BuchangApprovalManagerSalesSubmitC:BuchangApprovalManagerSalesSubmit__c, OPDBuchangApproverC:OPDBuchangApprover__c }).then(res=>{ console.log(res); if(res!=null&&res.success==false){ resultt=res; let messages =""; messages=resultt.errors[0].split(',')[1]; if (messages!=null&&messages!="") { console.log("hhh26"); alert("操作失败,错误信息:"+messages); return; } } }).catch(err=>{ console.log("updateRentalApplyC error:"); console.log(err.message); }).finally(()=>{ console.log("finally"); console.log(resultt); }); this.dispatchEvent(new CloseActionScreenEvent()); }; getConnectDMLErrorMessages (results) { console.log("in 1"); console.log(results); let messages = []; let i = 0; let len = results.length; let r; console.log("in 1.1"); for (; i < len; i++) { console.log("in 1.2"); r = results[i]; console.log("in 1.3"); if (r.success==false) { console.log("in 1.4"); messages = messages.concat(this.getConnectDMLMessagesOfAResult(r)); } } console.log("in 1"); console.log("1结果"); console.log(messages); return messages; }; getConnectDMLMessagesOfAResult(res) { console.log("in 2"); console.log(res); let messages = []; let errors = res.errors; let i = 0; let len = errors.length; let e; for (; i < len; i++) { e = errors[i]; console.log("in 2.1"); messages.push(e + " " + this.getConnectDMLErrorFields(errors)); console.log("3结果"); console.log(this.getConnectDMLErrorFields(errors)); console.log("in 2.2"); } console.log("in 2"); console.log("2结果"); console.log(messages); return messages; }; getConnectDMLErrorFields (error) { console.log("in 3"); console.log(error); let fields = error; if (fields.length > 0) { console.log("in 3"); return "[" + fields + ",]" } else { console.log("in 3"); return ""; } }; } force-app/main/default/lwc/rentalApplyLWT/rentalApplyLWT.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="rentalApplyLWT"> <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> sfdx-project.json
@@ -7,6 +7,6 @@ ], "name": "Olympuslightning", "namespace": "", "sfdcLoginUrl": "https://login.salesforce.com", "sfdcLoginUrl": "https://test.salesforce.com", "sourceApiVersion": "56.0" }