From bac2a731433a38cb262e7f38a98c9522481752ec Mon Sep 17 00:00:00 2001
From: unknown <sunxia@prec-tech.com>
Date: 星期四, 20 七月 2023 10:08:02 +0800
Subject: [PATCH] button-all_received_fse
---
force-app/main/default/classes/LexAllReceivedFseController.cls | 58 +++++++++++++++++++++++++++++
force-app/main/default/classes/LexAllReceivedFseController.cls-meta.xml | 5 ++
force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js | 56 ++++++++++++++-------------
3 files changed, 92 insertions(+), 27 deletions(-)
diff --git a/force-app/main/default/classes/LexAllReceivedFseController.cls b/force-app/main/default/classes/LexAllReceivedFseController.cls
new file mode 100644
index 0000000..9135f04
--- /dev/null
+++ b/force-app/main/default/classes/LexAllReceivedFseController.cls
@@ -0,0 +1,58 @@
+/**
+ * *
+ ODescription:
+ GAuthor: sun xia
+ @Date: 2023-07-11 15:31:56
+ GIastEditors: sun xia
+ @IastEditTime: 2023-07-11 15:31:56
+ * */
+public with sharing class LexAllReceivedFseController {
+ @AuraEnabled
+ public static InitData init(String recordId){
+ InitData res = new InitData();
+ try{
+ List<Rental_Apply__c> raList = [SELECT Id, Loaner_received_ng_num__c from Rental_Apply__c where Id = :recordId];
+ if(raList.size()>0){
+ Rental_Apply__c ra = raList[0];
+ res.id = ra.Id;
+ res.loanerReceivedNgNum = Integer.valueOf(ra.Loaner_received_ng_num__c);
+ }
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '****e:' + e);
+ }
+ return res;
+ }
+
+ @AuraEnabled
+ public static String getRaeSet(String recordId){
+ List<Rental_Apply_Equipment_Set__c> raeList = [SELECT Id, RAES_Status__c, Loaner_received_time__c from Rental_Apply_Equipment_Set__c WHERE Rental_Apply__c = :recordId];
+ List<Rental_Apply_Equipment_Set__c> updateList = new List<Rental_Apply_Equipment_Set__c>();
+ for(Integer i=0; i<raeList.size(); i++){
+ if(raeList[i].Loaner_received_time__c == null && raeList[i].RAES_Status__c == '宸插嚭搴�'){
+ Rental_Apply_Equipment_Set__c tempRAE = new Rental_Apply_Equipment_Set__c();
+ tempRAE.Id = raeList[i].Id;
+ tempRAE.Received_Confirm__c = 'OK';
+ updateList.add(tempRAE);
+ }
+ }
+
+ if(updateList.size()>0){
+ try {
+ Update updateList;
+ return 'SUCCESS';
+ }
+ catch (Exception e) {
+ return e.getMessage();
+ }
+ }
+
+ return '涓嶅瓨鍦ㄦ洿鏂版槑缁�';
+ }
+
+ public Class InitData{
+ @AuraEnabled
+ public String id;
+ @AuraEnabled
+ public Integer loanerReceivedNgNum;
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/LexAllReceivedFseController.cls-meta.xml b/force-app/main/default/classes/LexAllReceivedFseController.cls-meta.xml
new file mode 100644
index 0000000..9662499
--- /dev/null
+++ b/force-app/main/default/classes/LexAllReceivedFseController.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/lexAllReceivedFse/lexAllReceivedFse.js b/force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js
index 1e29534..e088359 100644
--- a/force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js
+++ b/force-app/main/default/lwc/lexAllReceivedFse/lexAllReceivedFse.js
@@ -4,8 +4,8 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { updateRecord } from 'lightning/uiRecordApi';
-import init from '@salesforce/apex/AllReceivedFseController.init';
-import getRaeSet from '@salesforce/apex/AllReceivedFseController.getRaeSet';
+import init from '@salesforce/apex/LexAllReceivedFseController.init';
+import getRaeSet from '@salesforce/apex/LexAllReceivedFseController.getRaeSet';
export default class lexAllReceivedFse extends LightningElement {
@api recordId;
@@ -26,31 +26,33 @@
init({
recordId: this.recordId
}).then(res=>{
- console.log('loanerReceivedNgNum==='+ res.loanerReceivedNgNum);
- if(res.loanerReceivedNgNum == 0){
- const evt = new ShowToastEvent({
- title : '鐜板満宸茬粡鍏ㄩ儴鏀跺埌瀹炵墿浜�',
- message: '',
- variant: 'error'
- });
- this.dispatchEvent(evt);
- this.dispatchEvent(new CloseActionScreenEvent());
- }else{
- getRaeSet({
- recordId: this.recordId
- }).then(res=>{
- if(res == 'SUCCESS'){
- this.showToast('鐜板満宸插叏閮ㄦ敹璐�','success');
- return;
- }else{
- this.showToast(res,'warning');
- return;
- }
-
- })
- .catch(err=>{
- console.log('getRaeSet==='+err);
- })
+ console.log('loanerReceivedNgNum==='+ JSON.stringify(res));
+ if(res){
+ if(res.loanerReceivedNgNum == 0){
+ const evt = new ShowToastEvent({
+ title : '鐜板満宸茬粡鍏ㄩ儴鏀跺埌瀹炵墿浜�',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ }else{
+ getRaeSet({
+ recordId: this.recordId
+ }).then(res=>{
+ if(res == 'SUCCESS'){
+ this.showToast('鐜板満宸插叏閮ㄦ敹璐�','success');
+ return;
+ }else{
+ this.showToast(res,'warning');
+ return;
+ }
+
+ })
+ .catch(err=>{
+ console.log('getRaeSet==='+err);
+ })
+ }
}
}).catch(err=>{
console.log('init==='+err);
--
Gitblit v1.9.1