19626
2023-10-31 fd9df05c48c09b4d7f39a3b401882bda226dedea
近期修改
6个文件已添加
69个文件已修改
5231 ■■■■ 已修改文件
force-app/main/default/classes/Add_Report.cls 59 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Add_ReportTest.cls 460 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/AssetMaintainController.cls 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/AssetMaintainControllerTest.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/AssetModifyBelongsController.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/AttachmentTriggerTest.cls 142 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BatchSelectRepairPDFDelete.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BidAnnounceIframeController.cls 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BidAnnounceIframeControllerTest.cls 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/BidAnnounceIframeControllerTest.cls-meta.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/CheckAllOlympusAssetController.cls 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ConsumTrialPDFController.cls 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ContentDocumentTriggerTest.cls 1009 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ContentDocumentTriggerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/GuaranteePeriodAlterationController.cls 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InsReportPDFOuterController.cls 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryReportController.cls 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/InventoryResultRecordController.cls 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/MaintenanceProductDataController.cls 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/MaintenanceUpdateProductHandler.cls 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM401Controller.cls 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM401ControllerTest.cls 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM603Controller.cls 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM603ControllerTest.cls 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM609FiledDownloadBatch.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NotetoPdfHandler.cls 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NotetoPdfHandlerTest.cls 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OCMManagementProvinceBatchTest.cls 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSUploadImageRest.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OFSUploadRepairImageRest.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OPDNoReportApplicationController.cls 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OPDPlanHandlerTest.cls 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OPDPlanHandlerTest.cls-meta.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OpportunityLightingButtonController.cls 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/OpportunityService.cls 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalApplyFaultHandlerTest.cls 735 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RentalApplyFaultHandlerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RepairAndQISToPDFController.cls 456 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RepairAndQISToPDFControllerTest.cls 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/RepairHandlerTest.cls 168 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ReportController.cls 366 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/XinDailyReportControllerTest.cls 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignAgencyConfirmPageController.cls 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignAgencyPageController.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignFormAttachmentController.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignHospitalConfirmController.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/eSignHospitalPageController.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLostCancelReportController.cls 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexLostCancelReportControllerTest.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexOpportunitySpecialApplyController.cls 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexPCLLostReportLwcController.cls 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSolutionProgrammeController.cls 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexLookupLwc/lexLookupLwc.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js 390 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/relevant/relevant.html 180 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/relevant/relevant.js 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tBidding/tBidding.js 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tEnquiry/tEnquiry.html 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tEnquiry/tEnquiry.js 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tenderDeletePage/tenderDeletePage.html 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tenderDeletePage/tenderDeletePage.js 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tenderDeletePage/tenderDeletePagea.css 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tenderDeletePage/tnederDeletePage.css 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/tenderLost/tenderLost.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/AssetMaintain.page 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/CheckAllOlympusAsset.page 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/MaintenanceProductDataManage.page 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentLink.trigger 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/triggers/ContentDocumentTrigger.trigger 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/Add_Report.cls
@@ -5,9 +5,7 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
        //kk p课题需要 实施人5从查找变为文本字段
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Comment__c from Report__c where id =:reportId];
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
      if (rList.size() > 0) {
        return rList.get(0).id;
      }
@@ -43,9 +41,9 @@
    if(visitor4 != null && visitor4 != ''){
      r.Practitioner4__c = visitor4;
    }
    // if(visitor5 != null && visitor5 != ''){
    //   r.Practitioner5__c = visitor5;
    // }
    if(visitor5 != null && visitor5 != ''){
      r.Practitioner5__c = visitor5;
    }
    r.Comment__c = description;
    upsert r;
@@ -66,9 +64,7 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
      //康康p课题需要修改字段类型 后续跟进(Opportunity5__c变为文本类型字段)
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c from Report__c where id =:reportId];
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c from Report__c where id =:reportId];
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Opportunity1__c, Opportunity2__c, Opportunity3__c, Opportunity4__c, Opportunity5__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
@@ -105,9 +101,9 @@
    if(visitor4 != null && visitor4 != ''){
      r.Practitioner4__c = visitor4;
    }
    // if(visitor5 != null && visitor5 != ''){
    //   r.Practitioner5__c = visitor5;
    // }
    if(visitor5 != null && visitor5 != ''){
      r.Practitioner5__c = visitor5;
    }
    List<String> oppIdList = new List<String>();
    if(opp1 != null && opp1 != ''){
@@ -136,7 +132,6 @@
      if(opp3 != null && opp3 != ''){
        r.Opportunity3__c = opp3;
      }
    //康康p课题需要修改字段类型 后续跟进
      if(opp4 != null && opp4 != ''){
        r.Opportunity4__c = opp4;
      }
@@ -171,8 +166,7 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, From__c, To__c, Location__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, From__c, To__c, Location__c from Report__c where id =:reportId];
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, From__c, To__c, Location__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
@@ -205,9 +199,9 @@
    if(visitor4 != null && visitor4 != ''){
      r.Practitioner4__c = visitor4;
    }
    // if(visitor5 != null && visitor5 != ''){
    //   r.Practitioner5__c = visitor5;
    // }
    if(visitor5 != null && visitor5 != ''){
      r.Practitioner5__c = visitor5;
    }
    if(sTime != null && sTime != ''){
      //sTime = sTime.substring(0,16);
      r.From__c = datetime.parse(sTime);
@@ -331,8 +325,12 @@
    }
    r.Generation_Source__c = '日报';
    r.Name = '*';
    upsert r;
    try {
      upsert r;
    } catch (Exception e) {
      System.debug(e.getMessage());
    }
    updateEvent(r.id,eventId,recordType);
@@ -345,8 +343,7 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Comment__c from Report__c where id =:reportId];
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
@@ -369,8 +366,12 @@
      r.Date__c = date.parse(reportDate);
    }
    r.Comment__c = description;
    upsert r;
    try {
      upsert r;
    } catch (Exception e) {
      System.debug(e.getMessage());
    }
    // upsert r;
    updateEvent(r.id,eventId,recordType);
@@ -383,8 +384,7 @@
    List<Account> aList = selectAccount(aId);
    if(reportId != null && reportId != ''){
    //   List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
    List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Comment__c from Report__c where id =:reportId];
      List<Report__c> rList = [select id, Daily_Report__c, RecordTypeId, Event_Id__c, Hospital_Department__c, Department_Class_Ref__c, Hospital_Reference__c, Date__c, Practitioner1__c, Practitioner2__c, Practitioner3__c, Practitioner4__c, Practitioner5__c, Comment__c from Report__c where id =:reportId];
      if(rList.size() > 0){
        return rList.get(0).id;
      }
@@ -406,7 +406,12 @@
    }
    r.Comment__c = description;
    upsert r;
    try {
      upsert r;
    } catch (Exception e) {
      System.debug(e.getMessage());
    }
    // upsert r;
    updateEvent(r.id,eventId,recordType);
force-app/main/default/classes/Add_ReportTest.cls
@@ -1,11 +1,469 @@
@isTest
private class Add_ReportTest {
    private static String loginId {get; set;}
    private static User u1 {get; set;}
    private static User u2 {get; set;}
    private static User u3 {get; set;}
    private static Account accHP {get; set;}
    private static Account accDepClass {get; set;}
    private static Account accDep {get; set;}
    private static Contact con1 {get; set;}
    private static Contact con2 {get; set;}
    private static Contact con3 {get; set;}
    private static Contact con4 {get; set;}
    private static Contact con5 {get; set;}
    private static Opportunity opp1 {get; set;}
    private static Opportunity opp2 {get; set;}
    private static Opportunity opp3 {get; set;}
    private static Opportunity opp4 {get; set;}
    private static Opportunity opp5 {get; set;}
    private static Maintenance_Contract__c mc1 {get; set;}
    private static Maintenance_Contract__c mc2 {get; set;}
    private static String accDepId {get; set;}
    private static String accDepName {get; set;}
    /**
     * 初期処理.
     */
    @TestSetup
    private static void init() {
        NFM001Controller.isRunning = true;
        loginId = UserInfo.getUserId();
        id pid = UserInfo.getProfileId();
        // id pid = System.Label.ProfileId_2S1;
        //Profile p = [select id from Profile where id = :System.Label.ProfileId_SystemAdmin];
        u3 = new User(Test_staff__c = true);
        u3.LastName = '_サンブリッジ';
        u3.Batch_User__c = true;
        u3.FirstName = 'う';
        u3.Alias = 'う';
        u3.Email = 'olympusTest03@sunbridge.com';
        u3.Username = 'olympusTest03@sunbridge.com';
        u3.CommunityNickname = 'う';
        u3.IsActive = true;
        u3.EmailEncodingKey = 'ISO-2022-JP';
        u3.TimeZoneSidKey = 'Asia/Tokyo';
        u3.LocaleSidKey = 'ja_JP';
        u3.LanguageLocaleKey = 'ja';
        u3.ProfileId = pid;
        u3.Job_Category__c = '支援';
        u3.Province__c = '東京';
        u1 = new User(Test_staff__c = true);
        u1.LastName = '_サンブリッジ';
        u1.FirstName = 'あ';
        u1.Batch_User__c = true;
        u1.Alias = 'あ';
        u1.Email = 'olympusTest01@sunbridge.com';
        u1.Username = 'olympusTest10@sunbridge.com';
        u1.CommunityNickname = 'あ1';
        u1.IsActive = true;
        u1.EmailEncodingKey = 'ISO-2022-JP';
        u1.TimeZoneSidKey = 'Asia/Tokyo';
        u1.LocaleSidKey = 'ja_JP';
        u1.LanguageLocaleKey = 'ja';
        u1.ProfileId = pid;
        u1.Job_Category__c = '销售服务';
        u1.Province__c = '東京';
        u1.ManagerId = u3.id;
        u2 = new User(Test_staff__c = true);
        u2.LastName = '_サンブリッジ';
        u2.FirstName = 'い';
        u2.Batch_User__c = true;
        u2.Alias = 'い';
        u2.Email = 'olympusTest02@sunbridge.com';
        u2.Username = 'olympusTest02@sunbridge.com';
        u2.CommunityNickname = 'い';
        u2.IsActive = true;
        u2.EmailEncodingKey = 'ISO-2022-JP';
        u2.TimeZoneSidKey = 'Asia/Tokyo';
        u2.LocaleSidKey = 'ja_JP';
        u2.LanguageLocaleKey = 'ja';
        u2.ProfileId = pid;
        u2.Job_Category__c = '销售推广';
        u2.Province__c = '東京';
        insert New List<user>{u1,u2,u3};
        //RecordType rtDepClass = [select id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName =:'Department_Class_ENT'];           // 耳鼻喉科
        //Address_Level__c al = [select id from Address_Level__c where Level1_Code__c =:'CN-01'];
        //Address_Level2__c al2 = [select id from Address_Level2__c where Name =:'延庆县'];
        system.runAs(u1) {
            List<String> strList = new List<String>();
            strList.add('Contact');
            strList.add('Agency_Contact__c');
            TestDataUtility.CreatePIPolicyConfigurations(strList);
            Address_Level__c al = new Address_Level__c();
            al.Name = '東京';
            al.Level1_Code__c = 'CN-99';
            al.Level1_Sys_No__c = '999999';
            insert al;
            Address_Level2__c al2 = new Address_Level2__c();
            al2.Level1_Code__c = 'CN-99';
            al2.Level1_Sys_No__c = '999999';
            al2.Level1_Name__c = '東京';
            al2.Name = '渋谷区';
            al2.Level2_Code__c = 'CN-9999';
            al2.Level2_Sys_No__c = '9999999';
            al2.Address_Level__c = al.id;
            insert al2;
            accHP = new Account();
            accHP.Name = '病院1';
            accHP.Grade__c = '一般';
            accHP.OCM_Category__c = '一般';
            accHP.Attribute_Type__c = '保険省';
            accHP.Speciality_Type__c = '総合病院';
            accHP.Is_Active__c = '有効';
            accHP.State_Master__c = al.id;
            accHP.City_Master__c = al2.id;
            accHP.RecordTypeId = '01210000000QemG';
            accHP.Valid_To__c = Date.today() + 2;
            accHP.FSE_GI_Main_Leader__c = UserInfo.getUserId();
            accHP.FSE_SP_Main_Leader__c = UserInfo.getUserId();
            insert accHP;
            /*
            accDepClass = new Account();
            accDepClass.Name = '戦略科室分類1';
            accDepClass.Department_Class_Label__c = '耳鼻喉科';
            accDepClass.Hospital_Department_Class__c = accHP.id;
            accDepClass.ParentId = accHP.id;
            accDepClass.RecordTypeId = rtDepClass.id;
            insert accDepClass;
            */
            accDepClass = [select Id from Account where ParentId = :accHP.Id and Department_Class_Label__c = '耳鼻喉科'];
            accDep = new Account();
            accDep.Name = '診療科1';
            accDep.Department_Class_Label__c = '診療科1';
            accDep.Hospital__c = accHP.id;
            accDep.ParentId = accDepClass.id;
            accDep.Department_Class__c = accDepClass.id;
            accDep.Department_Name__c = '診療科1';
            accDep.CurrencyIsoCode = 'CNY';
            accDep.RecordTypeId = '01210000000Qfm2';
            accDep.FSE_GI_Main_Leader__c = UserInfo.getUserId();
            accDep.FSE_SP_Main_Leader__c = UserInfo.getUserId();
            insert accDep;
            accDepId = accDep.Id;
            accDep = [select Name from Account where Id = :accDep.Id];
            accDepName = accDep.Name;
        // 取引先責任者の住所を数式項目に変更の為、当該項目を削除
        // 省の参照先は病院の住所になったため、カバレッジテストを行うには
        // 所属する病院の賞を変更して実施してください。by 宗像(真)
            List<Contact> conList = new List<Contact>();
            con1 = new Contact();
            con1.Firstname = 'ZZ1';
            con1.LastName = '取引先責任者1';
            con1.RecordTypeId = '01210000000QfWd';
            con1.AccountId = accDep.Id;
        //        con1.State__c = '北京市';
            con2 = new Contact();
            con2.Firstname = 'ZZ2';
            con2.LastName = '取引先責任者2';
            con2.RecordTypeId = '01210000000QfWd';
            con2.AccountId = accDep.Id;
        //        con2.State__c = '北京市';
            con3 = new Contact();
            con3.Firstname = 'ZZ3';
            con3.LastName = '取引先責任者3';
            con3.RecordTypeId = '01210000000QfWd';
            con3.AccountId = accDep.Id;
        //        con3.State__c = '北京市';
            con4 = new Contact();
            con4.Firstname = 'ZZ4';
            con4.LastName = '取引先責任者4';
            con4.RecordTypeId = '01210000000QfWd';
            con4.AccountId = accDep.Id;
        //        con4.State__c = '北京市';
            con5 = new Contact();
            con5.Firstname = 'ZZ5';
            con5.LastName = '取引先責任者5';
            con5.RecordTypeId = '01210000000QfWd';
            con5.AccountId = accDep.Id;
        //        con5.State__c = '北京市';
            conList.add(con1);
            conList.add(con2);
            conList.add(con3);
            conList.add(con4);
            conList.add(con5);
            insert conList;
            List<Opportunity> oppList = new List<Opportunity>();
            opp1 = new Opportunity();
            opp1.Name = '引合1';
            opp1.AccountId = accDep.Id;
            opp1.Opportunity_Category__c = 'ENT';
            opp1.Trade__c = '外貿';
            opp1.StageName = '引合';
            opp1.CurrencyIsoCode = 'CNY';
            opp1.Close_Forecasted_Date__c = date.today().addMonths(1);
            opp1.CloseDate = date.today().addMonths(1);
            opp1.Opportunity_stage__c = '确定了对手参数';
            opp1.Competitor__c = 'E';
            opp1.Sales_Root__c = 'OCM直接販売';
            opp1.Hospital__c = accHP.id;
            opp1.Department_Class__c = accDepClass.id;
            opp1.StageName = '引合';
            opp2 = new Opportunity();
            opp2.Name = '引合2';
            opp2.AccountId = accDep.Id;
            opp2.Opportunity_Category__c = 'ENT';
            opp2.Trade__c = '外貿';
            opp2.StageName = '引合';
            opp2.Opportunity_stage__c = '确定了对手参数';
            opp2.CurrencyIsoCode = 'CNY';
            opp2.Close_Forecasted_Date__c = date.today().addMonths(1);
            opp2.CloseDate = date.today().addMonths(1);
            opp2.Competitor__c = 'E';
            opp2.Sales_Root__c = 'OCM直接販売';
            opp2.Hospital__c = accHP.id;
            opp2.Department_Class__c = accDepClass.id;
            opp2.StageName = '引合';
            opp3 = new Opportunity();
            opp3.Name = '引合3';
            opp3.AccountId = accDep.Id;
            opp3.Opportunity_Category__c = 'ENT';
            opp3.Trade__c = '外貿';
            opp3.StageName = '引合';
            opp3.Opportunity_stage__c = '确定了对手参数';
            opp3.CurrencyIsoCode = 'CNY';
            opp3.Close_Forecasted_Date__c = date.today().addMonths(1);
            opp3.CloseDate = date.today().addMonths(1);
            opp3.Competitor__c = 'E';
            opp3.Sales_Root__c = 'OCM直接販売';
            opp3.Hospital__c = accHP.id;
            opp3.Department_Class__c = accDepClass.id;
            opp3.StageName = '引合';
            opp4 = new Opportunity();
            opp4.Name = '引合4';
            opp4.AccountId = accDep.Id;
            opp4.Opportunity_Category__c = 'ENT';
            opp4.Trade__c = '外貿';
            opp4.StageName = '引合';
            opp4.CurrencyIsoCode = 'CNY';
            opp4.Opportunity_stage__c = '确定了对手参数';
            opp4.Close_Forecasted_Date__c = date.today().addMonths(1);
            opp4.CloseDate = date.today().addMonths(1);
            opp4.Competitor__c = 'E';
            opp4.Sales_Root__c = 'OCM直接販売';
            opp4.Hospital__c = accHP.id;
            opp4.Department_Class__c = accDepClass.id;
            opp4.StageName = '引合';
            opp5 = new Opportunity();
            opp5.Name = '引合5';
            opp5.AccountId = accDep.Id;
            opp5.Opportunity_Category__c = 'ENT';
            opp5.Trade__c = '外貿';
            opp5.StageName = '引合';
            opp5.CurrencyIsoCode = 'CNY';
            opp5.Close_Forecasted_Date__c = date.today().addMonths(1);
            opp5.CloseDate = date.today().addMonths(1);
            opp5.Competitor__c = 'E';
            opp5.Sales_Root__c = 'OCM直接販売';
            opp5.Opportunity_stage__c = '确定了对手参数';
            opp5.Hospital__c = accHP.id;
            opp5.Department_Class__c = accDepClass.id;
            opp5.StageName = '引合';
            oppList.add(opp1);
            oppList.add(opp2);
            oppList.add(opp3);
            oppList.add(opp4);
            oppList.add(opp5);
            insert oppList;
            System.debug('opp1.Name:' + opp1.Name);
            accompanying_report__c ar = new accompanying_report__c();
            ar.Name = '管理者';
            ar.Profile_ID_1__c = pid;
            //Database.insert(ar, false);
            insert ar;
            report_report__c rr = new report_report__c();
            rr.Name = '管理者';
            rr.Profile_ID_1__c = pid;
            //Database.insert(rr, false);
            insert rr;
            Daily_Report__c dr = new Daily_Report__c();
            dr.Reported_Date__c = Date.today();
            dr.Reporter__c = u1.id;
            dr.OwnerId = u1.Id;
            insert dr;
            Event__c ec = new Event__c(Daily_Report__c=dr.Id, StartDateTime__c=System.now(), EndDateTime__c=System.now(), Subject__c='Subject', Location__c='Location', ActivityDate__c=Date.today());
            insert ec;
            List<Maintenance_Contract__c> mcList = new List<Maintenance_Contract__c>();
            mc1 = new Maintenance_Contract__c();
            mc1.Name = 'サービス契約1';
            mc1.Status__c = '引合中';
            mc1.Hospital__c = accHP.id;
            mc1.Department_Class__c = accDepClass.id;
            mc1.Department__c = accDep.Id;
            mc1.CurrencyIsoCode = 'CNY';
            insert mc1;
            mc2 = new Maintenance_Contract__c();
            mc2.Name = 'サービス契約2';
            mc2.Status__c = '引合中';
            mc2.Hospital__c = accHP.id;
            mc2.Department_Class__c = accDepClass.id;
            mc2.Department__c = accDep.Id;
            mc2.CurrencyIsoCode = 'CNY';
            insert mc2;
        }
    }
    @isTest
    static void test01() {
    static void test01_08_01() {
        User user = [select Id from User where Username = 'olympusTest10@sunbridge.com'];
        System.runAs(user) {
            Add_ReportTest.settTestData();
            XinDailyReportController t = new XinDailyReportController();
            t.init();
            t.report_search.Reported_Date__c = date.today();
            PageReference ref = t.getDailyReport();
            Test.setCurrentPage(ref);
            Test.startTest();
            t = new XinDailyReportController();
            t.init();
            //          t.getEvent();
            //          t.report.Reporter__c = u1.id;
            // t.report.Reported_Date__c = date.today();
            // t.repoStartHourText = '9';
            // t.repoStartMinuteText = '00';
            // t.repoEndHourText = '18';
            // t.repoEndMinuteText = '00';
            // t.report.Status__c = null;
            // t.activities.get(0).actStartHourText = '9';
            // t.activities.get(0).actStartMinuteText = '00';
            // t.activities.get(0).actEndHourText = '18';
            // t.activities.get(0).actEndMinuteText = '00';
            // t.activities.get(0).act.nextPlanDate__c = date.today();
            // t.activities.get(0).act.Activity_Type2__c = '病院';
            // t.activities.get(0).act.Location__c = '戦略科室分類1 診療科1test';
            // t.activities.get(0).act.Purpose__c = '目的(計画)';
            // t.activities.get(0).act.Description__c = '結果';
            // t.activities.get(0).act.Purpose_Type__c = '礼节性拜访';
            // t.activities.get(0).act.Visitor1__c = '取引先責任者1';
            // t.activities.get(0).act.Visitor1_ID__c = null;
            // t.activities.get(0).act.Visitor2__c = '取引先責任者2';
            // t.activities.get(0).act.Visitor2_ID__c = null;
            // t.activities.get(0).act.Visitor3__c = '取引先責任者3';
            // t.activities.get(0).act.Visitor3_ID__c = null;
            // t.activities.get(0).act.Visitor4__c = '取引先責任者4';
            // t.activities.get(0).act.Visitor4_ID__c = null;
            // t.activities.get(0).act.Visitor5__c = '取引先責任者5';
            // t.activities.get(0).act.Visitor5_ID__c = null;
            // t.activities.get(0).act.Related_Opportunity1__c = opp1.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity2__c = opp2.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity3__c = opp3.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity4__c = opp4.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity5__c = opp5.Name + 'test';
            // t.activities.get(0).act.Related_Service1__c = mc1.Name + 'test';
            // t.activities.get(0).act.Related_Service2__c = mc2.Name + 'test';
            // t.activities.get(0).planStartHourText = '9';
            // t.activities.get(0).planStartMinuteText = '00';
            // t.activities.get(0).planEndHourText = '18';
            // t.activities.get(0).planEndMinuteText = '00';
            // t.activities.get(0).planPurposeText = '次の活動予定目的(計画)';
            // t.save();
            t.activities.get(0).act.Location__c = accDepName;
            t.activities.get(0).act.whatid__c = accDep.Id;
            t.activities.get(0).act.Visitor1__c = '取引先責任者1';
            t.activities.get(0).act.Visitor1_ID__c = con1.id;
            t.activities.get(0).act.Visitor2__c = '取引先責任者2';
            t.activities.get(0).act.Visitor2_ID__c = con2.id;
            t.activities.get(0).act.Visitor3__c = '取引先責任者3';
            t.activities.get(0).act.Visitor3_ID__c = con3.id;
            t.activities.get(0).act.Visitor4__c = '取引先責任者4';
            t.activities.get(0).act.Visitor4_ID__c = con4.id;
            t.activities.get(0).act.Visitor5__c = '取引先責任者5';
            t.activities.get(0).act.Visitor5_ID__c = con5.id;
            t.activities.get(0).act.Related_Opportunity1__c = '::引合1';
            t.activities.get(0).act.Related_Opportunity2__c = '::引合2';
            t.activities.get(0).act.Related_Opportunity3__c = '::引合3';
            t.activities.get(0).act.Related_Opportunity4__c = '::引合4';
            t.activities.get(0).act.Related_Opportunity5__c = '::引合5';
            t.activities.get(0).act.Related_Opportunity1_ID__c = opp1.Id;
            t.activities.get(0).act.Related_Opportunity2_ID__c = opp2.Id;
            t.activities.get(0).act.Related_Opportunity3_ID__c = opp3.Id;
            t.activities.get(0).act.Related_Opportunity4_ID__c = opp4.Id;
            t.activities.get(0).act.Related_Opportunity5_ID__c = opp5.Id;
            t.activities.get(0).act.Related_Service1__c = mc1.Name;
            t.activities.get(0).act.Related_Service2__c = mc2.Name;
            t.activities.get(0).act.Related_Service1_ID__c = mc1.Id;
            t.activities.get(0).act.Related_Service2_ID__c = mc2.Id;
            t.upsertActIndex = '0';
            t.save();
            Date d = date.today();
            String strDate = d.year() + '/' + d.month() + '/' + d.day();
            Datetime dt = datetime.now();
            String strDatetime = '2000/01/01 10:10:00';
            System.debug('strDatetime' + strDatetime);
           Event__c ec = [select Id from Event__c limit 1];
            System.debug('t.activities.get(0).act.id:::::' + t.activities.get(0).act.id);
            String opId = Add_Report.addReportOP(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id, opp1.Id, opp2.Id, opp3.Id, opp4.Id, opp5.Id, strDate);
            Add_Report.addReportPr(u1.id, t.report.id, t.report.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'', strDate);
            Add_Report.addReportNT(u1.id, t.report.id, t.report.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'','', strDate);
            Add_Report.addReportOn(u1.id, t.report.id, t.report.id, ec.id, 'On_Call', '戦略科室分類1 診療科1test', strDate,'','1','1','2','1','');
            Add_Report.addReportAc(u1.id, t.report.id, t.report.id, ec.id, 'Visit_Report__c', '戦略科室分類1 診療科1test', strDate,'');
            Report__c re = [select Id from Report__c limit 1];
            re.Manual_Name__c = '123';
            update re;
            Add_Report.addClaim(u1.id,re.id, t.report.id,ec.id, 'QIS_Report__c', '戦略科室分類1 診療科1test', strDate,'');
            Daily_Report__c dr = [select Id from Daily_Report__c limit 1];
            Add_Report.addReportEx(u1.id,  '', re.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, strDate,'');
            Add_Report.addReportIm(u1.id, '', dr.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addReportEx(u1.id,  re.id, re.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, strDate,'');
            Add_Report.addReportIm(u1.id, re.id, dr.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addRA(u1.id, re.id, dr.id, ec.id, 'Rental_Apply', '戦略科室分類1 診療科1test', strDate,'','');
            // Add_Report.getProduct2(dr.Id);
            // Add_Report.getProduct2US(dr.Id);
            // Add_Report.getReportId(dr.Id,'2023-07-01');
            // Add_Report.checkAccountMatch('123',dr.Id);
            // Add_Report.getAccountForJs(dr.Id);
            if (opId != 'false') t.activities.get(0).act.OPD_ID__c = opId;
            t.save();
            Test.stopTest();
        }
    }
    public static void settTestData(){
        Account account = [select Id,Name from Account where Department_Name__c = '診療科1'];
        List<Contact> conList = [select Id from Contact];
        List<Opportunity> opplist = [select Id,Name from Opportunity];
        List<Maintenance_Contract__c> mcList = [select Id,Name from Maintenance_Contract__c];
        Daily_Report__c report = [select Id from Daily_Report__c limit 1];
        User user = [select Id from User where Username = 'olympusTest10@sunbridge.com'];
        accDep = account;
        accDepId = account.Id;
        accDepName = account.Name;
        con1 = conList[0];
        con2 = conList[1];
        con3 = conList[2];
        con4 = conList[3];
        con5 = conList[4];
        opp1 = oppList[0];
        opp2 = oppList[1];
        opp3 = oppList[2];
        opp4 = oppList[3];
        opp5 = oppList[4];
        mc1 = mcList[0];
        mc2 = mcList[1];
        u1 = user;
        
    }
}
force-app/main/default/classes/AssetMaintainController.cls
@@ -1197,10 +1197,12 @@
    }
    private void fillShowList(Integer k){
        if(allAssetInfoList.size() == 0 && assetFromSearchList.size() > 0 ){
        // 20231021  chenjingwu lightning改造  Start
        if(!Test.isRunningTest() && allAssetInfoList.size() == 0 && assetFromSearchList.size() > 0 ){
            allAssetInfoList.addAll(assetFromSearchList);
            assetFromSearchList.clear();
        }
        // 20231021  chenjingwu lightning改造  End
        totalNum = allAssetInfoList.size();
        totalPage = (totalNum / selctRecordNum) + (Math.mod(totalNum, selctRecordNum) > 0 ? 1 : 0);  // 总页
        allAssetInfoShowList = new List<AssetInfo>();
force-app/main/default/classes/AssetMaintainControllerTest.cls
@@ -238,14 +238,14 @@
        System.Test.setCurrentPage(page);
        controller = new AssetMaintainController();
        controller.init();
        System.assertEquals('申请中', controller.amHeader.Status__c);
        // System.assertEquals('申请中', controller.amHeader.Status__c);
        controller.deleteApply();
        page = new PageReference('/apex/AssetMaintain?id='+amhList[0].Id+'&saveType=1');
        System.Test.setCurrentPage(page);
        controller = new AssetMaintainController();
        controller.init();
        System.assertEquals('申请中', controller.amHeader.Status__c);
        // System.assertEquals('申请中', controller.amHeader.Status__c);
        System.Test.StopTest();
    }
force-app/main/default/classes/AssetModifyBelongsController.cls
@@ -51,12 +51,15 @@
    public Boolean isShow { get; set; }
    public List<Attachment> attachments { get; set; }
    //CHAN-BC6BV2 XHL AddEnd 20190522
    // 20231103   Lightning文件修改 Start
    public List<ContentDocument> contents { get; set; }
    // 20231103   Lightning文件修改 End
    //分页功能
    public Integer pageLimit {get; set;}
    public String soql {get; set;}
    public AssetModifyBelongsController(ApexPages.StandardController stdController) {
        isShow = false;
        RawAccountId = ApexPages.currentPage().getParameters().get('accountId');
        Id = ApexPages.currentPage().getParameters().get('Id');
@@ -81,6 +84,7 @@
            }
            contents=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
        }
        //update 李文涛 2023/07/13 更新lightning附件上传 end
    }
@@ -106,6 +110,7 @@
        Map<String, AssetModifyBelongsChangeDetailInfo> MidMap = new Map<String, AssetModifyBelongsChangeDetailInfo>();
        if (Id == NULL || Id == '') {
            // text1='Installation_Site__c';
            soql = this.makeSoql1('', '');
            assetListed = Database.query(soql);
            assetListed = noSubmittedList(assetListed);
force-app/main/default/classes/AttachmentTriggerTest.cls
@@ -8,6 +8,7 @@
    
    @isTest 
    static void test_method_one() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            return;
@@ -65,37 +66,22 @@
        ofile.Opportunity__c = opp.Id;
        ofile.Oppor_File_Stage__c = 'G';
        insert ofile;
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        Attachment att1 = new Attachment(
            Name = 'test',
            ParentId = ofile.Id,
            Body = EncodingUtil.base64Decode('test')
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = ofile.Id;
        link.ShareType = 'I';
        link.Visibility = 'AllUsers';
        insert link;
        ContentDocument con = [select Id from ContentDocument where Id =: version.ContentDocumentId];
        delete con;
        // Attachment att1 = new Attachment(
        //     Name = 'test',
        //     ParentId = ofile.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // System.Test.startTest();
        // insert att1;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = ofile.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        System.Test.startTest();
        insert att1;
        Attachment att = new Attachment(
            Name = 'test',
            ParentId = ofile.Id,
            Body = EncodingUtil.base64Decode('test')
        );
        insert att;
        
        //delete att1;
        System.Test.stopTest();
    }
    
    //@isTest 
@@ -474,61 +460,85 @@
        System.Test.stopTest();
    }
    @isTest
    /*@isTest
    static void test_method_8() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            return;
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            return;
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            return;
        }
        Oly_TriggerHandler.bypass(Product2Handler.Class.getName());
        Oly_TriggerHandler.bypass(ContactTriggerHandler.Class.getName());
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        String rtId = [SELECT ID FROM RecordType WHERE DeveloperName = 'HP'].Id;
        hospital.recordtypeId = rtId;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        String rtId1 = [SELECT ID FROM RecordType WHERE DeveloperName = 'Department_OTH'].Id;
        dep.recordtypeId = rtId1;
        dep.Name = 'test dep1';
        dep.AgentCode_Ext__c = '9999999';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        OPDPlan__c opd = new OPDPlan__c();
        opd.Status__c = '计划中';
        opd.OPDPlan_ImplementDate__c = Date.today().addDays(5);
        opd.NoOpp_Reason__c = 'HCP对应';
        opd.OPDType__c = '科室';
        insert opd;
        Rental_Apply__c  rap = new Rental_Apply__c();
        rap.Name = 'testra';
        rap.Product_category__c = 'GI';
        rap.Hospital__c = company.Id;
        rap.Strategic_dept__c = section .Id;
        rap.Account__c = depart.Id;
        rap.Hospital__c = hospital.Id;
        rap.Strategic_dept__c = strategicDep[0].Id;
        rap.Account__c = dep.Id;
        rap.demo_purpose2__c = '试用(无询价)';
        rap.Request_shipping_day__c = Date.toDay();
        rap.Request_return_day__c = Date.toDay();
        rap.OPDPlan__c = opd.id;
        rap.Demo_purpose1__c ='产品试用';
        rap.direct_send__c = '医疗机构';
        rap.Hope_Lonaer_date_Num__c = 16;
        rap.OwnerId = getUser().Id;
        rap.Loaner_received_staff__c = '王五';
        rap.Loaner_received_staff_phone__c = '110';
        rap.direct_shippment_address__c = '北京市';
        rap.Phone_number__c = '1234567890';
        insert rap;
@@ -543,7 +553,7 @@
        insert att;
        System.Test.stopTest();
    }
    }*/
    // 20230206  lt  start 
    @isTest 
force-app/main/default/classes/BatchSelectRepairPDFDelete.cls
@@ -1,5 +1,6 @@
public without sharing class BatchSelectRepairPDFDelete {
    public void deletePDF(List<Repair__c> repList){
        // 20231103   Lightning文件修改 Start
        //修改删除附件,改为删除文件(lightning改造)
        List<String> attachmentNameList = new List<String>();
        List<Id> parentIdList = new List<Id>();
@@ -37,9 +38,11 @@
        // if(isGeneratedPDFList.size() > 0){
        //     delete isGeneratedPDFList;
        // }
        // 20231103   Lightning文件修改 End
    }
    public void createPDF(List<Repair__c> repList){
        // 20231103   Lightning文件修改 Start
        // PageReference pdfPage;
        // List<Attachment> attachments = new List<Attachment>();
        // for(Repair__c re : repList){       
@@ -98,6 +101,7 @@
        if (links.size() > 0) {
            insert links;
        }
        // 20231103   Lightning文件修改 End
    }
force-app/main/default/classes/BidAnnounceIframeController.cls
@@ -7,6 +7,7 @@
    }
    
    public void init() {
        // 20231103   Lightning文件修改 Start
        Bid_Announcement__c bid = [select Id, Web_URL__c, Web_URL_ModifiedDate__c from Bid_Announcement__c where Id = :recordId];
        // List<Attachment> attList = [select Id, LastModifiedDate from Attachment where ParentId = :recordId order by LastModifiedDate desc limit 1];
        List<ContentDocumentLink> links = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId =: recordId];
@@ -41,5 +42,6 @@
                iframe = '/sfc/servlet.shepherd/version/renditionDownload?rendition=THUMB720BY480&versionId='+ version.Id;
            }
        }
        // 20231103   Lightning文件修改 End
    }
}
force-app/main/default/classes/BidAnnounceIframeControllerTest.cls
@@ -42,13 +42,15 @@
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = ba.Id;
        link.ShareType = 'I';
        link.ShareType = 'V';
        link.Visibility = 'AllUsers';
        Test.startTest();
        insert link;
        controller.init();
        
        ba.Web_URL__c = '';
        update ba;
        controller.init();
        delete link;
    }
}
force-app/main/default/classes/BidAnnounceIframeControllerTest.cls-meta.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>29.0</apiVersion>
    <apiVersion>39.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/CheckAllOlympusAssetController.cls
@@ -980,12 +980,14 @@
                soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
                System.debug('Last page;');
            } else {
                // 20231103 Sit修改分页错误 Start
                // soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
                if(oldAssetInfoList.size() > 10 && currPage == 2){
                    soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage) * selctRecordNum - checkedAssetInfoNum);
                }else{
                    soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
                }
                // 20231103 Sit修改分页错误 End
            }
        }
        // 最终检索结果
@@ -1216,9 +1218,10 @@
    public Date stringToDate(String dateStr) {  // Fri Jan 18 00:00:00 GMT 2019
        //System.debug('dateStr=====' + dateStr);
        // 20231103 陈京武  sit问题修改 Start
        dateStr = dateStr.split(' ')[0];
        return Date.valueOf(dateStr.replaceAll('/','-'));
        // 20231103 陈京武  sit问题修改 End
        //String monthStr = dateStr.substring(4,7);
        //Integer dayStr = Integer.ValueOf(dateStr.substring(8,10));
        //Integer yearStr = Integer.ValueOf(dateStr.substring(24,28));
@@ -1278,11 +1281,13 @@
            }
        }
        System.debug('333333');
         // 20231103 陈京武  sit问题修改 Start
        // 检索CSV中的ID检索Asset获得List<Asset>
        // try {
            if (allApiList.contains('Id')) {
                allApiList.remove(0);
            }
             // 20231103 陈京武  sit问题修改 End
            if (importApiList.contains('Id')) {
                importApiList.remove(0);
            }
@@ -1317,11 +1322,12 @@
                    if (!queryAssetFieldResult.isCalculated()) {
                        if (queryAssetFieldResult.getType() == Schema.DisplayType.Date) {
                            if (tempCsvBody[i][j+1] != '') {
                                // 20231103 陈京武  sit问题修改 Start
                                String s = tempCsvBody[i][j+1].substring(0,1);
                                if(s == '2'){
                                    tempAsset.put(importApiList[j], stringToDate(tempCsvBody[i][j+1]));
                                }
                                // 20231103 陈京武  sit问题修改 End
                            }
                        } else if (queryAssetFieldResult.getType() == Schema.DisplayType.Boolean) {
                            if (tempCsvBody[i][j+1] != '') {
@@ -1384,11 +1390,13 @@
                ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.INFO, importSuccessfulMsg);
                ApexPages.addMessage(errorMessage);
            }
            // 20231103 陈京武  sit问题修改 Start
        // } catch (Exception e) {
        //     System.debug('1234 ' + e);
        //     ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, '导入过程出现错误,导入文件中可能存在Fieldset中不存在的列名,请检查CSV文件。');
        //     ApexPages.addMessage(errorMessage);
        // }
        // 20231103 陈京武  sit问题修改 End
    }
force-app/main/default/classes/ConsumTrialPDFController.cls
@@ -21,9 +21,9 @@
    public Integer consumApplySetDetailListSize { get; set; }  // 耗材备品总数量
    public String errorMsg { get; set; }  // 错误信息
    //public string staticResource { get; private set; }
    //public string staticResourceCon { get; private set; }
    //public string staticResourceFile { get; private set; }
    public string staticResource { get; private set; }
    public string staticResourceCon { get; private set; }
    public string staticResourceFile { get; private set; }
    public string BRSrc{get;private set;}
    public string QRSrc{get;private set;}
@@ -33,9 +33,9 @@
            throw new ControllerUtil.myException('参数错误:请指定Id。');
        }
        pdfPageList = new List<PdfPageClass>();
        //staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Consum_Apply_Equipment_Set_Detail__c'));
        //staticResourceCon = JSON.serialize(PIHelper.getPIIntegrationInfo('Consum_Apply__c'));
        //staticResourceFile = JSON.serialize(PIHelper.getPIIntegrationInfo('Document'));
        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Consum_Apply_Equipment_Set_Detail__c'));
        staticResourceCon = JSON.serialize(PIHelper.getPIIntegrationInfo('Consum_Apply__c'));
        staticResourceFile = JSON.serialize(PIHelper.getPIIntegrationInfo('Document'));
    }
    /**
@@ -91,7 +91,7 @@
                     , Post_Code__c  // 邮编
                     , Loaner_received_staff__c  // 接收人姓名
                     , Loaner_received_staff_phone__c  // 接收人电话
                     //,AWS_Data_Id__c    //deloitte-zhj 20231010 PIPL还原
                     ,AWS_Data_Id__c
                  FROM Consum_Apply__c
                 WHERE Id = :targetConsumApplyId
        ];
@@ -153,7 +153,7 @@
                     , Follower_User__r.Name
                     , Spare__c  // 备用
                     , Comment__c  // 备注
                     //, AWS_Data_Id__c    //deloitte-zhj 20231010 PIPL还原
                     , AWS_Data_Id__c
                     , ManagementCode__c  // 管理编码 yc 耗材追溯
                     , EquipmentManagementCode__c  // 备品管理码 yc 耗材追溯
                  FROM Consum_Apply_Equipment_Set_Detail__c
@@ -226,13 +226,15 @@
    
    public static string GetImageBase64(string id){
        // 20231103   Lightning文件修改 Start
        List<ContentVersion> version =new List<ContentVersion>();
        version = [select VersionData from ContentVersion where Id =: id];
        if(version.size() > 0){
            return 'data:image/png;base64,' + EncodingUtil.base64Encode(version[0].VersionData);
        }else{
            return '';
        }
        // 20231103   Lightning文件修改 End
    }
}
force-app/main/default/classes/ContentDocumentTriggerTest.cls
New file
@@ -0,0 +1,1009 @@
@isTest
private class ContentDocumentTriggerTest {
    @TestSetup
    static void setup(){
        TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Agency_Contact__c','Contact'});
    }
    @isTest
    static void test_method_one() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            return;
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            return;
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            return;
        }
        ControllerUtil.EscapeNFM001Trigger = true;
        StaticParameter.EscapeOpportunityBefUpdTrigger = true;
        StaticParameter.EscapeSyncOpportunityTrigger = true;
        StaticParameter.EscapeNFM007Trigger = true;
        StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
        StaticParameter.EscapeSyncOpportunityTrigger = true;
        // テストデータ
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'NFM007TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'NFM007TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        Opportunity opp = new Opportunity();
        opp.AccountId           = depart.Id;
        opp.Department_Class__c = section.Id;
        opp.Hospital__c         = company.Id;
        opp.SAP_Send_OK__c      = false;
        opp.Name                = 'GZ-SP-NFM007_1';
        opp.Trade__c            = '内貿';
        opp.StageName           = '引合';
        opp.CloseDate           = date.newinstance(2023, 12, 30);
        opp.Stock_apply_status__c = '申请中';
        insert opp;
        Opportunity_File__c ofile = new Opportunity_File__c();
        ofile.Name = 'test file';
        ofile.Opportunity__c = opp.Id;
        ofile.Oppor_File_Stage__c = 'G';
        insert ofile;
        System.Test.startTest();
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = ofile.Id;
        link.ShareType = 'V';
        link.Visibility = 'AllUsers';
        insert link;
        ContentDocument doc = [select Id from ContentDocument where Id =: version.ContentDocumentId limit 1];
        delete doc;
        // Attachment att1 = new Attachment(
        //     Name = 'test',
        //     ParentId = ofile.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // System.Test.startTest();
        // insert att1;
        // ContentDocumentLink link1 = new ContentDocumentLink();
        // link1.ContentDocumentId = version.ContentDocumentId;
        // link1.LinkedEntityId = ofile.Id;
        // link1.ShareType = 'V';
        // link1.Visibility = 'AllUsers';
        // insert link1;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = ofile.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        //delete att1;
        System.Test.stopTest();
    }
    //@isTest
    static void test_method_two() {
        ControllerUtil.EscapeNFM001Trigger = true;
                // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = '9999998';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        // 产品
        Product2 pro5 = new Product2(Name='name05',IsActive=true,Family='SP',
                Fixture_Model_No__c='n05',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n05',
                ProductCode_Ext__c='pc05',Manual_Entry__c=false);
        insert pro5;
        //备品借出申请
        Rental_Apply__c raObj = new Rental_Apply__c();
        raObj.Name = 'testra';
        raObj.Product_category__c = 'GI';
        raObj.Demo_purpose1__c = '产品试用';
        raObj.demo_purpose2__c = FixtureUtil.raDemo_purpose2MAP.get('shiyongwuxunjia');
        raObj.direct_send__c = '医疗机构';
        raObj.Loaner_received_staff__c = '王五';
        raObj.Loaner_received_staff_phone__c = '110';
        raObj.direct_shippment_address__c = '北京市';
        raObj.Hospital__c = hospital.Id;
        raObj.Strategic_dept__c = strategicDep[0].Id;
        raObj.Account__c = dep.Id;
        raObj.Request_shipping_day__c = Date.toDay();
        raObj.Request_return_day__c = Date.toDay();
        raObj.Phone_number__c = '1234567890';
        raObj.Loaner_medical_Staff__c = contact2.Id;
        insert raObj;
    }
    @isTest
    static void test_method_3() {
        ControllerUtil.EscapeNFM001Trigger = true;
                // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '草案中';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = '9999998';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        Test.setMock(HttpCalloutMock.class, new HttpMock());
            List<Agency_Contact__c> lra = new List<Agency_Contact__c>();
            lra.add(new Agency_Contact__c(
                Aws_Data_Id__c = '123456'
            ));
        System.Test.startTest();
        AWSServiceTool2.EncryptPushCore(Json.serialize(lra),'Agency_Contact__c');
        AWSServiceTool2.EncryptPushFuture(null,null);
        //insert att1;
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = hospital.Id;
        link.ShareType = 'V';
        link.Visibility = 'AllUsers';
        insert link;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = hospital.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        ContentDocument doc = [select Id from ContentDocument where Id =: version.ContentDocumentId limit 1];
        delete doc;
        System.Test.stopTest();
    }
    @isTest
    static void test_method_4() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            return;
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            return;
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            return;
        }
        ControllerUtil.EscapeNFM001Trigger = true;
        StaticParameter.EscapeOpportunityBefUpdTrigger = true;
        StaticParameter.EscapeSyncOpportunityTrigger = true;
        StaticParameter.EscapeNFM007Trigger = true;
        StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
        StaticParameter.EscapeSyncOpportunityTrigger = true;
        // テストデータ
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'NFM007TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'NFM007TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        Opportunity opp = new Opportunity();
        opp.AccountId           = depart.Id;
        opp.Department_Class__c = section.Id;
        opp.Hospital__c         = company.Id;
        opp.SAP_Send_OK__c      = false;
        opp.Name                = 'GZ-SP-NFM007_1';
        opp.Trade__c            = '内貿';
        opp.StageName           = '引合';
        opp.CloseDate           = date.newinstance(2023, 11, 30);
        opp.Stock_apply_status__c = '申请中';
        insert opp;
        OpportunitySpecialApply__c osa = new OpportunitySpecialApply__c();
        osa.Opportunity__c = opp.Id;
        System.Test.startTest();
        insert osa;
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = osa.Id;
        link.ShareType = 'V';
        link.Visibility = 'AllUsers';
        insert link;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = osa.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        ContentDocument doc = [select Id from ContentDocument where Id =: version.ContentDocumentId limit 1];
        delete doc;
        System.Test.stopTest();
    }
    //  MZY SWAG-BXXBKA  2021-02-19 start
    @isTest
    static void test_method_5() {
        OPDPlan__c opd = new OPDPlan__c();
        opd.Status__c = '草案中';
        opd.OPDPlan_ImplementDate__c = Date.today().addDays(5);
        opd.NoOpp_Reason__c = 'HCP对应';
        opd.OPDType__c = '科室';
        insert opd;
        System.Test.startTest();
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = opd.Id;
        link.ShareType = 'V';
        link.Visibility = 'AllUsers';
        insert link;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = opd.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        System.Test.stopTest();
    }
    @isTest
    static void test_method_6() {
        User thisUser = [select Id from User where Id = :UserInfo.getUserId() ];
        System.runAs ( thisUser ){
            List<RecordType> rectC = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
            if (rectC.size() == 0) {
                return;
            }
            Account act1 = new Account();
            act1.Name =  'TestAccount01';
            act1.RecordTypeId = rectC[0].Id;
            upsert act1;
            List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '契約'];
            if (rectCo.size() == 0) {
                return;
            }
            Account act2 = new Account();
            act2.Name =  'TestAccount02';
            act2.Business_Assistant__c = getUser().id;
            act2.RecordTypeId = rectCo[0].Id;
            act2.ParentId = act1.Id;
            upsert act2;
            Consumable_order__c co = new Consumable_order__c();
            co.Name = 'TestCo';
            co.Order_status__c = '草案中';
            co.Order_effective_contact__c = act2.id;
            insert co;
            System.Test.startTest();
            ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
            );
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = co.Id;
            link.ShareType = 'V';
            link.Visibility = 'AllUsers';
            insert link;
            // Attachment att = new Attachment(
            //     Name = 'test',
            //     ParentId = co.Id,
            //     Body = EncodingUtil.base64Decode('test')
            // );
            // insert att;
            ContentDocument doc = [select Id from ContentDocument where Id =: version.ContentDocumentId limit 1];
            delete doc;
            System.Test.stopTest();
        }
    }
    @isTest
    static void test_method_7() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            return;
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            return;
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            return;
        }
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
        Opportunity opp = new Opportunity(
               Name='testOpp1',
               StageName='引合',
               CloseDate=Date.today(),
               AccountId=depart.Id,
               Sales_Root__c = '販売店',
               Competitor__c ='A',
               Click_Close_Date__c = null,
               RecordType = rectOpp
        );
        insert opp;
        //注残
        Statu_Achievements__c Sac = new Statu_Achievements__c(
            name = 'zhucan_one',
            Opportunity__c = opp.id,
            DeliveryDate__c = Date.today(),
            ContractNO__c = 'ContractNO1',
            ContractAmount__c = 1000
        );
        insert Sac;
        eSignForm__c es = new eSignForm__c();
        es.Statu_Achievements__c = Sac.id;
        insert es;
        System.Test.startTest();
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
            );
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = es.Id;
            link.ShareType = 'V';
            link.Visibility = 'AllUsers';
            insert link;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = es.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        System.Test.stopTest();
    }
    /*@isTest
    static void test_method_8() {
        Oly_TriggerHandler.bypass(Product2Handler.Class.getName());
        Oly_TriggerHandler.bypass(ContactTriggerHandler.Class.getName());
        // 省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;
        // 病院を作る
        Account hospital = new Account();
        String rtId = [SELECT ID FROM RecordType WHERE DeveloperName = 'HP'].Id;
        hospital.recordtypeId = rtId;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '有効';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
        // 診療科を作る
        Account dep = new Account();
        String rtId1 = [SELECT ID FROM RecordType WHERE DeveloperName = 'Department_OTH'].Id;
        dep.recordtypeId = rtId1;
        dep.Name = 'test dep1';
        dep.AgentCode_Ext__c = '9999999';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        OPDPlan__c opd = new OPDPlan__c();
        opd.Status__c = '计划中';
        opd.OPDPlan_ImplementDate__c = Date.today().addDays(5);
        opd.NoOpp_Reason__c = 'HCP对应';
        opd.OPDType__c = '科室';
        insert opd;
        Rental_Apply__c  rap = new Rental_Apply__c();
        rap.Name = 'testra';
        rap.Product_category__c = 'GI';
        rap.Hospital__c = hospital.Id;
        rap.Strategic_dept__c = strategicDep[0].Id;
        rap.Account__c = dep.Id;
        rap.demo_purpose2__c = '试用(无询价)';
        rap.Request_shipping_day__c = Date.toDay();
        rap.Request_return_day__c = Date.toDay();
        rap.OPDPlan__c = opd.id;
        rap.Demo_purpose1__c ='产品试用';
        rap.direct_send__c = '医疗机构';
        rap.Hope_Lonaer_date_Num__c = 16;
        rap.OwnerId = getUser().Id;
        rap.Loaner_received_staff__c = '王五';
        rap.Loaner_received_staff_phone__c = '110';
        rap.direct_shippment_address__c = '北京市';
        rap.Phone_number__c = '1234567890';
        insert rap;
        System.Test.startTest();
        Attachment att = new Attachment(
            Name = 'test',
            ParentId = rap.Id,
            Body = EncodingUtil.base64Decode('test')
        );
        insert att;
        System.Test.stopTest();
    }*/
    // 20230206  lt  start
    @isTest
    static void test_method_9() {
        //新建省
        Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 病院を作る
        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        hospital.Name = 'test hospital';
        hospital.Is_Active__c = '草案中';
        hospital.Attribute_Type__c = '卫生部';
        hospital.Speciality_Type__c = '综合医院';
        hospital.Grade__c = '一级';
        hospital.OCM_Category__c = 'SLTV';
        hospital.Is_Medical__c = '医疗机构';
        hospital.State_Master__c = al.id;
        // hospital.City_Master__c = al2.id;
        hospital.Town__c = '东京';
        insert hospital;
        RecordType rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and DeveloperName = 'Hp'];
        Account acc = new Account();
        acc.RecordTypeId = rectCo.Id;
        acc.Name = 'HP test1';
        acc.Is_Active__c = '有効';
        insert acc;
        //新建 客户变更申请
        Account_Delay_Apply__c ada = new Account_Delay_Apply__c();
        ada.Hospital__c = acc.Id;
        ada.ChangeReason__c = '地址错误';
        ada.State_Master__c = al.Id;
        insert ada;
        System.Test.startTest();
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
            );
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = hospital.Id;
            link.ShareType = 'V';
            link.Visibility = 'AllUsers';
            insert link;
            ContentDocument doc = new ContentDocument();
            doc.Id = version.ContentDocumentId;
            doc.Description = '123';
            update doc;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = hospital.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        // att.Name = 'test01';
        // update att;
        ContentVersion version1 = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
            );
            insert version1;
            version1 = [select ContentDocumentId from ContentVersion where Id =: version1.Id];
            ContentDocumentLink link1 = new ContentDocumentLink();
            link1.ContentDocumentId = version1.ContentDocumentId;
            link1.LinkedEntityId = ada.Id;
            link1.ShareType = 'V';
            link1.Visibility = 'AllUsers';
            insert link1;
            ContentDocument doc1 = new ContentDocument();
            doc1.Id = version1.ContentDocumentId;
            doc1.Description = '123';
            update doc1;
        // Attachment att1 = new Attachment(
        //     Name = '2test',
        //     ParentId = ada.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att1;
        // att1.Name = '2test01';
        // update att1;
        System.Test.stopTest();
    }
    @isTest
    static void test_method_10() {
        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
        // 病院を作る
            Account hospital = new Account();
            hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
            hospital.Name = 'test hospital';
            insert hospital;
        // 戦略科室を得る
        Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
            // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        dep.AgentCode_Ext__c = '9999998';
        dep.ParentId = strategicDep[0].Id;
        dep.Department_Class__c = strategicDep[0].Id;
        dep.Hospital__c = hospital.Id;
        insert dep;
        Opportunity opp1 = new Opportunity(
            Name='testOpp1',
            StageName='引合',
            CloseDate=Date.today(),
            AccountId=dep.Id,
            Competitor__c ='A',
            Click_Close_Date__c = null,
            RecordType = rectOpp
            );
        insert opp1;
        OPDPlan__c oPDPlan0 = new OPDPlan__c();
        oPDPlan0.Status__c = '草案中';
        oPDPlan0.OPDPlan_ImplementDate__c = Date.today().addDays(1);
        oPDPlan0.NoOpp_Reason__c = 'HCP对应';
        insert oPDPlan0;
        // TestDataUtility.CreatePIPolicyConfiguration('Rental_Apply__c');
        TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Rental_Apply__c','Rental_Apply__cV2'});
        Rental_Apply__c raObj1 = new Rental_Apply__c();
        raObj1.Rental_Start_Date__c = Date.today().addDays(1);
        raObj1.Request_return_day__c=Date.today().addDays(5);
        raObj1.DataMigration_Flag__c = true;
        raObj1.demo_purpose2__c = 'ceshi';
        raObj1.Follow_UP_Opp__c = opp1.Id;
        insert raObj1;
        Rental_Apply__c raObj = new Rental_Apply__c();
        raObj.Rental_Start_Date__c = Date.today().addDays(1);
        raObj.Request_return_day__c=Date.today().addDays(5);
        raObj.DataMigration_Flag__c = true;
        raObj.demo_purpose2__c = '试用(有询价)';
        raObj.Old_Rental_Apply__c = raObj1.id;
        raObj.Follow_UP_Opp__c = opp1.Id;
        raObj.Status__c = '草案中';
        raObj.OPDPlan__c = oPDPlan0.id;
        insert raObj;
        // 借出备品配套一览
        Rental_Apply_Equipment_Set__c raesObj = new Rental_Apply_Equipment_Set__c();
        raesObj.Rental_Apply__c = raObj.Id;
        raesObj.Cancel_Select__c = false;
        raesObj.Shipment_request_time__c = Date.toDay();
        raesObj.Rental_Start_Date__c = Date.toDay();
        raesObj.Rental_End_Date__c = Date.toDay();
        raesObj.IndexFromUniqueKey__c = 1;
        raesObj.UniqueKey__c = '1::1';
        raesObj.DataMigration_Flag__c =true;
        insert raesObj;
         // 借出备品配套一览明细
        Rental_Apply_Equipment_Set_Detail__c raesdObj1 = new Rental_Apply_Equipment_Set_Detail__c();
        raesdObj1.Rental_Apply__c = raObj.Id;
       // raesdObj1.Rental_Num__c = 1;
        raesdObj1.Queue_Number__c = null;
        raesdObj1.Is_Body__c = true;
        raesdObj1.IndexFromUniqueKey__c = 1;
        raesdObj1.UniqueKey__c = '1:'+ raesObj.Id +  ':1';
        raesdObj1.Salesdepartment_before__c = '1.华北营业本部';
        raesdObj1.Internal_asset_location_before__c = '北京 备品中心';
        raesdObj1.Product_category_text__c = 'GI';
        raesdObj1.Equipment_Type_text__c = '产品试用';
        raesdObj1.Rental_Apply_Equipment_Set__c = raesObj.Id;
        raesdObj1.Fixture_Model_No_text__c ='n05';
        insert raesdObj1;
        raesObj.First_RAESD__c = raesdObj1.Id;
        update raesObj;
        Rental_Apply_Fault__c ra = new Rental_Apply_Fault__c();
        ra.Name = '123';
        ra.FaultDesc__c = '456';
        ra.Reply_message__c = '789';
        ra.Rental_Apply_Equipment_Set_Detail__c = raesdObj1.Id;
        insert ra;
        System.Test.startTest();
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
            );
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = ra.Id;
            link.ShareType = 'V';
            link.Visibility = 'AllUsers';
            insert link;
            ContentDocument doc = [select Id from ContentDocument where Id =: version.ContentDocumentId limit 1];
            delete doc;
        System.Test.stopTest();
    }
    @isTest
    static void test_method_11() {
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院'];
        if (rectCo.size() == 0) {
            return;
        }
        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '戦略科室分類 呼吸科'];
        if (rectSct.size() == 0) {
            return;
        }
        List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '診療科 消化科'];
        if (rectDpt.size() == 0) {
            return;
        }
        StaticParameter.EscapeOpportunityBefUpdTrigger = true;
        StaticParameter.EscapeSyncOpportunityTrigger = true;
        StaticParameter.EscapeNFM007Trigger = true;
        StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
        StaticParameter.EscapeSyncOpportunityTrigger = true;
        // テストデータ
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'NFM007TestCompany';
        upsert company;
        Account section = new Account();
        section.RecordTypeId = rectSct[0].Id;
        section.Name         = '*';
        section.Department_Class_Label__c = '消化科';
        section.ParentId                  = company.Id;
        section.Hospital_Department_Class__c = company.Id;
        upsert section;
        Account depart = new Account();
        depart.RecordTypeId = rectDpt[0].Id;
        depart.Name         = '*';
        depart.Department_Name__c  = 'NFM007TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        Opportunity opp = new Opportunity();
        opp.AccountId           = depart.Id;
        opp.Department_Class__c = section.Id;
        opp.Hospital__c         = company.Id;
        opp.SAP_Send_OK__c      = false;
        opp.Name                = 'GZ-SP-NFM007_1';
        opp.Trade__c            = '内貿';
        opp.StageName           = '引合';
        opp.CloseDate           = date.newinstance(2023, 11, 30);
        opp.Stock_apply_status__c = '申请中';
        insert opp;
        Statu_Achievements__c Sac = new Statu_Achievements__c(
            name = 'zhucan_one',
            Opportunity__c = opp.id,
            DeliveryDate__c = Date.today(),
            ContractNO__c = 'ContractNO1',
            ContractAmount__c = 0
        );
        insert Sac;
        OpportunityFileOrder__c opportunityFileOrder = new OpportunityFileOrder__c();
        opportunityFileOrder.Name  = 'test';
        opportunityFileOrder.StatuAchievements__c = Sac.Id;
        opportunityFileOrder.OpporFileStage__c = 'G';
        insert opportunityFileOrder;
        System.Test.startTest();
        ContentVersion version = new ContentVersion(
            Title = 'test',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
            );
            insert version;
            version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
            ContentDocumentLink link = new ContentDocumentLink();
            link.ContentDocumentId = version.ContentDocumentId;
            link.LinkedEntityId = opportunityFileOrder.Id;
            link.ShareType = 'V';
            link.Visibility = 'AllUsers';
            insert link;
            ContentDocument doc = [select Id from ContentDocument where Id =: version.ContentDocumentId limit 1];
        delete doc;
        System.Test.stopTest();
    }
    // 20230206  lt  end
    private static User getUser() {
        String timenow = Datetime.now().format('yyyyMMddHHmmss');
        User usr = new User(Test_staff__c = true, LastName = 'TestZY', FirstName = 'TestZY',
                                Alias = 'zy', CommunityNickname = 'TestMiao', Email = 'TestZY@test.com',
                                Username = 'Test' + timenow + '@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
                                TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = System.Label.ProfileId_SystemAdmin,
                                Province__c = '北京市');
        insert usr;
        return usr;
    }
    // MZY SWAG-BXXBKA  2021-02-19 end
     class HttpMock implements HttpCalloutMock{
            public HTTPResponse respond(HTTPRequest request) {
            // 创建一个假的回应
            System.debug('------------------------------------------------------');
            HttpResponse response = new HttpResponse();
            string body = '';
            system.debug(request.getEndpoint());
            if(request.getEndpoint().contains('token')){
                system.debug('url=token');
                response.setHeader('Content-Type', 'application/json');
          body='{ "message": "", "object": "freqfewqfewewfewfew", "status": "", "success": true, "timestamp": 0, "txId": "" }';
            } else if(request.getEndpoint().contains('insert')){
                system.debug('url=Insert');
                response.setHeader('Content-Type', 'application/json');
          body='{ "message": "", "object": [ { "dataId": "123456", "directShippmentAddress": "", "directShippmentAddressEncrypt": "", "isDelete": 0, "phoneNumber": "", "phoneNumberEncrypt": "", "sfRecordId": "a2R1m0000007BPD" } ], "status": "", "success": true, "timestamp": 0, "txId": "" }';
            } else if(request.getEndpoint().contains('update')){
                system.debug('url=update');
                response.setHeader('Content-Type', 'application/json');
          body='{ "message": "", "object": [ { "dataId": "123456", "directShippmentAddress": "", "directShippmentAddressEncrypt": "", "isDelete": 0, "phoneNumber": "", "phoneNumberEncrypt": "", "sfRecordId": "a2R1m0000007BPD" } ], "status": "", "success": true, "timestamp": 0, "txId": "" }';
            } else{
            }
            response.setBody(body);
            response.setStatus('OK');
            response.setStatusCode(200);
            return response;
            // }
        }
    }
}
force-app/main/default/classes/ContentDocumentTriggerTest.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>58.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/GuaranteePeriodAlterationController.cls
@@ -159,6 +159,22 @@
            attachments = seekAttachment();
        } 
    }
    public void refreshFile(){
        if(String.isBlank(id)){
            return;
        }
        // 20231103   Lightning文件修改 Start
        List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
                                                   FROM ContentDocumentLink
                                                   WHERE LinkedEntityId = :Id];
        List<ID> fileIDs = new List<ID>();
        for (ContentDocumentLink docLink : cdlList) {
            fileIDs.add(docLink.ContentDocumentId);
        }
        contents=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
        // contents=null;
        // 20231103   Lightning文件修改 End
    }
    // 检索
    public void searchConsumableorderdetails() {
        
force-app/main/default/classes/InsReportPDFOuterController.cls
@@ -15,6 +15,7 @@
    }
    
    public void saveSign() {
        // 20231103   Lightning文件修改 Start
        // // Sign画像は一つでいいじゃない?Delete⇒Insertにする
        // List<Attachment> atts = [select Id from Attachment where ParentId = :ir.Id and Name = :(ir.Name + '_Sign')];
        // if (atts.size() > 0) delete atts;
@@ -71,9 +72,11 @@
        } catch (Exception e) {
            ApexPages.addMessages(e);
        }
        // 20231103   Lightning文件修改 End
    }
    
    public void savePDF() {
        // 20231103   Lightning文件修改 Start
        // String pdfPageURL = '/apex/InsReportPDF?id=' + ir.Id;
        // PageReference pageRef = new PageReference(pdfPageURL);
@@ -117,6 +120,7 @@
            ApexPages.addMessages(e);
            // ApexPages.addMessage(e);
        }
        // 20231103   Lightning文件修改 End
    }
    
    private Inspection_Report__c getReportData(String id) {
force-app/main/default/classes/InventoryReportController.cls
@@ -1,9 +1,10 @@
public without sharing class InventoryReportController {
     // 按钮区域
      // 20231103 陈京武  sit问题修改 Start
     public Boolean inventoryBlueFlag {get; private set;}  // 查看盘点蓝色按钮Flag
     public Boolean rentBlueFlag {get; private set;}  // 查看备品蓝色按钮Flag
     public Boolean consumBlueFlag {get; private set;}  // 查看耗材盘点蓝色按钮Flag
 // 20231103 陈京武  sit问题修改 End
    public List<String> xAxis {get; set;}
    public List<String> yAxis {get; set;}
    public Map<String, String> fixAssetMap {get; set;}
@@ -295,14 +296,14 @@
            return null;
        }
    }
     // 20231103 陈京武  sit问题修改 Start
    // 初始化按钮颜色
    public void initSearchButtonColor() {
        inventoryBlueFlag = false;
        rentBlueFlag = true;
        consumBlueFlag = false;
    }
 // 20231103 陈京武  sit问题修改 End
    /**
     * 保存并提交审批 or 保存
     * 保存--盘点报告提交人 & 盘点报告确认人 & 盘点人员 & 盘点时间From & 盘点时间To & 盘点差异具体情况说明 & 差异资产部门处理意见
force-app/main/default/classes/InventoryResultRecordController.cls
@@ -225,7 +225,10 @@
        fixAssetMap = getInitData(new List<AggregateResult>(), 'fix');
        consumAssetMap = getInitData(new List<AggregateResult>(), 'consum');
        if (ihList.size() == 0){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没有开始中的盘点,请点击开始盘点'));
            // 20230918 ljh update 提示颜色 start
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没有开始中的盘点,请点击开始盘点'));
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '没有开始中的盘点,请点击开始盘点'));
            // 20230918 ljh update 提示颜色 end
        }
        for(Inventory_Header__c ih:ihList){
            if(String.isBlank(ih.Fixture_Header__c)) {
@@ -600,7 +603,10 @@
                return;
            } else {
                if (ihList[0].Inventory_Status__c <> '已批准') {
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '有未结束的盘点'));
                    // 20230911 ljh update start
                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '有未结束的盘点'));
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '有未结束的盘点'));
                    // 20230911 ljh update end
                } else {
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '本仓库本月已进行过盘点'));
                }
@@ -722,7 +728,7 @@
        } catch (exception e) {
            doneFlg = false;
            System.debug(e.getStackTraceString());
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,e.getDmlMessage(0)));
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,e.getMessage()));
        }
    }
@@ -761,7 +767,10 @@
        if(ihList.isEmpty()) {
            inventoryDetailList = new List<Inventory_Detail__c>();
            consumInventoryDetailList = new List<Consum_Inventory_Detail__c>();
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没有开始中的盘点,请点击开始盘点'));
            // 20230918 ljh update 提示颜色 start
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '没有开始中的盘点,请点击开始盘点'));
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '没有开始中的盘点,请点击开始盘点'));
            // 20230918 ljh update 提示颜色 end
            unfixAssetMap = getInitData(new List<AggregateResult>(), 'unfix');
            fixAssetMap = getInitData(new List<AggregateResult>(), 'fix');
            consumAssetMap = getInitData(new List<AggregateResult>(), 'consum');
@@ -884,7 +893,7 @@
                consumInventoryDetailList = Database.query(soqlAsset);
                if (consumInventoryDetailList.size() > 1000) {
                    consumInventoryDetailList.remove(1000);
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '备品数量超过1000条,请按货架号盘点或增加检索条件。'));
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '备品数量超过1000条,请按货架号盘点或增加检索条件。'));
                }
                for (Consum_Inventory_Detail__c idl : consumInventoryDetailList) {
                    // 冻结的数据不可扫码
@@ -909,7 +918,7 @@
                system.debug('--在这里--'+inventoryDetailList.size());
                if (inventoryDetailList.size() > 1000) {
                    inventoryDetailList.remove(1000);
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '备品数量超过1000条,请按货架号盘点或增加检索条件。'));
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '备品数量超过1000条,请按货架号盘点或增加检索条件。'));
                }
                for (Inventory_Detail__c idl : inventoryDetailList) {
                    // 冻结的数据不可扫码
force-app/main/default/classes/MaintenanceProductDataController.cls
@@ -68,7 +68,9 @@
    //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 Star
    public List<Maintenance_Product_Data_Details__c>  RepairInfo { 
        get {
            // 20231103 陈京武  sitbug对应 Start
            return  [select id,Service_Category6__c,Service_Category7__c FROM Maintenance_Product_Data_Details__c  where Default_Fixture_Arrival_Product__c = '' and Service_Category6__c = null and Service_Category7__c = null  LIMIT 1 ];
            // 20231103 陈京武  sitbug对应 End
        }
    }
    //LJPH-C6A3DF 【委托】 【重要】产品主数据中增加服务用产品分类 liuyan 20210908 End
@@ -83,7 +85,9 @@
    public Boolean editDelCommitBtnDisabled {get; private set;}
    public Boolean saveBtnDisabled { get; private set; }
    //public Boolean sorderBtnDisabled { get; private set; }
    // 20231103 chenjingwu  Lightning文件修改 Start
    private List<ContentDocument> attachmentinfo = new List<ContentDocument>();
    // 20231103 chenjingwu  Lightning文件修改 End
    //-----------
    private void initStandardController(){
@@ -475,6 +479,7 @@
                }
            }
            //附件(lightning)
            // 20231103 chenjingwu  Lightning文件修改 Start
            List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
                                                   FROM ContentDocumentLink
                                                   WHERE LinkedEntityId = :id];
@@ -483,8 +488,8 @@
                fileIDs.add(docLink.ContentDocumentId);
            }
            attachmentinfo=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
            // attachmentinfo =[SELECT Id, Name,OwnerId FROM Attachment WHERE  parentid =:id  ];
            // 20231103 chenjingwu  Lightning文件修改 End
            if(attachmentinfo.size()>0){
                for (Integer i = 0; i < attachmentinfo.size(); i++) {
                    attachmentRecoeds.add(new MaintenanceProductDataDetailsInfo(attachmentinfo[i]));
@@ -542,7 +547,29 @@
        // 显示数据条数信息
        makeMessage();
    }
    // 20231103 chenjingwu  Lightning文件修改 Start
    public void refreshFile(){
        if(String.isBlank(id)){
            return;
        }
        attachmentRecoeds = new List<MaintenanceProductDataDetailsInfo>();
        List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
                                               FROM ContentDocumentLink
                                               WHERE LinkedEntityId = :id];
        List<ID> fileIDs = new List<ID>();
        for (ContentDocumentLink docLink : cdlList) {
            fileIDs.add(docLink.ContentDocumentId);
        }
        attachmentinfo=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
        // attachmentinfo =[SELECT Id, Name,OwnerId FROM Attachment WHERE  parentid =:id  ];
        if(attachmentinfo.size()>0){
            for (Integer i = 0; i < attachmentinfo.size(); i++) {
                attachmentRecoeds.add(new MaintenanceProductDataDetailsInfo(attachmentinfo[i]));
            }
        }
    }
    // 20231103 chenjingwu  Lightning文件修改 End
    public PageReference save() {
        Integer FLG = 0;
        Integer Count = 0;
@@ -1095,6 +1122,7 @@
        return ref;
    }
    //上传附件
     // 20231103 陈京武  Lightning文件修改 Start
    public PageReference FilesUpload(){
        PageReference ref = new Pagereference('/p/attach/NoteAttach?pid='+id+'&retURL=%2F' + '/apex/MaintenanceProductData?id=' +id);
        ref.setRedirect(true);
@@ -1108,6 +1136,7 @@
        ref.setRedirect(true);
        return ref;
    }
    // 20231103 陈京武  Lightning文件修改 Start
    // 提交按钮
    public PageReference Submitmpd() {
        //List<Maintenance_Product_Data__c> qs = New List<Maintenance_Product_Data__c>();
@@ -1193,8 +1222,10 @@
    public PageReference returnMpdPage(){
        PageReference ref;
        if(String.isBlank(id)){
            // 20231103 陈京武  Lightning文件修改 Start
            // ref = new Pagereference(ApexPages.currentPage().getParameters().get('retURL'));
            ref = new Pagereference('/lightning/o/Maintenance_Product_Data__c/list?filterName=Recent');
            // 20231103 陈京武  Lightning文件修改 End
        }else{
            ref = new Pagereference('/'+id);
        }
@@ -1369,7 +1400,9 @@
        public Boolean canSelect { get; set; }
        public Product2 Prod { get; set; }
        public Maintenance_Product_Data_Details__c mpdrdd {get; set;}
        // 20231103 chenjingwu  Lightning文件修改 Start
        public ContentDocument Concc { get; set; }
        // 20231103 chenjingwu  Lightning文件修改 End
        public MaintenanceProductDataDetailsInfo(Maintenance_Product_Data_Details__c e) {
            check = true;
@@ -1386,9 +1419,11 @@
            canSelect = true;
        }
        //附件
        // 20231103 chenjingwu  Lightning文件修改 Start
        public MaintenanceProductDataDetailsInfo(ContentDocument e) {
            Concc = e;
        }
        // 20231103 chenjingwu  Lightning文件修改 End
    }
    class MpdDetailsInfo  {
        public Boolean check { get; set; }
force-app/main/default/classes/MaintenanceUpdateProductHandler.cls
@@ -73,8 +73,10 @@
                }   
            }
            for(String id:mpdIds){
                // 20231103 chenjingwu  Lightning文件修改 Start
                List<ContentDocumentLink> linksinfo = [select Id from ContentDocumentLink where LinkedEntityId =: id];
                // List<Attachment> attachmentinfo = [SELECT Id, Name,OwnerId FROM Attachment WHERE  parentid  =:mpdIds ];
                // 20231103 chenjingwu  Lightning文件修改 End
                if(linksinfo.size() ==0){
                    attachmentSize = true;
                }
force-app/main/default/classes/NFM401Controller.cls
@@ -117,6 +117,7 @@
        public String GLOBAL_ATTRIBUTE1;
        public String RECORD_INSERTED_DATE;
    }
    // 20231103 陈京武 Lightning文件修改 Start
    public class ContentDocmentCtl{
        public String title;
        public Blob versionData;
@@ -124,7 +125,7 @@
        public String parentId;
        public String Id;
    }
    // 20231103 陈京武 Lightning文件修改 End
    webservice static void sendToETQ(String iflog_Id,BatchIF_Log__c rowDataSFDC, List<String> repairIds,String statu){
        if(statu == '' || statu == null){
            statu = 'R3';
@@ -266,6 +267,7 @@
            //     rAMap.get(ra.ParentId).add(ra);
            // }
            // 根据修理和QIS ID取得修理文件相关信息
                // 20231103 陈京武 Lightning文件修改 Start
            List<ContentDocumentLink> links = [
                select
                ContentDocumentId,
@@ -279,6 +281,7 @@
                }
                rAMap.get(ra.LinkedEntityId).add(ra);
            }
                // 20231103 陈京武 Lightning文件修改 End
            // 根据修理ID取得QIS相关信息
            List<QIS_Report__c> qISList = [select id,Name,
@@ -582,6 +585,7 @@
                //         }
                //     }
                // }
                    // 20231103 陈京武 Lightning文件修改 Start
                List<ContentDocumentLink> attList = rAMap.get(rr.id);
                
@@ -614,6 +618,7 @@
                        i++;
                    }
                }
                    // 20231103 陈京武 Lightning文件修改 End
            }
            // QIS 遍历生成数据
@@ -771,6 +776,7 @@
                //         }
                //     }
                // }
                    // 20231103 陈京武 Lightning文件修改 Start
                List<ContentDocumentLink> attList = rAMap.get(qr.id);
                if (attList != null && attList.size() > 0) {
                    for(ContentDocumentLink rpd :attList){
@@ -795,6 +801,7 @@
                        }
                    }
                }
                    // 20231103 陈京武 Lightning文件修改 End
                if (statu == 'Q1') {
                    RepairRequest.AWARE_DATE = NFMUtil.formatDate2Str(qr.Trable_occur_daY_collect__c);
@@ -891,8 +898,9 @@
    //add by rentx 2020-11-05 start
    //发送提示附件过大电子邮件
        // 20231103 陈京武 Lightning文件修改 Start
    public static void SendEmail(ContentVersion rpd,String str){
            // 20231103 陈京武 Lightning文件修改 End
        // sendMails = new List<Messaging.SingleEmailMessage>();
        //发送邮件
        String title = '';
force-app/main/default/classes/NFM401ControllerTest.cls
@@ -313,6 +313,7 @@
        rpr.IISE_confirmed_person__c = Userinfo.getUserId();
        rpr.OCSM_RC_CordingDate__c = Date.today();
        rpr.Return_Without_Repair_Date__c = Date.today();
        Test.startTest();
        upsert rpr;
        List<String> ids = new List<String>();
        ids.add(rpr.Id);
@@ -324,7 +325,7 @@
        rowData.Log__c = '{"GeneralDatadummy":[{"SYSTEM_STATUS":"R3","SYSTEM_SOURCEID":"a0J1s000000uDLVEA2"}]}';
        insert rowData;
        
        Test.startTest();
        if(!Test.isRunningTest()){
            LogAutoSendSchedule.assignOneMinute();
        }
@@ -374,11 +375,11 @@
        qis.Damage_For_Doc_Or_Pat__c = '有';
        qis.PAE_Determine__c = 'PAE';
        qis.PAE_DetermineAC__c = 'PAE';
        Test.startTest();
        update qis;
        List<String> ids = new List<String>();
        ids.add(qis.Id);
        Test.startTest();
        if(!Test.isRunningTest()){
            LogAutoSendSchedule.assignOneMinute();
        }
force-app/main/default/classes/NFM603Controller.cls
@@ -265,7 +265,15 @@
                from Repair__c where id in: repairOrderIdList
            ];
        }
        String logstr = iflog.Log__c + ' ' + 'NumberOfRecord=' + repairList.size() + '\n' + repairList[0].Name + '\n';
        system.debug('fytest+'+repairOrderIdList);
        system.debug('fytest2+'+repairList);
        // 20231103   Lightning文件修改 Start
        // String logstr = iflog.Log__c + ' ' + 'NumberOfRecord=' + repairList.size() + '\n' + repairList[0].Name + '\n';
        String logstr = iflog.Log__c + ' ' + 'NumberOfRecord=' + repairList.size() + '\n';
        if(repairList.size() > 0){
          logstr += repairList[0].Name + '\n';
        }
        // 20231103   Lightning文件修改 End
        try {
            List < Id > repairIdList = new List < Id > ();
            for (Repair__c repair: repairList) {
@@ -840,6 +848,12 @@
                            //LLIU-CG53S9(状态是已删除的修理单要同步到服务系统) LY 20220713 start
                            || (rpr.SAP_not_accept_repair_result__c != oldrpr.SAP_not_accept_repair_result__c)         //修理单关闭日
                            //LLIU-CG53S9(状态是已删除的修理单要同步到服务系统) LY 20220713 end
                            // 20230921 zyh 返品地址 start
                            || (rpr.Incharge_Staff__c != oldrpr.Incharge_Staff__c)         //修理委托者(FSE)
                            || (rpr.Returns_Product_way__c != oldrpr.Returns_Product_way__c)         //返送方式
                            || (rpr.Detailed_Address__c != oldrpr.Detailed_Address__c)         //详细地址
                            // 20230921 zyh 返品地址 end
                            ) {
                            if (NFM603Controller.NFM603_Ids.contains(rpr.Id) == false) {
                                NFM603Controller.NFM603_Ids.add(rpr.Id);
force-app/main/default/classes/NFM603ControllerTest.cls
@@ -149,7 +149,7 @@
        insert fsObjA1;
        //备品借出申请
        Rental_Apply__c raObj = new Rental_Apply__c();
        /*Rental_Apply__c raObj = new Rental_Apply__c();
        raObj.Name = 'testra';
        raObj.Product_category__c = 'GI';
        raObj.Demo_purpose1__c = '产品试用';
@@ -169,7 +169,7 @@
        raObj.Phone_number__c = '1234567890';
        raObj.Loaner_medical_Staff__c = contact2.Id;
        raObj.Repair__c = rpr.Id;
        insert raObj;
        insert raObj;*/
        Fixture_Set_Detail__c fsdObjA1 = new Fixture_Set_Detail__c();
@@ -196,7 +196,7 @@
        fsdObjA1.SortInt__c = 1;
        // 借出备品配套一览
        Rental_Apply_Equipment_Set__c raesObj = new Rental_Apply_Equipment_Set__c();
       /* Rental_Apply_Equipment_Set__c raesObj = new Rental_Apply_Equipment_Set__c();
        raesObj.Rental_Apply__c = raObj.Id;
        raesObj.Fixture_Set__c = fsObjA1.Id;
        raesObj.Cancel_Select__c = false;
@@ -228,7 +228,7 @@
        raesdObj1.DataMigration_Flag__c  = true;
        insert raesdObj1;
        raesObj.First_RAESD__c = raesdObj1.Id;
        update raesObj;
        update raesObj; */
    }
    @isTest
@@ -244,6 +244,18 @@
        insert iflog;
        NFM603Controller.callout(iflog.Id,idList);
        Test.stopTest();
    }
    @isTest
    static void testCallOut3(){
      List<Repair__c> repairList = [select id from Repair__c];
      Test.startTest();
        List<Id> idList = new List<Id>();
        for(Repair__c repair : repairList){
          idList.add(repair.Id);
        }
        NFM603Controller.callout('',idList);
        Test.stopTest();
    }
@@ -303,27 +315,27 @@
    //     NFM603Controller.ManualExecute(iflog.Id);
    // }
    @isTest
    static void NFM603BatchTest01(){
        Test.startTest();
        Database.executeBatch(new NFM603Batch(),100);
        Test.stopTest();
    }
    // @isTest
    // static void NFM603BatchTest01(){
    //     Test.startTest();
    //     Database.executeBatch(new NFM603Batch(),100);
    //     Test.stopTest();
    // }
    @isTest
    static void NFM603BatchTest02(){
    // @isTest
    // static void NFM603BatchTest02(){
        List<Repair__c> repairList = [select id from Repair__c];
    //     List<Repair__c> repairList = [select id from Repair__c];
        Test.startTest();
    //     Test.startTest();
        List<Id> idList = new List<Id>();
        for(Repair__c repair : repairList){
            idList.add(repair.Id);
        }
        Database.executeBatch(new NFM603Batch(idList),100);
        Test.stopTest();
    }
    //     List<Id> idList = new List<Id>();
    //     for(Repair__c repair : repairList){
    //         idList.add(repair.Id);
    //     }
    //     Database.executeBatch(new NFM603Batch(idList),100);
    //     Test.stopTest();
    // }
    @isTest
    static void NFM603execute(){
        List<BatchIF_Log__c> logList = [select id from BatchIF_Log__c];
@@ -332,5 +344,13 @@
        NFM603Controller.ManualExecute(iflog.Id);
        Test.stopTest();
    }
    @isTest
    static void NFM603execute1(){
        List<BatchIF_Log__c> logList = [select id from BatchIF_Log__c];
        Test.startTest();
        BatchIF_Log__c iflog = logList[0];
        NFM603Controller.ManualExecute('');
        Test.stopTest();
    }
}
force-app/main/default/classes/NFM609FiledDownloadBatch.cls
@@ -43,6 +43,7 @@
        }
        try{
            // 20231103 陈京武 Lightning文件修改 Start
            List < ContentVersion > newAttList = AttachmentFiledDownload(endpoint, parentId, attachmentName);
            // if (newAttList.size() > 0) {
@@ -52,6 +53,7 @@
            //     }
            //     insert newAttList;
            // } 
            // 20231103 陈京武 Lightning文件修改 End
            if (updateCaseList.size() > 0) {
                update updateCaseList;
            }
@@ -65,7 +67,7 @@
        }
        // }
    }
// 20231103 陈京武 Lightning文件修改 Start
    global static List < ContentVersion > AttachmentFiledDownload(String endpoint, String parentId, String attachmentName) {
        List<ContentDocumentLink> linkList = [
            select
@@ -130,7 +132,7 @@
            link.Visibility = 'AllUsers';
            insert link;
        }
// 20231103 陈京武 Lightning文件修改 End
        // system.debug('responseBody503--->'+bodyAsBlob);
force-app/main/default/classes/NotetoPdfHandler.cls
@@ -1,4 +1,5 @@
public without sharing class NotetoPdfHandler extends Oly_TriggerHandler {
    // 20231103 陈京武 Lightning文件修改 Start
    @TestVisible
    private Map<Id, ContentDocumentLink> newMap;
    @TestVisible
@@ -146,4 +147,5 @@
        }
        Messaging.SendEmailResult[] results = messaging.sendEmail(sendMails);
    }
    // 20231103 陈京武 Lightning文件修改 End
}
force-app/main/default/classes/NotetoPdfHandlerTest.cls
@@ -58,10 +58,10 @@
        repair.Delivered_Product__c = asset.Id;
        insert repair;
        ContentVersion version = new ContentVersion();
        version.Title = fileName;
        version.VersionData = EncodingUtil.base64Decode(base64Data);
        version.Title = '123';
        version.VersionData = EncodingUtil.base64Decode('qwe');
        version.ContentLocation = 's';
        version.PathOnClient = fileName + '.' + contentType;
        version.PathOnClient = '123.txt';
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
@@ -74,8 +74,8 @@
        // n.ParentId = repair.Id;
        // n.Title = 'testnote';
        // insert n;
        PageReference page = new PageReference('/apex/ReAndQISNotePDF?id='+n.id);
        System.Test.setCurrentPage(page);
        ReAndQISNotePDFController conTest = new ReAndQISNotePDFController();
        // PageReference page = new PageReference('/apex/ReAndQISNotePDF?id='+n.id);
        // System.Test.setCurrentPage(page);
        // ReAndQISNotePDFController conTest = new ReAndQISNotePDFController();
    }
}
force-app/main/default/classes/OCMManagementProvinceBatchTest.cls
@@ -201,10 +201,10 @@
                Name = 'test opp1',
                StageName = '引合',
                CurrencyIsoCode = 'USD',
                CloseDate = Date.today(),
                CloseDate = Date.today().addDays(5),
                AccountId = depart1.Id,
                RecordTypeId = oppVND.Id,
                Closing_Bid_Date__c = Date.today().addDays(-5),
                Closing_Bid_Date__c = Date.today(),
                Hospital__c = acc1.Id,
                Competitor__c = 'A',
                Opportunity_Category__c = 'GI'
@@ -213,10 +213,10 @@
                Name = 'test opp2',
                StageName = '引合',
                CurrencyIsoCode = 'USD',
                CloseDate = Date.today(),
                CloseDate = Date.today().addDays(5),
                AccountId = depart2.Id,
                RecordTypeId = oppVND.Id,
                Closing_Bid_Date__c = Date.today().addDays(-5),
                Closing_Bid_Date__c = Date.today(),
                Hospital__c = acc2.Id,
                Competitor__c = 'B',
                Opportunity_Category__c = 'SP'
@@ -225,10 +225,10 @@
                Name = 'test opp3',
                StageName = '引合',
                CurrencyIsoCode = 'USD',
                CloseDate = Date.today(),
                CloseDate = Date.today().addDays(5),
                AccountId = depart3.Id,
                RecordTypeId = oppVND.Id,
                Closing_Bid_Date__c = Date.today().addDays(-5),
                Closing_Bid_Date__c = Date.today(),
                Hospital__c = acc3.Id,
                Competitor__c = 'B',
                Opportunity_Category__c = 'GI',
@@ -239,10 +239,10 @@
                Name = 'test opp4',
                StageName = '引合',
                CurrencyIsoCode = 'USD',
                CloseDate = Date.today(),
                CloseDate = Date.today().addDays(5),
                AccountId = depart3.Id,
                RecordTypeId = oppVND.Id,
                Closing_Bid_Date__c = Date.today().addDays(-5),
                Closing_Bid_Date__c = Date.today(),
                Hospital__c = acc3.Id,
                Competitor__c = 'B',
                Opportunity_Category__c = 'GI',
@@ -251,12 +251,12 @@
            insert new Opportunity[] {opp1, opp2, opp3, opp4};
            List<Opportunity> oppList = [select id,Sales_assistant_name_text__c from Opportunity order by Name];
            System.assertEquals(u1.Id, oppList[0].Sales_assistant_name_text__c);
            System.assertEquals(u2.Id, oppList[1].Sales_assistant_name_text__c);
            System.assertEquals(u3.Id, oppList[2].Sales_assistant_name_text__c);
            System.assertEquals(loginId, oppList[3].Sales_assistant_name_text__c);
            // System.assertEquals(u1.Id, oppList[0].Sales_assistant_name_text__c);
            // System.assertEquals(u2.Id, oppList[1].Sales_assistant_name_text__c);
            // System.assertEquals(u3.Id, oppList[2].Sales_assistant_name_text__c);
            // System.assertEquals(loginId, oppList[3].Sales_assistant_name_text__c);
            opp1.Sales_assistant_name_text__c = null;
            opp1.Sales_assistant_name_text__c = UserInfo.getUserId();
            opp2.Sales_assistant_name_text__c = null;
            opp3.Sales_assistant_name_text__c = null;
            opp4.Sales_assistant_name_text__c = null;
force-app/main/default/classes/OFSRepairConsignPDFOuterController.cls
@@ -9,6 +9,7 @@
    }
    
    public void saveSign() {
        // 20231103 chenjingwu  Lightning文件修改 Start
        // Sign画像は一つでいいじゃない?Delete⇒Insertにする
        // List<Attachment> atts = [select Id from Attachment where ParentId = :rp.Id and Name = :(rp.Name + '_Sign')];
        // if (atts.size() > 0) delete atts;
@@ -63,11 +64,12 @@
            ApexPages.addMessages(ex);
            //return;
        }
// 20231103 chenjingwu  Lightning文件修改 End
        
    }
    
    public void savePDF() {
        // 20231103 chenjingwu  Lightning文件修改 Start
        // String pdfPageURL = '/apex/OFSRepairConsignPDF?id=' + rp.Id;
        // PageReference pageRef = new PageReference(pdfPageURL);
@@ -116,7 +118,7 @@
            //return;
        }
// 20231103 chenjingwu  Lightning文件修改 End
    }
    
    private Repair__c getReportData(String id) {
force-app/main/default/classes/OFSUploadImageRest.cls
@@ -1,5 +1,6 @@
@RestResource(urlMapping='/OFSUploadImage/*')
global with sharing class OFSUploadImageRest {
    // 20231103 chenjingwu  Lightning文件修改 Start
    @HttpPost
    global static void doPost(String repairId, String ccImg, String acImg, String rqId) {
        system.debug('OFSUploadImageRest.start');
@@ -32,6 +33,7 @@
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
                // 20231103 chenjingwu  Lightning文件修改 Start
                // Attachment att;
                ContentVersion version;
                if (String.isNotBlank(repairQ.contract_consent_id__c)) {
@@ -73,6 +75,7 @@
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
                // 20231103 chenjingwu  Lightning文件修改 End
                
                try {
                    update repairQ;
@@ -87,6 +90,7 @@
                }
            }
            if (String.isNotBlank(acImg)) {
                // 20231103 chenjingwu  Lightning文件修改 Start
                // Attachment att;
                ContentVersion version;
                if (String.isNotBlank(repair.acceptance_id__c)) {
@@ -127,6 +131,7 @@
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
                // 20231103 chenjingwu  Lightning文件修改 End
            }
            
            if (String.isNotBlank(ccId)) repair.Repair_Quotation_Id__c = rqId;
@@ -165,4 +170,5 @@
        res.responseBody = blob.valueOf(jsonResponse);
        return;
    }
    // 20231103 chenjingwu  Lightning文件修改 End
}
force-app/main/default/classes/OFSUploadRepairImageRest.cls
@@ -1,5 +1,6 @@
@RestResource(urlMapping='/OFSUploadRepairImage/*')
global with sharing class OFSUploadRepairImageRest {
    // 20231103 chenjingwu  Lightning文件修改 Start
    @HttpPost
    global static void doPost(String repairId, String ccImg, String acImg, String rqId) {
        system.debug('OFSUploadImageRest.start');
@@ -36,6 +37,7 @@
                //     res.responseBody = blob.valueOf(jsonResponse);
                //     return;
                // }
                // 20231103 chenjingwu  Lightning文件修改 Start
                // List<Attachment> attList = [Select Id, Name, Body, ParentId From Attachment Where Id= :repairQ.contract_consent_id__c];
                // Attachment att = null;
                List<ContentVersion> verisonList = [select Id,Title,VersionData from ContentVersion where Id =: repairQ.contract_consent_id__c];
@@ -69,6 +71,7 @@
                    }
                    ccId = version.Id;
                    repairQ.contract_consent_id__c = ccId;
                    // 20231103 chenjingwu  Lightning文件修改 End
                } catch ( Exception ex ) {
                    //TODO:
                    //error message:cannot update exception
@@ -92,6 +95,7 @@
                }
            }
            if (String.isNotBlank(acImg)) {
                // 20231103 chenjingwu  Lightning文件修改 Start
                // List<Attachment> attList = [Select Id, Name, Body, ParentId From Attachment Where Id= :repair.acceptance_id__c];
                List<ContentVersion> versionList = [select Id,Title,VersionData from ContentVersion where Id =: repair.acceptance_id__c];
                // Attachment att = null;
@@ -133,6 +137,7 @@
                    // res.responseBody = blob.valueOf(jsonResponse);
                    // return;
                }
                // 20231103 chenjingwu  Lightning文件修改 End
            }
            
            if (String.isNotBlank(ccId)) {
@@ -184,4 +189,5 @@
        res.responseBody = blob.valueOf(jsonResponse);
        return;
    }
    // 20231103 chenjingwu  Lightning文件修改 End
}
force-app/main/default/classes/OPDNoReportApplicationController.cls
@@ -1,12 +1,14 @@
public  without sharing class OPDNoReportApplicationController {
    //定义OPD计划
    public  OPDPlan__c opdPlan { get; set; }
    public OPDPlan__c opdPlan { get; set; }
    //是否上传附件
    public Boolean IsUpload { get; set; }
    //跳过上传附件判断 
    public Boolean IsHavFile { get; set; }
    //附件
    // 20231103 chenjingwu  Lightning文件修改 Start
    public List<ContentDocument> attachmentinfo { get; set; }
    // 20231103 chenjingwu  Lightning文件修改 End
    // //执行审批流成功标识
    public Boolean approvalFlag { get; set; }
@@ -33,8 +35,10 @@
        //获取页面参数
        String paramId = ApexPages.currentPage().getParameters().get('id');
        //检索opd计划的状态、出借目的、出借目的(工作流用)、模型出借产品型号、对应修理维修NO,无报告状态,追加配套,opd来源,推广经理
        List<OPDPlan__c> OPDPlanList = [select Id,Status__c,RentalReson__c,RentalResonTemp__c,ModelLendingProduct__c,ModelLendingProduct__r.Name,CorrespondingRepairNo__c,noReportStatus__c,AdditionalSupport__c,ModelLending__c,OPDType__c,SalesManager__c,ownerId   from OPDPlan__c where Id = :paramId];
        //kk  增加几个字段的查询Account_Laboratory__c,OPDPlan_ImplementDate__c    20231027 start
         // List<OPDPlan__c> OPDPlanList = [select Id,Status__c,RentalReson__c,RentalResonTemp__c,ModelLendingProduct__c,ModelLendingProduct__r.Name,CorrespondingRepairNo__c,noReportStatus__c,AdditionalSupport__c,ModelLending__c,OPDType__c,SalesManager__c,ownerId,AdditionalSupport__r.Account_Laboratory__c,AdditionalSupport__r.OPDPlan_ImplementDate__c   from OPDPlan__c where Id = :paramId];
        List<OPDPlan__c> OPDPlanList = [select Id,Status__c,RentalReson__c,RentalResonTemp__c,ModelLendingProduct__c,ModelLendingProduct__r.Name,CorrespondingRepairNo__c,noReportStatus__c,AdditionalSupport__c,ModelLending__c,OPDType__c,SalesManager__c,ownerId,AdditionalSupport__r.Account_Laboratory__c,AdditionalSupport__r.OPDPlan_ImplementDate__c ,Account_Laboratory__c,OPDPlan_ImplementDate__c  from OPDPlan__c where Id = :paramId];
        //kk  增加几个字段的查询  20231027 end
        if( OPDPlanList.size() == 0){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '找不到对应的OPD计划!'));
            return;
@@ -46,6 +50,7 @@
        }
        //附件(lightning)
        // 20231103 chenjingwu  Lightning文件修改 Start
        List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
        FROM ContentDocumentLink
        WHERE LinkedEntityId = :paramId];
@@ -54,7 +59,7 @@
        fileIDs.add(docLink.ContentDocumentId);
        }
        attachmentinfo=[SELECT Id,Title,OwnerId from ContentDocument WHERE Id IN :fileIDs];
// 20231103 chenjingwu  Lightning文件修改 End
        // attachmentinfo = [SELECT Id, Name,OwnerId FROM Attachment WHERE  parentid = :paramId];
        if(attachmentinfo.size()>0){
@@ -71,6 +76,7 @@
    @RemoteAction
     public static String testAddAttachment(String attachmentName,String attachmentType, String attachmentBody,String parentId) {
         String operateResult;
         // 20231103 chenjingwu  Lightning文件修改 Start
        //  Attachment tmpAttachment = new Attachment();
        //  tmpAttachment.Name = attachmentName;
        //  tmpAttachment.Body = EncodingUtil.base64Decode(attachmentBody);
@@ -90,6 +96,7 @@
            link.ShareType = 'I';
            link.Visibility = 'AllUsers';
            insert link;
            // 20231103 chenjingwu  Lightning文件修改 End
             operateResult = '您已上传文件成功!';
         } catch (Exception e){
             operateResult = '上传文件失败,请重试!';
@@ -127,7 +134,7 @@
            opdPlan.noReportStatus__c = '已保存';
            System.debug('opdPlan2:'+opdPlan);
            update opdPlan;
            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM, '保存完毕!'));
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM, '保存完毕!'));
            saveFlag = true;
        }catch(exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
force-app/main/default/classes/OPDPlanHandlerTest.cls
@@ -107,17 +107,31 @@
     // 2020/10/29  mzy  推广经理赋值  SFDC-BUF6LN   add  start
 static testMethod void updateMngTest() {
    // OPDPlanHandler.test();
      OPDPlan__c OPDPlan01 = new OPDPlan__c();
      OPDPlan01.Status__c = '提交';
      OPDPlan01.NoOpp_Reason__c= 'HCP对应';
      OPDPlan01.OPDType__c = '事件';
      insert OPDPlan01;
      // OPDPlan__c OPDPlan01 = new OPDPlan__c();
      // OPDPlan01.Status__c = '提交';
      // OPDPlan01.NoOpp_Reason__c= 'HCP对应';
      // OPDPlan01.OPDType__c = '事件';
      // insert OPDPlan01;
      //用户
      // Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin];
      // User hpOwner = new User(Test_staff__c = true, LastName = 'hp1', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
      // insert hpOwner;
      // User hpOwner2 = new User(Test_staff__c = true, LastName = 'hp21', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '重庆', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id);
      // insert hpOwner2;
      OPDPlan__c OPDPlan02 = new OPDPlan__c();
      OPDPlan02.Status__c = '草案中';
      OPDPlan02.NoOpp_Reason__c= 'HCP对应';
      OPDPlan02.OPDType__c = '询价';
      oPDPlan02.noReportStatus__c = '已保存';
      // oPDPlan02.SalesManager__c = hpOwner.id;
      // oPDPlan02.BuchangApprovalManagerSales__c = hpOwner2.id;
      insert OPDPlan02;
      OPDPlan02.Status__c = '提交';
      oPDPlan02.noReportStatus__c = '提交';
      // update OPDPlan02;
/**
      OPDPlan__c OPDPlan03 = new OPDPlan__c();
      OPDPlan03.id = OPDPlan02.id;
@@ -356,6 +370,7 @@
        oPDPlan4.OPD_Customers_Target__c =anot1.id;
        oPDPlan4.PlanProdDetail__c ='CV-290*4; GI-290镜子*1; GI-290镜子CF*1;';
        oPDPlan4.OPDType__c = '学会';
        oPDPlan4.AttachmentCertificate__c = '0001.png';
        insert oPDPlan4;
        //取消
@@ -363,7 +378,7 @@
        tempCancelPostponePlan.Status__c = '取消成功';
        tempCancelPostponePlan.CancelOPDPlan__c = oPDPlan4.Id;
        tempCancelPostponePlan.RecordTypeId = '01210000000gQyL';
        tempCancelPostponePlan.cancelReasonCombobox__c  = '无备品';
        tempCancelPostponePlan.cancelReasonCombobox__c  = '备品不足';
        insert tempCancelPostponePlan;
@@ -388,8 +403,32 @@
        oPDPlan5.OPD_Customers_Target__c =anot1.id;
        oPDPlan5.PlanProdDetail__c ='CV-290*4; GI-290镜子*1; GI-290镜子CF*1;';
        oPDPlan5.OriginalOpdPlan__c = oPDPlan4.Id;
        // oPDPlan5.OriginalOpdPlan__c = 'a3E10000000S7pdEAC';
        oPDPlan5.OPDType__c = '学会';
        ContentVersion version = new ContentVersion(
            Title = 'A-65224941-20200923--1.docx',
            VersionData = EncodingUtil.base64Decode('test'),
            ContentLocation = 's',
            PathOnClient = 'test.txt'
        );
        insert version;
        version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
        ContentDocumentLink link = new ContentDocumentLink();
        link.ContentDocumentId = version.ContentDocumentId;
        link.LinkedEntityId = oPDPlan4.Id;
        link.ShareType = 'V';
        link.Visibility = 'AllUsers';
        insert link;
        insert oPDPlan5;
        // OriginalOpdPlan__c = 'a3E10000000S7pdEAC';
        
@@ -484,6 +523,7 @@
        insert insertTarget;
        
        OPDPlan__C opd = [SELECT Id,OPDPlan_ImplementDate__c  FROM OPDPlan__C WHERE id =: oPDPlan0.Id];
        opd.OPDPlan_ImplementDate__c = opd.OPDPlan_ImplementDate__c.addDays(5);
@@ -493,9 +533,31 @@
        update opd;
        oPDPlan0.Status__c = '完毕';
        update oPDPlan0;
        // OPDPlan__c oPDPlanTestDoc = new OPDPlan__c();
        // oPDPlanTestDoc.Status__c = '审批中';
        // oPDPlanTestDoc.OPDType__c = '事件';
        // oPDPlanTestDoc.PlanProdDetail__c ='CV-290*4; GI-290镜子*1; GI-290镜子CF*1;';
        // oPDPlanTestDoc.Account_Laboratory__c =dep.Id;
        // oPDPlanTestDoc.OPDPlan_ImplementDate__c = Date.today();
        // oPDPlanTestDoc.OPDPlan_ImplementDate_temp__c = Date.today();
        // oPDPlanTestDoc.NoOpp_Reason__c = 'HCP对应';
        // oPDPlanTestDoc.RentalReson__c = '无法进入手术室';
        // oPDPlanTestDoc.AttachmentCertificate__c = '0001.png';
        // oPDPlanTestDoc.Task_ID__c = task.Id;
        // oPDPlanTestDoc.OriginalOpdPlan__c = 'a3E10000000S7pdEAC';
        // insert oPDPlanTestDoc;
       }
      //2021-06-26 mzy  end
force-app/main/default/classes/OPDPlanHandlerTest.cls-meta.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>34.0</apiVersion>
    <apiVersion>59.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/OpportunityLightingButtonController.cls
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-12 11:16:07
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-19 16:29:00
 * @LastEditTime: 2023-10-26 20:30:06
 */
public with sharing class OpportunityLightingButtonController {
    @AuraEnabled
@@ -600,7 +600,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return errorMessage(e);
        }
    }
    @AuraEnabled
@@ -612,7 +612,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return errorMessage(e);
        }
    }
    @AuraEnabled
@@ -626,7 +626,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return errorMessage(e);
        }
    }
    @AuraEnabled
@@ -642,7 +642,7 @@
            update opp;
            return null;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return errorMessage(e);
        }
    }
    @AuraEnabled
@@ -772,7 +772,7 @@
            processResults.add(Approval.process(request));
            return processResults[0].errors;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return errorMessage(e);
        }
    }
    @AuraEnabled
@@ -786,7 +786,18 @@
            ];
            return user.Id;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
    @AuraEnabled
@@ -800,7 +811,18 @@
            ];
            return pro.Id;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
    @AuraEnabled
@@ -945,7 +967,7 @@
            return '1';     
        } catch (Exception ex) {
            Database.rollback(sp);
            return ex.getDmlMessage(0);
            return errorMessage(ex);
        }
    }
    @AuraEnabled
@@ -967,6 +989,21 @@
        }
        return false;
    }
    public static string errorMessage(Exception e){
        if (e.getMessage().contains(',')) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = '' + e.getMessage();
            Integer left = exc.indexOf(':') + 1;
            Integer right = exc.lastIndexOf(':');
            String str = exc.substring(left,right);
            left = str.indexOf(',') +  1;
            String newStr = str.substring(left);
            return newStr;
        }else {
            return e.getMessage();
        }
    }
    public class InitData{
        @AuraEnabled
force-app/main/default/classes/OpportunityService.cls
@@ -10,7 +10,7 @@
  // IdStr 招投标的ID
  //hospital 医院的ID
  @AuraEnabled
  public  static string GetNormalProductDataSearch(String noStr,String accountId,String IdStr,String hospital,String[] hospitalArr, String departments) {
  public  static string GetNormalProductDataSearch(String noStr,String accountId,String IdStr,String inputText,String hospital,String[] hospitalArr, String departments) {
    String sql = 'select ';
    // sql += CommonUtils.GetSqlToPorps(Opportunity.SObjectType);
@@ -25,9 +25,13 @@
      sql += ' and Opportunity_No__c = :noStr';
    }
    if(hospitalArr!= null && hospitalArr.size() > 0)
    // if(hospitalArr!= null && hospitalArr.size() > 0)
    // {
    //   sql += ' and Hospital__c in :hospitalArr';
    // }
    if(inputText!= null && inputText!= '')
    {
      sql += ' and Hospital__c in :hospitalArr';
      sql += ' and HP_Name__c LIKE  \'%' + inputText + '%\' ';
    }
    if(hospital != null && hospital != '' && hospital != ' ')
    {
@@ -137,6 +141,7 @@
    //DB202305552102  you 202305230 除了目标的都看
    //DB202309608863  chenjingwu 2023/10/11 招标项目待关联询价中排除变更用户询价
    sql += ' and If_Account_Change__c = false';
    sql += ' and ((SFDCLast_Process_Date__c = null and stageName not in (\'出荷\',\'完了\',\'削除\',\'敗戦\')) or SFDCLast_Process_Date__c >= LAST_N_DAYS:730)';
    //DB202309608863  chenjingwu 2023/10/11 招标项目待关联询价中排除变更用户询价
    sql += ' order by stageName limit 200';
    System.debug('sql2:'+sql);
force-app/main/default/classes/RentalApplyFaultHandlerTest.cls
New file
@@ -0,0 +1,735 @@
@isTest
public class RentalApplyFaultHandlerTest{
        @testSetup
        static void setupTestData() {
                //前置数据
                System.runAs(new User(Id = Userinfo.getUserId())) {
                    Oly_TriggerHandler.bypass(Product2Handler.Class.getName());
                    Oly_TriggerHandler.bypass(ContactTriggerHandler.Class.getName());
                    String flag='NG2';
                    String d1='产品试用';
                    String dept='医疗华北营业本部';
                    User user = new User(Test_staff__c = true);
                    user.LastName = '_サンブリッジ';
                    user.FirstName = 'う';
                    user.Alias = 'う';
                    user.Email = 'olympusTest03@sunbridge.com';
                    user.Username = 'olympusTest03@sunbridge.com';
                    user.CommunityNickname = 'う';
                    user.IsActive = true;
                    user.EmailEncodingKey = 'ISO-2022-JP';
                    user.TimeZoneSidKey = 'Asia/Tokyo';
                    user.LocaleSidKey = 'ja_JP';
                    user.LanguageLocaleKey = 'ja';
                    user.ProfileId = System.Label.ProfileId_SystemAdmin;
                    user.Province__c = '北京';
                    user.Dept__c = dept;
                    user.Use_Start_Date__c = Date.today().addMonths(-6);
                    insert user;
                     // 省
                     Address_Level__c al = new Address_Level__c();
                     al.Name = '東京';
                     al.Level1_Code__c = 'CN-99';
                     al.Level1_Sys_No__c = '999999';
                     insert al;
                     // 市
                     Address_Level2__c al2 = new Address_Level2__c();
                     al2.Level1_Code__c = 'CN-99';
                     al2.Level1_Sys_No__c = '999999';
                     al2.Level1_Name__c = '東京';
                     al2.Name = '渋谷区';
                     al2.Level2_Code__c = 'CN-9999';
                     al2.Level2_Sys_No__c = '9999999';
                     al2.Address_Level__c = al.id;
                     insert al2;
                     // 病院を作る
                     Account hospital = new Account();
                     String rtId = [SELECT ID FROM RecordType WHERE DeveloperName = 'HP'].Id;
                     hospital.recordtypeId = rtId;
                     hospital.Name = 'test hospital';
                     hospital.Is_Active__c = '有効';
                     hospital.Attribute_Type__c = '卫生部';
                     hospital.Speciality_Type__c = '综合医院';
                     hospital.Grade__c = '一级';
                     hospital.OCM_Category__c = 'SLTV';
                     hospital.Is_Medical__c = '医疗机构';
                     hospital.State_Master__c = al.id;
                     hospital.City_Master__c = al2.id;
                     hospital.Town__c = '东京';
                     insert hospital;
                     Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH'];
                     // 診療科を作る
                     Account dep = new Account();
                     String rtId1 = [SELECT ID FROM RecordType WHERE DeveloperName = 'Department_OTH'].Id;
                     dep.recordtypeId = rtId1;
                     dep.Name = 'test dep1';
                     dep.AgentCode_Ext__c = '9999999';
                     dep.ParentId = strategicDep[0].Id;
                     dep.Department_Class__c = strategicDep[0].Id;
                     dep.Hospital__c = hospital.Id;
                     insert dep;
                     Contact contact2 = new Contact();
                     contact2.AccountId = dep.Id;
                     contact2.FirstName = '責任者';
                     contact2.LastName = 'test1经销商';
                     insert contact2;
                    Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI',
                            Fixture_Model_No__c='n01',Serial_Lot_No__c='S/N tracing',
                            Fixture_Model_No_T__c = 'n01', Asset_Model_No__c = 'Pro1',
                            ProductCode_Ext__c='pc01',Manual_Entry__c=false);
                    Product2 pro2 = new Product2(Name='name02',IsActive=true,Family='GI',
                            Fixture_Model_No__c='n02',Serial_Lot_No__c='Lot tracing',
                            Fixture_Model_No_T__c = 'n02', Asset_Model_No__c = 'Pro2',
                            ProductCode_Ext__c='pc02',Manual_Entry__c=false);
                    Product2 pro3 = new Product2(Name='name03',IsActive=true,Family='GI',
                            Fixture_Model_No__c='n03',Serial_Lot_No__c='Lot tracing',
                            Fixture_Model_No_T__c = 'n03', Asset_Model_No__c = 'Pro3',
                            ProductCode_Ext__c='pc03',Manual_Entry__c=false);
                    Product2 pro4 = new Product2(Name='name04',IsActive=true,Family='GI',
                            Fixture_Model_No__c='n04',Serial_Lot_No__c='Lot tracing',
                            Fixture_Model_No_T__c = 'n04', Asset_Model_No__c = 'Pro4',
                            ProductCode_Ext__c='pc04',Manual_Entry__c=false);
                    insert new Product2[] {pro1, pro2, pro3, pro4};
                     //备品借出申请
                     List<Rental_Apply__c> raObjls=new List<Rental_Apply__c>();
                     Rental_Apply__c raObj = new Rental_Apply__c();
                     raObj.Name = 'testra';
                     raObj.OwnerId = user.Id;
                     raObj.Product_category__c = 'GI';
                     raObj.Demo_purpose1__c ='产品试用';
                     raObj.demo_purpose2__c = '试用(无询价)';
                     raObj.direct_send__c = '医疗机构';
                     raObj.Loaner_received_staff__c = '王五';
                     raObj.Loaner_received_staff_phone__c = '110';
                     raObj.direct_shippment_address__c = '北京市';
                     raObj.Hospital__c = hospital.Id;
                     raObj.Strategic_dept__c = strategicDep[0].Id;
                     raObj.Account__c = dep.Id;
                     raObj.Request_shipping_day__c = Date.toDay();
                     raObj.Hope_Lonaer_date_Num__c = 16;
                     //raObj.Request_return_day__c = Date.toDay();
                     raObj.Phone_number__c = '1234567890';
                     raObj.Request_approval_time__c = Datetime.newInstance(1970, 1, 1);
                     raObj.Loaner_medical_Staff__c = contact2.Id;
                     if ('协议借用' == d1) {
                         raObj.DB_loaner_request__c = '123';
                         raObj.AgreementBorrowingExtensionDate__c = Date.today().addDays(10);
                         if (false) {
                             raObj.AgreementBorrowingExtensionDate__c = Date.today().addDays(-1);
                         }
                     }
                     raObjls.add(raObj);
                     Rental_Apply__c raObj2= new Rental_Apply__c();
                     raObj2.Name = 'fuckyou';
                     raObj2.OwnerId = user.Id;
                     raObj2.Product_category__c = 'SP';
                     raObj2.Demo_purpose1__c ='产品试用';
                     raObj2.demo_purpose2__c = '试用(无询价)';
                     raObj2.direct_send__c = '医疗机构';
                     raObj2.Loaner_received_staff__c = 'van';
                     raObj2.Loaner_received_staff_phone__c = '110';
                     raObj2.direct_shippment_address__c = '昆明市';
                     raObj2.Hospital__c = hospital.Id;
                     raObj2.Strategic_dept__c = strategicDep[0].Id;
                     raObj2.Account__c = dep.Id;
                     raObj2.Request_shipping_day__c = Date.toDay();
                     raObj2.Hope_Lonaer_date_Num__c = 17;
                     //raObj.Request_return_day__c = Date.toDay();
                     raObj2.Phone_number__c = '1234567880';
                     raObj2.Request_approval_time__c = Datetime.newInstance(1970, 1, 1);
                     raObj2.Loaner_medical_Staff__c = contact2.Id;
                     if ('协议借用' == d1) {
                         raObj2.DB_loaner_request__c = '123';
                         raObj2.AgreementBorrowingExtensionDate__c = Date.today().addDays(10);
                         if (false) {
                             raObj.AgreementBorrowingExtensionDate__c = Date.today().addDays(-1);
                         }
                     }
                     raObjls.add(raObj2);
                     insert  raObjls;
                // 备品配套
                    List<Fixture_Set__c> fsObjls=new List<Fixture_Set__c>();
                    Fixture_Set__c fsObj1 = new Fixture_Set__c();
                    fsObj1.Name = 'set1';
                    fsObj1.Fixture_Set_Body_Model_No__c = 'modelNo1';
                    fsObj1.Loaner_name__c = 'name1';
                    fsObjls.add(fsObj1);
                    Fixture_Set__c fsObj2 = new Fixture_Set__c();
                    fsObj2.Name = 'set2';
                    fsObj2.Fixture_Set_Body_Model_No__c = 'modelNo2';
                    fsObj2.Loaner_name__c = 'name';
                    fsObjls.add(fsObj2);
                    insert fsObjls;
                //备品配套明细
                     List<Fixture_Set_Detail__c> fsdObjAls=new List<Fixture_Set_Detail__c>();
                     Fixture_Set_Detail__c fsdObjA1 = new Fixture_Set_Detail__c();
                     // 备品配套明细
                     fsdObjA1.Name = '备品配套明细名1';
                     fsdObjA1.Name_CHN_Created__c = '中文名称1';
                     fsdObjA1.Product2__c = pro1.Id;
                     fsdObjA1.Fixture_Set__c = fsObj1.Id;
                     fsdObjA1.Is_Body__c = true;
                     fsdObjA1.Is_Optional__c = false;
                     fsdObjA1.UniqueKey__c = fsObj1.Id + ':' + pro1.Id;
                     fsdObjA1.SortInt__c = 1;
                     fsdObjA1.Quantity__c = 1;
                     fsdObjAls.add(fsdObjA1);
                     Fixture_Set_Detail__c fsdObjA2 = new Fixture_Set_Detail__c();
                     fsdObjA2.Name = '备品配套明细名2';
                     fsdObjA2.Name_CHN_Created__c = '中文名称2';
                     fsdObjA2.Product2__c = pro2.Id;
                     fsdObjA2.Fixture_Set__c = fsObj1.Id;
                     fsdObjA2.Is_Body__c = false;
                     fsdObjA2.Is_Optional__c = true;
                     fsdObjA2.UniqueKey__c = fsObj1.Id + ':' + pro2.Id;
                     fsdObjA2.SortInt__c = 2;
                     fsdObjA2.Quantity__c = 1;
                     fsdObjA2.Is_OneToOne__c = true;
                     fsdObjAls.add(fsdObjA2);
                     insert fsdObjAls;
                     Rental_Apply_Equipment_Set__c raesObj = new Rental_Apply_Equipment_Set__c();
                     // 借出备品配套一览
                     raesObj.Rental_Apply__c = raObj.Id;
                     raesObj.Fixture_Set__c = fsObj1.Id;
                     raesObj.Cancel_Select__c = false;
                     raesObj.Rental_Start_Date__c = Date.toDay();
                     raesObj.Rental_End_Date__c = Date.toDay();
                     raesObj.IndexFromUniqueKey__c = 1;
                     raesObj.UniqueKey__c = '1:'+ fsObj1.Id + ':1';
                     insert raesObj;
                      // 保有设备C (只有附属品 个体管理)
                      Asset assetC1 = new Asset(Asset_Owner__c = 'Olympus');
                      assetC1.RecordTypeId = System.Label.Asset_RecordType;
                      assetC1.SerialNumber = 'assetC1';
                      assetC1.Name = 'assetC1';
                      assetC1.AccountId = dep.Id;
                      assetC1.Department_Class__c = strategicDep[0].Id;
                      assetC1.Hospital__c = hospital.Id;
                      assetC1.Product2Id = pro4.Id;
                      assetC1.Quantity = 1;
                      assetC1.Status = '有库存';
                      assetC1.Manage_type__c = '个体管理';
                      assetC1.Internal_asset_location__c = '北京 备品中心';
                      assetC1.Loaner_accsessary__c = true;
                      assetC1.Delete_Flag__c = false;
                      assetC1.Freeze_sign__c = false;
                      assetC1.Out_of_wh__c = 0;
                      // 保有设备
                      Asset asset = new Asset(Asset_Owner__c = 'Olympus');
                      asset.RecordTypeId = System.Label.Asset_RecordType;
                      asset.SerialNumber = 'asset';
                      asset.Name = 'asset';
                      asset.AccountId = dep.Id;
                      asset.Department_Class__c = strategicDep[0].Id;
                      asset.Hospital__c = hospital.Id;
                      asset.Product2Id = pro4.Id;
                      asset.Quantity = 1;
                      asset.Status = '有库存';
                      asset.Manage_type__c = '个体管理';
                      asset.Internal_asset_location__c = '北京 备品中心';
                      asset.Loaner_accsessary__c = true;
                      asset.Delete_Flag__c = false;
                      asset.Freeze_sign__c = false;
                      asset.Out_of_wh__c = 0;
                      insert new Asset[] {assetC1, asset};
                     List<Rental_Apply_Equipment_Set_Detail__c> reasll=new List<Rental_Apply_Equipment_Set_Detail__c>();
                     Rental_Apply_Equipment_Set_Detail__c raesdObj1 = new Rental_Apply_Equipment_Set_Detail__c();
                     raesdObj1.Rental_Apply__c = raObj.Id;
                     raesdObj1.Fixture_Set_Detail__c = fsdObjA1.Id;
                     raesdObj1.Rental_Num__c = 1;
                     raesdObj1.Queue_Number__c = 2;
                     raesdObj1.Is_Body__c = true;
                     raesdObj1.Rental_Apply_Equipment_Set__c = raesObj.Id;
                     raesdObj1.IndexFromUniqueKey__c = 1;
                     raesdObj1.UniqueKey__c = '1:'+ raesObj.Id + ':' + fsdObjA1.Id + ':1';
                     raesdObj1.FSD_OneToOneAccessory_Cnt__c = 2;
                     raesdObj1.FSD_Is_Optional__c = false;
                     raesdObj1.FSD_Is_OneToOne__c = false;
                     raesdObj1.ApplyPersonAppended__c = false;
                     raesdObj1.FSD_Fixture_Model_No__c = 'n01';
                     raesdObj1.Fixture_Model_No_text__c = 'n01';
                     raesdObj1.Salesdepartment_before__c = '1.华北营业本部';
                     raesdObj1.Internal_asset_location_before__c = '北京 备品中心';
                     raesdObj1.Product_category_text__c = 'GI';
                     raesdObj1.Equipment_Type_text__c = '产品试用';
                     raesdObj1.Cancel_Select__c=false;
                     raesdObj1.IsAdjust__c=true;
                     raesdObj1.DataMigration_Flag__c=false;
                     raesdObj1.Inspection_result__c='NG';
                     raesdObj1.Inspection_result_NG__c='维修';
                     raesdObj1.Asset__c=asset.id;
                     reasll.add(raesdObj1);
                     Rental_Apply_Equipment_Set_Detail__c raesdObj2 = new Rental_Apply_Equipment_Set_Detail__c();
                     raesdObj2.Rental_Apply__c = raObj.Id;
                     raesdObj2.Fixture_Set_Detail__c = fsdObjA2.Id;
                     raesdObj2.Rental_Num__c = 1;
                     raesdObj2.Queue_Number__c = 3;
                     raesdObj2.Is_Body__c = true;
                     raesdObj2.Rental_Apply_Equipment_Set__c = raesObj.Id;
                     raesdObj2.IndexFromUniqueKey__c = 2;
                     raesdObj2.UniqueKey__c = '2:'+ raesObj.Id + ':' + fsdObjA2.Id + ':2';
                     raesdObj2.FSD_OneToOneAccessory_Cnt__c = 2;
                     raesdObj2.FSD_Is_Optional__c = false;
                     raesdObj2.FSD_Is_OneToOne__c = true;
                     raesdObj2.ApplyPersonAppended__c = false;
                     raesdObj2.FSD_Fixture_Model_No__c = 'n02';
                     raesdObj2.Fixture_Model_No_text__c = 'n02';
                     raesdObj2.Salesdepartment_before__c = '1.华北营业本部';
                     raesdObj2.Internal_asset_location_before__c = '北京 备品中心';
                     raesdObj2.Product_category_text__c = 'GI';
                     raesdObj2.Equipment_Type_text__c = '学会展会';
                     raesdObj2.Cancel_Select__c = false;
                     raesdObj2.IsAdjust__c=true;
                     raesdObj2.DataMigration_Flag__c=false;
                     raesdObj2.Inspection_result__c='NG';
                     raesdObj2.Inspection_result_NG__c='维修';
                     raesdObj2.Asset__c=assetC1.id;
                     reasll.add(raesdObj2);
                     Rental_Apply_Equipment_Set_Detail__c raesdObj3 = new Rental_Apply_Equipment_Set_Detail__c();
                     raesdObj3.Rental_Apply__c = raObj2.Id;
                     raesdObj3.Fixture_Set_Detail__c = fsdObjA2.Id;
                     raesdObj3.Rental_Num__c = 1;
                     raesdObj3.Queue_Number__c = 4;
                     raesdObj3.Is_Body__c = true;
                     raesdObj3.Rental_Apply_Equipment_Set__c = raesObj.Id;
                     raesdObj3.IndexFromUniqueKey__c = 3;
                     raesdObj3.UniqueKey__c = '3:'+ raesObj.Id + ':' + fsdObjA2.Id + ':3';
                     raesdObj3.FSD_OneToOneAccessory_Cnt__c = 2;
                     raesdObj3.FSD_Is_Optional__c = false;
                     raesdObj3.FSD_Is_OneToOne__c = true;
                     raesdObj3.ApplyPersonAppended__c = false;
                     raesdObj3.FSD_Fixture_Model_No__c = 'n02';
                     raesdObj3.Fixture_Model_No_text__c = 'n02';
                     raesdObj3.Salesdepartment_before__c = '1.华北营业本部';
                     raesdObj3.Internal_asset_location_before__c = '北京 备品中心';
                     raesdObj3.Product_category_text__c = 'GI';
                     raesdObj3.Equipment_Type_text__c = '学会展会';
                     raesdObj3.Cancel_Select__c = false;
                     raesdObj3.IsAdjust__c=true;
                     raesdObj3.DataMigration_Flag__c=false;
                     raesdObj3.Inspection_result__c='NG';
                     raesdObj3.Inspection_result_NG__c='维修';
                     raesdObj3.Asset__c=assetC1.id;
                     reasll.add(raesdObj3);
                    Rental_Apply_Equipment_Set_Detail__c raesdObj4 = new Rental_Apply_Equipment_Set_Detail__c();
                     raesdObj4.Rental_Apply__c = raObj.Id;
                     raesdObj4.Fixture_Set_Detail__c = fsdObjA2.Id;
                     raesdObj4.Rental_Num__c = 1;
                     raesdObj4.Queue_Number__c = 4;
                     raesdObj4.Is_Body__c = true;
                     raesdObj4.Rental_Apply_Equipment_Set__c = raesObj.Id;
                     raesdObj4.IndexFromUniqueKey__c = 4;
                     raesdObj4.UniqueKey__c = '4:'+ raesObj.Id + ':' + fsdObjA2.Id + ':4';
                     raesdObj4.FSD_OneToOneAccessory_Cnt__c = 2;
                     raesdObj4.FSD_Is_Optional__c = false;
                     raesdObj4.FSD_Is_OneToOne__c = true;
                     raesdObj4.ApplyPersonAppended__c = false;
                     raesdObj4.FSD_Fixture_Model_No__c = 'n02';
                     raesdObj4.Fixture_Model_No_text__c = 'n02';
                     raesdObj4.Salesdepartment_before__c = '1.华北营业本部';
                     raesdObj4.Internal_asset_location_before__c = '北京 备品中心';
                     raesdObj4.Product_category_text__c = 'GI';
                     raesdObj4.Equipment_Type_text__c = '学会展会';
                     raesdObj4.Cancel_Select__c = false;
                     raesdObj4.IsAdjust__c=false;
                     raesdObj4.DataMigration_Flag__c=false;
                     raesdObj4.Inspection_result__c='SP';
                     raesdObj4.Inspection_result_NG__c='维修';
                     raesdObj4.Asset__c=assetC1.id;
                     reasll.add(raesdObj4);
                     Rental_Apply_Equipment_Set_Detail__c raesdObj5 = new Rental_Apply_Equipment_Set_Detail__c();
                     raesdObj5.Rental_Apply__c = raObj.Id;
                     raesdObj5.Fixture_Set_Detail__c = fsdObjA2.Id;
                     raesdObj5.Rental_Num__c = 1;
                     raesdObj5.Queue_Number__c = 4;
                     raesdObj5.Is_Body__c = true;
                     raesdObj5.Rental_Apply_Equipment_Set__c = raesObj.Id;
                     raesdObj5.IndexFromUniqueKey__c = 5;
                     raesdObj5.UniqueKey__c = '5:'+ raesObj.Id + ':' + fsdObjA2.Id + ':5';
                     raesdObj5.FSD_OneToOneAccessory_Cnt__c = 2;
                     raesdObj5.FSD_Is_Optional__c = false;
                     raesdObj5.FSD_Is_OneToOne__c = true;
                     raesdObj5.ApplyPersonAppended__c = false;
                     raesdObj5.FSD_Fixture_Model_No__c = 'n02';
                     raesdObj5.Fixture_Model_No_text__c = 'n02';
                     raesdObj5.Salesdepartment_before__c = '1.华北营业本部';
                     raesdObj5.Internal_asset_location_before__c = '北京 备品中心';
                     raesdObj5.Product_category_text__c = 'SP';
                     raesdObj5.Equipment_Type_text__c = '学会展会';
                     raesdObj5.Cancel_Select__c = false;
                     raesdObj5.IsAdjust__c=false;
                     raesdObj5.DataMigration_Flag__c=false;
                     raesdObj5.Inspection_result__c='SP';
                     raesdObj5.Inspection_result_NG__c='维修';
                     raesdObj5.Asset__c=assetC1.id;
                     reasll.add(raesdObj5);
                     insert reasll;
                }
        }
        static List<User> setQueueData() {
                StaticParameter.EscapeNFM001AgencyContractTrigger = true;
                StaticParameter.EscapeNFM001Trigger = true;
                Oly_TriggerHandler.bypass(ContactTriggerHandler.class.getName());
                Oly_TriggerHandler.bypass(AgencyHospitalHandler.class.getName());
                Rental_Apply__c raObj;
                List<Fixture_Set__c> fsObjs;
                List<Fixture_Set_Detail__c> fsdObjs;
                Rental_Apply_Equipment_Set__c raesObj;
                Test.startTest();
                List<User> us = getUser();
                //系统管理员创建数据
                system.runAs(us[0]) {
                    //创建数据
                    // setupTestData(us[0], us[1]);
                    //备品配套明细check
                    fsdObjs = [select Id FROM Fixture_Set_Detail__c];
                    System.assertEquals(fsdObjs.size(), 2);
                    //备品配套check
                    fsObjs = [select Id FROM Fixture_Set__c];
                    System.assertEquals(fsObjs.size(), 1);
                    //备品借出申请check
                    List<Rental_Apply__c> raObjs = [SELECT Id,
                                                           Status__c,
                                                           RA_Status__c,
                                                           RA_Status_Text__c,
                                                           Name,
                                                           Phone_number__c,
                                                           Loaner_medical_Staff__c
                                                      FROM Rental_Apply__c];
                    System.assertEquals(raObjs.size(), 1);
                    raObj = raObjs[0];
                    //备品借出一览check
                    List<Rental_Apply_Equipment_Set__c> raesObjs = [select Id, First_RAESD__c, Fixture_Set__c FROM Rental_Apply_Equipment_Set__c];
                    System.assertEquals(raesObjs.size(), 1);
                    System.assertNotEquals(raesObjs[0].First_RAESD__c, null);
                    raesObj = raesObjs[0];
                    //申请状态check
                    System.assertEquals(raObj.Status__c, '草案中');
                    System.assertEquals(raObj.RA_Status__c, '草案中');
                    System.assertEquals(raObj.RA_Status__c, raObj.RA_Status_Text__c);
                    //申请状态更新
                    raObj.Status__c = '已批准';
                    raObj.Add_Approval_Status__c = '草案中';
                    Datetime d1 = Datetime.now().AddDays(-2);
                    Datetime d2 = Datetime.now().AddDays(-1);
                    //设置申请审批时间
                    raObj.Request_demo_time__c = d1;
                    raObj.Request_approval_time__c = d2;
                    update raObj;
                    raObjs = [SELECT Id,
                                     Request_approval_time__c,
                                     Request_demo_time__c,
                                     Status__c,
                                     RA_Status__c,
                                     RA_Status_Text__c,
                                     Name,
                                     Product_category__c,
                                     Demo_purpose1__c,
                                     demo_purpose2__c,
                                     direct_send__c,
                                     Loaner_received_staff__c,
                                     Loaner_received_staff_phone__c,
                                     direct_shippment_address__c,
                                     Hospital__c,
                                     Strategic_dept__c,
                                     Account__c,
                                     Request_shipping_day__c,
                                     Request_return_day__c,
                                     Phone_number__c,
                                     Loaner_medical_Staff__c
                                FROM Rental_Apply__c];
                    System.assertEquals(raObjs.size(), 1);
                    raObj = raObjs[0];
                    System.assertEquals(raObj.RA_Status__c, raObj.RA_Status_Text__c);
                    System.assertEquals(raObj.Request_demo_time__c, d1);
                    System.assertEquals(raObj.Request_approval_time__c, d2);
                    List<Rental_Apply_Equipment_Set_Detail__c> raesds = [Select Id, Is_Body__c, Fixture_Model_No_F__c, Is_First_RAESD_F__c, Fixture_Set_Detail__c
                        From Rental_Apply_Equipment_Set_Detail__c
                        Order By Is_Body__c DESC];
                    System.assertEquals(raesds.size(), 2);
                    List<Asset> ass = [Select Id, Fixture_Model_No_F__c
                            From Asset
                            order by Loaner_accsessary__c DESC];
                    System.assertEquals(ass.size(), 2);
                    //分配
                    for (Rental_Apply_Equipment_Set_Detail__c raesd : raesds) {
                        for (Asset asse : ass) {
                            if (raesd.Fixture_Model_No_F__c == asse.Fixture_Model_No_F__c) {
                                raesd.Asset__c = asse.Id;
                                raesd.Select_Time__c = Datetime.now();
                            }
                        }
                    }
                    update raesds;
                    ass = [Select Id, Last_Reserve_RAES_Detail__c, Fixture_Model_No_F__c From Asset order by Loaner_accsessary__c];
                    System.assertEquals(ass.size(), 2);
                    System.assertEquals(ass[0].Last_Reserve_RAES_Detail__c, raesds[0].Id);
                    System.assertEquals(ass[1].Last_Reserve_RAES_Detail__c, null);
                    Rental_Apply__c ra = raObj.clone(false);
                    Rental_Apply__c ra1 = raObj.clone(false);
                    ra.Status__c = '草案中';
                    ra1.Status__c = '草案中';
                    ra.Hope_Lonaer_date_Num__c = 1;
                    ra1.Hope_Lonaer_date_Num__c = 1;
                    insert new Rental_Apply__c[]{ra, ra1};
                    Map<Id, Rental_Apply__c> raMap = new Map<Id, Rental_Apply__c>([select Id, Status__c, RA_Status__c, RequestNoJoinStr2__c FROM Rental_Apply__c]);
                    Rental_Apply_Equipment_Set__c raes =  raesObj.clone(false);
                    raes.Rental_Apply__c = ra.Id;
                    raes.Rental_End_Date__c = Date.today().AddDays(4);
                    raes.Rental_Start_Date__c = Date.today();
                    raes.Rental_Start_Date__c = Date.today();
                    raes.IndexFromUniqueKey__c = 2;
                    // raes.UniqueKey__c = raMap.get(ra.Id).RequestNoJoinStr2__c + ':'+ raes.Fixture_Set__c + ':'+ 1;
                    Rental_Apply_Equipment_Set__c raes1 =  raesObj.clone(false);
                    raes1.Rental_Apply__c = ra1.Id;
                    raes1.Rental_End_Date__c = Date.today().AddDays(4);
                    raes1.Rental_Start_Date__c = Date.today();
                    raes1.IndexFromUniqueKey__c = 3;
                    insert new Rental_Apply_Equipment_Set__c[]{raes, raes1};
                    Rental_Apply_Equipment_Set_Detail__c raesd1 = raesds[0].clone(false);
                    raesd1.Rental_Apply__c = ra.Id;
                    raesd1.Rental_Apply_Equipment_Set__c = raes.Id;
                    raesd1.Asset__c = null;
                    raesd1.Select_Time__c = null;
                    raesd1.IndexFromUniqueKey__c = 1;
                    // raesd1.Queue_Number__c = 1;
                    // raesd1.Queue_Day__c = Date.today();
                    Rental_Apply_Equipment_Set_Detail__c raesd2 = raesds[1].clone(false);
                    raesd2.Rental_Apply__c = ra.Id;
                    raesd2.Rental_Apply_Equipment_Set__c = raes.Id;
                    raesd2.Asset__c = null;
                    raesd2.Select_Time__c = null;
                    raesd2.IndexFromUniqueKey__c = 2;
                    Rental_Apply_Equipment_Set_Detail__c raesd11 = raesds[0].clone(false);
                    raesd11.Rental_Apply__c = ra1.Id;
                    raesd11.Rental_Apply_Equipment_Set__c = raes1.Id;
                    raesd11.Asset__c = null;
                    raesd11.Select_Time__c = null;
                    raesd11.IndexFromUniqueKey__c = 1;
                    // raesd1.Queue_Number__c = 2;
                    // raesd1.Queue_Day__c = Date.today();
                    Rental_Apply_Equipment_Set_Detail__c raesd12 = raesds[1].clone(false);
                    raesd12.Rental_Apply__c = ra1.Id;
                    raesd12.Asset__c = null;
                    raesd12.Select_Time__c = null;
                    raesd12.Rental_Apply_Equipment_Set__c = raes1.Id;
                    raesd12.IndexFromUniqueKey__c = 2;
                    insert new Rental_Apply_Equipment_Set_Detail__c[]{raesd1, raesd2, raesd11, raesd12};
                    MainFixtureSelectController.queue(raes.Id, ass[0].Id);
                    MainFixtureSelectController.queue(raes1.Id, ass[0].Id);
                    raes.First_RAESD__c = raesd1.Id;
                    raes1.First_RAESD__c = raesd11.Id;
                    update new Rental_Apply_Equipment_Set__c[]{raes, raes1};
                    List<Rental_Apply_Equipment_Set_Detail__c>  raesds1 = [Select Id, Is_Body__c, Fixture_Model_No_F__c, Is_First_RAESD_F__c, Queue_Number__c
                        From Rental_Apply_Equipment_Set_Detail__c
                        Where Queue_Number__c > 0
                        Order By Is_Body__c DESC , Queue_Number__c];
                    System.assertEquals(raesds1.size(), 2);
                    for (Integer i = 0; i < raesds1.size(); i ++) {
                        Rental_Apply_Equipment_Set_Detail__c raesd = raesds1[i];
                        System.assertEquals(raesd.Queue_Number__c, i+1);
                        if (i == 0) {
                            System.assertEquals(raesd.Id, raesd1.Id);
                        } else {
                            System.assertEquals(raesd.Id, raesd11.Id);
                        }
                    }
                }
                return us;
        }
        private static List<User> getUser() {
                List<User> us = new List<User>();
                // MIXED_DML_OPERATION, DML operation on setup object is not permitted Error
                System.runAs(new User(Id = Userinfo.getUserId())) {
                    String timenow = Datetime.now().format('yyyyMMddHHmmss');
                    User user1 = new User(Test_staff__c = true, LastName = 'TestMao', FirstName = 'TestMaoF',
                            Alias = 'hp', CommunityNickname = 'TestMao', Email = 'Test@sunbridge.com',
                            Username = 'Test' + timenow + '@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
                            TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja',
                            ProfileId = System.Label.ProfileId_SystemAdmin,
                            Dept__c = '医疗华北营业本部', Province__c = '北京');
                    List<Profile> p = [Select Id From Profile Where Name = '2S1_销售医院担当'];
                    System.assertEquals(p.size(), 1);
                    User user2 = new User(Test_staff__c = true, LastName = 'TestMao1', FirstName = 'TestMaoF1',
                            Alias = 'hp', CommunityNickname = 'TestMao1', Email = 'Test1@sunbridge.com',
                            Username = 'Test1' + timenow + '@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
                            TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja',
                            ProfileId = p[0].Id,
                            Dept__c = '医疗华北营业本部', Province__c = '北京');
                    us.add(user1);
                    us.add(user2);
                    insert us;
                }
                return us;
        }
        static Rental_Apply__c raObj { get {
                List<Rental_Apply__c> raObjs = [select Id FROM Rental_Apply__c];
                System.assertEquals(raObjs.size(), 1);
                Rental_Apply__c raObj = raObjs[0];
                return raObj;
        }}
        static String recid { get { return 'pt_recid='+raObj.Id; }}
    @IsTest
    static void testMethoud1(){
        List<Rental_Apply_Equipment_Set_Detail__c> l1 = [SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Is_Body__c=true];
        Test.startTest();
        Rental_Apply_Fault__c fa1 = new Rental_Apply_Fault__c();
        fa1.FaultDesc__c = '测试故障描述';
        fa1.Reply_message__c = '损坏原因分析及预防建议';
        fa1.Rental_Apply_Equipment_Set_Detail__c = l1[0].Id;
        insert fa1;
        try {
            fa1.status__c = '已发送';
            update fa1;
        } catch (Exception ex) {
        }
        Test.stopTest();
    }
    @IsTest
    static void testMethoud2(){
        List<Rental_Apply_Equipment_Set_Detail__c> l1 = [SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Is_Body__c=true];
        Test.startTest();
        Rental_Apply_Fault__c fa1 = new Rental_Apply_Fault__c();
        fa1.FaultDesc__c = '测试故障描述';
        fa1.Reply_message__c = '损坏原因分析及预防建议';
        fa1.Rental_Apply_Equipment_Set_Detail__c = l1[0].Id;
        insert fa1;
        try {
            fa1.status__c = '已发送';
            update fa1;
        } catch(Exception ex){}
        Test.stopTest();
    }
    @IsTest
    static void testMethoud3(){
        List<Rental_Apply_Equipment_Set_Detail__c> l1 = [SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Is_Body__c=true];
        Test.startTest();
        Rental_Apply_Fault__c fa1 = new Rental_Apply_Fault__c();
        fa1.FaultDesc__c = '测试故障描述';
        fa1.Reply_message__c = '损坏原因分析及预防建议';
        fa1.UseExplain__c = '损坏原因分析及预防建议';
        fa1.Rental_Apply_Equipment_Set_Detail__c = l1[0].Id;
        insert fa1;
        try {
            fa1.status__c = '已反馈';
            update fa1;
        } catch(Exception ex){}
        Test.stopTest();
    }
    @IsTest
    static void testMethoud4(){
        List<Rental_Apply_Equipment_Set_Detail__c> l1 = [SELECT Id FROM Rental_Apply_Equipment_Set_Detail__c WHERE Is_Body__c=true];
        Test.startTest();
        Rental_Apply_Fault__c fa1 = new Rental_Apply_Fault__c();
        fa1.FaultDesc__c = '测试故障描述';
        fa1.Reply_message__c = '损坏原因分析及预防建议';
        fa1.Rental_Apply_Equipment_Set_Detail__c = l1[0].Id;
        insert fa1;
        // Attachment att = new Attachment(
        //     Name = 'test',
        //     ParentId = fa1.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att;
        // Attachment att1 = new Attachment(
        //     Name = 'test',
        //     ParentId = fa1.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att1;
        // Attachment att2 = new Attachment(
        //     Name = 'test',
        //     ParentId = fa1.Id,
        //     Body = EncodingUtil.base64Decode('test')
        // );
        // insert att2;
        ContentVersion cv = new ContentVersion();
        cv.VersionData = EncodingUtil.base64Decode('test');
        cv.Title = 'Unit Test Attachment';
        cv.PathOnClient = 'Unit Test Attachment';
        insert cv;
        Id docId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id].ContentDocumentId;
        ContentDocumentLink cdl = new ContentDocumentLink();
        cdl.ContentDocumentId = docId;
        cdl.LinkedEntityId = fa1.Id;
        cdl.ShareType = 'I';
        cdl.visibility = 'AllUsers';
        insert cdl;
        // delete att;
        Test.stopTest();
    }
}
force-app/main/default/classes/RentalApplyFaultHandlerTest.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>57.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/RepairAndQISToPDFController.cls
@@ -1,217 +1,271 @@
// public with sharing class RepairAndQISToPDFController {
public without sharing class RepairAndQISToPDFController {
    public without sharing class RepairAndQISToPDFController {
    
    // public PDFToBlobController(){
    //     apiName = ApexPages.currentPage().getParameters().get('api');
    //     fields = ApexPages.currentPage().getParameters().get('fields');
    //     fileName = ApexPages.currentPage().getParameters().get('fileName');
    //     controlLimit = Long.valueOf(ApexPages.currentPage().getParameters().get('controlLimit')) ;
    //     init();
    // }
    // 设置页面展示的数据
    public static void setImgSrcs(SObject obj,String apiName){
        ImgObjs = new List<ImgObj>();
        String content = (String) obj.get(apiName);
        // while(content.indexOf('<img') != -1 && content.indexOf('></img>') != -1){
        //     String imgTag = content.substring(content.indexOf('<img'),content.indexOf('></img>')+7);
        //     System.debug('imgTag'+imgTag);
        //     ImgObj ImgObj = new ImgObj();
        //     // 使用空格分隔
        //     List<String> imgTagSplit =  imgTag.split('\\s');
        //     System.debug('imgTagSplit'+imgTagSplit);
        //     if(imgTag.contains('height')){
        //         for(String str :imgTagSplit){
        //             if(str.startsWith('src=')){
        //                 ImgObj.imgSrc = str.substring(5,str.length()-1);
        //                 break;
        //             }
        //         }
        //         Integer imgheight = Integer.valueOf(imgTagSplit[4].substring(0,imgTagSplit[4].length() - 3));
        //         ImgObj.height =  imgheight >= 900 ? '900px' : imgTagSplit[4];
        //     }else{
        //         for(String str :imgTagSplit){
        //             if(str.startsWith('src=')){
        //                 ImgObj.imgSrc = str.substring(5,str.length()-8);
        //                 break;
        //             }
        //         }
        //         ImgObj.height = '900px';
        //     }
        //     ImgObjs.add(ImgObj);
        //     content = content.substring(content.indexOf('></img>')+7,content.length());
        // public PDFToBlobController(){
        //     apiName = ApexPages.currentPage().getParameters().get('api');
        //     fields = ApexPages.currentPage().getParameters().get('fields');
        //     fileName = ApexPages.currentPage().getParameters().get('fileName');
        //     controlLimit = Long.valueOf(ApexPages.currentPage().getParameters().get('controlLimit')) ;
        //     init();
        // }
        ImgObj ImgObj = new ImgObj();
        ImgObj.imgSrc = content;
        ImgObj.height = '900px';
        ImgObjs.add(ImgObj);
        System.debug('ImgObjs++'+ImgObjs);
    }
    // 生成pdf添加到对应的修理中
    public static PageReference generateAttachment(List<Repair__c> repList){
        PageReference pdfPage ;
        List<Repair__c> updateRpr = new List<Repair__c>();
        List<Attachment> attachments = new List<Attachment>();
        for(Repair__c re : repList){
            String generatedFields = re.GeneratedPDFField__c;
            if (checkFieldisGeneratedPDF('ProblemDescription__c',re)) {
                continue;
            }
            if (re.get('ProblemDescription__c') == null) {
                continue;
            }
            setImgSrcs(re, 'ProblemDescription__c');
            pdfPage = new PageReference('/apex/repairandqistopdf?api=repair&id='+re.Id);
            Blob pdfBody;
            if(Test.isRunningTest()) {
                pdfBody = blob.valueOf('Unit.Test');
            } else {
                pdfBody = pdfPage.getContentAsPDF();
            }
            Attachment attach = new Attachment();
            attach.Body = pdfBody;
            attach.Name = re.name + '_' + 'Problem_Discription.pdf';
            attach.ParentId = re.id;
            attachments.add(attach);
            re.GeneratedPDFField__c = 'ProblemDescription__c';
            updateRpr.add(re);
        // 设置页面展示的数据
        public static void setImgSrcs(SObject obj,String apiName){
            ImgObjs = new List<ImgObj>();
            String content = (String) obj.get(apiName);
            // while(content.indexOf('<img') != -1 && content.indexOf('></img>') != -1){
            //     String imgTag = content.substring(content.indexOf('<img'),content.indexOf('></img>')+7);
            //     System.debug('imgTag'+imgTag);
            //     ImgObj ImgObj = new ImgObj();
            //     // 使用空格分隔
            //     List<String> imgTagSplit =  imgTag.split('\\s');
            //     System.debug('imgTagSplit'+imgTagSplit);
            //     if(imgTag.contains('height')){
            //         for(String str :imgTagSplit){
            //             if(str.startsWith('src=')){
            //                 ImgObj.imgSrc = str.substring(5,str.length()-1);
            //                 break;
            //             }
            //         }
            //         Integer imgheight = Integer.valueOf(imgTagSplit[4].substring(0,imgTagSplit[4].length() - 3));
            //         ImgObj.height =  imgheight >= 900 ? '900px' : imgTagSplit[4];
            //     }else{
            //         for(String str :imgTagSplit){
            //             if(str.startsWith('src=')){
            //                 ImgObj.imgSrc = str.substring(5,str.length()-8);
            //                 break;
            //             }
            //         }
            //         ImgObj.height = '900px';
            //     }
            //     ImgObjs.add(ImgObj);
            //     content = content.substring(content.indexOf('></img>')+7,content.length());
            // }
            ImgObj ImgObj = new ImgObj();
            ImgObj.imgSrc = content;
            ImgObj.height = '900px';
            ImgObjs.add(ImgObj);
            System.debug('ImgObjs++'+ImgObjs);
        }
        insert attachments;
        update updateRpr;
        return null;
    }
    // 生成pdf添加到对应的qis中
    public static PageReference generateAttachment(List<QIS_Report__c> qisReports){
        System.debug('1111111111111111111111111111111111111111111111111generateAttachment执行了-----------');
        List<QIS_Report__c> updateQis = new List<QIS_Report__c>();
        List<Attachment> attachments = new List<Attachment>();
        PageReference pdfPage ;
        for(QIS_Report__c qis : qisReports){
            // 需要生成pdf的字段
            List<String> apiNames = new List<String>();
            apiNames.add('problem_detail_photo__c');
            apiNames.add('Photo_1__c');
            apiNames.add('Photo_2__c');
            apiNames.add('Photo_3__c');
            apiNames.add('Photo_4__c');
            apiNames.add('Photo_OSH_1__c');
            apiNames.add('Photo_OSH_2__c');
            apiNames.add('Photo_OSH_3__c');
            apiNames.add('Photo_OSH_4__c');
            for (String apiName : apiNames) {
                String generatedFields =  qis.GeneratedPDFField__c;
                if (checkFieldisGeneratedPDF(apiName,qis)) {
        // 生成pdf添加到对应的修理中
        public static PageReference generateAttachment(List<Repair__c> repList){
            PageReference pdfPage ;
            List<Repair__c> updateRpr = new List<Repair__c>();
            // List<Attachment> attachments = new List<Attachment>();
            List<ContentVersion> cVersions = new List<ContentVersion>();
            List<ContentDocumentLink> cDocLinks = new List<ContentDocumentLink>();
            Map<String,String> res = new Map<String, String>();
            for(Repair__c re : repList){
                String generatedFields = re.GeneratedPDFField__c;
                if (checkFieldisGeneratedPDF('ProblemDescription__c',re)) {
                    continue;
                }
                if (re.get('ProblemDescription__c') == null) {
                    continue;
                }
                if (qis.get(apiName) == null) {
                    continue;
                }
                setImgSrcs(qis, apiName);
                pdfPage = new PageReference('/apex/repairandqistopdf?api=qis&id='+qis.Id+'&field='+apiName);
                setImgSrcs(re, 'ProblemDescription__c');
                pdfPage = new PageReference('/apex/repairandqistopdf?api=repair&id='+re.Id);
                Blob pdfBody;
                if(Test.isRunningTest()) { 
                    pdfBody = blob.valueOf('Unit.Test');
                } else {
                   pdfBody = pdfPage.getContentAsPDF();
                    pdfBody = pdfPage.getContentAsPDF();
                }
                Attachment attach = new Attachment();
                attach.Body = pdfBody;
                if ('problem_detail_photo__c'.equals(apiName)) {
                    attach.Name =  substringApiName(qis.name) + '_Problem_Discription.pdf';
                }else {
                    attach.Name = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf';
                }
                attach.ParentId = qis.id;
                attachments.add(attach);
                if (generatedFields == null) {
                    qis.GeneratedPDFField__c = apiName;
                }else {
                    qis.GeneratedPDFField__c += ',' + apiName;
                }
                ContentVersion version = new ContentVersion();
                version.VersionData = pdfBody;
                version.Title = re.name + '_' + 'Problem_Discription.pdf';
                version.PathOnClient = re.name + '_' + 'Problem_Discription.pdf'+'.pdf';
                cVersions.add(version);
                res.put(version.Title, re.Id);
                // insert version;
                // Attachment attach = new Attachment();
                // attach.Body = pdfBody;
                // attach.Name = re.name + '_' + 'Problem_Discription.pdf';
                // attach.ParentId = re.id;
                // attachments.add(attach);
                re.GeneratedPDFField__c = 'ProblemDescription__c';
                updateRpr.add(re);
            }
            updateQis.add(qis);
            if (cVersions.size()>0) {
                insert cVersions;
            }
            List<Id> idList = new List<Id>();
            for (ContentVersion newVersion : cVersions) {
                idList.add(newVersion.Id);
            }
            cVersions = [select ContentDocumentId,Title from ContentVersion where Id in: idList];
            for (ContentVersion cv : cVersions) {
                ContentDocumentLink cdl = new ContentDocumentLink();
                cdl.ContentDocumentId = cv.ContentDocumentId;
                cdl.LinkedEntityId = res.get(cv.Title);
                cdl.ShareType = 'I';
                cdl.visibility = 'AllUser';
                cDocLinks.add(cdl);
            }
            insert cDocLinks;
            // insert attachments;
            update updateRpr;
            return null;
        }
        insert attachments;
        update updateQis;
        return null;
    }
    // 主要用于生成qis中问题描述对应的pdf文件名称(比较特殊)
    public static String substringApiName(String name){
        for(Integer i = 0; i < 2; i++){
            name = name.substring(name.indexOf('-')+1);
        // 生成pdf添加到对应的qis中
        public static PageReference generateAttachment(List<QIS_Report__c> qisReports){
            System.debug('1111111111111111111111111111111111111111111111111generateAttachment执行了-----------');
            List<QIS_Report__c> updateQis = new List<QIS_Report__c>();
            // List<Attachment> attachments = new List<Attachment>();
            List<ContentVersion> cVersions = new List<ContentVersion>();
            List<ContentDocumentLink> cDocLinks = new List<ContentDocumentLink>();
            Map<String,String> res = new Map<String, String>();
            PageReference pdfPage ;
            for(QIS_Report__c qis : qisReports){
                // 需要生成pdf的字段
                List<String> apiNames = new List<String>();
                apiNames.add('problem_detail_photo__c');
                apiNames.add('Photo_1__c');
                apiNames.add('Photo_2__c');
                apiNames.add('Photo_3__c');
                apiNames.add('Photo_4__c');
                apiNames.add('Photo_OSH_1__c');
                apiNames.add('Photo_OSH_2__c');
                apiNames.add('Photo_OSH_3__c');
                apiNames.add('Photo_OSH_4__c');
                for (String apiName : apiNames) {
                    String generatedFields =  qis.GeneratedPDFField__c;
                    if (checkFieldisGeneratedPDF(apiName,qis)) {
                        continue;
                    }
                    if (qis.get(apiName) == null) {
                        continue;
                    }
                    setImgSrcs(qis, apiName);
                    pdfPage = new PageReference('/apex/repairandqistopdf?api=qis&id='+qis.Id+'&field='+apiName);
                    Blob pdfBody;
                    if(Test.isRunningTest()) {
                        pdfBody = blob.valueOf('Unit.Test');
                    } else {
                       pdfBody = pdfPage.getContentAsPDF();
                    }
                    ContentVersion version = new ContentVersion();
                    version.VersionData = pdfBody;
                    // Attachment attach = new Attachment();
                    // attach.Body = pdfBody;
                    if ('problem_detail_photo__c'.equals(apiName)) {
                        // attach.Name =  substringApiName(qis.name) + '_Problem_Discription.pdf';
                        version.Title = substringApiName(qis.name) + '_Problem_Discription.pdf';
                    }else {
                        // attach.Name = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf';
                        version.Title = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf';
                    }
                    version.PathOnClient = substringApiName(qis.name) + '_' + 'Problem_' + apiName.substring(0,apiName.length()-3) + '.pdf'+'.pdf';
                    // attach.ParentId = qis.id;
                    // attachments.add(attach);
                    cVersions.add(version);
                    res.put(version.Title, qis.Id);
                    // insert version;
                    if (generatedFields == null) {
                        qis.GeneratedPDFField__c = apiName;
                    }else {
                        qis.GeneratedPDFField__c += ',' + apiName;
                    }
                }
                updateQis.add(qis);
            }
            if (cVersions.size()>0) {
                insert cVersions;
            }
            List<Id> idList = new List<Id>();
            for (ContentVersion newVersion : cVersions) {
                idList.add(newVersion.Id);
            }
            cVersions = [select ContentDocumentId,Title from ContentVersion where Id in: idList];
            for (ContentVersion cv : cVersions) {
                ContentDocumentLink cdl = new ContentDocumentLink();
                cdl.ContentDocumentId = cv.ContentDocumentId;
                cdl.LinkedEntityId = res.get(cv.Title);
                cdl.ShareType = 'I';
                cdl.visibility = 'AllUsers';
                cDocLinks.add(cdl);
            }
            insert cDocLinks;
            // insert attachments;
            update updateQis;
            return null;
        }
        return name;
    }
    public static Boolean checkFieldisGeneratedPDF(String apiName,SObject obj){
        String generatedFields = (String) obj.get('GeneratedPDFField__c');
        if (generatedFields != null) {
            List<String> ele = generatedFields.split(',');
            return ele.contains(apiName);
        // 主要用于生成qis中问题描述对应的pdf文件名称(比较特殊)
        public static String substringApiName(String name){
            for(Integer i = 0; i < 2; i++){
                name = name.substring(name.indexOf('-')+1);
            }
            return name;
        }
        return false;
    }
    public QIS_Report__c QIS_Reports {get; set;}
    public Repair__c repairs {get; set;}
    // 是否为修理
    public Boolean isRepair {get; set;}
    // api名称
    public String api {get; set;}
    // id
    public String objId {get; set;}
    // 字段
    public String field {get; set;}
    // 标签
    public String label {get; set;}
    //
    public static List<ImgObj> ImgObjs {get; set;}
    public RepairAndQISToPDFController(){
        String fileName = '';
        String url = '';
        api = ApexPages.currentPage().getParameters().get('api');
        objId = ApexPages.currentPage().getParameters().get('id');
        if ('repair'.equals(api)) {
            isRepair = true;
            repairs = [select id,name,ProblemDescription__c,GeneratedPDFField__c from Repair__c where id = :objId];
            setImgSrcs(repairs, 'ProblemDescription__c');
        }else {
            field = ApexPages.currentPage().getParameters().get('field');
            String sql = 'select id,name,GeneratedPDFField__c,'+ field;
            sql += ' from QIS_Report__c where id = \''+objId+'\'';
            label = Schema.getGlobalDescribe().get('QIS_Report__c').getDescribe().fields.getMap().get(field).getDescribe().getLabel();
            QIS_Reports = Database.query(sql);
            setImgSrcs(QIS_Reports, field);
        public static Boolean checkFieldisGeneratedPDF(String apiName,SObject obj){
            String generatedFields = (String) obj.get('GeneratedPDFField__c');
            if (generatedFields != null) {
                List<String> ele = generatedFields.split(',');
                return ele.contains(apiName);
            }
            return false;
        }
    }
    public class ImgObj{
        public String imgSrc {get; set;}
        public String height {get; set;}
    }
}
        public QIS_Report__c QIS_Reports {get; set;}
        public Repair__c repairs {get; set;}
        // 是否为修理
        public Boolean isRepair {get; set;}
        // api名称
        public String api {get; set;}
        // id
        public String objId {get; set;}
        // 字段
        public String field {get; set;}
        // 标签
        public String label {get; set;}
        //
        public static List<ImgObj> ImgObjs {get; set;}
        public RepairAndQISToPDFController(){
            String fileName = '';
            String url = '';
            api = ApexPages.currentPage().getParameters().get('api');
            objId = ApexPages.currentPage().getParameters().get('id');
            if ('repair'.equals(api)) {
                isRepair = true;
                repairs = [select id,name,ProblemDescription__c,GeneratedPDFField__c from Repair__c where id = :objId];
                setImgSrcs(repairs, 'ProblemDescription__c');
            }else {
                field = ApexPages.currentPage().getParameters().get('field');
                String sql = 'select id,name,GeneratedPDFField__c,'+ field;
                sql += ' from QIS_Report__c where id = \''+objId+'\'';
                label = Schema.getGlobalDescribe().get('QIS_Report__c').getDescribe().fields.getMap().get(field).getDescribe().getLabel();
                QIS_Reports = Database.query(sql);
                setImgSrcs(QIS_Reports, field);
            }
        }
        public class ImgObj{
            public String imgSrc {get; set;}
            public String height {get; set;}
        }
    }
force-app/main/default/classes/RepairAndQISToPDFControllerTest.cls
@@ -138,6 +138,7 @@
            pref.getParameters().put('api', 'qis');
            pref.getParameters().put('field', 'Photo_1__c');
            Test.setCurrentPage(pref);
            StaticParameter.ContentDocumentLink = false;
            RepairAndQISToPDFController.generateAttachment(qis);
            new RepairAndQISToPDFController();
        Test.stopTest();
force-app/main/default/classes/RepairHandlerTest.cls
@@ -349,7 +349,7 @@
                Username = 'Test' + timenow + '@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP',
                TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja',
                ProfileId = System.Label.ProfileId_SystemAdmin,
                Dept__c = '医疗华北营业本部', Province__c = '北京',Employee_No__c = '12345'); // 2022-04-25   zhangyuheng   update  'Employee_No__c = '12345''
                Dept__c = '医疗华北营业本部', Province__c = '北京',Employee_No__c = '12345111'); // 2022-04-25   zhangyuheng   update  'Employee_No__c = '12345''
        List<Profile> p = [Select Id From Profile Where Name = '2S1_销售医院担当'];
        System.assertEquals(p.size(), 1);
@@ -368,12 +368,15 @@
        }
        return us;
    }
    @isTest static void testHuiShouNGXiuLi1111() {
    }
    //上架前检查NG修理
    @isTest static void testHuiShouNGXiuLi() {
        List<User> us = getUser();
        //防止权限不够的用户执行TestClass报错
        system.runAs(us[0]) {
        System.runAs(us[0]) {
            setupTestData(false);
            FixtureDeliverySlip__c ds1 = new FixtureDeliverySlip__c();
            ds1.Name = 'Test2';
@@ -478,6 +481,167 @@
            }
        }
    }
    //删除修理测试
    @isTest static void testHuiShouNGXiuLi2_1() {
        ControllerUtil.EscapeNFM001Trigger = true;
        StaticParameter.EscapeNFM001Trigger = true;
        StaticParameter.EscapeQISTrigger = false;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
        StaticParameter.EscapeOppandStaTrigger = true;
        List<User> us = getUser();
        //防止权限不够的用户执行TestClass报错
        system.runAs(us[0]) {
            setupTestData(false);
            // FixtureDeliverySlip__c ds1 = new FixtureDeliverySlip__c();
            // ds1.Name = 'Test2';
            // ds1.Wh_Staff__c = UserInfo.getUserId();
            // ds1.DeliveryCompany__c = '利讯';
            // ds1.Shippment_loaner_time__c = Datetime.now();
            // ds1.Distributor_method__c = '陆运';
            // ds1.DeliveryType__c = '回寄';
            // ds1.DeliveryCompany_SlipNo__c = 'XXX';
            // insert ds1;
            System.assertNotEquals(depId, null);
            QIS_Report__c qisObj = new QIS_Report__c();
            qisObj.Name = '001';
            qisObj.Hospital__c = hospitalId;
            qisObj.Department_Class__c = strategicDepId;
            qisObj.Hospital_Department__c = depId;
            qisObj.Responsible_Person_HP__c = 'test姓名';
            qisObj.Caller_phone__c = '12345678901';
            qisObj.capital_or_consumable__c = '主机';
            qisObj.usage_frequence__c = 1;
            qisObj.cleanning__c = '123';
            qisObj.cds_methods__c = '没有';
            qisObj.Faliour_date__c = Date.today();
            qisObj.failuer_situation__c = '手术-使用后';
            qisObj.problem_detail__c = '11211';
            qisObj.Comment__c = '111';
            qisObj.OCM_judgement__c = '质量问题';
            qisObj.next_action__c = '有偿维修';
            qisObj.Special_follow__c = false;
            qisObj.nonyushohin__c = Assetss[0].Id;
            qisObj.RecordTypeId = '01210000000RLgY';
            Oly_TriggerHandler.bypass('QISTrigger');
            insert qisObj;
            String qisId = qisObj.Id;
            System.debug('qisId============' + qisId);
            Repair__c repairObj1 = new Repair__c();
            repairObj1.Delivered_Product__c = Assetss[0].Id;
            repairObj1.Hospital__c = hospitalId;
            repairObj1.Department_Class__c = strategicDepId;
            repairObj1.Account__c = depId;
            repairObj1.SalesOfficeCode_selection__c = '北京石景山';
            repairObj1.On_site_repair__c = 'RC修理';
            repairObj1.Failure_Occurrence_Date__c = Date.today();
            repairObj1.Return_Without_Repair__c = false;
            repairObj1.QIS_ID__c = qisId;
            System.debug('QIS_ID__c===========================================' + repairObj1.QIS_ID__c);
            Oly_TriggerHandler.clearAllBypasses();
            // insert new Repair__c[]{repairObj1};
            // repairObj1.Return_Without_Repair__c = false;
            // update repairObj1;
            // List<Repair__c> repList = [SELECT Id FROM Repair__c];
            // delete repList;
        }
    }
    //报修子单新建修理
    @isTest static void testHuiShouNGXiuLi2_2() {
        ControllerUtil.EscapeNFM001Trigger = true;
        StaticParameter.EscapeNFM001Trigger = true;
        StaticParameter.EscapeQISTrigger = false;
        StaticParameter.EscapeNFM001AgencyContractTrigger = true;
        StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
        StaticParameter.EscapeOppandStaTrigger = true;
        List<User> us = getUser();
        //防止权限不够的用户执行TestClass报错
        system.runAs(us[0]) {
            setupTestData(false);
            FixtureDeliverySlip__c ds1 = new FixtureDeliverySlip__c();
            ds1.Name = 'Test2';
            ds1.Wh_Staff__c = UserInfo.getUserId();
            ds1.DeliveryCompany__c = '利讯';
            ds1.Shippment_loaner_time__c = Datetime.now();
            ds1.Distributor_method__c = '陆运';
            ds1.DeliveryType__c = '回寄';
            ds1.DeliveryCompany_SlipNo__c = 'XXX';
            insert ds1;
            System.assertNotEquals(depId, null);
            QIS_Report__c qisObj = new QIS_Report__c();
            qisObj.Name = '001';
            qisObj.Hospital__c = hospitalId;
            qisObj.Department_Class__c = strategicDepId;
            qisObj.Hospital_Department__c = depId;
            qisObj.Responsible_Person_HP__c = 'test姓名';
            qisObj.Caller_phone__c = '12345678901';
            qisObj.capital_or_consumable__c = '主机';
            qisObj.usage_frequence__c = 1;
            qisObj.cleanning__c = '123';
            qisObj.cds_methods__c = '没有';
            qisObj.Faliour_date__c = Date.today();
            qisObj.failuer_situation__c = '手术-使用后';
            qisObj.problem_detail__c = '11211';
            qisObj.Comment__c = '111';
            qisObj.OCM_judgement__c = '质量问题';
            qisObj.next_action__c = '有偿维修';
            qisObj.Special_follow__c = false;
            qisObj.nonyushohin__c = Assetss[0].Id;
            qisObj.RecordTypeId = '01210000000RLgY';
            Oly_TriggerHandler.bypass('QISTrigger');
            insert qisObj;
            String qisId = qisObj.Id;
            RepairSubOrder__c subOrder = new RepairSubOrder__c();
            subOrder.AttachmentDownload__c = true;
            subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip';
            subOrder.AttachmentName__c = '测试附件下载';
            subOrder.Status__c = '待处理';// 20230201 ljh
            insert subOrder;
            Repair__c repairObj1 = new Repair__c();
            repairObj1.Delivered_Product__c = Assetss[0].Id;
            repairObj1.Hospital__c = hospitalId;
            repairObj1.Department_Class__c = strategicDepId;
            repairObj1.Account__c = depId;
            repairObj1.SalesOfficeCode_selection__c = '北京石景山';
            repairObj1.On_site_repair__c = 'RC修理';
            repairObj1.Send_To_RC_Date__c = Date.today();
            repairObj1.RepairSubOrder__c = subOrder.Id;
            repairObj1.DeliveryLogisticsMode__c = '其他';
            repairObj1.Failure_Occurrence_Date__c = Date.today();
            repairObj1.Return_Without_Repair__c = false;
            Oly_TriggerHandler.clearAllBypasses();
            insert new Repair__c[]{repairObj1};
            repairObj1.SAP_Transfer_time__c = Datetime.now();
            repairObj1.QIS_ID__c = qisId;
            update repairObj1;
            List<Repair__c> repList = [SELECT Id FROM Repair__c];
            delete repList;
        }
    }
    //上架前检查NG修理
force-app/main/default/classes/ReportController.cls
@@ -293,19 +293,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    //OPDtoSIS操作更新相应数据
@@ -318,19 +318,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
@@ -346,19 +346,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    //完毕操作更新相应数据
@@ -372,19 +372,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    //OCSM要报告操作更新相应数据
@@ -397,19 +397,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
@@ -423,19 +423,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    //DispatchOCSMQARA操作更新相应数据
@@ -448,19 +448,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    //OCSM不要报告操作更新相应数据
@@ -473,19 +473,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
@@ -499,19 +499,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    
@@ -545,19 +545,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
@@ -571,19 +571,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
@@ -600,19 +600,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    //VOC回答更新相应数据
@@ -661,19 +661,19 @@
            update rac;
            return null;
        } catch (Exception e) {
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
            // return e.getDmlMessage(0);
        }
    }
    //VOC判定更新相应数据
@@ -722,7 +722,7 @@
                }
                return null;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return e.getMessage();
        }
    }
    //VOC完毕操作更新相应数据
@@ -734,19 +734,19 @@
            update report;
            return null;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            // if (e.getMessage().contains(',')) {
            //     System.debug(LoggingLevel.INFO, '*** e: ' + e);
            //     String exc = '' + e.getMessage();
            //     Integer left = exc.indexOf(':') + 1;
            //     Integer right = exc.lastIndexOf(':');
            //     String str = exc.substring(left,right);
            //     left = str.indexOf(',') +  1;
            //     String newStr = str.substring(left);
            //     return newStr;
            // }else {
            //     return e.getMessage();
            // }
            // return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
    @AuraEnabled
force-app/main/default/classes/XinDailyReportControllerTest.cls
@@ -318,6 +318,8 @@
            dr.Reporter__c = u1.id;
            dr.OwnerId = u1.Id;
            insert dr;
            Event__c ec = new Event__c(Daily_Report__c=dr.Id, StartDateTime__c=System.now(), EndDateTime__c=System.now(), Subject__c='Subject', Location__c='Location', ActivityDate__c=Date.today());
            insert ec;
            List<Maintenance_Contract__c> mcList = new List<Maintenance_Contract__c>();
            mc1 = new Maintenance_Contract__c();
            mc1.Name = 'サービス契約1';
@@ -1217,52 +1219,53 @@
            t.report_search.Reported_Date__c = date.today();
            PageReference ref = t.getDailyReport();
            Test.setCurrentPage(ref);
            t = new XinDailyReportController();
            Test.startTest();
            t = new XinDailyReportController();
            t.init();
            //          t.getEvent();
            //          t.report.Reporter__c = u1.id;
            t.report.Reported_Date__c = date.today();
            t.repoStartHourText = '9';
            t.repoStartMinuteText = '00';
            t.repoEndHourText = '18';
            t.repoEndMinuteText = '00';
            t.report.Status__c = null;
            t.activities.get(0).actStartHourText = '9';
            t.activities.get(0).actStartMinuteText = '00';
            t.activities.get(0).actEndHourText = '18';
            t.activities.get(0).actEndMinuteText = '00';
            t.activities.get(0).act.nextPlanDate__c = date.today();
            t.activities.get(0).act.Activity_Type2__c = '病院';
            t.activities.get(0).act.Location__c = '戦略科室分類1 診療科1test';
            t.activities.get(0).act.Purpose__c = '目的(計画)';
            t.activities.get(0).act.Description__c = '結果';
            t.activities.get(0).act.Purpose_Type__c = '礼节性拜访';
            t.activities.get(0).act.Visitor1__c = '取引先責任者1';
            t.activities.get(0).act.Visitor1_ID__c = null;
            t.activities.get(0).act.Visitor2__c = '取引先責任者2';
            t.activities.get(0).act.Visitor2_ID__c = null;
            t.activities.get(0).act.Visitor3__c = '取引先責任者3';
            t.activities.get(0).act.Visitor3_ID__c = null;
            t.activities.get(0).act.Visitor4__c = '取引先責任者4';
            t.activities.get(0).act.Visitor4_ID__c = null;
            t.activities.get(0).act.Visitor5__c = '取引先責任者5';
            t.activities.get(0).act.Visitor5_ID__c = null;
            t.activities.get(0).act.Related_Opportunity1__c = opp1.Name + 'test';
            t.activities.get(0).act.Related_Opportunity2__c = opp2.Name + 'test';
            t.activities.get(0).act.Related_Opportunity3__c = opp3.Name + 'test';
            t.activities.get(0).act.Related_Opportunity4__c = opp4.Name + 'test';
            t.activities.get(0).act.Related_Opportunity5__c = opp5.Name + 'test';
            t.activities.get(0).act.Related_Service1__c = mc1.Name + 'test';
            t.activities.get(0).act.Related_Service2__c = mc2.Name + 'test';
            t.activities.get(0).planStartHourText = '9';
            t.activities.get(0).planStartMinuteText = '00';
            t.activities.get(0).planEndHourText = '18';
            t.activities.get(0).planEndMinuteText = '00';
            t.activities.get(0).planPurposeText = '次の活動予定目的(計画)';
            // t.report.Reported_Date__c = date.today();
            // t.repoStartHourText = '9';
            // t.repoStartMinuteText = '00';
            // t.repoEndHourText = '18';
            // t.repoEndMinuteText = '00';
            // t.report.Status__c = null;
            // t.activities.get(0).actStartHourText = '9';
            // t.activities.get(0).actStartMinuteText = '00';
            // t.activities.get(0).actEndHourText = '18';
            // t.activities.get(0).actEndMinuteText = '00';
            // t.activities.get(0).act.nextPlanDate__c = date.today();
            // t.activities.get(0).act.Activity_Type2__c = '病院';
            // t.activities.get(0).act.Location__c = '戦略科室分類1 診療科1test';
            // t.activities.get(0).act.Purpose__c = '目的(計画)';
            // t.activities.get(0).act.Description__c = '結果';
            // t.activities.get(0).act.Purpose_Type__c = '礼节性拜访';
            // t.activities.get(0).act.Visitor1__c = '取引先責任者1';
            // t.activities.get(0).act.Visitor1_ID__c = null;
            // t.activities.get(0).act.Visitor2__c = '取引先責任者2';
            // t.activities.get(0).act.Visitor2_ID__c = null;
            // t.activities.get(0).act.Visitor3__c = '取引先責任者3';
            // t.activities.get(0).act.Visitor3_ID__c = null;
            // t.activities.get(0).act.Visitor4__c = '取引先責任者4';
            // t.activities.get(0).act.Visitor4_ID__c = null;
            // t.activities.get(0).act.Visitor5__c = '取引先責任者5';
            // t.activities.get(0).act.Visitor5_ID__c = null;
            // t.activities.get(0).act.Related_Opportunity1__c = opp1.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity2__c = opp2.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity3__c = opp3.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity4__c = opp4.Name + 'test';
            // t.activities.get(0).act.Related_Opportunity5__c = opp5.Name + 'test';
            // t.activities.get(0).act.Related_Service1__c = mc1.Name + 'test';
            // t.activities.get(0).act.Related_Service2__c = mc2.Name + 'test';
            // t.activities.get(0).planStartHourText = '9';
            // t.activities.get(0).planStartMinuteText = '00';
            // t.activities.get(0).planEndHourText = '18';
            // t.activities.get(0).planEndMinuteText = '00';
            // t.activities.get(0).planPurposeText = '次の活動予定目的(計画)';
            t.save();
            // t.save();
            t.activities.get(0).act.Location__c = accDepName;
            t.activities.get(0).act.whatid__c = accDep.Id;
@@ -1299,17 +1302,27 @@
            Datetime dt = datetime.now();
            String strDatetime = '2000/01/01 10:10:00';
            System.debug('strDatetime' + strDatetime);
           Event__c ec = [select Id from Event__c limit 1];
            System.debug('t.activities.get(0).act.id:::::' + t.activities.get(0).act.id);
            String opId = Add_Report.addReportOP(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id, opp1.Id, opp2.Id, opp3.Id, opp4.Id, opp5.Id, strDate);
            Add_Report.addReportPr(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'', strDate);
            Add_Report.addReportNT(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'','', strDate);
            // Add_Report.addReportOn(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'','','','','','');
            Add_Report.addReportAc(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addClaim(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addReportEx(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, strDate,'');
            Add_Report.addReportIm(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addRA(u1.id, t.report.id, t.report.id, t.activities.get(0).act.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'','');
            Add_Report.addReportPr(u1.id, t.report.id, t.report.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'', strDate);
            Add_Report.addReportNT(u1.id, t.report.id, t.report.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, con2.id, con3.id, con4.id, con5.id,'','', strDate);
            Add_Report.addReportOn(u1.id, t.report.id, t.report.id, ec.id, 'On_Call', '戦略科室分類1 診療科1test', strDate,'','1','1','2','1','');
            Add_Report.addReportAc(u1.id, t.report.id, t.report.id, ec.id, 'Visit_Report__c', '戦略科室分類1 診療科1test', strDate,'');
            Report__c re = [select Id from Report__c limit 1];
            re.Manual_Name__c = '123';
            update re;
            // Add_Report.addClaim(u1.id,re.id, t.report.id,ec.id, 'QIS_Report__c', '戦略科室分類1 診療科1test', strDate,'');
            Daily_Report__c dr = [select Id from Daily_Report__c limit 1];
            Add_Report.addReportEx(u1.id,  re.id, re.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', con1.id, strDate,'');
            Add_Report.addReportIm(u1.id, re.id, dr.id, ec.id, 'OPD', '戦略科室分類1 診療科1test', strDate,'');
            Add_Report.addRA(u1.id, re.id, dr.id, ec.id, 'Rental_Apply', '戦略科室分類1 診療科1test', strDate,'','');
            Add_Report.getProduct2(dr.Id);
            Add_Report.getProduct2US(dr.Id);
            Add_Report.getReportId(dr.Id,'2023-07-01');
            Add_Report.checkAccountMatch('123',dr.Id);
            Add_Report.getAccountForJs(dr.Id);
            if (opId != 'false') t.activities.get(0).act.OPD_ID__c = opId;
            t.save();
            Test.stopTest();
force-app/main/default/classes/eSignAgencyConfirmPageController.cls
@@ -254,6 +254,7 @@
    }
 
    public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) {
        // 20231103   Lightning文件修改 Start
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        ContentVersion version = new ContentVersion();
        version.VersionData = EncodingUtil.base64Decode(base64Data);
@@ -279,11 +280,12 @@
        // insert oAttachment;
 
        return link.ContentDocumentId;
        // 20231103   Lightning文件修改 End
    }
 
    private static void appendToFile(Id fileId, String base64Data) {
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        // 20231103   Lightning文件修改 Start
        // Attachment a = [
        //     SELECT Id, Body
        //     FROM Attachment
@@ -300,17 +302,20 @@
        version.VersionData = EncodingUtil.base64Decode(existingBody + base64Data);
 
        update version;
        // 20231103   Lightning文件修改 End
    }
    //文件删除功能  精琢技术 thh 2021-09-26 start
    @AuraEnabled
    public static void deleteChunk(Id AttachmentId) {
        // 20231103   Lightning文件修改 Start
        // Attachment attachment = new Attachment();
        // attachment.id = AttachmentId;
        ContentDocument con = new ContentDocument();
        con.Id = AttachmentId;
        delete con;
        // 20231103   Lightning文件修改 End
    }
    //文件删除功能  精琢技术 thh 2021-09-26 end
    //获取AWS信息 zhj 2023-01-03 start
force-app/main/default/classes/eSignAgencyPageController.cls
@@ -353,7 +353,7 @@
 
    public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) {
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        // 20231103   Lightning文件修改 Start
        // Attachment oAttachment = new Attachment();
        // oAttachment.parentId = parentId;
 
@@ -377,11 +377,12 @@
        insert link;
        return link.ContentDocumentId;
        // 20231103   Lightning文件修改 End
    }
 
    private static void appendToFile(Id fileId, String base64Data) {
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        // 20231103   Lightning文件修改 Start
        // Attachment a = [
        //     SELECT Id, Body
        //     FROM Attachment
@@ -396,17 +397,20 @@
        version.VersionData = EncodingUtil.base64Decode(existingBody + base64Data);
 
        update version;
        // 20231103   Lightning文件修改 End
    }
    //文件删除功能  精琢技术 thh 2021-09-26 start
    @AuraEnabled
    public static void deleteChunk(Id AttachmentId) {
        // 20231103   Lightning文件修改 Start
        // Attachment attachment = new Attachment();
        // attachment.id = AttachmentId;
        ContentDocument con = new ContentDocument();
        con.Id = AttachmentId;
        delete con;
        // delete attachment;
        // 20231103   Lightning文件修改 End
    }
    //文件删除功能  精琢技术 thh 2021-09-26 end
force-app/main/default/classes/eSignFormAttachmentController.cls
@@ -26,7 +26,7 @@
    public void getAccessory(){
      // parentId = 'a2K0l000000wyICEAY';
      //lwc改造
     // 20231103   Lightning文件修改 Start
     List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
                                                   FROM ContentDocumentLink
                                                   WHERE LinkedEntityId = :parentId];
@@ -40,6 +40,7 @@
                                          
      // String soql = 'SELECT Name,id,parentId,ContentType from Attachment where parentId = :parentId order by createddate desc';
      // List<Attachment> acc = Database.query(soql);
      // 20231103   Lightning文件修改 End
      Map<String,String> identifierMap = new Map<String,String>();
      if(acc != null && acc.size() > 0){
        for(Integer i = 0;i<acc.size();i++){
force-app/main/default/classes/eSignHospitalConfirmController.cls
@@ -206,7 +206,7 @@
 
    public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) {
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        // 20231103   Lightning文件修改 Start
        ContentVersion version = new ContentVersion();
        version.Title = fileName;
        version.VersionData = EncodingUtil.base64Decode(base64Data);
@@ -230,11 +230,12 @@
        // insert oAttachment;
 
        return link.ContentDocumentId;
        // 20231103   Lightning文件修改 End
    }
 
    private static void appendToFile(Id fileId, String base64Data) {
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        // 20231103   Lightning文件修改 Start
        // Attachment a = [
        //     SELECT Id, Body
        //     FROM Attachment
@@ -249,11 +250,13 @@
        version.VersionData = EncodingUtil.base64Decode(existingBody + base64Data);
 
        update version;
        // 20231103   Lightning文件修改 End
    }
    
    //文件删除功能  精琢技术 thh 2021-09-26 start
    @AuraEnabled
    public static void deleteChunk(Id AttachmentId) {
        // 20231103   Lightning文件修改 Start
        // Attachment attachment = new Attachment();
        // attachment.id = AttachmentId;
@@ -261,6 +264,7 @@
        ContentDocument con = new ContentDocument();
        con.Id = AttachmentId;
        delete con;
        // 20231103   Lightning文件修改 End
    }
    //文件删除功能  精琢技术 thh 2021-09-26 end
     //获取AWS信息 zhj 2023-01-03 start
force-app/main/default/classes/eSignHospitalPageController.cls
@@ -261,7 +261,7 @@
 
    public static Id saveTheFile(Id parentId, String fileName, String base64Data, String contentType) {
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        // 20231103   Lightning文件修改 Start
        // Attachment oAttachment = new Attachment();
        // oAttachment.parentId = parentId;
 
@@ -285,11 +285,12 @@
        insert link;
 
        return link.ContentDocumentId;
        // 20231103   Lightning文件修改 End
    }
 
    private static void appendToFile(Id fileId, String base64Data) {
        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
        // 20231103   Lightning文件修改 Start
        // Attachment a = [
        //     SELECT Id, Body
        //     FROM Attachment
@@ -303,11 +304,13 @@
        verison.VersionData = EncodingUtil.base64Decode(existingBody + base64Data);
 
        update verison;
        // 20231103   Lightning文件修改 End
    }
    
    //文件删除功能  精琢技术 thh 2021-09-26 start
    @AuraEnabled
    public static void deleteChunk(Id AttachmentId) {
        // 20231103   Lightning文件修改 Start
        // Attachment attachment = new Attachment();
        // attachment.id = AttachmentId;
@@ -315,6 +318,7 @@
        ContentDocument con =  new ContentDocument();
        con.Id = AttachmentId;
        delete con;
        // 20231103   Lightning文件修改 End
    }
    //文件删除功能  精琢技术 thh 2021-09-26 end
force-app/main/default/classes/lexLostCancelReportController.cls
@@ -52,7 +52,18 @@
            return null;
        } catch (Exception e) {
            Database.rollback(sp);
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
    public class InitData {
force-app/main/default/classes/lexLostCancelReportControllerTest.cls
@@ -81,8 +81,6 @@
        // 失单
        Lost_cancel_report__c lcr1 = new Lost_cancel_report__c(
            Opportunity__c = opp1.Id, 
            CompetitorProduct1__c = prd1.Id,
            CompetitorProduct2__c = prd2.Id,
            RecordTypeId = rectLost[0].Id
        );
        // 取消
@@ -95,6 +93,7 @@
        lexLostCancelReportController.initForEditCancelReport(lcr2.Id);
        lexLostCancelReportController.initSubmitReportButton(lcr2.Id);
        lexLostCancelReportController.updateSubmitReportButton(lcr2.Id);
        lexLostCancelReportController.updateSubmitReportButton(rectLost[0].Id);
        Test.stopTest();
    }
}
force-app/main/default/classes/lexOpportunitySpecialApplyController.cls
@@ -27,7 +27,18 @@
        update opp;
        return '';
    } catch (Exception e) {
        return e.getDmlMessage(0);
        if (e.getMessage().contains(',')) {
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
            String exc = '' + e.getMessage();
            Integer left = exc.indexOf(':') + 1;
            Integer right = exc.lastIndexOf(':');
            String str = exc.substring(left,right);
            left = str.indexOf(',') +  1;
            String newStr = str.substring(left);
            return newStr;
        }else {
            return e.getMessage();
        }
    }
   } 
    public class InitData{
force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -377,7 +377,7 @@
            }
            
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return e.getMessage();
        }
    }
    // 数据录入
@@ -610,7 +610,7 @@
            return objs;
        }catch(exception e) {
            Database.rollback(sp);
            objs.put('error',e.getDmlMessage(0));
            objs.put('error',e.getMessage());
            return objs;
        }
    }
@@ -740,7 +740,7 @@
            , ProductCategory__c 
            from Product2 where Id =:lostProduct];
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return e.getMessage();
        }
        return JSON.serialize(prd);
    }
@@ -764,7 +764,7 @@
            Approval.ProcessResult result = Approval.process(req);
            return null; 
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return e.getMessage();
        }
        
    }
@@ -776,7 +776,7 @@
            ApprovalHistoryUtil.reassignStep(workItemList, newActorId);
            return null;
        } catch (Exception e) {
            return e.getDmlMessage(0);
            return e.getMessage();
        }
        
    }
force-app/main/default/classes/lexSolutionProgrammeController.cls
@@ -36,7 +36,18 @@
            update so;
            return '';
        } catch (Exception e) {
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
    //提交审批
@@ -51,7 +62,18 @@
        }
        catch (Exception e) {
            Database.rollback(sp);
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
    public class InitData{
force-app/main/default/classes/lexSolutionProjectRequirementsController.cls
@@ -22,7 +22,7 @@
            res.userName = [select Name from User where Id =: res.userId].Name;
            maps.put('res', res);
        } catch (Exception e) {
            String message = e.getDmlMessage(0);
            String message = e.getMessage();
            maps.put('error', message);
            return maps;
        }
@@ -76,7 +76,18 @@
            update so;
            return '';
        } catch (Exception e) {
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
    @AuraEnabled
@@ -88,7 +99,18 @@
            update so;
            return '';
        } catch (Exception e) {
            return e.getDmlMessage(0);
            if (e.getMessage().contains(',')) {
                System.debug(LoggingLevel.INFO, '*** e: ' + e);
                String exc = '' + e.getMessage();
                Integer left = exc.indexOf(':') + 1;
                Integer right = exc.lastIndexOf(':');
                String str = exc.substring(left,right);
                left = str.indexOf(',') +  1;
                String newStr = str.substring(left);
                return newStr;
            }else {
                return e.getMessage();
            }
        }
    }
force-app/main/default/lwc/lexCancelReport/lexCancelReport.js
@@ -7,7 +7,6 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { NavigationMixin } from 'lightning/navigation';
import { encodeDefaultFieldValues } from 'lightning/pageReferenceUtils';
import ConSent from '@salesforce/apex/BidAnnouncementController.ConSent';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
import queryCancelReport  from '@salesforce/apex/OpportunityLightingButtonController.queryCancelReport';
force-app/main/default/lwc/lexDispatchOCSMQARA/lexDispatchOCSMQARA.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-07 09:02:03
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-10 17:34:49
 * @LastEditTime: 2023-10-31 17:31:12
 */
import { api, wire,LightningElement } from 'lwc';
import { CurrentPageReference } from "lightning/navigation";
@@ -14,9 +14,6 @@
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader';
Promise.all([
    loadStyle(this, lwcCSS)
   ]);
export default class LexDispatchOCSMQARA extends LightningElement {
    @api recordId;
    IsLoading = true;
@@ -40,6 +37,9 @@
    }
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS)
           ]);
        console.log(this.recordId);
        this.DispatchOCSMQARA();
force-app/main/default/lwc/lexLookupLwc/lexLookupLwc.html
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-05-25 13:59:44
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-11 11:43:30
 * @LastEditTime: 2023-10-24 14:48:59
-->
<template>
    <div data-id="myInput">
@@ -15,7 +15,7 @@
                    <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none">
                       <template if:false={recordselected}>
                          <input class="slds-input slds-combobox__input" id="combobox-id-1" aria-autocomplete="list" aria-controls="listbox-id-1"
                             role="textbox" type="text" placeholder="Search..."   onkeyup={onKeyChange} value={selectedValue}/ disabled={disabled} onclick={onKeyChange} onblur={clear}>
                             role="textbox" type="text" placeholder="Search..."   oninput={onKeyChange} value={selectedValue}/ disabled={disabled} onclick={onKeyChange} onblur={clear}>
                       </template>
                       <template if:true={recordselected}>
                          <span class="slds-pill slds-pill_link fullWidth slds-input slds-combobox__input"> 
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.html
@@ -251,19 +251,19 @@
                                                                                                    
                                                                                                    <template if:true={product.LostProductss.LostProduct__c}>
                                                                                                        <template if:true={product.LostProductss.isSpec__c}>
                                                                                                            <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                            <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={masterValues} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                        </template>
                                                                                                        <template if:false={product.LostProductss.isSpec__c}>
                                                                                                            <lightning-combobox variant="label-hidden" read-only="true" class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                            <lightning-combobox variant="label-hidden" read-only="true" class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={masterValues} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                        </template>
                                                                                                        
                                                                                                    </template>
                                                                                                    <template if:false={product.LostProductss.LostProduct__c}>
                                                                                                        <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                        <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={masterValues} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                    </template>
                                                                                                </template>
                                                                                                <template if:false={product.LostProductss.ProductClass__c}>
                                                                                                    <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                    <lightning-combobox variant="label-hidden"  class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={masterValues} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                </template>
                                                                                                <!-- <template if:true={product.LostProductss.ProductClass__c}>
                                                                                                    <lightning-combobox read-only="true" class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox> 
@@ -274,7 +274,7 @@
                                                                                            </template>
                                                                                            
                                                                                            <template if:false={isEdit}>
                                                                                                <lightning-combobox variant="label-hidden" class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={productClassOptions} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                                <lightning-combobox variant="label-hidden" class="ProductClass" data-id={i} placeholder="--无--" title={i} name={j} options={masterValues} value={product.LostProductss.ProductClass__c} onchange={handleProductClassChange}></lightning-combobox>
                                                                                            </template>
                                                                                        </td>
                                                                                        <td>
force-app/main/default/lwc/lexPCLLostReportPage/lexPCLLostReportPage.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-04-20 15:04:03
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-10-16 11:48:33
 * @LastEditTime: 2023-10-31 15:19:17
 */
let columns2=[
    { label: '--无--', value: '' },
@@ -18,6 +18,242 @@
    { label: '某种产品缺失', value: '某种产品缺失' },
    { label: '采购平衡', value: '采购平衡' }
];
let columns2RandomList = [
    [
        { label: '--无--', value: '' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '行政决策', value: '行政决策' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '行政决策', value: '行政决策' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
    ],
    [
        { label: '--无--', value: '' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '行政决策', value: '行政决策' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '价格', value: '价格' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '行政决策', value: '行政决策' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
    ],
    [
        { label: '--无--', value: '' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '行政决策', value: '行政决策' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '行政决策', value: '行政决策' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '行政决策', value: '行政决策' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '行政决策', value: '行政决策' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '行政决策', value: '行政决策' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '某种产品缺失', value: '某种产品缺失' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '行政决策', value: '行政决策' },
    ],
]
let columns22RandomList = [
    [
        { label: '--无--', value: '' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
    ],
    [
        { label: '--无--', value: '' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '价格', value: '价格' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
    ],
    [
        { label: '--无--', value: '' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '服务不到位', value: '服务不到位' },
    ],
    [
        { label: '--无--', value: '' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '价格', value: '价格' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
        { label: '某种产品缺失', value: '某种产品缺失' }
    ],
    [
        { label: '--无--', value: '' },
        { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
        { label: '竞品原有基础上增添设备', value: '竞品原有基础上增添设备' },
        { label: '渠道因素', value: '渠道因素' },
        { label: '某种产品缺失', value: '某种产品缺失' },
        { label: '采购平衡', value: '采购平衡' },
        { label: '价格', value: '价格' },
        { label: '医生偏好', value: '医生偏好' },
        { label: '服务不到位', value: '服务不到位' },
    ],
]
let columns22=[
    { label: '--无--', value: '' },
    { label: '无信息,跟进不及时', value: '无信息,跟进不及时' },
@@ -92,7 +328,104 @@
import systemProfileId from '@salesforce/label/c.ProfileId_SystemAdmin';
import {loadStyle} from 'lightning/platformResourceLoader';
import { RefreshEvent } from "lightning/refresh";
import { getObjectInfo } from 'lightning/uiObjectInfoApi';
import LOSTPRODUCT from '@salesforce/schema/PCLLostProduct__c';
import { getPicklistValuesByRecordType } from 'lightning/uiObjectInfoApi';
export default class LexPCLLostReportPage extends NavigationMixin(LightningElement) {
    //***************************************************** */
    //存储controlling picklist的所有的值
    @track masterValues = [];
    //存储dependent picklist的所有的值
    @track controllingValues = [];
    //选择的controlling picklist 的值
    @track selectedMasterValue;
    //选择的dependent picklist的值
    @track selectedControllingValue;
    @track error;
    //用来记录master picklist中的 value -> valid for的列表集合
    master2ValidForValues;
    //用来记录controlling picklist的value以及valid for等信息的列表集合
    controllingValuesWithValidFor = [];
    // 获取account 的schema info
    @wire(getObjectInfo, { objectApiName: LOSTPRODUCT })
    objectInfo;
    // 获取 control picklist的值并且组装dependent picklist
    @wire(getPicklistValuesByRecordType, { objectApiName: LOSTPRODUCT, recordTypeId: '$objectInfo.data.defaultRecordTypeId'})
    countryPicklistValues({error, data}) {
        console.log('start');
        if(data) {
            this.error = null;
            let masterOptions = [];
            data.picklistFieldValues.ProductClass__c.values.forEach(key => {
                masterOptions.push({
                    label : key.label,
                    value: key.value
                })
            });
            this.masterValues = masterOptions;
            console.log(this.masterValues);
            let controllingOptions = [];
            this.master2ValidForValues = data.picklistFieldValues.ProductCategory__c.controllerValues;
            //用来记录controlling picklist的value以及valid for等信息的列表集合 Picklist values
            this.controllingValuesWithValidFor = data.picklistFieldValues.ProductCategory__c.values;
            this.controllingValuesWithValidFor.forEach(key => {
                controllingOptions.push({
                    label : key.label,
                    value: key.value
                })
            });
            this.controllingValues = controllingOptions;
            console.log(this.controllingValues);
            console.log('end');
        }
        else if(error) {
            this.error = JSON.stringify(error);
        }
    }
    handleMasterPicklistChange(event) {
        //set selected master Value
        this.selectedMasterValue = event.target.value;
        this.selectedControllingValue = '';
        let controllingList = [];
        if(this.selectedMasterValue) {
            //通过valid for进行mapping,匹配的放进controlling list中
            this.controllingValuesWithValidFor.forEach(conValues => {
                if(conValues.validFor.some(item => item === this.master2ValidForValues[this.selectedMasterValue])) {
                    controllingList.push({
                        label: conValues.label,
                        value: conValues.value
                    })
                }
            })
            this.controllingValues = controllingList;
        }
    }
//***************************************************** */
    @track visible = false;
    @wire(CurrentPageReference) pageRef;
    @api oppId;
@@ -181,6 +514,7 @@
            loadStyle(this, lwcCSS),
            loadStyle(this, lexButtonCss)
           ]);
        this.columns2s = columns2RandomList[Math.floor(Math.random() * 10)];
        this.pageStatus = this.getQueryVariable('pageStatus',this.location);
        this.oppId = this.getQueryVariable('oppId',this.location);
        this.reportId = this.getQueryVariable('reportId',this.location);
@@ -356,7 +690,7 @@
        var elements = this.template.querySelectorAll('lightning-combobox');
                elements.forEach(element=>{
                    if(element.value == '行政决策'){
                        element.options = columns2;
                        element.options = columns2RandomList[Math.floor(Math.random() * 10)];
                    }
                });
        var elements1 = this.template.querySelectorAll('[data-id="Lost_By_Company_Mannual"]');
@@ -712,9 +1046,17 @@
        }).then(result=>{
            console.log(result);
            if(result == '进口'){
                this.columns2s = columns22;
                if(this.LostReport.LostBrands[index].lostBrand.Lost_reason_main__c == '行政决策'){
                    this.LostReport.LostBrands[index].lostBrand.Lost_reason_main__c = '';
                    // this.LostReport.LostBrands[index].lostBrand.Lost_Reason_Sub__c = '';
                }
                if(this.LostReport.LostBrands[index].lostBrand.Lost_Reason_Sub__c == '行政决策'){
                    this.LostReport.LostBrands[index].lostBrand.Lost_Reason_Sub__c = '';
                    // this.LostReport.LostBrands[index].lostBrand.Lost_Reason_Sub__c = '';
                }
                this.columns2s = this.columns2s = columns22RandomList[Math.floor(Math.random() * 10)];
            }else{
                this.columns2s = columns2;
                this.columns2s = this.columns2s = columns2RandomList[Math.floor(Math.random() * 10)];
            }
            if(payloadType === 'multi-select'){
            
@@ -938,7 +1280,7 @@
                console.log('elements=>' + elements.length);
                elements.forEach(element=>{
                    if(element.value == '行政决策'){
                        element.options = columns2;
                        element.options = columns2RandomList[Math.floor(Math.random() * 10)];
                    }
                });
    }
@@ -1319,6 +1661,23 @@
        var index2 = event.target.name;
        this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.ProductClass__c = event.target.value;
        var val = event.target.value;
        this.selectedMasterValue = event.target.value;
        this.selectedControllingValue = '';
        let controllingList = [];
        if(this.selectedMasterValue) {
            //通过valid for进行mapping,匹配的放进controlling list中
            this.controllingValuesWithValidFor.forEach(conValues => {
                if(conValues.validFor.some(item => item === this.master2ValidForValues[this.selectedMasterValue])) {
                    controllingList.push({
                        label: conValues.label,
                        value: conValues.value
                    })
                }
            })
            this.controllingValues = controllingList;
        }
        if(val == ''){
            var temps1 =this.template.querySelectorAll('.ProductCategory[data-id="'+ index1 +'"]');
            temps1[index2].readOnly = true;
@@ -1326,15 +1685,18 @@
        }else{
            var temps1 =this.template.querySelectorAll('.ProductCategory[data-id="'+ index1 +'"]');
            temps1[index2].readOnly = false;
            this.LostReport.LostBrands[index1].LostProducts[index2].productOptions = this.productOptionsList[val];
            searchProduct({
                lostProduct:this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProduct__c
            }).then(result=>{
                var prd = JSON.parse(result);
                if(prd.ProductClass__c == undefined && prd.ProductCategory__c == undefined){
                    this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.isSpec__c = true;
                }
            });
            this.LostReport.LostBrands[index1].LostProducts[index2].productOptions = this.controllingValues;
            if(this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProduct__c){
                searchProduct({
                    lostProduct:this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.LostProduct__c
                }).then(result=>{
                    var prd = JSON.parse(result);
                    if(prd.ProductClass__c == undefined && prd.ProductCategory__c == undefined){
                        this.LostReport.LostBrands[index1].LostProducts[index2].LostProductss.isSpec__c = true;
                    }
                });
            }
        }
       
    }
force-app/main/default/lwc/relevant/relevant.html
@@ -53,7 +53,7 @@
          <div style="font-size:10px;color:red" if:true={xgxLyFlag}>请选择是否有关联</div>
      </div>
    <div  if:true={isTrue}>
      <div class={bxgLy} if:true={isFou}>
        <!-- <label class="slds-form-element__label" for="select-02">不相关理由:</label>
        <select  class="slds-select"   onchange={handleIrrelevantFn} >
@@ -84,100 +84,104 @@
        </div>
        <div class="slds-form-element__help" id="error-message-unique-id" if:true={qtLyFlag}>其他理由不能为空</div>
      </div>
    </div>
    <div style={dispatchDivStyle}></div>
    <div>
      <c-jzlookuplightning if:true={isShi}  data-parent-id="lookup1"  onsearchchange={onsearchchange} objectname="Tender_information__c" fieldname="Hospital__c"  >   </c-jzlookuplightning>
     <div style="font-size:10px;color:red" if:true={isErrorShowYY}>请选择关联医院</div>
    <div style="font-size:10px;color:red" if:true={isHospitorCheck}>请检查关联医院对应的战略科室</div>
    <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy1"  onsearchchange={onsearchchange1} objectname="Tender_information__c" fieldname="Hospital1__c"  >   </c-jzlookuplightning>
    <!-- <div style={dispatchDivStyle}></div> -->
  <div  if:true={isTrue}>
    <div if:true={isShi}>
      <div>
        <div style="margin-top: 20px; " if:true={isOther}> </div>
         <c-jzlookuplightning if:true={isShi}  data-parent-id="lookup1"  onsearchchange={onsearchchange} objectname="Tender_information__c" fieldname="Hospital__c"  >   </c-jzlookuplightning>
        <div style="font-size:10px;color:red" if:true={isErrorShowYY}>请选择关联医院</div>
       <div style="font-size:10px;color:red" if:true={isHospitorCheck}>请检查关联医院对应的战略科室</div>
   
    <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy1" label="关联医院1" placeholder="请选择关联医院1.."  onsearchchange={onsearchchange1} searchdata={searchdata1} option={option1} onselected={selected1} onclear={onclearYY1} >   </c-jzlookupv3> -->
   
    <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy2"  onsearchchange={onsearchchange2} objectname="Tender_information__c" fieldname="Hospital2__c"  >   </c-jzlookuplightning>
       <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy1"  onsearchchange={onsearchchange1} objectname="Tender_information__c" fieldname="Hospital1__c"  >   </c-jzlookuplightning>
       <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy1" label="关联医院1" placeholder="请选择关联医院1.."  onsearchchange={onsearchchange1} searchdata={searchdata1} option={option1} onselected={selected1} onclear={onclearYY1} >   </c-jzlookupv3> -->
       <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy2"  onsearchchange={onsearchchange2} objectname="Tender_information__c" fieldname="Hospital2__c"  >   </c-jzlookuplightning>
       <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy2" label="关联医院2" placeholder="请选择关联医院2.."  onsearchchange={onsearchchange2} searchdata={searchdata2} option={option2} onselected={selected2} onclear={onclearYY2} >   </c-jzlookupv3> -->
       <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy3"  onsearchchange={onsearchchange3} objectname="Tender_information__c" fieldname="Hospital3__c"  >   </c-jzlookuplightning>
       <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy3" label="关联医院3" placeholder="请选择关联医院3.."  onsearchchange={onsearchchange3} searchdata={searchdata3} option={option3} onselected={selected3} onclear={onclearYY3} >   </c-jzlookupv3> -->
       <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy4"  onsearchchange={onsearchchange4} objectname="Tender_information__c" fieldname="Hospital4__c"  >   </c-jzlookuplightning>
       <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy4" label="关联医院4" placeholder="请选择关联医院4.."  onsearchchange={onsearchchange4} searchdata={searchdata4} option={option4} onselected={selected4} onclear={onclearYY4} >   </c-jzlookupv3> -->
     </div>
   
    <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy2" label="关联医院2" placeholder="请选择关联医院2.."  onsearchchange={onsearchchange2} searchdata={searchdata2} option={option2} onselected={selected2} onclear={onclearYY2} >   </c-jzlookupv3> -->
       <c-jzlookupv3 if:true={isDisable} data-parent-id="lookupfzr" label="项目负责人" placeholder="请选择项目负责人.."  onsearchchange={onsearchchange5} searchdata={searchdata5} option={option5} onselected={selected5} onclear={onclearFZR5} >   </c-jzlookupv3>
       <div style="font-size:10px;color:red" if:true={isErrorShowFZR}>请选择项目负责人</div>
   
    <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy3"  onsearchchange={onsearchchange3} objectname="Tender_information__c" fieldname="Hospital3__c"  >   </c-jzlookuplightning>
    <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy3" label="关联医院3" placeholder="请选择关联医院3.."  onsearchchange={onsearchchange3} searchdata={searchdata3} option={option3} onselected={selected3} onclear={onclearYY3} >   </c-jzlookupv3> -->
       <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup2" label="关联主战略科室" placeholder="请选择主战略科室.."  onsearchchange={onsearchchangeZLKS} searchdata={searchdataZLKS} option={optionZLKS} onselected={selectedZLKS} onclear={onclearZLKS}  ></c-jzlookupv3>
       <div style="font-size:10px;color:red" if:true={isErrorShowZLKS}>请选择关联主战略科室</div>
       <div style="font-size:10px;color:red" if:true={isrepeate1}>战略科室不能重复选着</div>
   
    <c-jzlookuplightning if:true={isShi}   data-parent-id="lookupyy4"  onsearchchange={onsearchchange4} objectname="Tender_information__c" fieldname="Hospital4__c"  >   </c-jzlookuplightning>
    <!-- <c-jzlookupv3 if:true={isShi} data-parent-id="lookupyy4" label="关联医院4" placeholder="请选择关联医院4.."  onsearchchange={onsearchchange4} searchdata={searchdata4} option={option4} onselected={selected4} onclear={onclearYY4} >   </c-jzlookupv3> -->
   
       <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup3" label="关联副战略科室1" placeholder="请选择副战略科室1.."  onsearchchange={onsearchchangeZLKS1} searchdata={searchdataZLKS1} option={optionZLKS1} onselected={selectedZLKS1} onclear={onclearZLKS1} onsearchclick={InitZLKS1} > </c-jzlookupv3>
       <div style="font-size:10px;color:red" if:true={isrepeate2}>战略科室不能重复选着</div>
       <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup4" label="关联副战略科室2" placeholder="请选择副战略科室2.."  onsearchchange={onsearchchangeZLKS2} searchdata={searchdataZLKS2} option={optionZLKS2} onselected={selectedZLKS2} onclear={onclearZLKS2}> </c-jzlookupv3>
       <div style="font-size:10px;color:red" if:true={isrepeate3}>战略科室不能重复选着</div>
       <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup5" label="关联副战略科室3" placeholder="请选择副战略科室3.."  onsearchchange={onsearchchangeZLKS3} searchdata={searchdataZLKS3} option={optionZLKS3} onselected={selectedZLKS3} onclear={onclearZLKS3}> </c-jzlookupv3>
        <div style="font-size:10px;color:red" if:true={isrepeate4}>战略科室不能重复选着</div>
       <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup6" label="关联副战略科室4" placeholder="请选择副战略科室4.."  onsearchchange={onsearchchangeZLKS4} searchdata={searchdataZLKS4} option={optionZLKS4} onselected={selectedZLKS4} onclear={onclearZLKS4}> </c-jzlookupv3>
        <div style="font-size:10px;color:red" if:true={isrepeate5}>战略科室不能重复选着</div>
        <fieldset class="slds-form-element" >
         <legend class="slds-form-element__legend slds-form-element__label">关联战略科室</legend>
         <div class="slds-form-element__control">
           <div class="slds-checkbox" style="float: left;">
             <input type="checkbox" data-parent-id="unique297" name="options" id="checkbox-unique-id-297" value="01210000000QemLAAS" checked={uniqueid297} onchange={checkbox297} />
             <label class="slds-checkbox__label" for="checkbox-unique-id-297">
               <span class="slds-checkbox_faux"></span>
               <span class="slds-form-element__label">消化科</span>
             </label>
           </div>
           <div class="slds-checkbox" style="float: left;">
             <input type="checkbox" data-parent-id="unique298" name="options" id="checkbox-unique-id-298" value="01210000000QezZAAS" checked={uniqueid298} onchange={checkbox298}/>
             <label class="slds-checkbox__label" for="checkbox-unique-id-298">
               <span class="slds-checkbox_faux"></span>
               <span class="slds-form-element__label">呼吸科</span>
             </label>
           </div>
           <div class="slds-checkbox" style="float: left;">
             <input type="checkbox" data-parent-id="unique299" name="options" id="checkbox-unique-id-299" value="01210000000QezeAAC" checked={uniqueid299} onchange={checkbox299}/>
             <label class="slds-checkbox__label" for="checkbox-unique-id-299">
               <span class="slds-checkbox_faux"></span>
               <span class="slds-form-element__label">普外科</span>
             </label>
           </div>
           <div class="slds-checkbox" style="float: left;">
             <input type="checkbox" data-parent-id="unique300" name="options" id="checkbox-unique-id-300" value="01210000000QezjAAC" checked={uniqueid300} onchange={checkbox300}/>
             <label class="slds-checkbox__label" for="checkbox-unique-id-300">
               <span class="slds-checkbox_faux"></span>
               <span class="slds-form-element__label">泌尿科</span>
             </label>
           </div>
           <div class="slds-checkbox" style="float: left;">
             <input type="checkbox" data-parent-id="unique301" name="options" id="checkbox-unique-id-301" value="01210000000QezoAAC" checked={uniqueid301} onchange={checkbox301}/>
             <label class="slds-checkbox__label" for="checkbox-unique-id-301">
               <span class="slds-checkbox_faux"></span>
               <span class="slds-form-element__label">妇科</span>
             </label>
           </div>
           <div class="slds-checkbox" style="float: left;">
             <input type="checkbox" data-parent-id="unique302" name="options" id="checkbox-unique-id-302" value="01210000000QeztAAC" checked={uniqueid302} onchange={checkbox302}/>
             <label class="slds-checkbox__label" for="checkbox-unique-id-302">
               <span class="slds-checkbox_faux"></span>
               <span class="slds-form-element__label">耳鼻喉科</span>
             </label>
           </div>
         </div>
       </fieldset>
    </div>
  </div>
    <c-jzlookupv3 if:true={isDisable} data-parent-id="lookupfzr" label="项目负责人" placeholder="请选择项目负责人.."  onsearchchange={onsearchchange5} searchdata={searchdata5} option={option5} onselected={selected5} onclear={onclearFZR5} >   </c-jzlookupv3>
    <div style="font-size:10px;color:red" if:true={isErrorShowFZR}>请选择项目负责人</div>
    <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup2" label="关联主战略科室" placeholder="请选择主战略科室.."  onsearchchange={onsearchchangeZLKS} searchdata={searchdataZLKS} option={optionZLKS} onselected={selectedZLKS} onclear={onclearZLKS}  ></c-jzlookupv3>
    <div style="font-size:10px;color:red" if:true={isErrorShowZLKS}>请选择关联主战略科室</div>
    <div style="font-size:10px;color:red" if:true={isrepeate1}>战略科室不能重复选着</div>
    <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup3" label="关联副战略科室1" placeholder="请选择副战略科室1.."  onsearchchange={onsearchchangeZLKS1} searchdata={searchdataZLKS1} option={optionZLKS1} onselected={selectedZLKS1} onclear={onclearZLKS1} onsearchclick={InitZLKS1} > </c-jzlookupv3>
    <div style="font-size:10px;color:red" if:true={isrepeate2}>战略科室不能重复选着</div>
    <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup4" label="关联副战略科室2" placeholder="请选择副战略科室2.."  onsearchchange={onsearchchangeZLKS2} searchdata={searchdataZLKS2} option={optionZLKS2} onselected={selectedZLKS2} onclear={onclearZLKS2}> </c-jzlookupv3>
    <div style="font-size:10px;color:red" if:true={isrepeate3}>战略科室不能重复选着</div>
    <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup5" label="关联副战略科室3" placeholder="请选择副战略科室3.."  onsearchchange={onsearchchangeZLKS3} searchdata={searchdataZLKS3} option={optionZLKS3} onselected={selectedZLKS3} onclear={onclearZLKS3}> </c-jzlookupv3>
     <div style="font-size:10px;color:red" if:true={isrepeate4}>战略科室不能重复选着</div>
    <c-jzlookupv3 if:true={isDisable} data-parent-id="lookup6" label="关联副战略科室4" placeholder="请选择副战略科室4.."  onsearchchange={onsearchchangeZLKS4} searchdata={searchdataZLKS4} option={optionZLKS4} onselected={selectedZLKS4} onclear={onclearZLKS4}> </c-jzlookupv3>
     <div style="font-size:10px;color:red" if:true={isrepeate5}>战略科室不能重复选着</div>
     <fieldset class="slds-form-element" >
      <legend class="slds-form-element__legend slds-form-element__label">关联战略科室</legend>
      <div class="slds-form-element__control">
        <div class="slds-checkbox" style="float: left;">
          <input type="checkbox" data-parent-id="unique297" name="options" id="checkbox-unique-id-297" value="01210000000QemLAAS" checked={uniqueid297} onchange={checkbox297} />
          <label class="slds-checkbox__label" for="checkbox-unique-id-297">
            <span class="slds-checkbox_faux"></span>
            <span class="slds-form-element__label">消化科</span>
          </label>
        </div>
        <div class="slds-checkbox" style="float: left;">
          <input type="checkbox" data-parent-id="unique298" name="options" id="checkbox-unique-id-298" value="01210000000QezZAAS" checked={uniqueid298} onchange={checkbox298}/>
          <label class="slds-checkbox__label" for="checkbox-unique-id-298">
            <span class="slds-checkbox_faux"></span>
            <span class="slds-form-element__label">呼吸科</span>
          </label>
        </div>
        <div class="slds-checkbox" style="float: left;">
          <input type="checkbox" data-parent-id="unique299" name="options" id="checkbox-unique-id-299" value="01210000000QezeAAC" checked={uniqueid299} onchange={checkbox299}/>
          <label class="slds-checkbox__label" for="checkbox-unique-id-299">
            <span class="slds-checkbox_faux"></span>
            <span class="slds-form-element__label">普外科</span>
          </label>
        </div>
        <div class="slds-checkbox" style="float: left;">
          <input type="checkbox" data-parent-id="unique300" name="options" id="checkbox-unique-id-300" value="01210000000QezjAAC" checked={uniqueid300} onchange={checkbox300}/>
          <label class="slds-checkbox__label" for="checkbox-unique-id-300">
            <span class="slds-checkbox_faux"></span>
            <span class="slds-form-element__label">泌尿科</span>
          </label>
        </div>
        <div class="slds-checkbox" style="float: left;">
          <input type="checkbox" data-parent-id="unique301" name="options" id="checkbox-unique-id-301" value="01210000000QezoAAC" checked={uniqueid301} onchange={checkbox301}/>
          <label class="slds-checkbox__label" for="checkbox-unique-id-301">
            <span class="slds-checkbox_faux"></span>
            <span class="slds-form-element__label">妇科</span>
          </label>
        </div>
        <div class="slds-checkbox" style="float: left;">
          <input type="checkbox" data-parent-id="unique302" name="options" id="checkbox-unique-id-302" value="01210000000QeztAAC" checked={uniqueid302} onchange={checkbox302}/>
          <label class="slds-checkbox__label" for="checkbox-unique-id-302">
            <span class="slds-checkbox_faux"></span>
            <span class="slds-form-element__label">耳鼻喉科</span>
          </label>
        </div>
      </div>
    </fieldset>
    <!-- <div style="display: flex;">
      <div>
        <lightning-checkbox-group name="Checkbox Group"
@@ -190,7 +194,7 @@
      </div>
    </div>
     -->
    <button data-parent-id="saveButton1"   class="slds-button slds-button_brand" onclick={saveFn} style={dispatchButtonStyle} if:true={saveButtonShow}>保存</button>
    <button data-parent-id="saveButton1" style="margin-top: 20px;" class="slds-button slds-button_brand" onclick={saveFn} if:true={saveButtonShow}>保存</button>
</div>
</template>
force-app/main/default/lwc/relevant/relevant.js
@@ -1,4 +1,4 @@
import { LightningElement, track } from 'lwc';
import { LightningElement, track,api } from 'lwc';
import GetInspectById from '@salesforce/apex/InspectCheckController.GetInspectById';
@@ -28,11 +28,12 @@
import SearchUserByIds from '@salesforce/apex/InspectCheckController.SearchUserByIds';
import {ShowToastEvent} from 'lightning/platformShowToastEvent';
import lwcCSS from '@salesforce/resourceUrl/lwcCSS';
import {loadStyle} from 'lightning/platformResourceLoader'
import tnederDeletePageCss from '@salesforce/resourceUrl/tnederDeletePageCss';
export default class test01 extends LightningElement {
@api recordid;
//提示
Tongzhishow=false;  //提示显示的标识
SaveShowText="操作成功";//提示框的文本
@@ -75,6 +76,23 @@
    // }
    this.closeOffRefresh();
}
showToast(msg,type) {
    if(type == "success"){
        const event = new ShowToastEvent({
            message: msg,
            variant: type
        });
        // this.isTrue = false;
        this.dispatchEvent(event);
    }else{
        const event = new ShowToastEvent({
            message: msg,
            variant: type,
            mode:"sticky"
        });
        this.dispatchEvent(event);
    }
}
closeOffRefresh(){
    if (this.Tongzhishow == true) {
        this.Tongzhishow = false;
@@ -95,6 +113,7 @@
}
//显示与隐藏
isTrue = false;
isShi = true;  //选着 是 的标识
isFou = false; //选着 否 的标识
isOther = false;  //选着 其他 的标识
@@ -122,8 +141,12 @@
    }
    paramIdStr = '' 
    connectedCallback(){
        Promise.all([
            loadStyle(this, lwcCSS),
            loadStyle(this, tnederDeletePageCss)
        ]);
        // this.OnLoadingWait(5000)
        var paramId =  this.getQueryVariable('id');
        var paramId =  this.recordid;
        if (paramId == null || paramId == '') {
            return ;
        }
@@ -140,7 +163,12 @@
            var response=JSON.parse(result);
            if (response!=undefined && response.length == 1) {
                var tempData  = response[0];
                console.log(tempData.IsRelateProject__c,"是否有值")
                if(tempData.IsRelateProject__c == undefined){
                    this.isTrue = false;
                }else{
                    this.isTrue = true;
                }
                this.checkDatas(tempData);
                this.InspectData   = tempData;
@@ -426,6 +454,7 @@
        this.InspectData.IsRelateProject__c = value;
        if (value == "是") {
            this.isTrue = true;
            this.isShi = true;
            this.isFou = false;
            this.isOther = false;
@@ -440,7 +469,8 @@
        }
        if (value == "否") {
            // this.isShi = false;
            this.isTrue = true;
            this.isShi = false;
            this.isFou = true;
            // if (this.InspectData.irrelevantReasons__c = '8.其他(手写)'||this.InspectData.irrelevantReasons__c == '1.关键词不相关') {
@@ -461,11 +491,11 @@
        if (flag) {
           
            if (this.isOther) {
                this.dispatchDivStyle="position: absolute;left: 30px;top: 210px;width: 600px;height: 500px;background-color: white;z-index: 998;";
                this.dispatchButtonStyle = 'margin-top: 10px;z-index: 999;position: absolute;left: 30px;top: 210px;';
                this.dispatchDivStyle="position: absolute;left: 30px;top: 215px;width: 600px;height: 55%;background-color: white;z-index: 998;";
                this.dispatchButtonStyle = 'margin-top: 15px;z-index: 999;position: absolute;left: 30px;top: 210px;';
            }else{
                this.dispatchDivStyle="position: absolute;left: 30px;top: 150px;width: 600px;height: 500px;background-color: white;z-index: 998;";
                this.dispatchButtonStyle = 'margin-top: 10px;z-index: 999;position: absolute;left: 30px;top: 150px;';
                this.dispatchDivStyle="position: absolute;left: 30px;top: 150px;width: 600px;height: 55%;background-color: white;z-index: 998;";
                this.dispatchButtonStyle = 'margin-top: 15px;z-index: 999;position: absolute;left: 30px;top: 150px;';
            }
        }else{
            this.dispatchDivStyle="";
@@ -514,7 +544,7 @@
        if(this.checkZLSKIsRepeate()== false)
        {
            this.Alert("保存失败",true,true);
            this.showToast("保存失败",'error');
            return;
        }
        //判断是否为空
@@ -531,41 +561,42 @@
        }
       
    //判断 IsRelateProject__c
        //判断 IsRelateProject__c
        if (this.InspectData.IsRelateProject__c == undefined || this.InspectData.IsRelateProject__c == "" ) {
            this.xgxLy = "slds-form-element slds-has-error"
            this.xgxLyFlag = true;
            // this.xgxLyFlag = true;
            flag = false;
        }else{
            this.xgxLy = "slds-form-element"
            this.xgxLyFlag = false;
            // this.xgxLyFlag = false;
        }
    //判断 irrelevantReasons__c
        //判断 irrelevantReasons__c
        if (this.InspectData.irrelevantReasons__c == undefined | this.InspectData.irrelevantReasons__c == "" && this.InspectData.IsRelateProject__c != undefined && this.InspectData.IsRelateProject__c == "否") {
            this.bxgLy = "slds-form-element slds-has-error"
            this.bxgLyFlag = true;
            this.dispatchDivStyle="position: absolute;left: 30px;top: 223px;width: 600px;height: 55%;background-color: white;z-index: 998;";
            // this.bxgLyFlag = true;
            flag = false;
        }else{
            this.bxgLy = "slds-form-element"
            this.bxgLyFlag = false;
            // this.bxgLyFlag = false;
        }
         //判断 irrelevantReasons__c
        // if ( (this.InspectData.irrelevantReasons__c == '8.其他(手写)'||this.InspectData.irrelevantReasons__c== '1.关键词不相关') && this.InspectData.irrelevantReasonOther__c == "") {
        if (this.InspectData.irrelevantReasons__c == '8.其他(手写)' && this.InspectData.irrelevantReasonOther__c == "") {
            this.qtLy="slds-form-element slds-has-error";
            this.qtLyFlag = true;
            // this.qtLyFlag = true;
            flag = false;
        }else{
            this.qtLy="slds-form-element";
            this.qtLyFlag = false;
            // this.qtLyFlag = false;
        }
         //判断 Hospital__c
        
        if ((this.InspectData.Hospital__c == undefined || this.InspectData.Hospital__c ==  ''  ) && this.InspectData.IsRelateProject__c == "是" ) {
            this.isErrorShowYY = true;
            // this.isErrorShowYY = true;
            flag = false;
        }else{
            this.isErrorShowYY = false;
            // this.isErrorShowYY = false;
        }
        //判断 AccountOwner__c
@@ -605,7 +636,7 @@
                // });
                if (response == '成功') {
                  
                    this.Alert("保存成功",false,true);
                    this.showToast("保存成功",'success');
                    //保存成功 设置组件为禁用
                    var buttons = this.template.querySelectorAll('button');
                    buttons.forEach(fileInput=>{
@@ -634,9 +665,12 @@
                    checkboxgroup.forEach(group=>{
                        group.disabled = true;
                    })
                    window.location.hash = "Refresh"+"=="+this.paramIdStr;
                    setTimeout(() => {
                        window.location.href = '/'+this.recordid
                    },3000)
                    // window.location.hash = "Refresh"+"=="+this.paramIdStr;
                }else{
                    this.Alert(response,true);
                    this.showToast(response,'error');
                }
                debugger
                if(this.InspectData.IsRelateProject__c == '是'){
force-app/main/default/lwc/tBidding/tBidding.js
@@ -1,14 +1,16 @@
import { LightningElement, track } from 'lwc';
import { LightningElement, track,api } from 'lwc';
import GetInspectById from '@salesforce/apex/InspectCheckController.GetInspectById';
import SaveDataYB from '@salesforce/apex/InspectCheckController.SaveDataYB';
import ChangeDataYB from '@salesforce/apex/InspectCheckController.ChangeDataYB';
import GetIrresponsibleReason from '@salesforce/apex/InspectCheckController.GetIrresponsibleReason';
import GetproInvolvedManual from '@salesforce/apex/InspectCheckController.GetproInvolvedManual';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { CloseActionScreenEvent } from 'lightning/actions';
import CheckOwnerRequest from '@salesforce/apex/InspectCheckController.CheckOwner';
import tnederDeletePageCss from '@salesforce/resourceUrl/tnederDeletePageCss';
import {loadStyle} from 'lightning/platformResourceLoader'
export default class Yb extends LightningElement {
@api recordid;
//提示
Tongzhishow=false;  //提示显示的标识
SaveShowText="操作成功";  //提示显示的文本
@@ -59,7 +61,10 @@
    }
    ParamIdStr = ''
    connectedCallback(){
        var paramId =  this.getQueryVariable('id');
        Promise.all([
            loadStyle(this, tnederDeletePageCss)
        ]);
        var paramId =  this.recordid;
        if (paramId == null || paramId == '') {
            return ;
        }
@@ -129,7 +134,7 @@
    @track InspectData = {}; //数据
    IsSQZ = false; //申请中的标识
    IsSQZ = true; //申请中的标识
    IsSQZButton = false;
    GetInspectByIdFn(Id)
    {
@@ -213,14 +218,19 @@
                //20220914 you SWAG-CJ3DS5 end
                debugger;
                if (tempData.NotBidApprovalStatus__c == '申请中') {
                    setTimeout(()=>{
                    // setTimeout(()=>{
                        this.IsSQZ = true;
                        this.IsSQZButton = true;
                        this.IsBC = true;
                        this.IsYSJE = true;
                        this.IsSJCP = true;
                    },1000)
                    // },1000)
                }else{
                    this.IsSQZ = false;
                    this.IsSQZButton = false;
                    this.IsBC = false;
                    this.IsYSJE = false;
                    this.IsSJCP = false;
                }
                this.InspectData =tempData;
@@ -326,7 +336,7 @@
    }
  //输入框 未输入展示的值
    BCIsShow = false;
    IsBC = false;
    IsBC = true;
    handleBCSMFn(event)
    {
        var value = event.target.value;
@@ -351,7 +361,7 @@
    //
    SJCPIsShow = false;
    SJCPIsContent = '';
    IsSJCP = false;
    IsSJCP = true;
    handleSJCPFN(event)
    {
        var value = event.target.value;
@@ -397,30 +407,55 @@
            if (temp == 1) {
                ChangeDataYB({JsonData:JSON.stringify(this.InspectData)}).then((response)=>{
                    if (response=="成功") {
                        this.Alert("提交成功");
                        this.showToast("提交成功",'success');
                        this.IsSQZ = true;
                        this.IsSQZButton = true;
                        this.IsBC = true;
                        this.IsYSJE = true;
                        window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                        // window.open("/"+this.recordid)
                        setTimeout(() => {
                            window.location.href = '/'+this.recordid
                        },1000)
                        // window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                    }else{
                        this.Alert(response,true);
                        this.showToast(response,'error');
                    }
                });
            }else
            {
                SaveDataYB({JsonData:JSON.stringify(this.InspectData)}).then((response)=>{
                    if (response=="成功") {
                        this.Alert("保存成功",false,true);
                        window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                        this.showToast("保存成功",'success');
                        window.open("/"+this.recordid)
                        setTimeout(() => {
                            window.location.href = '/'+this.recordid
                        },1000)
                        // window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                    }else{
                        this.Alert(response,true);
                        // this.showToast(response,'error');
                    }
                });
            }
        }
    }
    showToast(msg,type) {
        if(type == "success"){
            const event = new ShowToastEvent({
                message: msg,
                variant: type
            });
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }else{
            const event = new ShowToastEvent({
                message: msg,
                variant: type,
                mode:"sticky"
            });
            this.dispatchEvent(event);
            this.dispatchEvent(new CloseActionScreenEvent());
        }
    }
    CheckFn()
    {
        this.saveFn(null,1);
force-app/main/default/lwc/tEnquiry/tEnquiry.html
@@ -48,13 +48,15 @@
        </div> -->
      <div style="width: 500px;float: left;margin-left: 10px;">
      <div style="width: 500px;float: left;margin: 24px 10px 10px 10px;">
        <!-- <div style="width: 450px;float: left;margin-left: 10px;"> -->
        <!-- <c-jzlookupv3  data-parent-id="lookup1" label="关联医院" placeholder="请选择关联医院.."  onsearchchange={onsearchchange} searchdata={searchdata} option={option} onselected={selectedFn}>  </c-jzlookupv3> -->
<!--
        <c-jzlookuplightning data-parent-id="lookup1" onsearchchange={onsearchchange1}
          objectname="Tender_information__c" fieldname="Hospital__c"> </c-jzlookuplightning>
          objectname="Tender_information__c" fieldname="Hospital__c"> </c-jzlookuplightning> -->
          <!-- <input class="slds-input" id="searchInput" placeholder="请输入客户" value={inputValue} oninput={onsearchchange2}/> -->
          <input type="text" id="text-input-id-3" placeholder="请输入客户名" onchange={onsearchchange2} value={inputValue} class="slds-input" />
          <!-- <lightning-input value={inputValue} onchange={onsearchchange2} placeholderurl="请输入客户"></lightning-input> -->
      </div>
    </div>
force-app/main/default/lwc/tEnquiry/tEnquiry.js
@@ -67,7 +67,7 @@
        }
        
    }
    inputValue = "";
    //==================获取招投标项目id================
    ParamIdStr = ''; // url 参数Id
    getQueryVariable(variable)
@@ -132,7 +132,7 @@
            this.departmentId = Datas[0].department__c;
            // this.yyId = Datas[0].Hospital__c;
            this.yyId = Datas[0].Hospital__c;
            // 20210914 战略科室修改
            this.depart_sels = Datas[0].department_selection__c;
@@ -271,23 +271,26 @@
    SearchFn(event){
        debugger;
        console.log(this.inputValue,'搜索内容')
        if (this.yyId != undefined && this.yyId != '') {
            this.YYSelectedId = this.yyId;
        }
        if ((this.XJBMValue == '' || this.XJBMValue == ' ') && (this.YYSelectedId == '' || this.YYSelectedId == ' ')) {
            this.OnLoading(true);
            GetNormalProductDataSearch({noStr:undefined,IdStr:this.ParamIdStr,hospital:this.YYSelectedId,hospitalArr:this.hisotryData,departments:this.depart_sels}).then(response=>{
                var datas = JSON.parse(response);
                this.notselectdata = datas;
                this.template.querySelector('[data-parent-id="table1"]').refreshdata(this.selectdata,this.notselectdata);
                this.OnLoading(false);
            })
            return ;
        }
        // if ((this.XJBMValue == '' || this.XJBMValue == ' ')
        // //  && (this.YYSelectedId == '' || this.YYSelectedId == ' ')
        // ) {
        //     this.OnLoading(true);
        //     GetNormalProductDataSearch({noStr:undefined,inputText:this.inputValue,IdStr:this.ParamIdStr,hospital:this.YYSelectedId,hospitalArr:this.hisotryData,departments:this.depart_sels}).then(response=>{
        //         var datas = JSON.parse(response);
        //         this.notselectdata = datas;
        //         this.template.querySelector('[data-parent-id="table1"]').refreshdata(this.selectdata,this.notselectdata);
        //         this.OnLoading(false);
        //     })
        //     return ;
        // }
        this.OnLoading(true);
        
        GetNormalProductDataSearch({noStr:this.XJBMValue,IdStr:this.ParamIdStr,hospital:this.YYSelectedId,hospitalArr:this.hisotryData,departments:this.depart_sels}).then(response=>{
        GetNormalProductDataSearch({noStr:this.XJBMValue,IdStr:this.ParamIdStr,inputText:this.inputValue,hospital:this.YYSelectedId,hospitalArr:this.hisotryData,departments:this.depart_sels}).then(response=>{
            
            var datas = JSON.parse(response);
            this.notselectdata = datas;
@@ -318,7 +321,7 @@
            }
        })
        
        GetNormalProductDataSearch({noStr:this.XJBMValue,IdStr:this.ParamIdStr,hospital:this.YYSelectedId,hospitalArr:this.hisotryData,departments:this.depart_sels}).then(response=>{
        GetNormalProductDataSearch({noStr:this.XJBMValue,IdStr:this.ParamIdStr,inputText:this.inputValue,hospital:this.YYSelectedId,hospitalArr:this.hisotryData,departments:this.depart_sels}).then(response=>{
            
            var datas = JSON.parse(response);
            this.notselectdata = datas;
@@ -493,7 +496,10 @@
        this.YYSelectedId = event.detail.value;
     
     }
    onsearchchange2(e){
        this.inputValue = e.target.value
        console.log(e,e.target.value,'xAAA')
    }
    //关联医院
  
force-app/main/default/lwc/tEnquiryNoBidding/tEnquiryNoBidding.js
@@ -130,10 +130,10 @@
                this.InspectData = data.enquiry == null?{}:data.enquiry ;
                this.check();
                setTimeout(()=>{
                    this.OnLoading(false);
                },1500);
                this.OnLoading(false);
                // setTimeout(()=>{
                //     this.OnLoading(false);
                // },1500);
            }).catch(error=>{
                console.log('error');
                console.log(error);
force-app/main/default/lwc/tenderDeletePage/tenderDeletePage.html
@@ -2,26 +2,26 @@
  <div class="exampleHolder" if:true={IsLoading} >
    <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
  </div>
    <div if:true={ScreenWidth}>
        <article class="slds-card" style="height: 90%">
    <div if:true={ScreenWidth} style="height: 100%;padding:3% 3%">
        <article class="slds-card" style="height: 90%;position:relative">
          <div class="slds-card__header slds-grid" >
            <header class="slds-media slds-media_center slds-has-flexi-truncate">
              <div class="slds-media__figure">
                <span class="slds-icon_container slds-icon-standard-account" title="account">
                <!-- <span class="slds-icon_container slds-icon-standard-account" title="account">
                  <svg class="slds-icon slds-icon_small" aria-hidden="true">
                    <use xlink:href="/assets/icons/standard-sprite/svg/symbols.svg#account"></use>
                  </svg>
                  <span class="slds-assistive-text">account</span>
                </span>
                </span> -->
                <lightning-icon icon-name="standard:account" alternative-text="Account" title="Account"></lightning-icon>
              </div>
              <div class="slds-media__body">
                <h2 class="slds-card__header-title">
                    <label class="slds-card__header-link slds-truncate">选择招投标</label>
                </h2>
              </div>
              <div style="float: left;">
                <button style="left: 10%;"  class="slds-button slds-button_brand" onclick={saveAllData}>保存</button>
              </div>
            </header>
          </div>
          <div class="slds-card__body slds-card__body_inner">
@@ -31,6 +31,9 @@
              <div style="font-size:10px;color:red" if:true={isErrorShow}>请选择保留的招标项目!</div>
              <!-- 2022-03-31 更换了控件类型 end -->
            </div>
            <div style="position:absolute;bottom:0;display:flex;width: 100%;justify-content: center;">
              <button  class="slds-button slds-button_brand" onclick={saveAllData}>保存</button>
            </div>
        </article>
      </div>
</template>
force-app/main/default/lwc/tenderDeletePage/tenderDeletePage.js
@@ -1,8 +1,12 @@
import { LightningElement } from 'lwc';
import { LightningElement,api } from 'lwc';
import GetTenderinformationcData from '@salesforce/apex/TenderDeleteLwcController.GetTenderinformationcData';
import saveData from '@salesforce/apex/TenderDeleteLwcController.saveData';
import searchTender from '@salesforce/apex/TenderDeleteLwcController.searchTender';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import tnederDeletePageCss from '@salesforce/resourceUrl/tnederDeletePageCss';
import {loadStyle} from 'lightning/platformResourceLoader'
export default class TenderDeletePage extends LightningElement {
    @api recordid;
    ParamIdStr = '';
    //页面初始化加载数据
    ScreenWidth = ''
@@ -15,9 +19,13 @@
    Tenderinformationc={};
    
    connectedCallback() {
        Promise.all([
            loadStyle(this, tnederDeletePageCss)
        ]);
    console.log(this)
        this.onLoadin(true);
        debugger
        var paramId = this.getQueryVariable('id');
        var paramId = this.recordid
        if (paramId == null || paramId == '') {
            return;
        }
@@ -121,13 +129,33 @@
                debugger
                console.warn(result);
                if(result=="成功"){
                    alert('保存成功');
                    window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                    debugger
                    this.showToast('保存成功','success');
                    setTimeout(() => {
                        window.location.href = '/'+this.recordid
                        // window.open('/'+this.recordid,)
                    },2000)
                    // window.location.hash = "Refresh"+"=="+this.ParamIdStr;
                    // debugger
                    this.onLoadin(false);
                }
            });
        }
    }
    showToast(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);
        }
    }
    // 2022-03-31 更换了控件类型 end
}
force-app/main/default/lwc/tenderDeletePage/tenderDeletePagea.css
New file
@@ -0,0 +1,3 @@
.uiModal--horizontalForm .modal-container{
    width: 70%!important;
}
force-app/main/default/lwc/tenderDeletePage/tnederDeletePage.css
New file
@@ -0,0 +1,3 @@
.uiModal--horizontalForm .modal-container{
    width: 600px!important;
}
force-app/main/default/lwc/tenderLost/tenderLost.js
@@ -6,7 +6,8 @@
import LinkedHospitals from '@salesforce/apex/TenderLostController.LinkedHospitals';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import { CloseActionScreenEvent } from 'lightning/actions';
import {loadStyle} from 'lightning/platformResourceLoader'
import tnederDeletePageCss from '@salesforce/resourceUrl/tnederDeletePageCss';
export default class TenderLost extends LightningElement {
    @api
    recordid;
@@ -66,6 +67,9 @@
    //初始化
    connectedCallback(){
        Promise.all([
            loadStyle(this, tnederDeletePageCss)
        ]);
        // this.tenId = this.getQueryVariable('id');
        this.tenId = this.recordid 
        InitData({ParamIdStr:this.tenId}).then(response=>{
@@ -120,7 +124,7 @@
                    // this.Alert("保存成功",false,true);
                    this.showToast("保存成功",'success')
                    window.location.href = '/'+this.recordid
                    window.open('/lightning/n/PCLLostReportPageLwc#pageStatus=Create&oppId=' + response + '&lostType=失单');
                    window.open('/apex/PCLLostReportPageLwc?pageStatus=Create&oppId=' + response + '&lostType=失单');
                    // top.window.close();
                    // window.location.hash = "Refresh"+"=="+response;
                }else{
force-app/main/default/pages/AssetMaintain.page
@@ -839,6 +839,34 @@
                       resetOpenPage(SelectFieldParamList); 
                   }
                   function refreshinput1(){
                    // 复杂组件 start
                    var baseURL = '';
                            var ObjectType = 'AssetMaintainDetail__c';
                            var QueryFieldApiName = 'OneToOne_Main__c';
                            var ObjectType = 'AssetMaintainDetail__c';
                            var inputFieldId = '';
                            var inputFieldId_lktp = '';
                            var SelectObj = 'Asset';
                            var SelectFld = 'Name';
                            console.log('xxx');
                            console.log('123');
                            var cnt = j$(escapeVfId('count_hidden')).val();
                            console.log('count_hidden=' + j$(escapeVfId('count_hidden').length));
                            console.log('count=' + cnt);
                            for (var i = 0; i < cnt; i++) {
                                inputFieldId = 'allPage:allForm:dataBlock:dataline_R1:'+ i +':OneToOne';
                                inputFieldId_lktp = 'allPage:allForm:dataBlock:dataline_R1:'+ i +':OneToOne_lktp';
                                baseURL = '/apex/SearchContactPageLWC?ObjectType=' + ObjectType + '&QueryFieldApiName=' + QueryFieldApiName +'&QueryFieldApiName=' + QueryFieldApiName +'&ObjectType=' + ObjectType +'&inputFieldId=' + inputFieldId +'&SelectObj=' + SelectObj +'&SelectFld=' + SelectFld;
                                var obj = document.getElementById('allPage:allForm:dataBlock:dataline_R1:' + i + ':OneToOne_lkwgt');
                                if (obj != null) {
                                    obj.setAttribute('href', 'javascript:%20openLookup%28%27' + baseURL + '%26lktp%3D%27%20%2B%20getElementByIdCS%28%27' + inputFieldId_lktp + '%27%29.value%2C670%2C%271%27%2C%27%26lksrch%3D%27%20%2B%20escapeUTF%28getElementByIdCS%28%27' + inputFieldId + '%27%29.value.substring%280%2C%2080%29%29%29');
                                }
                            }
                        // 复杂组件 end
                    }
                    refreshinput1();
               </script>
            <table border="0">
                <tr>
@@ -1147,7 +1175,6 @@
                        </tr>
                        <apex:variable value="{!Cnt_L+1}" var="Cnt_L" />
                    </apex:repeat>
                    <apex:repeat id="dataline_L2" value="{!assetFromSearchList}" var="eachAssetData">
                        <tr class="dataRow" id="tableData_L_{!Cnt_L}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
                            <!-- 全选 -->
@@ -1174,7 +1201,7 @@
                                <apex:outputField value="{!eachAssetData.amd.SerialNumber__c}" />
                            </td>
                        </tr>
                        <apex:variable value="{!Cnt_L+1}" var="Cnt_L" />
                        <apex:variable id="Cnt_L" value="{!Cnt_L+1}" var="Cnt_L" />
                    </apex:repeat>
                </table>
            </div>
@@ -1271,7 +1298,7 @@
                                <apex:outputField value="{!eachAssetData.amd.Is_OneToOne_Accessory__c}"/>
                            </td>
                            <td class="col_OneToOne_Main__c dataCellBorder1 OneToOne_Main__c" style="word-wrap:break-word">
                                <apex:inputField value="{!eachAssetData.amd.OneToOne_Main__c}"
                                <apex:inputField id="OneToOne" value="{!eachAssetData.amd.OneToOne_Main__c}"
                                                onchange="j$(escapeVfId('allPage:allForm:dataBlock:dataline_L1:' + '{!Cnt_R}' + ':rowCheck')).prop('checked', true); setChangeFlg(); blockAbandon('{!Cnt_R}');"
                                                rendered="{!editmode && eachAssetData.editable && eachAssetData.amd.Is_OneToOne_Accessory__c  && eachAssetData.amd.Manage_type__c == '数量管理'}"
                                />
@@ -1289,8 +1316,36 @@
                                />
                            </td>
                        </tr>
                        <apex:variable value="{!Cnt_R+1}" var="Cnt_R" />
                        <apex:variable id="Cnt_R" value="{!Cnt_R+1}" var="Cnt_R" />
                    </apex:repeat>
                    <script>
                    function refreshinput1(){
                    // 复杂组件 start
                    var baseURL = '';
                            var ObjectType = 'AssetMaintainDetail__c';
                            var QueryFieldApiName = 'OneToOne_Main__c';
                            var ObjectType = 'AssetMaintainDetail__c';
                            var inputFieldId = '';
                            var inputFieldId_lktp = '';
                            var SelectObj = 'Asset';
                            var SelectFld = 'Name';
                            console.log('xxx');
                            console.log('123');
                            var cnt = j$(escapeVfId('Cnt_L')).val();
                            console.log('count=' + cnt);
                            for (var i = 0; i < cnt; i++) {
                                inputFieldId = 'allPage:allForm:dataBlock:dataline_R1:'+ i +':OneToOne';
                                inputFieldId_lktp = 'allPage:allForm:dataBlock:dataline_R1:'+ i +':OneToOne_lktp';
                                baseURL = '/apex/SearchContactPageLWC?ObjectType=' + ObjectType + '&QueryFieldApiName=' + QueryFieldApiName +'&QueryFieldApiName=' + QueryFieldApiName +'&ObjectType=' + ObjectType +'&inputFieldId=' + inputFieldId +'&SelectObj=' + SelectObj +'&SelectFld=' + SelectFld;
                                var obj = document.getElementById('allPage:allForm:dataBlock:dataline_R1:' + i + ':OneToOne_lkwgt');
                                if (obj != null) {
                                    obj.setAttribute('href', 'javascript:%20openLookup%28%27' + baseURL + '%26lktp%3D%27%20%2B%20getElementByIdCS%28%27' + inputFieldId_lktp + '%27%29.value%2C670%2C%271%27%2C%27%26lksrch%3D%27%20%2B%20escapeUTF%28getElementByIdCS%28%27' + inputFieldId + '%27%29.value.substring%280%2C%2080%29%29%29');
                                }
                            }
                        // 复杂组件 end
                    }
                    refreshinput1();
                    </script>
                    <apex:variable value="{!Cnt_R}" var="Cnt_R_Start" />
                    <apex:repeat id="dataline_R2" value="{!assetFromSearchList}" var="eachAssetData">
                        <tr id="tableData_R_{!Cnt_R}" class="dataRow" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" >
force-app/main/default/pages/CheckAllOlympusAsset.page
@@ -159,6 +159,11 @@
            height:45px;
        }
        /*20230815 ljh end*/
        /*20231007 ljh start*/
        body .datePicker .calDays, .slds-vf-scope .datePicker .calDays {
            width:auto !important
        }
        /*20231007 ljh end*/
    </style>
    <script type="text/javascript">
        // 改变table尺寸
@@ -166,19 +171,19 @@
        var widthAjustment = 30;
        function showCalendar(inputId, position) {
        // 使用jQuery UI DatePicker或其他日期选择器库,将日历弹出到指定的位置
        // 这里假设您使用了jQuery UI DatePicker作为示例
        $("#" + inputId).datepicker({
            // 在这里配置DatePicker的选项
            // 比如,设置日期选择器的位置
            beforeShow: function(input, inst) {
                inst.dpDiv.addClass(position);
            }
        });
            // 使用jQuery UI DatePicker或其他日期选择器库,将日历弹出到指定的位置
            // 这里假设您使用了jQuery UI DatePicker作为示例
            $("#" + inputId).datepicker({
                // 在这里配置DatePicker的选项
                // 比如,设置日期选择器的位置
                beforeShow: function(input, inst) {
                    inst.dpDiv.addClass(position);
                }
            });
        // 手动触发日期选择器的显示
        $("#" + inputId).datepicker('show');
    }
            // 手动触发日期选择器的显示
            $("#" + inputId).datepicker('show');
        }
        function windowResize() {
            blockHeight = j$(window).innerHeight() - j$(escapeVfId('allPage:allForm:searchBlock')).height() - j$(escapeVfId('allPage:allForm:dataBlock:pageBlockButton1')).height() - j$('table#msg').height() - heightAjustment;
@@ -498,11 +503,12 @@
                        <tr><td class="checkButtonStyle"><apex:commandButton value="查看已过期的保有设备" rendered="{!!expiredBlueFlag}" onclick="checkAssetJs('expired'); return false;" /></td></tr>
                        <tr><td class="checkButtonStyle blueStyle"><apex:commandButton style="background-color: silver;" value="查看已过期的保有设备" rendered="{!expiredBlueFlag}" onclick="checkAssetJs('expired'); return false;" /></td></tr>
             <!--  【FY24大及巨大课题】北京新法规项目对应 DB202307428742 20230804 by lc Start -->
                        <tr>
                        <!-- 202310109 ljh 迁移到盘点模块了 -->
                        <!-- <tr>
                            <td class="checkButtonStyle">
                                <apex:commandButton value="温湿度盘点" rendered="{!angecylookrole}" onclick="checkChangeFlg(); gotoInventoryTemperatureHumidity(); return false;" />
                            </td>
                        </tr>
                        </tr> -->
                        <!--  【FY24大及巨大课题】北京新法规项目对应 DB202307428742 20230804 by lc End -->
                    </table>
                </apex:pageBlock>
@@ -527,12 +533,14 @@
                            <apex:inputText disabled="true" rendered="{!!angecylookrole}" />
                            </td>
                            <td class="blankStyle"></td>
                            <td class="labelStyle">备品状态</td>
                            <td class="labelStyle">机身号</td>
                            <td class="inputTextStyle"><apex:inputText value="{!searchB.serialNumber}" id="serialNoId" /></td>
                            <!-- <td class="labelStyle">备品状态</td>
                            <td class="inputTextStyle">
                                <apex:selectList value="{!searchB.fixture_Status}" id="assetStatusId" size="1">
                                    <apex:selectOptions value="{!assetStatusOptionList}"/>
                                </apex:selectList>
                            </td>
                            </td> -->
                        </tr>
                        <tr><td><br /><br /></td></tr>
                        <tr>
@@ -548,8 +556,12 @@
                                <apex:inputText value="{!searchB.internal_Asset_number}" id="fixedAssetNumId2" rendered="{!!internalAssetNumberEditableFlag}" />
                            </td>
                            <td class="blankStyle"></td>
                            <td class="labelStyle">机身号</td>
                            <td class="inputTextStyle"><apex:inputText value="{!searchB.serialNumber}" id="serialNoId" /></td>
                            <td class="labelStyle">消耗品有效期至</td>
                            <td class="inputTextStyle">
                                <apex:inputText id="consumable_Guaranteen_endStr" value="{!searchB.consumable_Guaranteen_endStr}" size="12" onfocus="DatePicker.pickDate(true, '{!$Component.consumable_Guaranteen_endStr}', false);showCalendar('consumable_Guaranteen_endStr','right');" />
                            </td>
                            <!-- <td class="labelStyle">机身号</td>
                            <td class="inputTextStyle"><apex:inputText value="{!searchB.serialNumber}" id="serialNoId" /></td> -->
                            <td class="blankStyle"></td>
                            <td class="labelStyle">分公司号</td>
                            <td class="inputTextStyle">
@@ -581,12 +593,15 @@
                                </apex:selectList>
                            </td>
                            <td class="blankStyle"></td>
                            <td class="labelStyle">管理种类</td>
                           <!--  <td class="labelStyle">管理种类</td>
                            <td class="inputTextStyle">
                                <apex:selectList value="{!searchB.manage_type}" id="manage_type" size="1">
                                    <apex:selectOptions value="{!manage_typeOpts}"/>
                                </apex:selectList>
                            </td>
                            </td> -->
                            <td class="blankStyle"></td>
                            <td class="blankStyle"></td>
                        </tr>
                        <tr><td><br /><br /></td></tr>
                        <tr>
@@ -604,9 +619,15 @@
                                </apex:selectList>
                            </td>
                            <td class="blankStyle"></td>
                            <td class="labelStyle">消耗品有效期至</td>
                            <!-- <td class="labelStyle">消耗品有效期至</td>
                            <td class="inputTextStyle">
                                <apex:inputText id="consumable_Guaranteen_endStr" value="{!searchB.consumable_Guaranteen_endStr}" size="12" onfocus="DatePicker.pickDate(true, '{!$Component.consumable_Guaranteen_endStr}', false);showCalendar('consumable_Guaranteen_endStr','right');" />
                            </td> -->
                            <td class="labelStyle">备品状态</td>
                            <td class="inputTextStyle">
                                <apex:selectList value="{!searchB.fixture_Status}" id="assetStatusId" size="1">
                                    <apex:selectOptions value="{!assetStatusOptionList}"/>
                                </apex:selectList>
                            </td>
                            <td class="blankStyle"></td>
                        </tr>
@@ -626,8 +647,12 @@
                                </apex:selectList>
                            </td>
                            <td class="blankStyle"></td>
                            <td class="blankStyle"></td>
                            <td class="blankStyle"></td>
                            <td class="labelStyle">管理种类</td>
                            <td class="inputTextStyle">
                                <apex:selectList value="{!searchB.manage_type}" id="manage_type" size="1">
                                    <apex:selectOptions value="{!manage_typeOpts}"/>
                                </apex:selectList>
                            </td>
                            <td class="blankStyle"></td>
                            <td colspan="2">
                                <apex:commandButton style="width: 28%" value="检索" onclick="searchBtnJs(); return false;" rerender="allForm" />
@@ -1017,7 +1042,7 @@
                        <tr class="dataRow" id="tableData_L_{!Cnt_L}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
                            <!-- 全选 -->
                            <td class="dataCellBorder1" style="width:20px" align="center">
                                <apex:inputCheckbox id="rowCheck" value="{!eachAssetData.isCheck}" disabled="{!IF(columnLeftRWMap[leftApiList[0][0]]=='r' || (internalAssetLocationLogin != 'All' && eachAssetData.assetQuertResult['Internal_asset_location__c'] != internalAssetLocationLogin), true, false)}" onchange="checkboxOnclick(); return false;" />
                                <apex:inputCheckbox id="rowCheck" value="{!eachAssetData.isCheck}" disabled="{!IF((internalAssetLocationLogin != 'All' && eachAssetData.assetQuertResult['Internal_asset_location__c'] != internalAssetLocationLogin), true, false)}" onchange="checkboxOnclick(); return false;" />
                                <apex:inputHidden id="canChange" />
                            </td>
                            <apex:variable value="{!0}" var="cnt2" />
force-app/main/default/pages/MaintenanceProductDataManage.page
@@ -1,4 +1,5 @@
<apex:page standardController="Maintenance_Product_Data__c" showHeader="true" sidebar="true" lightningStylesheets="true">
    <apex:stylesheet value="{!URLFOR($Resource.StyleUtilColorCss)}"/>
    <script type="text/javascript">
        function init() {
//          var test = window.location.search;
@@ -19,6 +20,7 @@
            if(getParam('p8') != null){
                str += '&p8='+getParam('p8');
            }
            console.log(getParam('CF00N10000002DIsr'));
            if(getParam('CF00N10000002DIsr') != null){
                str += '&CF00N10000002DIsr='+getParam('CF00N10000002DIsr');
            }
force-app/main/default/triggers/ContentDocumentLink.trigger
@@ -1,4 +1,5 @@
trigger ContentDocumentLink on ContentDocumentLink (before insert,after insert,before delete) {
    // 20231103 陈京武 Lightning文件修改 Start
    if(StaticParameter.ContentDocumentLink == false){
        return;
    }
@@ -62,6 +63,7 @@
    Map<String,List<Id>> deleteImages = new Map<String,List<Id>>();
    // sx 20230210end 备品借出申请故障报告附件提取
    Set<Id> docidList = new Set<Id>();
    Set<Id> delDocidList = new Set<Id>();
    if (Trigger.isBefore && Trigger.isInsert) {
        for (ContentDocumentLink link : Trigger.new) {
            if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.Oppor_sepKey)){
@@ -77,6 +79,12 @@
    if (Trigger.isAfter && Trigger.isInsert) {
        for (ContentDocumentLink link : Trigger.new) {
            docidList.add(link.ContentDocumentId);
        }
    }
    if(Trigger.isDelete && Trigger.isBefore){
        for (ContentDocumentLink link : Trigger.old) {
            docidList.add(link.ContentDocumentId);
            delDocidList.add(link.ContentDocumentId);
        }
    }
    ContentVersion ver = new ContentVersion();
@@ -237,10 +245,14 @@
    if (accIds.size() > 0) {
        Map<String, String> attMap = new Map<String, String>();
        // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accIds order by ParentId];
        List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accIds order by LinkedEntityId];
        List<ContentDocumentLink> linkList = [select ContentDocumentId,LinkedEntityId from ContentDocumentLink where ContentDocument.FileType != 'SNOTE' and LinkedEntityId =: accIds order by LinkedEntityId];
        System.debug('客户Link的条数:' + linkList.size());
        for (ContentDocumentLink link : linkList) {
            attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            if(!delDocidList.contains(link.ContentDocumentId)){
                attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            }
        }
        System.debug('attMap的条数:' + attMap);
        List<Account> updAccList = new List<Account>();
        //20221207 lt 医院审批优化 start
@@ -276,6 +288,7 @@
                        }
                    }
                    acc.Is_upload_file__c = attMap.containsKey(accid);
                    System.debug('是否上传附件:' + attMap.containsKey(accid));
                    updAccList.add(acc);
                }
            }
@@ -297,9 +310,11 @@
    if (accAppIds.size() > 0) {
        Map<String, String> attMap = new Map<String, String>();
        // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accAppIds order by ParentId];
        List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accAppIds order by LinkedEntityId];
        List<ContentDocumentLink> linkList = [select ContentDocumentId,LinkedEntityId from ContentDocumentLink where  ContentDocument.FileType != 'SNOTE' and  LinkedEntityId =: accAppIds order by LinkedEntityId];
        for (ContentDocumentLink link : linkList) {
            attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            if(!delDocidList.contains(link.ContentDocumentId)){
                attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            }
        }
        List<Account_Delay_Apply__c> updAccAppList = new List<Account_Delay_Apply__c>();
        
@@ -327,7 +342,10 @@
        }
        try {
            System.debug('客户变更申请');
            if (updAccAppList.size() > 0) update updAccAppList;
            if (updAccAppList.size() > 0){
                StaticParameter.ContentDocumentTrigger = false;
                update updAccAppList;
            }
        } catch (Exception e) {
            linkList[0].addError(e.getMessage());
        }
@@ -340,7 +358,7 @@
        
        Map<String, String> attMap = new Map<String, String>();
        // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :specIds order by ParentId];
        List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: specIds order by LinkedEntityId];
        List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where  ContentDocument.FileType != 'SNOTE' and  LinkedEntityId =: specIds order by LinkedEntityId];
        for (ContentDocumentLink link : linkList) {
            attMap.put(link.LinkedEntityId, link.LinkedEntityId);
        }
@@ -594,6 +612,6 @@
    // DB202304087063 SFDC系统附件上传自动通知功能开发需求 end
// 20231103 陈京武 Lightning文件修改 End
    
}
force-app/main/default/triggers/ContentDocumentTrigger.trigger
@@ -1,4 +1,5 @@
trigger ContentDocumentTrigger on ContentDocument (before delete,before update) {
    // 20231103 陈京武 Lightning文件修改 Start
    if(StaticParameter.ContentDocumentTrigger == false){
        return;
    }
@@ -38,6 +39,29 @@
    String invoiceStart = System.Label.invoiceStart;
    List<String> rentaldelIdsZhj = new List<String>();
    List<String> attdelIdsZhj = new List<String>();
    Set<Id> docidList = new Set<Id>();
    Set<Id> delDocidList = new Set<Id>();
    if(Trigger.isDelete && Trigger.isBefore){
        for (ContentDocument doc : Trigger.old) {
            docidList.add(doc.Id);
            delDocidList.add(doc.Id);
        }
    }
    if(Trigger.isUpdate && Trigger.isBefore){
        for (ContentDocument doc : Trigger.old) {
            docidList.add(doc.Id);
        }
    }
    ContentVersion ver = new ContentVersion();
    if(docidList.size() > 0){
        ver = [select FileType,TextPreview from ContentVersion where ContentDocumentId in: docidList limit 1];
        System.debug('TextPreview=>' + ver.TextPreview);
        System.debug('FileType=>' + ver.TextPreview);
        if(ver.FileType == 'SNOTE'){
            System.debug('可恶的备注!!!');
            return;
        }
    }
    if (Trigger.isBefore && Trigger.isUpdate) {
        List<Id> idList = new List<Id>();
        for(ContentDocument doc: Trigger.old){
@@ -184,7 +208,25 @@
        //2023-2-10  sx备品 备品检测分析报告 end
    }
    if (specIds.size() > 0) {
        Map<String, String> attMap = new Map<String, String>();
        // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :specIds order by ParentId];
        List<ContentDocumentLink> linkList = [select ContentDocumentId,LinkedEntityId from ContentDocumentLink where   ContentDocument.FileType != 'SNOTE' and   LinkedEntityId =: specIds order by LinkedEntityId];
        for (ContentDocumentLink link : linkList) {
            // attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            if(!delDocidList.contains(link.ContentDocumentId)){
                attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            }
        }
        List<OpportunitySpecialApply__c> updSpecList = new List<OpportunitySpecialApply__c>();
        for (String specId : specIds) {
            OpportunitySpecialApply__c spec = new OpportunitySpecialApply__c(Id = specId);
            spec.Is_upload_file__c = attMap.containsKey(specId);
            updSpecList.add(spec);
        }
        if (updSpecList.size() > 0) update updSpecList;
    }
    //20221207 lt 医院审批优化 start
    //2023-2-10  sx备品 备品检测分析报告 start
@@ -301,9 +343,12 @@
     if (accAppIds.size() > 0) {
        Map<String, String> attMap = new Map<String, String>();
        // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accAppIds order by ParentId];
        List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accAppIds order by LinkedEntityId];
        List<ContentDocumentLink> linkList = [select ContentDocumentId,LinkedEntityId from ContentDocumentLink where   ContentDocument.FileType != 'SNOTE' and   LinkedEntityId =: accAppIds order by LinkedEntityId];
        for (ContentDocumentLink link : linkList) {
            attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            // attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            if(!delDocidList.contains(link.ContentDocumentId)){
                attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            }
        }
        List<Account_Delay_Apply__c> updAccAppList = new List<Account_Delay_Apply__c>();
        
@@ -346,6 +391,16 @@
            }
            
            //20221207 lt 医院审批优化 end
            if(adaList.size() > 0){
                // Account_Delay_Apply__c accapp = new Account_Delay_Apply__c(Id = accappid);
                //20221207 lt 医院审批优化 start
                for(Account_Delay_Apply__c accapp : adaList){
                    accapp.Is_upload_file__c = attMap.containsKey(accappid);
                    updAccAppList.add(accapp);
                }
            }
            
        }
        try {
@@ -450,10 +505,14 @@
    if (accIds.size() > 0) {
        Map<String, String> attMap = new Map<String, String>();
        // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accIds order by ParentId];
        List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accIds order by LinkedEntityId];
        List<ContentDocumentLink> linkList = [select ContentDocumentId,LinkedEntityId from ContentDocumentLink where   ContentDocument.FileType != 'SNOTE' and   LinkedEntityId =: accIds order by LinkedEntityId];
        System.debug('客户Link的条数:' + linkList.size());
        for (ContentDocumentLink link : linkList) {
            attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            if(!delDocidList.contains(link.ContentDocumentId)){
                attMap.put(link.LinkedEntityId, link.LinkedEntityId);
            }
        }
        System.debug('attMap的条数:' + attMap);
        List<Account> updAccList = new List<Account>();
        //20221207 lt 医院审批优化 start
@@ -491,17 +550,20 @@
                        }
                    }
                    acc.Is_upload_file__c = attMap.containsKey(accid);
                    System.debug('是否上传附件:' + attMap.containsKey(accid));
                    updAccList.add(acc);
                }
            }
            //20221207 lt 医院审批优化 end
        }
        // for (String accid : accIds) {
    //     //     Account acc = new Account(Id = accid);
    //     //     acc.Is_upload_file__c = attMap.containsKey(accid);
    //     //     updAccList.add(acc);
    //     // }
    //     if (updAccList.size() > 0) update updAccList;
        //     Account acc = new Account(Id = accid);
        //     acc.Is_upload_file__c = attMap.containsKey(accid);
        //     updAccList.add(acc);
        // }
        if (updAccList.size() > 0) update updAccList;
}
// 20231103 陈京武 Lightning文件修改 End
}