From 8b5e79424cc90685244496d136b93d9d079b9f82 Mon Sep 17 00:00:00 2001
From: twysparks <twysparks@163.com>
Date: 星期四, 18 五月 2023 11:39:48 +0800
Subject: [PATCH] 申请修理
---
force-app/main/default/lwc/lexSendNFM103/lexSendNFM103.js | 388 +++++++++++++++++++++++++++---------------------------
force-app/main/default/classes/otherButtonRepairController.cls | 10
2 files changed, 198 insertions(+), 200 deletions(-)
diff --git a/force-app/main/default/classes/otherButtonRepairController.cls b/force-app/main/default/classes/otherButtonRepairController.cls
index 2316304..1907e8d 100644
--- a/force-app/main/default/classes/otherButtonRepairController.cls
+++ b/force-app/main/default/classes/otherButtonRepairController.cls
@@ -357,7 +357,7 @@
String res='';
try {
Repair__c repair = new Repair__c();
- repair.ID = recordId;
+ repair.Id = recordId;
repair.Maintenance_Contract__c = null;
repair.MaintenanceContractType__c = null;
update repair;
@@ -371,6 +371,7 @@
//鏇存柊Repair__c涓殑璁板綍锛岃嫢鎹曡幏鍒板紓甯稿垯杩斿洖閿欒淇℃伅
@AuraEnabled
public static String updateRepair2(String recordId,User staff,Boolean DWSign,String statusc,String DOJStatus,String SAPcondition){
+ String res='';
try {
Repair__c repair = new Repair__c();
repair.Id = recordId;
@@ -397,13 +398,10 @@
repair.SAP_Transfer_time__c = Datetime.now();
}
update repair;
- return null;
} catch (Exception e) {
- String eMessage = e.getMessage();
- Integer left = eMessage.indexOf(',') + 1;
- Integer right = eMessage.length();
- return eMessage.substring(left,right);
+ res = e.getMessage();
}
+ return res;
}
// 鏌ユ壘绠�妗�
diff --git a/force-app/main/default/lwc/lexSendNFM103/lexSendNFM103.js b/force-app/main/default/lwc/lexSendNFM103/lexSendNFM103.js
index 0f9f24d..dcb0438 100644
--- a/force-app/main/default/lwc/lexSendNFM103/lexSendNFM103.js
+++ b/force-app/main/default/lwc/lexSendNFM103/lexSendNFM103.js
@@ -79,6 +79,7 @@
AWSDataId;
userName;
profileName;
+ Id;
@wire(CurrentPageReference)
getStateParameters(currentPageReference) {
@@ -102,7 +103,7 @@
btns[i].disabled = true;
btns[i].className = 'btnDisabled';
}
-
+ this.Id = result.Id;
this.detailedAddress = result.detailedAddress;
this.dealer = result.DealerC;
this.numberofEffectiveContract = result.numberofEffectiveContract;
@@ -135,7 +136,7 @@
this.DWSign = result.DWSign;
this.DOJStatus = result.DOJStatus;
this.SAPcondition = result.SAPcondition;
- this.salesOfficeCodeSelection = result.salesOfficeCodeSelection;
+ this.salesOfficeCodeSelection = result.SalesOfficeCodeSelectionC;
this.profileId = result.profileId;
this.userId = result.userID;
this.AWSDataId = result.AWSDataId;
@@ -169,234 +170,233 @@
queryForrecords3({
dealer: this.dealer
}).then(result => {
- // if (result.length > 0 && result[0].FirstParagraph__c == true) {
- // if (!confirm("璇ョ粡閿�鍟嗕负鍏堟瀵硅薄锛屾槸鍚︾户缁敵璇蜂慨鐞嗭紵")) {
- // return;
- // }
- // }
+ if (result.length > 0 && result[0].FirstParagraph__c == true) {
+ if (!confirm("璇ョ粡閿�鍟嗕负鍏堟瀵硅薄锛屾槸鍚︾户缁敵璇蜂慨鐞嗭紵")) {
+ return;
+ }
+ }
- // if (
- // this.numberofEffectiveContract == "鏃�" && this.newProductGuaranteTxt != "2: 澶氬勾淇濅慨" &&
- // this.newProductGuaranteTxt != "2: 鏈嶅姟澶氬勾淇濅慨" && this.newProductGuaranteTxt != "8: 甯傚満澶氬勾淇濅慨" &&
- // this.onSiteRepair == "鐩撮�丼ORC淇悊"
- // ) {
- // if (!confirm("璁惧涓洪潪缁翠慨鍚堝悓涓旈潪澶氬勾淇濅慨瀵硅薄鍝侊紝璇风‘璁ゆ槸鍚︾洿閫丼ORC淇悊锛�")) {
- // return;
- // }
- // }
+ if (
+ this.numberofEffectiveContract == "鏃�" && this.newProductGuaranteTxt != "2: 澶氬勾淇濅慨" &&
+ this.newProductGuaranteTxt != "2: 鏈嶅姟澶氬勾淇濅慨" && this.newProductGuaranteTxt != "8: 甯傚満澶氬勾淇濅慨" &&
+ this.onSiteRepair == "鐩撮�丼ORC淇悊"
+ ) {
+ if (!confirm("璁惧涓洪潪缁翠慨鍚堝悓涓旈潪澶氬勾淇濅慨瀵硅薄鍝侊紝璇风‘璁ゆ槸鍚︾洿閫丼ORC淇悊锛�")) {
+ return;
+ }
+ }
- // if ((this.maintenanceContract != undefined || this.VMMaintenanceContract != undefined) &&
- // this.onSiteRepair == "RC淇悊" && this.FSEState == "灞变笢鐪�"
- // ) {
- // if (!confirm("璇ヨ澶囦负缁翠慨鍚堝悓鎴栧骞翠繚淇璞″搧锛岃纭鏄惁閫佽嚦RC淇悊锛�")) {
- // return;
- // }
- // }
+ if ((this.maintenanceContract != undefined || this.VMMaintenanceContract != undefined) &&
+ this.onSiteRepair == "RC淇悊" && this.FSEState == "灞变笢鐪�"
+ ) {
+ if (!confirm("璇ヨ澶囦负缁翠慨鍚堝悓鎴栧骞翠繚淇璞″搧锛岃纭鏄惁閫佽嚦RC淇悊锛�")) {
+ return;
+ }
+ }
- // var today = Date.now();
- // var dateReceiptQuestions = Date.parse(this.dateReceiptQuestions);
- // var dates = (today - dateReceiptQuestions) / (24 * 60 * 60 * 1000);
- // if (this.profileName != "绯荤粺绠$悊鍛�" && this.userName != "鑳� 鐜夋垚" && this.userName != "鏉� 鐞竻" &&
- // this.userName != "閮� 娲�" &&
- // this.delayReportReason == undefined && dates > "1" &&
- // this.repairSource != "QIS杞慨鐞�") {
- // alert("鐢宠淇悊鏃禨AP淇悊鐢宠鏃ヨ秴杩囬棶棰樿仈缁滄敹鍒版棩1澶╋紝蹇呴』濉啓闂秴鏃舵姤鍛婄殑鐞嗙敱");
- // return;
- // }
+ var today = Date.now();
+ var dateReceiptQuestions = Date.parse(this.dateReceiptQuestions);
+ var dates = (today - dateReceiptQuestions) / (24 * 60 * 60 * 1000);
+ if (this.profileName != "绯荤粺绠$悊鍛�" && this.userName != "鑳� 鐜夋垚" && this.userName != "鏉� 鐞竻" &&
+ this.userName != "閮� 娲�" &&
+ this.delayReportReason == undefined && dates > "1" &&
+ this.repairSource != "QIS杞慨鐞�") {
+ alert("鐢宠淇悊鏃禨AP淇悊鐢宠鏃ヨ秴杩囬棶棰樿仈缁滄敹鍒版棩1澶╋紝蹇呴』濉啓闂秴鏃舵姤鍛婄殑鐞嗙敱");
+ return;
+ }
- // if (this.quickRepairSign == true && (this.numberofEffectiveContract == "鏈�" || this.newProductGuaranteTxt == "2: 澶氬勾淇濅慨" ||
- // this.newProductGuaranteTxt == "2: 鏈嶅姟澶氬勾淇濅慨" || this.newProductGuaranteTxt == "8: 甯傚満澶氬勾淇濅慨") &&
- // (this.onSiteRepair == "RC淇悊" || this.onSiteRepair == "鍔炰簨澶勪慨鐞�" || this.onSiteRepair == "鐜板満淇悊")) {
- // if (this.RCCD == "2.涓滃寳" || this.RCCD == "3.瑗垮寳") {
- // if (!confirm("璇ュ瀷鍙峰搴斾负鍚堝悓鎴栧骞翠繚瀵硅薄鍝併�傚纭涓哄ぇ淇悊鏁呴殰锛岄渶瑕侀�夋嫨鐩撮�丼ORC淇悊锛岃纭鏄惁缁х画銆�")) {
- // return;
- // }
- // } else if (this.RCCD == "1.鍗庡寳" || this.RCCD == "6.鍗庡崡" || this.RCCD == "4.瑗垮崡") {
- // if (!confirm("璇ュ瀷鍙峰搴斾负鍚堝悓鎴栧骞翠繚瀵硅薄鍝併�傚纭涓哄ぇ淇悊鏁呴殰锛岄渶瑕侀�夋嫨鐩撮�丱GZ淇悊锛岃纭鏄惁缁х画銆�")) {
- // return;
- // }
- // }
- // }
+ if (this.quickRepairSign == true && (this.numberofEffectiveContract == "鏈�" || this.newProductGuaranteTxt == "2: 澶氬勾淇濅慨" ||
+ this.newProductGuaranteTxt == "2: 鏈嶅姟澶氬勾淇濅慨" || this.newProductGuaranteTxt == "8: 甯傚満澶氬勾淇濅慨") &&
+ (this.onSiteRepair == "RC淇悊" || this.onSiteRepair == "鍔炰簨澶勪慨鐞�" || this.onSiteRepair == "鐜板満淇悊")) {
+ if (this.RCCD == "2.涓滃寳" || this.RCCD == "3.瑗垮寳") {
+ if (!confirm("璇ュ瀷鍙峰搴斾负鍚堝悓鎴栧骞翠繚瀵硅薄鍝併�傚纭涓哄ぇ淇悊鏁呴殰锛岄渶瑕侀�夋嫨鐩撮�丼ORC淇悊锛岃纭鏄惁缁х画銆�")) {
+ return;
+ }
+ } else if (this.RCCD == "1.鍗庡寳" || this.RCCD == "6.鍗庡崡" || this.RCCD == "4.瑗垮崡") {
+ if (!confirm("璇ュ瀷鍙峰搴斾负鍚堝悓鎴栧骞翠繚瀵硅薄鍝併�傚纭涓哄ぇ淇悊鏁呴殰锛岄渶瑕侀�夋嫨鐩撮�丱GZ淇悊锛岃纭鏄惁缁х画銆�")) {
+ return;
+ }
+ }
+ }
- // var returnsProductWay = this.returnsProductway;
- // if (returnsProductWay == undefined) {
- // if (!confirm("杩斿搧鏂瑰紡涓虹┖锛屾槸鍚︾户缁敵璇蜂慨鐞嗭紒")) {
- // return;
- // }
- // }
+ var returnsProductWay = this.returnsProductway;
+ if (returnsProductWay == undefined) {
+ if (!confirm("杩斿搧鏂瑰紡涓虹┖锛屾槸鍚︾户缁敵璇蜂慨鐞嗭紒")) {
+ return;
+ }
+ }
var DetailedAddress = this.detailedAddress;
- // if (this.assetOwner != "Olympus") {
- // if (DetailedAddress != undefined) {
- // var prompt = '褰撳墠鐩磋繑鏀惰揣鍦板潃涓猴細' + DetailedAddress + ',鎮ㄧ‘璁や笉淇敼浜嗗悧锛�';
- // if (!confirm(prompt)) {
- // return;
- // }
- // } else {
- // alert('褰撳墠淇悊娌℃湁褰曞叆鐩磋繑鏀惰揣鐨勮缁嗗湴鍧�锛屼笉鑳界敵璇蜂慨鐞嗭紒');
- // return;
- // }
- // }
+ if (this.assetOwner != "Olympus") {
+ if (DetailedAddress != undefined) {
+ var prompt = '褰撳墠鐩磋繑鏀惰揣鍦板潃涓猴細' + DetailedAddress + ',鎮ㄧ‘璁や笉淇敼浜嗗悧锛�';
+ if (!confirm(prompt)) {
+ return;
+ }
+ } else {
+ alert('褰撳墠淇悊娌℃湁褰曞叆鐩磋繑鏀惰揣鐨勮缁嗗湴鍧�锛屼笉鑳界敵璇蜂慨鐞嗭紒');
+ return;
+ }
+ }
- // queryForEquipments({
- // deliveredProductId: this.deliveredProductId,
- // }).then(equipments => {
- // if (equipments != null && equipments.length > 0) {
- // var equipment = equipments[0];
- // if (equipment.Status == "寤冩") {
- // alert("璁惧搴熷純锛屼笉鑳芥彁浜ょ敵璇�!");
- // return;
- // }
- // }
- // });
+ queryForEquipments({
+ deliveredProductId: this.deliveredProductId,
+ }).then(equipments => {
+ if (equipments != null && equipments.length > 0) {
+ var equipment = equipments[0];
+ if (equipment.Status == "寤冩") {
+ alert("璁惧搴熷純锛屼笉鑳芥彁浜ょ敵璇�!");
+ return;
+ }
+ }
+ });
- // if (this.FSEApplyForRepairTime != undefined) {
- // alert("宸蹭慨鐞嗙敵璇凤紝涓嶅啀淇悊鐢宠浜�");
- // return;
- // }
+ if (this.FSEApplyForRepairTime != undefined) {
+ alert("宸蹭慨鐞嗙敵璇凤紝涓嶅啀淇悊鐢宠浜�");
+ return;
+ }
var surplusCount = 0;
- // if (this.URFReapir == false) {
- // queryForUrfAsset({
- // maintenanceContractId: this.maintenanceContractId,
- // deliveredProductId: this.deliveredProductId,
- // }).then(urfAsset => {
- // var seriesMaxRepairCount = 0;
- // var seriesRepairCount = 0;
- // if (urfAsset != null && urfAsset.length > 0) {
- // seriesMaxRepairCount = urfAsset[0].Series_MaxRepairCount_F__c;
- // seriesRepairCount = urfAsset[0].Series_RepairCount_F__c;
- // surplusCount = seriesMaxRepairCount - seriesRepairCount;
- // }
- // });
+ if (this.URFReapir == false) {
+ queryForUrfAsset({
+ maintenanceContractId: this.maintenanceContractId,
+ deliveredProductId: this.deliveredProductId,
+ }).then(urfAsset => {
+ var seriesMaxRepairCount = 0;
+ var seriesRepairCount = 0;
+ if (urfAsset != null && urfAsset.length > 0) {
+ seriesMaxRepairCount = urfAsset[0].Series_MaxRepairCount_F__c;
+ seriesRepairCount = urfAsset[0].Series_RepairCount_F__c;
+ surplusCount = seriesMaxRepairCount - seriesRepairCount;
+ }
+ });
- // queryForUrfSeriesInfo({
- // URFLimitSerial: this.URFLimitSerial,
- // }).then(urfSeriesInfo => {
- // var urfSeries = "";
- // if (urfSeriesInfo != null && urfSeriesInfo.length > 0) {
- // urfSeries = urfSeriesInfo[0].URFLimitSerial__c;
- // }
+ queryForUrfSeriesInfo({
+ URFLimitSerial: this.URFLimitSerial,
+ }).then(urfSeriesInfo => {
+ var urfSeries = "";
+ if (urfSeriesInfo != null && urfSeriesInfo.length > 0) {
+ urfSeries = urfSeriesInfo[0].URFLimitSerial__c;
+ }
- // queryForRepairCount({
- // maintenanceContractId: this.maintenanceContractId,
- // status1: "1.鍙楃悊瀹屾瘯",
- // URFLimitSerial: urfSeries,
- // }).then(repairCount => {
- // if (repairCount.length > 0 && surplusCount == 1) {
- // alert("璇ヨ澶囧叧鑱旈檺娆″悎鍚岋紝鐩墠鍓╀綑娆℃暟灏忎簬閫佷慨璁惧銆傝绛夊緟杩涜涓慨鐞嗗畬鎴愬悗鍐嶈繘琛岀敵璇�");
- // return;
- // }
- // });
- // });
- // }
+ queryForRepairCount({
+ maintenanceContractId: this.maintenanceContractId,
+ status1: "1.鍙楃悊瀹屾瘯",
+ URFLimitSerial: urfSeries,
+ }).then(repairCount => {
+ if (repairCount.length > 0 && surplusCount == 1) {
+ alert("璇ヨ澶囧叧鑱旈檺娆″悎鍚岋紝鐩墠鍓╀綑娆℃暟灏忎簬閫佷慨璁惧銆傝绛夊緟杩涜涓慨鐞嗗畬鎴愬悗鍐嶈繘琛岀敵璇�");
+ return;
+ }
+ });
+ });
+ }
- // if (this.status != "鑽夋涓�" && this.status != "1.鍙楃悊瀹屾瘯(SAP寰呭彂閫�)" && this.status != "4.淇悊鍝佽繑閫侀樁娈�") {
- // alert("涓嶆槸鑽夋涓笉鑳界敵璇�");
- // } else {
- // if (this.dealer != undefined) {
+ if (this.status != "鑽夋涓�" && this.status != "1.鍙楃悊瀹屾瘯(SAP寰呭彂閫�)" && this.status != "4.淇悊鍝佽繑閫侀樁娈�") {
+ alert("涓嶆槸鑽夋涓笉鑳界敵璇�");
+ } else {
+ if (this.dealer != undefined) {
- // queryForFindInvalidLicense({
- // dealerId: this.dealerId,
- // }).then(findInvalidLicense => {
- // console.log(findInvalidLicense);
- // if (findInvalidLicense.length > 0) {
- // alert("缁忛攢鍟嗕笁璇佷笉鍦ㄦ湁鏁堟湡锛屾棤娉曢�佷慨");
- // return;
- // }
- // });
- // }
- // }
+ queryForFindInvalidLicense({
+ dealerId: this.dealerId,
+ }).then(findInvalidLicense => {
+ console.log(findInvalidLicense);
+ if (findInvalidLicense.length > 0) {
+ alert("缁忛攢鍟嗕笁璇佷笉鍦ㄦ湁鏁堟湡锛屾棤娉曢�佷慨");
+ return;
+ }
+ });
+ }
+ }
- // if (this.ifDeadHurt == "鏈�") {
- // if (!confirm("鏄惁纭AE瑕佹彁浜わ紵")) {
- // return;
- // }
- // }
+ if (this.ifDeadHurt == "鏈�") {
+ if (!confirm("鏄惁纭AE瑕佹彁浜わ紵")) {
+ return;
+ }
+ }
- // if (this.dayLater30 == "鏄�") {
- // alert("鍒涘缓鍚庤秴杩�30澶╋紝涓嶈兘鐢宠浜�");
- // return;
- // }
+ if (this.dayLater30 == "鏄�") {
+ alert("鍒涘缓鍚庤秴杩�30澶╋紝涓嶈兘鐢宠浜�");
+ return;
+ }
- // var prompt11 = "鍚堝悓鍐呭ぇ淇鏁板凡鐢ㄥ畬锛屽綋鍓嶄慨鐞嗕负鍚堝悓澶栫殑淇悊锛屾槸鍚︾户缁紵";
- // if (this.URFReapir == false && surplusCount == 0) {
- // if (!confirm(prompt11)) {
- // return;
- // }
-
-
- // }
-
- updateForRepair1({
- recordId: this.Id,
- }).then(result => {
- if (result.length > 0) {
- var split = result.split(", ");
- alert(split[1]);
+ var prompt11 = "鍚堝悓鍐呭ぇ淇鏁板凡鐢ㄥ畬锛屽綋鍓嶄慨鐞嗕负鍚堝悓澶栫殑淇悊锛屾槸鍚︾户缁紵";
+ if (this.URFReapir == false && surplusCount == 0) {
+ if (!confirm(prompt11)) {
return;
}
- queryForReocrds({
- inchargeStaffId: this.inchargeStaffId,
- }).then(records => {
- if (records != null && records.length > 0) {
- var staff = records[0];
- updateRepair2({
- recordId: this.Id,
- staff: staff,
- DWSign: this.DWSign,
- statusc: "1.鍙楃悊瀹屾瘯",
- DOJStatus: this.DOJStatus,
- SAPcondition: this.SAPcondition,
- }).then(result => {
- if (result.length > 0) {
- var split = result.split(", ");
- alert(split[1]);
- } else {
- if (this.salesOfficeCodeSelection == "鎴愰兘RC") {
- alert("鐜伴樁娈碉紝鎴愰兘RC浠呭彈鐞嗗洓宸濓紙瑗胯棌锛夊唴闀溿�佽タ鍗楀叏鍩烠V/CLV锛屽叾浣欏疄鐗╄鍙戣嚦骞垮窞RC銆�");
+
+ }
+ updateForRepair1({
+ recordId: this.Id
+ }).then(result => {
+ if (result != null && result.length > 0) {
+ var split = result.split(", ");
+ alert(split[1]);
+ } else {
+ queryForReocrds({
+ inchargeStaffId: this.inchargeStaffId,
+ }).then(records => {
+ if (records != null && records.length > 0) {
+ var staff = records[0];
+ console.log(staff);
+ updateRepair2({
+ recordId: this.Id,
+ staff: staff,
+ DWSign: this.DWSign,
+ statusc: "1.鍙楃悊瀹屾瘯",
+ DOJStatus: this.DOJStatus,
+ SAPcondition: this.SAPcondition,
+ }).then(result => {
+ console.log(result);
+ if (result != null && result.length > 0) {
+ var split = result.split(", ");
+ alert(split[1]);
+ } else {
+ if (this.salesOfficeCodeSelection == "鎴愰兘RC") {
+ alert("鐜伴樁娈碉紝鎴愰兘RC浠呭彈鐞嗗洓宸濓紙瑗胯棌锛夊唴闀溿�佽タ鍗楀叏鍩烠V/CLV锛屽叾浣欏疄鐗╄鍙戣嚦骞垮窞RC銆�");
+ }
}
- }
+ });
queryForRds({
recordId: this.Id,
}).then(rds => {
if (rds != null && rds.length > 0) {
var repairAft = rds[0];
- if (
- repairAft.NewProductGuarante_Formula__c != repairAft.ProductGuarante_Create__c
- ) {
+ if (repairAft.NewProductGuarante_Formula__c != repairAft.ProductGuarante_Create__c) {
alert("璇ヨ澶囦繚淇俊鎭凡鍙戠敓鍙樺寲锛岃浜嗚В");
}
}
});
- });
- } else {
- alert("娌℃湁鎵惧埌 淇悊濮旀墭鑰�");
- }
- });
+
+ } else {
+ alert("娌℃湁鎵惧埌 淇悊濮旀墭鑰�");
+ }
+ });
+ }
});
});
- // var staticResource;
- // getStaticResource({
- // sobj: "Repair__c"
- // }).then(result => {
- // console.log(result);
- // staticResource = JSON.parse(result);
+ var staticResource;
+ var DetailedAddress = this.detailedAddress;
- // window.AWSService.query(staticResource.queryUrl,
- // this.AWSDataId,
- // function (data) {
- // console.log(data);
- // if (data && data.object) {
- // DetailedAddress = data.object.detailedAddress;
- // }
- // this.foo();
- // },
- // staticResource.token)
- // })
+ getStaticResource({
+ sobj: "Repair__c"
+ }).then(result => {
+ console.log(result);
+ staticResource = JSON.parse(result);
+
+ AWSService.query(staticResource.queryUrl, this.AWSDataId, function (data) {
+ console.log(123);
+ console.log(data);
+ if (data && data.object) {
+ DetailedAddress = data.object.detailedAddress;
+ }
+ this.foo();
+ }, staticResource.token);
+ })
}
ShowToastEvent(msg, type) {
--
Gitblit v1.9.1