force-app/main/default/classes/buttonQISReportCtl.cls
New file @@ -0,0 +1,162 @@ public with sharing class buttonQISReportCtl { public buttonQISReportCtl() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ QIS_Report__c report = [SELECT QIS_Status__c,PAE_DetermineAC__c,AE_DetermineResult__c,ETQ_UPLOAD_STATUS__c,QIS_final_judgement__c,OCM_judgement__c,PAE_Determine__c,Id FROM QIS_Report__c WHERE Id =: recordId LIMIT 1]; res.PAEDetermineC = report.PAE_Determine__c; res.PAEDetermineACC = report.PAE_DetermineAC__c; res.OCMJudgementC = report.OCM_judgement__c; res.QISFinalJudgementC = report.QIS_final_judgement__c; res.ETQUPLOADSTATUSC = report.ETQ_UPLOAD_STATUS__c; res.AEDetermineResultC = report.AE_DetermineResult__c; res.Id = report.Id; res.QISStatusC = report.QIS_Status__c; res.userId = UserInfo.getUserId(); res.email = UserInfo.getUserEmail(); res.profileId = UserInfo.getProfileId(); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 根据ID修理报价提交 @AuraEnabled public static String updateOSHNogoods(String Id,String email,String userId){ List<User> user = new List<User>(); user = [SELECT Id,Alias from User]; String res =''; try { QIS_Report__c rac = new QIS_Report__c(); rac.Id = Id; rac.QIS_Status__c = 'OSH检测中'; rac.OSHRecievedDate__c = Date.today(); rac.OSH_Receive_staff__c = user[0].Alias; rac.OSH_staff__c = user[0].Alias; rac.OSH_staff_email__c = email; rac.Is_ProductGot__c = true; rac.OSH_GotProductPeople__c = userId; List<User> records = new List<User>(); records = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id=: userId ]; if (records != null && records.size() > 0 && records[0].JingliApprovalManager__c != null&& records[0].BuchangApprovalManager__c != null) { rac.OSH_Manager__c= records[0].JingliApprovalManager__c; rac.OSH_Buzhang__c= records[0].BuchangApprovalManager__c; } else { rac.OSH_Manager__c= userId; rac.OSH_Buzhang__c= userId; } rac.OSHInspectionDate__c = Date.today(); rac.OSH_Nogoods__c = true; update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); res = e.getMessage(); } return res; } @AuraEnabled public static String sendToETQ(String iflog_Id,BatchIF_Log__c rowDataSFDC, List<String> repairIds,String statu){ List<QIS_Report__c> temp = [select id from QIS_Report__c where id in :repairIds ]; if(temp != null && temp.size() > 0){ try { Database.executeBatch(new QISToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu),50); //生成PDF } catch (Exception e) { return '更新QIS报错:'+ e.getMessage(); } }else{ BatchIF_Log__c iflog = new BatchIF_Log__c(); iflog.Type__c = 'sendToETQ'; iflog.ErrorLog__c = ''; iflog.Log__c = 'NFM401WebService start--'; Repair__c updateRe = new Repair__c(); updateRe.Id = repairIds[0]; updateRe.INTERFACE_RECORD_ID__c = null; updateRe.ETQ_UPLOAD_STATUS__c = null; updateRe.ETQ_UPLOAD_MESSAGE__c = null; updateRe.OSH_ConfirmationDate__c = Date.today(); updateRe.OSH_Affirmant__c = UserInfo.getUserId(); updateRe.AWS_Interface_Time__c = Datetime.now(); updateRe.AsyncData__c = true; try{ update updateRe; Database.executeBatch(new RepairToPDFBatch(iflog_Id, rowDataSFDC,repairIds,statu)); //生成PDF iflog.Log__c += '\n修理:'+updateRe+' 更新成功'; iflog.Log__c = '\nNFM401WebService end--'; insert iflog; }catch(Exception ex){ iflog.ErrorLog__c += '修理:'+updateRe+' 更新失败,因为::'+ex.getMessage(); iflog.Log__c = '\nNFM401WebService end--'; insert iflog; return '更新修理报错:'+ ex.getMessage(); } } return '发送成功!'; } // 根据ID修理报价提交 @AuraEnabled public static void updateQISReportC(String QId,String uid){ try { QIS_Report__c rac = new QIS_Report__c(); rac.Id = QId; rac.INTERFACE_RECORD_ID__c = null; rac.ETQ_UPLOAD_STATUS__c = null; rac.ETQ_UPLOAD_MESSAGE__c = null; rac.AsyncData__c = true; rac.AWS_Interface_Time__c = Datetime.now(); rac.OSH_ConfirmationDate__c = Date.today(); rac.OSH_Affirmant__c = uid; update rac; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } // 根据ID修理报价提交 @AuraEnabled public static List<QIS_Report__c> selectQISReportC(String QId){ List<QIS_Report__c> res = new List<QIS_Report__c>(); try { res = [SELECT Id,AsyncData__c,Complaint_Number__c,ETQ_UPLOAD_STATUS__c from QIS_Report__c where Id=: QId ]; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String QISStatusC; @AuraEnabled public String userId; @AuraEnabled public String email; @AuraEnabled public String profileId; @AuraEnabled public String PAEDetermineC; @AuraEnabled public String PAEDetermineACC; @AuraEnabled public String OCMJudgementC; @AuraEnabled public String QISFinalJudgementC; @AuraEnabled public String ETQUPLOADSTATUSC; @AuraEnabled public String AEDetermineResultC; } } force-app/main/default/classes/buttonQISReportCtl.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/buttonQISSCReportCtl.cls
New file @@ -0,0 +1,41 @@ public with sharing class buttonQISSCReportCtl { public buttonQISSCReportCtl() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ QIS_SC_Report__c report = [SELECT Status__c,Id FROM QIS_SC_Report__c WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.Id = report.Id; res.StatusC = report.Status__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } // 根据ID修改QIS市场部 @AuraEnabled public static void updateQISSCReport(String Id){ try { QIS_SC_Report__c qis_Sc = new QIS_SC_Report__c(); qis_Sc.Id = Id; qis_Sc.Status__c = '已提交'; update qis_Sc; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); } } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String StatusC; } } force-app/main/default/classes/buttonQISSCReportCtl.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/buttonRepairQuotationCtl.cls
@@ -7,10 +7,13 @@ public static InitData init(String recordId){ InitData res = new initData(); try{ Repair_Quotation__c report = [SELECT Id,CutPriceStatus_Service__c FROM Repair_Quotation__c WHERE Id =: recordId LIMIT 1]; Repair_Quotation__c report = [SELECT Repair__c,Loaner_repair_sys__c,Rental_Apply_Discount_Status__c,Id,CutPriceStatus_Service__c FROM Repair_Quotation__c WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.RepairC = report.Repair__c; res.LoanerRepairSysC = report.Loaner_repair_sys__c; res.Id = report.Id; res.CutPriceStatusServiceC = report.CutPriceStatus_Service__c; res.RentalApplyDiscountStatusC = report.Rental_Apply_Discount_Status__c; res.profileId = UserInfo.getProfileId(); System.debug(LoggingLevel.INFO, '*** res: ' + res); @@ -51,6 +54,50 @@ return res; } // 根据ID修理报价提交 @AuraEnabled public static String updateRepairQuotation03(String recordId){ String res =''; try { Repair_Quotation__c repair = new Repair_Quotation__c(); repair.Id = recordid; repair.Rental_Apply_Discount_Status__c = '已提交'; update repair; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); res = e.getMessage(); } return res; } // 根据ID修理报价提交 @AuraEnabled public static String updateRepairQuotation04(String recordId){ String res =''; try { Repair_Quotation__c repair = new Repair_Quotation__c(); repair.Id = recordid; repair.Repair_quotation_status__c = '减价申请填写完毕'; update repair; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); res = e.getMessage(); } return res; } // 查找修理 @AuraEnabled public static List<Repair__c> selectRepairC(String recordId){ List<Repair__c> res = new List<Repair__c>(); try{ res = [SELECT Id, Return_Without_Repair__c, Return_Without_Repair_IF__c FROM Repair__c WHERE Id=: recordId ]; }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } public class InitData{ @AuraEnabled public String Id; @@ -58,5 +105,11 @@ public String CutPriceStatusServiceC; @AuraEnabled public String profileId; @AuraEnabled public String RentalApplyDiscountStatusC; @AuraEnabled public Boolean LoanerRepairSysC; @AuraEnabled public String RepairC; } } force-app/main/default/classes/buttonRepairSubOrderCtl.cls
New file @@ -0,0 +1,28 @@ public with sharing class buttonRepairSubOrderCtl { public buttonRepairSubOrderCtl() { } @AuraEnabled public static InitData init(String recordId){ InitData res = new initData(); try{ RepairSubOrder__c report = [SELECT Id,Status__c FROM RepairSubOrder__c WHERE Id =: recordId LIMIT 1]; System.debug(LoggingLevel.INFO, '*** opp: ' + report); res.Id = report.Id; res.StatusC = report.Status__c; System.debug(LoggingLevel.INFO, '*** res: ' + res); }catch(Exception e){ System.debug(LoggingLevel.INFO, '*** e: ' + e); } return res; } public class InitData{ @AuraEnabled public String Id; @AuraEnabled public String StatusC; } } force-app/main/default/classes/buttonRepairSubOrderCtl.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>56.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/otherButtonRepairController.cls
@@ -141,7 +141,8 @@ // 根据ID修改修理 @AuraEnabled public static void updateRepair(String recordId){ public static String updateRepair(String recordId){ String res; try { Repair__c repair = new Repair__c(); repair.Id = recordid; @@ -149,7 +150,9 @@ update repair; } catch (Exception e) { System.debug(LoggingLevel.INFO, '*** e: ' + e); res=e.getMessage(); } return res; } // 修改验收单 force-app/main/default/lwc/lexCopyPIOnCall/__tests__/lexCopyPIOnCall.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexCopyPIOnCall from 'c/lexCopyPIOnCall'; describe('c-lex-copy-pi-on-call', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-copy-pi-on-call', { is: LexCopyPIOnCall }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexCopyPIOnCall/lexCopyPIOnCall.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexCopyPIOnCall/lexCopyPIOnCall.js
New file @@ -0,0 +1,52 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/buttonOnCallCtl.init'; export default class LexCopyPIOnCall extends LightningElement { @api recordId; str; IsLoading = true; Id; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.CopyPI(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }) } //复制 CopyPI() { window.location.href = '/' + this.Id + '/e?newclone=1'; } } force-app/main/default/lwc/lexCopyPIOnCall/lexCopyPIOnCall.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <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> force-app/main/default/lwc/lexCustomDelete/lexCopyRepair.html
New file @@ -0,0 +1,6 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexCustomDelete/lexCustomDelete.js
@@ -12,7 +12,9 @@ import init from '@salesforce/apex/otherButtonRepairController.init'; import selectCustomDeleteById from '@salesforce/apex/otherButtonRepairController.selectCustomDeleteById'; import deleteRepair from '@salesforce/apex/otherButtonRepairController.deleteRepair'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexCustomDelete extends LightningElement { @api recordId; @@ -63,13 +65,13 @@ rp.Status__c != "1.受理完毕(SAP待发送)" && rp.Status__c != "4.修理品返送阶段" ) { alert("不是草案中,不能删除"); this.ShowToastEvent("不是草案中,不能删除", "error") } else if (rp.Status__c == "4.修理品返送阶段" && (rp.SAP_Transfer_time__c != "" || rp.Repair_Ordered_Date__c != "") (rp.SAP_Transfer_time__c != undefined || rp.Repair_Ordered_Date__c != undefined) ) { alert("已经发送过SAP,不能删除"); this.ShowToastEvent("已经发送过SAP,不能删除", "error") } else if (this.userID.substring(0, 15) != rp.CreatedById.substring(0, 15) && this.userID.substring(0, 15) != rp.Acc_OwnerId__c.substring(0, 15) && this.userID.substring(0, 15) != rp.FSE_ownerid__c.substring(0, 15)) { alert("不是所有人、创建人或FSE主负责人,不能删除"); this.ShowToastEvent("不是所有人、创建人或FSE主负责人,不能删除", "error") } else { if (confirm("是否确定?")) { deleteRepair({ @@ -86,4 +88,13 @@ } }) } ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexOSHNogoods/__tests__/lexOSHNogoods.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexOSHNogoods from 'c/lexOSHNogoods'; describe('c-lex-osh-nogoods', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-osh-nogoods', { is: LexOSHNogoods }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.html
New file @@ -0,0 +1,6 @@ <template> <div class="toReportHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> <lightning-button label="Show Toast" onclick={ShowToastEvent}></lightning-button> </div> </template> force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js
New file @@ -0,0 +1,90 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/buttonQISReportCtl.init'; import updateOSHNogoods from '@salesforce/apex/buttonQISReportCtl.updateOSHNogoods'; import { ShowToastEvent } from 'lightning/platformShowToastEvent'; export default class LexOSHNogoods extends LightningElement { @api recordId; str; IsLoading = true; Id; QISStatusC; userId; email; @wire(CurrentPageReference) getStateParameters(currentPageReference) { if (currentPageReference) { const urlValue = currentPageReference.state.recordId; if (urlValue) { let str = `${urlValue}`; this.recordId = str; } } } connectedCallback() { init({ recordId: this.recordId }).then(result => { console.log(result); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.QISStatusC = result.QISStatusC; this.userId = result.userId; this.email = result.email; this.OSHNogoods(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }) } // 减价申请 OSHNogoods() { if (this.QISStatusC != 'OSH检测申请' && this.QISStatusC != '完毕') { this.ShowToastEvent("OSH已经收到实物", "error") // alert('OSH已经收到实物'); } else { updateOSHNogoods({ Id: this.Id, email: this.email, userId: this.userId }).then(result => { console.log(result); if (result.length > 0) { var split = result.split(", "); alert(split[1]); } location.reload(); }).catch(error => { console.log(error); }) } } // 弹窗 ShowToastEvent(msg, type) { const event = new ShowToastEvent({ title: '', message: msg, variant: type }); this.dispatchEvent(event); } } force-app/main/default/lwc/lexOSHNogoods/lexOSHNogoods.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <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> force-app/main/default/lwc/lexSelectAssetsMaintenance/__tests__/lexSelectAssetsMaintenance.test.js
New file @@ -0,0 +1,25 @@ import { createElement } from 'lwc'; import LexSelectAssetsMaintenance from 'c/lexSelectAssetsMaintenance'; describe('c-lex-select-assets-maintenance', () => { afterEach(() => { // The jsdom instance is shared across test cases in a single file so reset the DOM while (document.body.firstChild) { document.body.removeChild(document.body.firstChild); } }); it('TODO: test case generated by CLI command, please fill in test logic', () => { // Arrange const element = createElement('c-lex-select-assets-maintenance', { is: LexSelectAssetsMaintenance }); // Act document.body.appendChild(element); // Assert // const div = element.shadowRoot.querySelector('div'); expect(1).toBe(1); }); }); force-app/main/default/lwc/lexSelectAssetsMaintenance/lexSelectAssetsMaintenance.html
New file @@ -0,0 +1,5 @@ <template> <div class="exampleHolder" if:true={IsLoading}> <lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> </div> </template> force-app/main/default/lwc/lexSelectAssetsMaintenance/lexSelectAssetsMaintenance.js
New file @@ -0,0 +1,53 @@ import { LightningElement, wire, api } from 'lwc'; import { CurrentPageReference } from "lightning/navigation"; import { CloseActionScreenEvent } from 'lightning/actions'; import init from '@salesforce/apex/otherButtonMaintenanceContractCtl.init'; export default class LexSelectAssetsMaintenance extends LightningElement { @api recordId; str; IsLoading = true; Id; @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); if (result != null) { this.IsLoading = false; this.Id = result.Id; this.SelectAssets(); this.dispatchEvent(new CloseActionScreenEvent()); } }).catch(error => { console.log(error); }) } // サービス契約対象製品登録 SelectAssets() { window.open("/apex/SelectAsset?targetContractId=" + this.Id, "_top"); } } force-app/main/default/lwc/lexSelectAssetsMaintenance/lexSelectAssetsMaintenance.js-meta.xml
New file @@ -0,0 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <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> force-app/main/default/lwc/lexcopyQIS/lexcopyQIS.js
@@ -1,9 +1,7 @@ import { LightningElement,wire,track,api} from 'lwc'; import { LightningElement,wire,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.initForlexcopyQISButton'; @@ -17,15 +15,10 @@ @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; } } @@ -54,8 +47,6 @@ this.dispatchEvent(new CloseActionScreenEvent()); }).catch(error => { console.log('error='+error); }).finally(() => { }); }) } }