import getStaticResource from "@salesforce/apex/ButtonJsUtility.getStaticResource";
|
import init from "@salesforce/apex/otherButtonRepairController.init";
|
import initList from "@salesforce/apex/otherButtonRepairController.initList";
|
import initSelectProfile from '@salesforce/apex/otherButtonRepairController.initSelectProfile';
|
import initUserName from '@salesforce/apex/otherButtonRepairController.initUserName';
|
import queryForEquipments from "@salesforce/apex/otherButtonRepairController.queryForEquipments";
|
import queryForFindInvalidLicense from "@salesforce/apex/otherButtonRepairController.queryForFindInvalidLicense";
|
import queryForRds from "@salesforce/apex/otherButtonRepairController.queryForRds";
|
import queryForReocrds from "@salesforce/apex/otherButtonRepairController.queryForReocrds";
|
import queryForRepairCount from "@salesforce/apex/otherButtonRepairController.queryForRepairCount";
|
import queryForUrfAsset from "@salesforce/apex/otherButtonRepairController.queryForUrfAsset";
|
import queryForUrfSeriesInfo from "@salesforce/apex/otherButtonRepairController.queryForUrfSeriesInfo";
|
import queryForrecords3 from "@salesforce/apex/otherButtonRepairController.queryForrecords3";
|
import updateRepair2 from "@salesforce/apex/otherButtonRepairController.updateRepair2";
|
import CeilingContractRepair from "@salesforce/apex/otherButtonRepairController.CeilingContractRepair";
|
//import AWSService from "@salesforce/resourceUrl/AWSService";
|
//import { AWSService } from 'c/piUtils'; //Deloitte-zhj PIPL解密 2023-08-23 //deloitte-zhj 20231123 PIPL还原
|
import { CloseActionScreenEvent} from "lightning/actions";
|
import { CurrentPageReference} from "lightning/navigation";
|
import { ShowToastEvent} from 'lightning/platformShowToastEvent';
|
import { LightningElement, api, wire} from "lwc";
|
|
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
|
import lexSendNfm103 from '@salesforce/resourceUrl/lexSendNfm103';
|
import {loadStyle} from 'lightning/platformResourceLoader'
|
import LightningConfirm from 'lightning/confirm';
|
|
import IFTradeComplianceAlert2 from '@salesforce/label/c.IFTradeComplianceAlert2'; // sx 贸易合规2期 add
|
import accSendEmailFW from '@salesforce/apex/buttonAssetCtl.accSendEmailFW';//wyl 贸易合规2期 add
|
|
export default class LexSendNFM103 extends LightningElement {
|
@api recordId;
|
dealer;
|
numberofEffectiveContract;
|
newProductGuaranteTxt;
|
onSiteRepair;
|
maintenanceContract;
|
VMMaintenanceContract;
|
FSEState;
|
dateReceiptQuestions;
|
delayReportReason;
|
repairSource;
|
quickRepairSign;
|
RCCD;
|
returnsProductway;
|
salesDeptHP;
|
isAohuiProduct;
|
stateHospital;
|
assetOwner;
|
deliveredProductId;
|
FSEApplyForRepairTime;
|
maintenanceContractId;
|
URFLimitSerial;
|
status;
|
dealerId;
|
ifDeadHurt;
|
dayLater30;
|
recallCorrespondence;
|
URFReapir;
|
inchargeStaffId;
|
DWSign;
|
DOJStatus;
|
SAPcondition;
|
salesOfficeCodeSelection;
|
profileId;
|
userId;
|
AWSDataId;
|
userName;
|
profileName;
|
Id;
|
DetailedAddress;
|
surplusCount = 0;
|
url;
|
HPActiveC;
|
tradeComplianceStatusFlagFW;
|
typeDeveloperName;
|
ifTradeComplianceIntercept;
|
ifTradeComplianceAlert;
|
HospitalC;
|
affiliationRC;
|
limitPrice;
|
//AWSService;//Deloitte-zhj PIPL解密 2023-08-23 //deloitte-zhj 20231123 PIPL还原
|
//staticResorceRepair; //Deloitte-zhj PIPL解密 2023-08-23 //deloitte-zhj 20231123 PIPL还原
|
records1;
|
administrator;
|
huyucheng;
|
liqiqing;
|
guoyang;
|
AccountName; // WYL 贸易合规2期 add
|
state; // WYL 贸易合规2期 add
|
Asset_Model_No; // WYL 贸易合规2期 add
|
ProTradeComplianceStatus;// WYL 贸易合规2期 add
|
repairLength = 0;
|
maintenanceFlag = false;
|
@wire(CurrentPageReference)
|
getStateParameters(currentPageReference) {
|
if (currentPageReference) {
|
this.url = currentPageReference.state.backgroundContext;
|
const urlValue = currentPageReference.state.recordId;
|
if (urlValue) {
|
let str = `${urlValue}`;
|
this.recordId = str;
|
}
|
}
|
}
|
|
connectedCallback() {
|
// debugger
|
Promise.all([
|
loadStyle(this, lwcCSS),
|
loadStyle(this, lexSendNfm103)
|
// ,
|
// loadScript(this, AWSService + '/AWSService.js'),
|
// loadScript(this, jqueryurl),
|
// loadScript(this, jq + "/dist/jquery.js"),
|
// loadScript(this, con),
|
// loadScript(this, apex),
|
// loadScript(this, common)
|
]);
|
//this.AWSService = new AWSService();//Deloitte-zhj PIPL解密 2023-08-23 //deloitte-zhj 20231123 PIPL还原
|
init({
|
recordId: this.recordId
|
}).then(result => {
|
console.log(result);
|
|
var btns = document.getElementsByName("send_nfm103");
|
for (var i = 0; i < btns.length; i++) {
|
btns[i].disabled = true;
|
btns[i].className = 'btnDisabled';
|
}
|
this.Id = result.Id;
|
this.HPActiveC = result.HPActiveC;
|
this.DetailedAddress = result.detailedAddress;
|
this.dealer = result.DealerC;
|
this.numberofEffectiveContract = result.numberofEffectiveContract;
|
this.newProductGuaranteTxt = result.newProductGuaranteTxt;
|
this.onSiteRepair = result.OnSiteRepairC;
|
this.maintenanceContract = result.maintenanceContract;
|
this.VMMaintenanceContract = result.VMMaintenanceContract;
|
this.FSEState = result.FSEState;
|
this.dateReceiptQuestions = result.DateReceiptQuestionsC;
|
this.delayReportReason = result.DelayReportReasonC;
|
this.repairSource = result.repairSource;
|
this.quickRepairSign = result.quickRepairSign;
|
this.RCCD = result.RCCD;
|
this.returnsProductway = result.ReturnsProductWayC;
|
this.salesDeptHP = result.salesDeptHP;
|
this.isAohuiProduct = result.isAohuiProduct;
|
this.stateHospital = result.stateHospital;
|
this.assetOwner = result.assetOwner;
|
this.deliveredProductId = result.deliveredProductId;
|
this.FSEApplyForRepairTime = result.FSEApplyForRepairTime;
|
this.maintenanceContractId = result.maintenanceContractId;
|
this.URFLimitSerial = result.URFLimitSerial;
|
this.status = result.status;
|
this.dealerId = result.dealerId;
|
this.ifDeadHurt = result.ifDeadHurtC;
|
this.dayLater30 = result.dayLater30;
|
this.recallCorrespondence = result.recallCorrespondence;
|
this.URFReapir = result.URFReapir;
|
this.inchargeStaffId = result.inchargeStaffId;
|
this.DWSign = result.DWSign;
|
this.DOJStatus = result.DOJStatus;
|
this.SAPcondition = result.SAPcondition;
|
this.salesOfficeCodeSelection = result.SalesOfficeCodeSelectionC;
|
this.profileId = result.profileId;
|
this.userId = result.userID;
|
this.AWSDataId = result.AWSDataId;
|
this.HospitalC = result.HospitalC;
|
this.AccountName = result.AccountName;// WYL 贸易合规2期 add
|
this.state = result.state; // WYL 贸易合规2期 add
|
this.Asset_Model_No = result.Asset_Model_No; // WYL 贸易合规2期 add
|
this.ProTradeComplianceStatus = result.ProTradeComplianceStatus; // WYL 贸易合规2期 add
|
this.tradeComplianceStatusFlagFW = result.tradeComplianceStatusFlagFW;
|
this.typeDeveloperName = result.typeDeveloperName;
|
this.ifTradeComplianceIntercept = result.ifTradeComplianceIntercept;
|
this.ifTradeComplianceAlert = result.ifTradeComplianceAlert;
|
this.affiliationRC = result.affiliationRC;
|
this.limitPrice = result.limitPrice;
|
this.records1 = result.sql;
|
//this.staticResorceRepair = JSON.parse(result.staticResourceRepair); //Deloitte-zhj PIPL解密 2023-08-23 //deloitte-zhj 20231123 PIPL还原
|
initList().then(res => {
|
console.log(res,'administrator--->>')
|
this.administrator = res.administrator;
|
this.huyucheng = res.huyucheng;
|
this.liqiqing = res.liqiqing;
|
this.guoyang = res.guoyang;
|
})
|
this.onefunction();
|
}).catch(error => {
|
console.log(error);
|
});
|
}
|
|
async onefunction(){
|
await initUserName({
|
userId: this.userId
|
}).then(result => {
|
if (result != null) {
|
this.IsLoading = false;
|
this.userName = result[0].Name;
|
}
|
})
|
|
await initSelectProfile({
|
profileId: this.profileId
|
}).then(result => {
|
if (result != null) {
|
this.IsLoading = false;
|
this.profileName = result[0].Name;
|
}
|
})
|
//deloitt-zhj 20231126 PIPL还原 start
|
this.nextfunction();
|
// let that = this
|
// var staticResource;
|
// await getStaticResource({
|
// sobj: "Repair__c"
|
// }).then(result => {
|
// staticResource = JSON.parse(result);
|
// console.log(staticResource,'staticResource');
|
// // debugger
|
// that.AWSService.query(staticResource.queryUrl,
|
// that.AWSDataId,
|
// function (data) {
|
// console.log('data zhj = ',data);
|
// if (data && data.object) {
|
// that.DetailedAddress = data.object.detailedAddress;
|
// }
|
// that.nextfunction();
|
// },staticResource.token);
|
// })
|
//deloitt-zhj 20231126 PIPL还原 end
|
}
|
|
async nextfunction() {
|
// debugger;
|
console.log('nextfunction方法------->>>');
|
//贸易合规 you
|
var TradeComplianceStatusFlagFW = this.tradeComplianceStatusFlagFW;//贸易合规开关
|
var IFTradeComplianceAlert = this.ifTradeComplianceAlert;//贸易合规提醒
|
console.log('贸易合规开关------->>>',TradeComplianceStatusFlagFW);
|
if (TradeComplianceStatusFlagFW) {
|
console.log('this.records1------------->>>',this.records1);
|
console.log('this.records1.length------------->>>',this.records1.length);
|
if (null != this.records1 && this.records1.length > 0) {
|
var flaginacc = false;
|
var flagindea = false;
|
var flagwaacc = false;
|
var flagwadea = false;
|
console.log('贸易合规------->>>',this.records1);
|
this.records1.forEach(item => {
|
var AccDealerBlacklist = item.IFTradeComplianceIntercept__c;//判断客户/经销商是否为黑名单
|
var recname = item.RecordType.DeveloperName;
|
console.log('AccDealerBlacklist------------->>>>>>',AccDealerBlacklist);
|
if(AccDealerBlacklist=='intercept'){
|
if(recname =='HP' && this.HospitalC !=null && this.HospitalC !=''){
|
flaginacc = true;
|
}
|
console.log('this.DealerC------------->>>>>>',this.dealer);
|
if (recname == 'Agency' && this.dealer != null && this.dealer != '') {
|
flagindea = true;
|
}
|
}
|
if (AccDealerBlacklist == 'WarningList') {
|
if (recname == 'HP' && this.HospitalC !=null && this.HospitalC !='') {
|
flagwaacc = true;
|
}
|
if (recname == 'Agency' && this.dealer != null && this.dealer != '') {
|
flagwadea = true;
|
}
|
}
|
});
|
console.log('flaginacc------------->>>',flaginacc);
|
console.log('flagindea------------->>>',flagindea);
|
console.log('flagwaacc------------->>>',flagwaacc);
|
console.log('flagwadea------------->>>',flagwadea);
|
|
if (flaginacc && flagindea) {
|
this.ShowToastEvent('您所选择的医院和经销商存在贸易合规风险,无法新建修理,' + IFTradeComplianceAlert, 'error');
|
this.dispatchEvent(new CloseActionScreenEvent());
|
this.SendEmailFW(this.AccountName,this.recordId,'1',this.state,null); // wyl 贸易合规2期 add
|
return;
|
} else if (flaginacc) {
|
this.ShowToastEvent('您所选择的医院存在贸易合规风险,无法新建修理,' + IFTradeComplianceAlert, 'error');
|
this.SendEmailFW(this.AccountName,this.recordId,'1',this.state,null);// wyl 贸易合规2期 add
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
} else if (flagindea) {
|
this.ShowToastEvent('您所选择的经销商存在贸易合规风险,无法新建修理,' + IFTradeComplianceAlert, 'error');
|
this.SendEmailFW(this.AccountName,this.recordId,'1',this.state,null);// wyl 贸易合规2期 add
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
|
|
// if (flagwaacc && flagwadea) {
|
// if (!this.handleConfirmClick('您所选择的医院和经销商存在贸易合规警示风险,是否继续申请修理,' + IFTradeComplianceAlert)) {
|
// return;
|
// }
|
// } else if (flagwaacc) {
|
// if (!this.handleConfirmClick('您所选择的医院存在贸易合规警示风险,是否继续申请修理,' + IFTradeComplianceAlert)) {
|
// return;
|
// }
|
// } else if (flagwadea) {
|
// if (!this.handleConfirmClick('您所选择的经销商存在贸易合规警示风险,是否继续申请修理,' + IFTradeComplianceAlert)) {
|
// return;
|
// }
|
// }else{
|
// this.nextOnefunction();
|
// }
|
// sx 贸易合规2期 start
|
if((flagwaacc || flagwadea) && this.ProTradeComplianceStatus == '0'){
|
this.SendEmailFW(this.AccountName,this.recordId,'8',this.state,this.Asset_Model_No);
|
if (!this.handleConfirmClick('您此次申请的业务可能存在贸易合规风险,是否继续申请,' + IFTradeComplianceAlert2 + '(一般需5-10个工作日)')) {
|
return;
|
} else{
|
this.nextOnefunction();
|
}
|
// sx 贸易合规2期 end
|
}else{
|
this.nextOnefunction();
|
}
|
}else{
|
this.nextOnefunction();
|
}
|
}else{
|
this.nextOnefunction();
|
}
|
|
|
}
|
// WYL 贸易合规2期 邮件 start
|
async SendEmailFW (Hospital,recordId,type,state,Asset_Model_No){
|
accSendEmailFW({
|
accname:Hospital,
|
mcid:recordId,
|
type:type,
|
state:state,
|
Asset_Model_No:Asset_Model_No
|
})
|
.then(result=>{
|
return;
|
}).catch(err=>{
|
console.log('邮件错误'+error);
|
})
|
}
|
// WYL 贸易合规2期 邮件 end
|
async nextOnefunction(){
|
|
if (this.HPActiveC == '無効') {
|
this.ShowToastEvent("本医院已无效,无法进行申请。", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
|
console.log('queryForrecords3------------>>>',queryForrecords3);
|
await queryForrecords3({
|
dealer: this.dealer
|
}).then(result => {
|
console.log('queryForrecords3---result------------>>>',result);
|
if (result.length > 0) {
|
console.log('result[0].FirstParagraph__c------->>>>>>',result[0].FirstParagraph__c);
|
if(result[0].FirstParagraph__c){
|
if (!this.handleConfirmClick01("该经销商为先款对象,是否继续申请修理?")) {
|
return;
|
}
|
}else{
|
console.log('进入----------false>>>>>>>>>');
|
this.thirdfunction();
|
}
|
//20231106 ymh 逻辑添加 end
|
}else{
|
this.thirdfunction();
|
}
|
});
|
|
}
|
|
async thirdfunction(){
|
//全国直送流程整期方案 20230607 LY start
|
console.log('设备,this.quickRepairSign,this.affiliationRC,this.onSiteRepair-------->>>>>>',this.quickRepairSign,this.affiliationRC,this.onSiteRepair);
|
console.log('this.maintenanceContract,this.VMMaintenanceContract -------->>>>>>',this.maintenanceContract,this.VMMaintenanceContract);
|
console.log( '判断-------->>>',this.quickRepairSign==false && this.affiliationRC != 'SHRC' && (this.onSiteRepair == '直送SORC修理' || this.onSiteRepair == '直送OGZ修理')
|
&& ((this.maintenanceContract != '' && this.maintenanceContract != null) || (this.VMMaintenanceContract != '' && this.VMMaintenanceContract != null)));
|
|
if ( this.quickRepairSign == false && this.affiliationRC == 'SHRC' && this.onSiteRepair == 'RC修理') {
|
if (!this.handleConfirmClick02("该设备选择RC修理,请确认是否继续进行?")) {
|
return;
|
}
|
}else if (this.quickRepairSign == false && this.affiliationRC != 'SHRC' && this.onSiteRepair == 'RC修理'
|
&& ((this.maintenanceContract != '' && this.maintenanceContract != null) || (this.VMMaintenanceContract != '' && this.VMMaintenanceContract != null))) {
|
if (!this.handleConfirmClick02("该设备为维修合同或多年保修对象品,选择RC修理,请确认是否继续进行?")) {
|
return;
|
}
|
}else if ( this.quickRepairSign == false && this.affiliationRC != 'SHRC'
|
&& (this.onSiteRepair == '直送SORC修理' || this.onSiteRepair == '直送OGZ修理')
|
&& ((this.maintenanceContract == '' || this.maintenanceContract == null) && (this.VMMaintenanceContract == '' || this.VMMaintenanceContract == null))) { //20231107 ymh 修改判断条件
|
if (!this.handleConfirmClick02("该设备为非维修合同或非多年保修对象品,选择直送工厂修理,请确认继续进行?")) {
|
return;
|
}
|
}else{
|
this.fourthfunction();
|
}
|
}
|
|
|
|
async fourthfunction(){
|
console.log(3);
|
var today = new Date();
|
today.setHours(0);
|
var dateReceiptQuestions = Date.parse(this.dateReceiptQuestions);
|
var dates = (today - dateReceiptQuestions) / (24 * 60 * 60 * 1000);
|
if (this.profileName != this.administrator && this.userName != this.huyucheng && this.userName != this.liqiqing &&
|
this.userName != this.guoyang && this.delayReportReason == undefined && dates > "1" && this.repairSource != "QIS转修理") {
|
this.ShowToastEvent("申请修理时SAP修理申请日超过问题联络收到日1天,必须填写问超时报告的理由", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
if (this.returnsProductway == undefined) {
|
if (!this.handleConfirmClick03("返品方式为空,是否继续申请修理!")) {
|
return;
|
}
|
}else{
|
this.fifthfunction();
|
}
|
|
}
|
|
async fifthfunction(){
|
console.log(6);
|
if (this.assetOwner != "Olympus") {
|
if (this.DetailedAddress != undefined) {
|
//deloitte-zhj 20231123 PIPL还原 start
|
if (!this.handleConfirmClick04("当前直返收货地址为:" + this.DetailedAddress +",您确认不修改了吗?")) {
|
return;
|
}
|
// //Deloitte-zhj PIPL解密 2023-08-23 start
|
// let that = this;
|
// // debugger;
|
// this.AWSService.query(this.staticResorceRepair.queryUrl, this.AWSDataId, function (data) {
|
// console.log('queryLeadFromAWSIFS data = ',data);
|
// if (data.object) {
|
// that.DetailedAddress = data.object['detailedAddress'];
|
// if (!that.handleConfirmClick04("当前直返收货地址为:" + that.DetailedAddress +",您确认不修改了吗?")) {
|
// return;
|
// }
|
// }else{
|
// that.DetailedAddress = data.object['detailedAddress'];
|
// if (!that.handleConfirmClick04("当前直返收货地址为:" + that.DetailedAddress +",您确认不修改了吗?")) {
|
// return;
|
// }
|
// }
|
// }, this.staticResorceRepair.token)
|
// //Deloitte-zhj PIPL解密 2023-08-23 end
|
//deloitte-zhj 20231123 PIPL还原 end
|
} else {
|
this.ShowToastEvent('当前修理没有录入直返收货的详细地址,不能申请修理!', "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
|
} else {
|
this.sixthfunction();
|
}
|
}
|
|
async sixthfunction() {
|
console.log(7);
|
await queryForEquipments({
|
deliveredProductId: this.deliveredProductId,
|
}).then(equipments => {
|
if (equipments != null && equipments.length > 0) {
|
var equipment = equipments[0];
|
if (equipment.Status == "廃棄") {
|
this.ShowToastEvent("设备废弃,不能提交申请!", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else{
|
this.sixthNextOnefunction();
|
}
|
}else{
|
this.sixthNextOnefunction();
|
}
|
});
|
}
|
|
async sixthNextOnefunction(){
|
console.log(701);
|
if (this.FSEApplyForRepairTime != undefined) {
|
this.ShowToastEvent("已修理申请,不再修理申请了", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
|
console.log(702);
|
//计算上限合同进行中的修理 LY 20230117 start
|
if (this.limitPrice == true) {
|
await CeilingContractRepair({ MaintenanceContractId: this.maintenanceContractId }).then(res => {
|
console.log(res, '<===res')
|
console.log('res.repairs.length----------->>>', res.repairs.length);
|
console.log('res.repairs----------->>>', res.repairs);
|
this.repairLength = res.repairs.length;
|
console.log('this.repairLength----------->>>', this.repairLength);
|
var remainingAmountM = 0;
|
|
if(res.maintenanceContract[0].PackageFlag__c){
|
remainingAmountM = res.maintenanceContract[0].Remaining_Amount_DB__c;
|
}else {
|
remainingAmountM = res.maintenanceContract[0].Remaining_Amount__c;
|
}
|
console.log('remainingAmountM----------->>>',remainingAmountM);
|
console.log('this.repairLength----------->>>', this.repairLength);
|
if (remainingAmountM <= 0) {
|
if (!this.handleConfirmClick05("合同的上限金额已用完,当前修理为合同外修理,是否继续?")) {
|
return;
|
}
|
}else if (this.repairLength > 1 && remainingAmountM <= 150000 && remainingAmountM > 0) {
|
this.ShowToastEvent("该设备关联上限合同,目前修理剩余金额小于15万。请等待进行中修理完成后再进行申请", 'error');
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
//计算上限合同进行中的修理 LY 20230117 end
|
}else{
|
this.sevenfunction();
|
}
|
})
|
}else{
|
this.sevenfunction();
|
}
|
}
|
|
async sevenfunction(){
|
console.log(703);
|
console.log('this.URFReapir-------->>>>>',this.URFReapir);
|
if (this.URFReapir) {
|
await 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;
|
this.surplusCount = seriesMaxRepairCount - seriesRepairCount;
|
}
|
});
|
console.log(703);
|
|
await queryForUrfSeriesInfo({
|
URFLimitSerial: this.URFLimitSerial,
|
}).then(urfSeriesInfo => {
|
var urfSeries = "";
|
if (urfSeriesInfo != null && urfSeriesInfo.length > 0) {
|
urfSeries = urfSeriesInfo[0].URFLimitSerial__c;
|
console.log(704);
|
var statusList = new Array()
|
statusList.push('00.申请完毕');
|
statusList.push('01.分公司受理完毕');
|
statusList.push('02.RC受理完毕');
|
statusList.push('03.报价检查结束');
|
statusList.push('04.报价跟进中');
|
queryForRepairCount({
|
maintenanceContractId: this.maintenanceContractId,
|
status1: statusList,
|
URFLimitSerial: urfSeries,
|
}).then(repairCount => {
|
if (repairCount.length > 1 && this.surplusCount == 1) {
|
this.ShowToastEvent("该设备关联限次合同,目前剩余次数小于送修设备。请等待进行中修理完成后再进行申请", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else{
|
this.sevenNextOnefunction();
|
}
|
});
|
}else{
|
this.sevenNextOnefunction();
|
}
|
});
|
}else{
|
this.sevenNextOnefunction();
|
}
|
|
}
|
|
async sevenNextOnefunction(){
|
console.log(705);
|
|
if (this.status != "草案中" && this.status != "1.受理完毕(SAP待发送)" && this.status != "4.修理品返送阶段") {
|
this.ShowToastEvent("不是草案中不能申请", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
} else {
|
if (this.dealer != undefined) {
|
await queryForFindInvalidLicense({
|
dealerId: this.dealerId,
|
}).then(findInvalidLicense => {
|
console.log(findInvalidLicense);
|
if (findInvalidLicense.length > 0) {
|
this.ShowToastEvent("经销商三证不在有效期,无法送修", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else{
|
this.eighthfunction();
|
}
|
});
|
}else{
|
this.eighthfunction();
|
}
|
}
|
}
|
|
async eighthfunction(){
|
var flag = true;
|
if (this.ifDeadHurt == "有") {
|
if (!this.handleConfirmClick06("是否确认AE要提交?")) {
|
// flag = false;
|
return;
|
}
|
} else{
|
this.ninthfunction();
|
}
|
|
}
|
async ninthfunction(){
|
if (this.dayLater30 == "是") {
|
// flag = false;
|
this.ShowToastEvent("创建后超过30天,不能申请了", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else{
|
this.tenthfunction();
|
}
|
}
|
|
async tenthfunction(){
|
if (this.URFReapir == true && this.surplusCount <= 0) {
|
if (!this.handleConfirmClick07("合同内大修次数已用完,当前修理为合同外的修理,是否继续?")) {
|
// flag = false;
|
return;
|
}
|
} else{
|
this.elevenfunction();
|
}
|
}
|
|
async elevenfunction() {
|
console.log(9);
|
console.log(901);
|
await queryForReocrds({
|
inchargeStaffId: this.inchargeStaffId,
|
}).then(records => {
|
if (records != null && records.length > 0) {
|
var staff = records[0];
|
console.log(staff);
|
console.log(902);
|
updateRepair2({
|
recordId: this.Id,
|
staff: staff,
|
DWSign: this.DWSign,
|
statusc: "1.受理完毕",
|
DOJStatus: this.DOJStatus,
|
SAPcondition: this.SAPcondition,
|
maintenanceFlag:this.maintenanceFlag
|
}).then(result => {
|
console.log(result);
|
console.log(903);
|
if (result != '1' ) {
|
console.log("updateRepair2----1"+result);
|
this.ShowToastEvent(result, "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
} else {
|
if (this.salesOfficeCodeSelection == "成都RC") {
|
this.ShowToastEvent("现阶段,成都RC仅受理四川(西藏)内镜、西南全域CV/CLV,其余实物请发至广州RC。", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
window.open(this.url, "_self");
|
}
|
console.log(904);
|
queryForRds({
|
recordId: this.Id,
|
}).then(rds => {
|
console.log(rds);
|
if (rds != null && rds.length > 0) {
|
var repairAft = rds[0];
|
if (repairAft.NewProductGuarante_Formula__c != repairAft.ProductGuarante_Create__c) {
|
this.ShowToastEvent("该设备保修信息已发生变化,请了解", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
}
|
});
|
}).catch(err=>{
|
console.log("updateRepair2----2"+err);
|
this.ShowToastEvent(err, "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
});
|
} else {
|
this.ShowToastEvent("没有找到 修理委托者", "error");
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
});
|
|
}
|
|
async handleConfirmClick(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
label: 'this is the aria-label value'
|
});
|
if (!result) {
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else{
|
this.nextOnefunction();
|
}
|
}
|
|
async handleConfirmClick01(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
label: 'this is the aria-label value'
|
});
|
if (!result) {
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
this.thirdfunction();
|
|
}
|
|
async handleConfirmClick02(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
});
|
if (!result) {
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
this.fourthfunction();
|
}
|
|
async handleConfirmClick03(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
label: 'this is the aria-label value'
|
});
|
if (!result){
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
this.fifthfunction();
|
}
|
|
async handleConfirmClick04(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
label: 'this is the aria-label value'
|
});
|
if (!result){
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
this.sixthfunction();
|
}
|
|
async handleConfirmClick05(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
label: 'this is the aria-label value'
|
});
|
if (!result) {
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}
|
this.sevenfunction();
|
}
|
|
async handleConfirmClick06(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
label: 'this is the aria-label value'
|
});
|
if (!result) {
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else{
|
this.ninthfunction();
|
}
|
}
|
|
async handleConfirmClick07(msg) {
|
const result = await LightningConfirm.open({
|
message: msg,
|
variant: 'headerless',
|
label: 'this is the aria-label value'
|
});
|
if (!result) {
|
this.dispatchEvent(new CloseActionScreenEvent());
|
return;
|
}else{
|
this.maintenanceFlag = true;
|
this.elevenfunction();
|
}
|
}
|
|
async ShowToastEvent(msg, type) {
|
if (type == 'success') {
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type
|
});
|
this.dispatchEvent(event);
|
} else {
|
const event = new ShowToastEvent({
|
message: msg,
|
variant: type,
|
mode: 'Sticky'
|
});
|
this.dispatchEvent(event);
|
}
|
}
|
|
|
}
|