unknown
2023-05-11 7cd5d7cecb0bc9fef2a34488e5dec8ba15b3e827
备品借出申请-出库指示

备品借出申请-出库指示(按钮)修改
2个文件已修改
144 ■■■■ 已修改文件
force-app/main/default/classes/loanerArrangedEmailController.cls 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/loanerArrangedEmailController.cls
@@ -1,9 +1,4 @@
public with sharing class loanerArrangedEmailController {
    public loanerArrangedEmailController() {
    }
public with sharing class LoanerArrangedEmailController {
    @AuraEnabled
    public static InitData init(String recordId) {
@@ -16,22 +11,22 @@
            if( rac.Campaign__c != null ){
                //获取学会对象
                Campaign camp = [select Id, Status, Rental_Apply_Flag__c,IF_Approved__c,Approved_Status__c, Meeting_Approved_No__c from Campaign where id = :rac.Campaign__c];
                res.CampaignId = camp.Id;
                res.CampaignStatus = camp.Status;
                res.IFApproved = camp.IF_Approved__c;
                res.MeetingApprovedNo = camp.Meeting_Approved_No__c;
                res.ApprovedStatus = camp.Approved_Status__c;
                res.campaignId = camp.Id;
                res.campaignStatus = camp.Status;
                res.iFApproved = camp.IF_Approved__c;
                res.meetingApprovedNo = camp.Meeting_Approved_No__c;
                res.approvedStatus = camp.Approved_Status__c;
            }   
            res.Id = recordId;
            res.RaStatus = rac.Status__c;
            res.WeiAssignedCnt = Integer.valueOf(rac.Wei_Assigned_Cnt__c);
            res.AssignedNotShipment = Integer.valueOf(rac.Assigned_Not_Shipment__c);
            res.DemoPurpose1 = rac.Demo_purpose1__c;
            res.ContractPdfUpdated = rac.Contract_pdf_updated__c;
            res.RepairId = rac.Repair__c;
            res.RepairFinalInspectionDateF = rac.Repair_Final_Inspection_Date_F__c;
            res.RCReturnToOffice = rac.RC_return_to_office__c;
            res.StatusList = status;
            res.id = recordId;
            res.raStatus = rac.Status__c;
            res.weiAssignedCnt = Integer.valueOf(rac.Wei_Assigned_Cnt__c);
            res.assignedNotShipment = Integer.valueOf(rac.Assigned_Not_Shipment__c);
            res.demoPurpose1 = rac.Demo_purpose1__c;
            res.contractPdfUpdated = rac.Contract_pdf_updated__c;
            res.repairId = rac.Repair__c;
            res.repairFinalInspectionDateF = rac.Repair_Final_Inspection_Date_F__c;
            res.rCReturnToOffice = rac.RC_return_to_office__c;
            res.statusList = status;
        }
        catch (Exception e) {
            System.debug(LoggingLevel.INFO, '****e:' + e);
@@ -62,34 +57,34 @@
    public class InitData{
        @AuraEnabled
        public String Id;
        public String id;
        @AuraEnabled
        public String CampaignStatus;    //学会状态
        public String campaignStatus;    //学会状态
        @AuraEnabled
        public String CampaignId;    //学会Id
        public String campaignId;    //学会Id
        @AuraEnabled
        public String RaStatus;        //备品借出申请状态
        public String raStatus;        //备品借出申请状态
        @AuraEnabled
        public Integer WeiAssignedCnt;        //未分配件数  Wei_Assigned_Cnt__c
        public Integer weiAssignedCnt;        //未分配件数  Wei_Assigned_Cnt__c
        @AuraEnabled
        public Integer AssignedNotShipment;    //已分配未出库指示  Assigned_Not_Shipment__c
        public Integer assignedNotShipment;    //已分配未出库指示  Assigned_Not_Shipment__c
        @AuraEnabled
        public String DemoPurpose1;            //使用目的1     Demo_purpose1__c
        public String demoPurpose1;            //使用目的1     Demo_purpose1__c
        @AuraEnabled
        public Boolean ContractPdfUpdated;    //合同书已上传    Contract_pdf_updated__c
        public Boolean contractPdfUpdated;    //合同书已上传    Contract_pdf_updated__c
        @AuraEnabled
        public String RepairId;                //学会.修理Id
        public String repairId;                //学会.修理Id
        @AuraEnabled
        public Date RepairFinalInspectionDateF;        //修理最终检测日F      Repair_Final_Inspection_Date_F__c
        public Date repairFinalInspectionDateF;        //修理最终检测日F      Repair_Final_Inspection_Date_F__c
        @AuraEnabled
        public Date RCReturnToOffice;        //RC修理品返送日        RC_return_to_office__c
        public Date rCReturnToOffice;        //RC修理品返送日        RC_return_to_office__c
        @AuraEnabled
        public Boolean IFApproved;            //学会.是否需要申请决裁
        public Boolean iFApproved;            //学会.是否需要申请决裁
        @AuraEnabled
        public String MeetingApprovedNo;    //学会.会议决裁编码
        public String meetingApprovedNo;    //学会.会议决裁编码
        @AuraEnabled
        public String ApprovedStatus;        //学会.决裁状态    Approved_Status__c
        public String approvedStatus;        //学会.决裁状态    Approved_Status__c
        @AuraEnabled
        public List<String> StatusList;
        public List<String> statusList;
    }
}
force-app/main/default/lwc/lexLoanerArrangedEmail/lexLoanerArrangedEmail.js
@@ -1,6 +1,8 @@
import { LightningElement, track, wire, api } from 'lwc';
import { CurrentPageReference,NavigationMixin } from 'lightning/navigation';
import { CloseActionScreenEvent } from 'lightning/actions';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { updateRecord } from 'lightning/uiRecordApi';
import init from '@salesforce/apex/loanerArrangedEmailController.init';
import getRentalApplyEquipmentSet from '@salesforce/apex/loanerArrangedEmailController.getRentalApplyEquipmentSet';
@@ -25,49 +27,50 @@
        init({
            recordId: this.recordId
        }).then(result => {
            console.log(this.recordId);
            let statusArr = result.statusList;
            console.log('result==='+JSON.stringify(result));
            if(result != null) {
                if( result.WeiAssignedCnt > 0 ) {
                    alert("申请单内存在未分配的配套,请分配备品或分割申请单");
                }else if(result.CampaignStatus == "取消") {
                    alert("学会取消,不可出库指示");
                }else if (result.RaStatus == "已出库指示" && result.AssignedNotShipment == 0){
                    alert("所有的借出备品Set一览都进行过出库指示了");
                }else if (result.AssignedNotShipment == 0) {
                    alert("没有可以出库指示的明细");
                }else if (result.DemoPurpose1 == "长期借出" && result.ContractPdfUpdated == 0){
                    alert("长期借出时,必须先上传契约书");
                }else if (result.RepairId != '' && (result.RepairFinalInspectionDateF != null && result.RepairFinalInspectionDateF != '') || (result.RCReturnToOffice != null && result.RCReturnToOffice != '')){
                    alert("修理有最终检测日或修理品返送日,不可出库指示");
                }else if (result.IFApproved == "true" && (result.MeetingApprovedNo == null || result.MeetingApprovedNo == "")){
                    alert("没有决裁号的,暂不能出借,请更新裁决信息。");
                }else if (result.IFApproved == "true" && result.MeetingApprovedNo != "" && result.StatusList.indexOf(records[0].Approved_Status__c) != -1){
                    alert("已申请决裁但决裁状态不符合条件。");
                }else {
                if( result.weiAssignedCnt > 0 ) {
                    this.showToast("申请单内存在未分配的配套,请分配备品或分割申请单",'error');
                }else if(result.campaignStatus == "取消") {
                    this.showToast("学会取消,不可出库指示",'error');
                }else if (result.raStatus == "已出库指示" && result.assignedNotShipment == 0){
                    this.showToast("所有的借出备品Set一览都进行过出库指示了",'error');
                }else if (result.assignedNotShipment == 0) {
                    this.showToast("没有可以出库指示的明细",'error');
                }else if (result.demoPurpose1 == "长期借出" && result.contractPdfUpdated == false){
                    this.showToast("长期借出时,必须先上传契约书",'error');
                }else if (result.repairId != '' && (result.repairFinalInspectionDateF != null && result.repairFinalInspectionDateF != '') || (result.rCReturnToOffice != null && result.rCReturnToOffice != '')){
                    this.showToast("修理有最终检测日或修理品返送日,不可出库指示",'error');
                }else if (result.iFApproved == true && (result.meetingApprovedNo == null || result.meetingApprovedNo == "")){
                    this.showToast("没有决裁号的,暂不能出借,请更新裁决信息。",'error');
                }else if (result.iFApproved == true && result.meetingApprovedNo != "" && statusArr.indexOf(result.approvedStatus) != -1){
                    this.showToast("已申请决裁但决裁状态不符合条件。",'error');
                }else{
                    approvalCheck({
                        rentalApplyId: this.recordId
                    }).then(res=>{
                        if (res != '1') {
                            alert(rs1);
                        } else {
                    }).then(res1 =>{
                        if (res1 != '1') {
                            this.showToast(res1,'error');
                        }else{
                            //bp2 var rs2 = sforce.apex.execute("RentalApplyWebService", "reserve", {rentalApplyId: raid});
                            //bp2 if (rs2 != '1') {
                            //bp2 alert(rs2);
                            //bp2 } else {
                            //var rs1 = sforce.apex.execute("RentalApplyWebService", "setShipment_request", {raid : "{!Rental_Apply__c.Id}"}); 
                            console.log('setShipment_request==');
                            setShipment_request({
                                raid: this.recordId
                            }).then(res=>{
                                if (res == "状态更新到已出库指示") {
                                    alert("状态更新到已出库指示");
                                console.log('res==',res);
                                if (res == "状态更新到已出库指示") {
                                    this.showToast("状态更新到已出库指示",'success');
                                    print();
                                    setTimeout(function() {
                                        location.href = "/{!Rental_Apply__c.Id}";
                                    },100);
                                    // setTimeout(function() {
                                    //     location.href = "/{!Rental_Apply__c.Id}";
                                    // },100);
                                }else {
                                    alert(res);
                                    this.showToast(res,'error');
                                }
                            }).catch(e=>{
                                console.log('approvalCheck==='+e);
@@ -99,4 +102,20 @@
        var Seconds = fixTime(date.getSeconds());
        return date.getFullYear() + "-" + Month + "-" + Day + "T" + Time;
    }
    showToast(msg,type) {
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        if(type == 'success'){
            this.updateRecordView();
        }
        this.dispatchEvent(event);
        this.dispatchEvent(new CloseActionScreenEvent());
    }
    updateRecordView(recordId) {
        updateRecord({fields: { Id: recordId }});
    }
}