From f6f716639aa79c711e6bc89e76496fee8a63e042 Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 20 七月 2023 10:27:41 +0800
Subject: [PATCH] button-lexRentalApplyJump
---
force-app/main/default/classes/LexRentalApplyControllerLWT.cls | 296 +++++++++++++++++++++++++++++++++++++++++++++++++
force-app/main/default/classes/LexRentalApplyControllerLWT.cls-meta.xml | 5
force-app/main/default/lwc/lexRentalApplyJump/lexRentalApplyJump.js | 8
3 files changed, 305 insertions(+), 4 deletions(-)
diff --git a/force-app/main/default/classes/LexRentalApplyControllerLWT.cls b/force-app/main/default/classes/LexRentalApplyControllerLWT.cls
new file mode 100644
index 0000000..dea0ca8
--- /dev/null
+++ b/force-app/main/default/classes/LexRentalApplyControllerLWT.cls
@@ -0,0 +1,296 @@
+public with sharing class LexRentalApplyControllerLWT {
+ public LexRentalApplyControllerLWT() {
+
+ }
+
+ @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>();
+ // 瀹氫箟瀛楃涓插垪琛紝鍏朵腑鍖呭惈鑻ュ共 sObject 鐨� API 鍚嶇О
+ //List<String> objTypeList = new List<String>{'Account', 'ExampleCustomObj__c'};
+ // 寰楀埌 Account 鍜� ExampleCustomObj__c 鐨勪俊鎭�
+ //Schema.DescribeSobjectResult[] results = Schema.describeSObjects(objTypeList);
+ 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;
+ @AuraEnabled
+ public List<String> statusList;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexRentalApplyControllerLWT.cls-meta.xml b/force-app/main/default/classes/LexRentalApplyControllerLWT.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/LexRentalApplyControllerLWT.cls-meta.xml
@@ -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>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRentalApplyJump/lexRentalApplyJump.js b/force-app/main/default/lwc/lexRentalApplyJump/lexRentalApplyJump.js
index 38786e0..4f8a591 100644
--- a/force-app/main/default/lwc/lexRentalApplyJump/lexRentalApplyJump.js
+++ b/force-app/main/default/lwc/lexRentalApplyJump/lexRentalApplyJump.js
@@ -1,10 +1,10 @@
import { LightningElement,api, track, wire } from 'lwc';
import {CurrentPageReference} from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
-import getUserId from '@salesforce/apex/RentalApplyControllerLWT.getUserId';
-import init from '@salesforce/apex/SelectSubstituteControllerLWT.initFromSelectSubstituteButton';
-import selectRentalApplyEquipmentSetByID from '@salesforce/apex/SelectSubstituteControllerLWT.selectRentalApplyEquipmentSetByID';
-import selectRentalApplyEquipmentSetByRACID from '@salesforce/apex/SelectSubstituteControllerLWT.selectRentalApplyEquipmentSetByRACID';
+import getUserId from '@salesforce/apex/LexRentalApplyControllerLWT.getUserId';
+import init from '@salesforce/apex/LexSelectSubstituteControllerLWT.initFromSelectSubstituteButton';
+import selectRentalApplyEquipmentSetByID from '@salesforce/apex/LexSelectSubstituteControllerLWT.selectRentalApplyEquipmentSetByID';
+import selectRentalApplyEquipmentSetByRACID from '@salesforce/apex/LexSelectSubstituteControllerLWT.selectRentalApplyEquipmentSetByRACID';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
export default class lexRentalApplyJump extends LightningElement {
--
Gitblit v1.9.1