From 2d0c3e982b4dbd9192a6d717488653a54afebcb2 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期四, 13 四月 2023 17:15:29 +0800
Subject: [PATCH] QIS按钮(发送QIS到SPO,OCSM服务本部收到实物)
---
force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js | 49 +++++-
force-app/main/default/lwc/lexSendQIS/lexSendQIS.css | 22 ++
force-app/main/default/lwc/lexSendQIS/lexSendQIS.html | 5
force-app/main/default/lwc/lexSendQIS/lexSendQIS.js | 121 +++++++++++++++
force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css | 22 ++
force-app/main/default/classes/QISReportController.cls | 101 ++++++++++++
force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml | 11 +
force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html | 5
force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js | 103 ++++++++++++
force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml | 11 +
10 files changed, 442 insertions(+), 8 deletions(-)
diff --git a/force-app/main/default/classes/QISReportController.cls b/force-app/main/default/classes/QISReportController.cls
index 3b375e1..3d6a036 100644
--- a/force-app/main/default/classes/QISReportController.cls
+++ b/force-app/main/default/classes/QISReportController.cls
@@ -413,15 +413,114 @@
}
return re;
}
+ //鍙戦�丵IS鍒癝PO
+ @AuraEnabled
+ public static InitData initForlexSendQISButton (String recordId){
+ InitData res = new initData();
+ ID myUserID = UserInfo.getUserId();
+ User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
+ try{
+ QIS_Report__c report = [SELECT id ,RecordTypeId,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ RecordType rec = [SELECT id,name FROM RecordType where Id = :report.RecordTypeId];
+ res.Id = report.Id;
+ res.qisRecordTypeId = report.RecordTypeId;
+ res.qisRecordName = rec.name;
+ res.profileName = userinfo.Profile.name;
+ res.IsSendQIS = report.IsSendQIS__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ @AuraEnabled
+ public static String updateQisForSendQIS (String recordId){
+ String re = '鎴愬姛';
+ QIS_Report__c report = [SELECT Id,Name,IsSendQIS__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ if(report == null ){
+ return '娌℃湁QIS锛�' + recordId + '鐨勬暟鎹��';
+ }
+ Savepoint sp = Database.setSavepoint();
+ try{
+
+ QIS_Report__c rac = new QIS_Report__c();
+ rac.id = recordId;
+ rac.IsSendQIS__c = true;
+ update rac;
+ }catch(Exception e){
+ Database.rollback(sp);
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ re = e.getMessage();
+ }
+ return re;
+ }
+ // OCSM鏈嶅姟鏈儴鏀跺埌瀹炵墿
+ @AuraEnabled
+ public static InitData initForlexRCRecievedButton (String recordId){
+ InitData res = new initData();
+ ID myUserID = UserInfo.getUserId();
+ User userinfo = [SELECT id,Profile.name FROM User WHERE Id = :myUserID LIMIT 1];
+ try{
+ QIS_Report__c report = [SELECT id ,isAE_Profile__c,QIS_Status__c,isPAE_Profile__c,is_CNBuy__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
+ res.Id = report.Id;
+ res.isAEProfile = report.isAE_Profile__c;
+ res.isPAEProfile = report.isPAE_Profile__c;
+ res.QIStatus = report.QIS_Status__c;
+ res.isCNBuy = report.is_CNBuy__c;
+ System.debug(LoggingLevel.INFO, '*** res: ' + res);
+ }catch(Exception e){
+ System.debug(LoggingLevel.INFO, '*** e: ' + e);
+ }
+ return res;
+ }
+
+ @AuraEnabled
+ public static String updateQisForRCRecieved (String recordId){
+ String re = '鎴愬姛';
+ ID myUserID = UserInfo.getUserId();
+ User userinfo = [SELECT id,Alias,BuchangApprovalManagerSales__c,JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID LIMIT 1];
+
+ try{
+ QIS_Report__c rac = new QIS_Report__c();
+ rac.id = recordId;
+
+ rac.QIS_Status__c = 'RC妫�娴嬩腑';
+ rac.OCM_RC_RecievedDate__c = Date.today();
+ rac.RC__c = myUserID;
+ rac.RC_Receive_staff__c = userinfo.Alias;
+
+ if (userinfo != null && userinfo.BuchangApprovalManagerSales__c!= null) {
+ rac.RC_Manager__c = userinfo.BuchangApprovalManagerSales__c;
+ } else {
+ rac.RC_Manager__c = myUserID;
+ }
+ 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 qISSCReport;
+ @AuraEnabled
+ public String name;
+ @AuraEnabled
+ public String qISSCId;
@AuraEnabled
public String ownerId;
@AuraEnabled
public String qisRecordTypeId;
@AuraEnabled
public String qisRecordName;
+ @AuraEnabled
+ public String nextaction;
+ @AuraEnabled
+ public String qISMarketCategory;
@AuraEnabled
public String profileName;
@AuraEnabled
@@ -455,6 +554,8 @@
@AuraEnabled
public Date qISInstallDate;
@AuraEnabled
+ public Date oSHInspectionDate;
+ @AuraEnabled
public Date cdsdate;
@AuraEnabled
public Date awaredate;
diff --git a/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
index 0e82f06..515ea3e 100644
--- a/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
+++ b/force-app/main/default/lwc/lexOSHSubmit/lexOSHSubmit.js
@@ -2,6 +2,7 @@
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.initForOSHSubmitButton';
import updateQis from '@salesforce/apex/QISReportController.updateQis1';
import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
@@ -44,27 +45,59 @@
console.log('this.OSHstaff='+this.OSHstaff);
console.log('this.OSHstaffEmail='+this.OSHstaffEmail);
if (this.qisStatus=='OSH妫�娴嬬敵璇�' && this.qisStatus=='瀹屾瘯') {
- alert('闇�瑕佸厛鐐瑰嚮锛籓SH妫�鏌ュ彈鐞嗭冀');
- return;
+ const evt = new ShowToastEvent({
+ title : '闇�瑕佸厛鐐瑰嚮锛籓SH妫�鏌ュ彈鐞嗭冀',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
}
if (this.qisStatus!='OSH妫�娴嬩腑') {
- alert('宸茬粡鎻愪氦瀹℃壒');
- return;
+ const evt = new ShowToastEvent({
+ title : '宸茬粡鎻愪氦瀹℃壒',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
}
if (!confirm("涓�鏃︽彁浜ゆ璁板綍浠ュ緟鎵瑰噯锛屾牴鎹偍鐨勮缃偍鍙兘涓嶅啀鑳藉缂栬緫姝よ褰曟垨灏嗕粬浠庢壒鍑嗚繃绋嬩腑璋冨洖銆傛槸鍚︾户缁紵")) {
return;
}
if (this.OSHstaff==null||this.OSHstaffEmail==null) {
- alert("OSH鎷呭綋蹇呴』濉啓");
- return;
+ const evt = new ShowToastEvent({
+ title : 'OSH鎷呭綋蹇呴』濉啓',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
}
try{
this.updateQisSubmit();
}catch(err){
if(err.faultstring !=undefined && err.faultstring.indexOf('INVALID_SESSION_ID') != -1) {
- alert('褰撳墠缃戦〉宸茬櫥鍑猴紝璇锋偍閲嶆柊鐧诲綍鍚庡埛鏂拌缃戦〉锛�');
+ const evt = new ShowToastEvent({
+ title : '褰撳墠缃戦〉宸茬櫥鍑猴紝璇锋偍閲嶆柊鐧诲綍鍚庡埛鏂拌缃戦〉锛�',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
} else {
- alert(err.faultstring);
+ const evt = new ShowToastEvent({
+ title : err.faultstring,
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
}
return;
}
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.css
@@ -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 */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html
new file mode 100644
index 0000000..49a10f7
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="sisToOPDHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js
new file mode 100644
index 0000000..2afabee
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js
@@ -0,0 +1,103 @@
+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.initForlexRCRecievedButton';
+import updateQis from '@salesforce/apex/QISReportController.updateQisForRCRecieved';
+
+export default class lexRCRecieved extends LightningElement {
+ @api recordId;
+ err;
+ IsLoading = true;
+ qisReportId;
+ qisStatus;
+ isAEProfile;
+ isPAEProfile;
+ isCNBuy;
+ @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.isAEProfile = result.isAEProfile;
+ this.isPAEProfile = result.isPAEProfile;
+ this.isCNBuy = result.isCNBuy;
+ console.log('this.qisStatus='+this.qisStatus);
+ if (this.qisStatus!='RC妫�娴嬬敵璇�') {
+ const evt = new ShowToastEvent({
+ title : 'OCM鏈嶅姟鏈儴宸茬粡鏀跺埌瀹炵墿',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }else{
+ if (this.isAEProfile == null || this.isPAEProfile == null || this.isCNBuy != 'true') {
+ const evt = new ShowToastEvent({
+ title : '瀹夊叏淇℃伅鏈垽瀹氾紝璇疯仈绯昏川閲忔硶瑙勯儴',
+ 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);
+ 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(() => {
+
+ });
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml
new file mode 100644
index 0000000..120b162
--- /dev/null
+++ b/force-app/main/default/lwc/lexRCRecieved/lexRCRecieved.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexRCRecieved">
+ <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>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.css b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.css
new file mode 100644
index 0000000..635bc6c
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.css
@@ -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 */
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.html b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.html
new file mode 100644
index 0000000..c8bdbfc
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.html
@@ -0,0 +1,5 @@
+<template>
+ <div class="sisToOPDHolder" if:true={IsLoading}>
+ <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner>
+ </div>
+</template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js
new file mode 100644
index 0000000..f1ca368
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js
@@ -0,0 +1,121 @@
+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.initForlexSendQISButton';
+import sendSPO from '@salesforce/apex/QISReportController.updateQisForSendQIS';
+import UserInfo_Owner from '@salesforce/apex/TaskFeedbackController.UserInfo_Owner';
+import { updateRecord } from 'lightning/uiRecordApi';
+
+export default class lexSendQIS extends LightningElement {
+ @api recordId;
+ str;
+ err;
+ IsLoading = true;
+ qisReportId;
+ qisRecordTypeId;
+ qisRecordName;
+ ProfileName;
+ IsSendQIS;
+ @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.qisRecordTypeId = result.qisRecordTypeId;
+ this.qisReportId = result.Id;
+ this.qisRecordName = result.qisRecordName;
+ this.ProfileName = result.profileName;
+ this.IsSendQIS = result.isSendQIS;
+ if (this.qisRecordName == '2.OCSM') {
+ const evt = new ShowToastEvent({
+ title : '涓嶈兘鎻愪氦鍒癝PO',
+ message: '璁板綍绫诲瀷涓�'+this.qisRecordName,
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ if (!(this.ProfileName == '绯荤粺绠$悊鍛�' || this.ProfileName == '2F4_鎶�鏈帹杩涢儴' || this.ProfileName == '2F1_鏈嶅姟绐楀彛')) {
+ const evt = new ShowToastEvent({
+ title : '娌℃湁鏉冮檺鎻愪氦锛岃鑱旂郴绯荤粺绠$悊鍛�',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+
+ if (this.IsSendQIS) {
+ const evt = new ShowToastEvent({
+ title : '宸叉彁浜ゅ埌SPO锛岃涓嶈閲嶅鎻愪氦',
+ message: '',
+ variant: 'error'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ return;
+ }
+ this.send2SPO();
+ }).catch(error => {
+ console.log(error.getMessage());
+ }).finally(() => {
+
+ });
+ }
+ updateRecordView(recordId) {
+ updateRecord({fields: { Id: recordId }});
+ }
+
+ send2SPO(){
+ sendSPO({
+ 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());
+ return;
+ }else{
+ const evt = new ShowToastEvent({
+ title : '鎻愪氦鎴愬姛锛佽鍦⊿PO绯荤粺涓畬鎴愰��鎹㈣揣鐢宠',
+ message: '',
+ variant: 'success'
+ });
+ this.dispatchEvent(evt);
+ this.dispatchEvent(new CloseActionScreenEvent());
+ this.updateRecordView(this.recordId);
+ window.location.replace("https://olympus.sharepoint.cn/sites/GSPWF/SitePages/HomePage.aspx");
+ }
+
+ }).catch(error => {
+ console.log('error='+error);
+ }).finally(() => {
+
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml
new file mode 100644
index 0000000..814503e
--- /dev/null
+++ b/force-app/main/default/lwc/lexSendQIS/lexSendQIS.js-meta.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lexSendQIS">
+ <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>
\ No newline at end of file
--
Gitblit v1.9.1