buli
2022-03-11 02ddc35714cbd1688b7cb057f770f1410de79dab
force-app/main/default/classes/ConsumTrialPDFController.cls
@@ -21,12 +21,17 @@
    public Integer consumApplySetDetailListSize { get; set; }  // 耗材备品总数量
    public String errorMsg { get; set; }  // 错误信息
    public string staticResource { get; private set; }
    public string BRSrc{get;private set;}
    public string QRSrc{get;private set;}
    public ConsumTrialPDFController() {
        targetConsumApplyId = ApexPages.currentPage().getParameters().get('id');
        if (String.isBlank(targetConsumApplyId)) {
            throw new ControllerUtil.myException('参数错误:请指定Id。');
        }
        pdfPageList = new List<PdfPageClass>();
        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Consum_Apply_Equipment_Set_Detail__c'));
    }
    /**
@@ -40,6 +45,10 @@
            ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.ERROR, errorMsg));
            return;
        }
        BRSrc = GetImageBase64(targetConsumApply.BRId__c);
        QRSrc = GetImageBase64(targetConsumApply.QRId__c);
        // 获取耗材备品配套一览明细
        List<Consum_Apply_Equipment_Set_Detail__c> targetConsumSetDetailList = getTargetConsumSetDetailList();
@@ -139,6 +148,7 @@
                     , Follower_User__r.Name
                     , Spare__c  // 备用
                     , Comment__c  // 备注
                     , AWS_Data_Id__c
                     , ManagementCode__c  // 管理编码 yc 耗材追溯
                     , EquipmentManagementCode__c  // 备品管理码 yc 耗材追溯
                  FROM Consum_Apply_Equipment_Set_Detail__c
@@ -207,4 +217,12 @@
            equipSetDetailList = new List<Consum_Apply_Equipment_Set_Detail__c>();
        }
    }
    public static string GetImageBase64(string id){
        List<Attachment> atts = [SELECT Id, IsDeleted, ParentId, Name, IsPrivate, ContentType, BodyLength, Body, OwnerId, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById, SystemModstamp, Description FROM Attachment where id=:id];
        if (atts.size()==0) {
            return null;
        }
        return 'data:image/png;base64,' + EncodingUtil.base64Encode(atts[0].body);
    }
}