LiJinHuan
2023-08-08 9f5874fcd8657ade15b4fc73c924813684f3a9a8
备品最近优化代码
21个文件已修改
19个文件已添加
8064 ■■■■■ 已修改文件
force-app/main/default/classes/EquipmentRentalCancelController.cls 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRentalCancelController.cls.bak 241 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived5Controller.cls 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentSetShippmentReceived5Controller.cls.bak 254 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FixtureRentalPDFController.cls.bak 833 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FixtureSetDetailHandler.cls 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FixtureSetDetailHandler.cls.bak 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FixtureSetHandler.cls 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/FixtureSetHandler.cls.bak 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/MainFixtureSelectController.cls 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/MainFixtureSelectController.cls.bak 2259 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/components/RelationListPagingCmp.component 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/components/RelationListPagingCmp.component.bak 483 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/MainFixtureSelect.page 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/MainFixtureSelect.page.bak 695 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/QueuePageByAssetId.page 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/QueuePageByAssetId.page.bak 184 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ReantalApplySeriesNo.page 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ReantalApplySeriesNo.page.bak 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalApplyExtensions.page 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalApplyExtensions.page.bak 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalApplySequence.page 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalApplySequence.page.bak 452 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalApplySplit.page 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalApplySplit.page.bak 176 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalFixtureSetAssign.page 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalFixtureSetAssign.page.bak 642 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalFixtureSetAssignAgency.page 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/RentalFixtureSetAssignAgency.page.bak 558 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/EquipmentSetShippmentReceivedcss.css 203 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/EquipmentSetShippmentReceivedcss.css.bak 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/ReceivingNotePageCss.css 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/ReceivingNotePageCss.css.bak 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/RelationListPagingCmpCss.css 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/RelationListPagingCmpJS.js 49 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/RentalFixtureSetDetilSelectCss.css 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/StyleUtilCss.css 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/StyleUtilCss.css.bak 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/TransferShippmentReceivedcss.css 136 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/staticresources/TransferShippmentReceivedcss.css.bak 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/EquipmentRentalCancelController.cls
@@ -141,7 +141,10 @@
            //}
            if (line.isSelect == true) {
                Rental_Apply_Equipment_Set__c upd = new Rental_Apply_Equipment_Set__c();
                upd = line.raes;
                // 20230706 ljh DB202306220097 start
                // upd = line.raes;
                upd.Id = line.raes.Id;
                // 20230706 ljh DB202306220097 end
                upd.Cancel_Select__c = true;
                upd.Cancel_Date__c = Date.today();
                upd.Cancel_Time__c = MainFixtureSelectController.getCurrentTime();
force-app/main/default/classes/EquipmentRentalCancelController.cls.bak
New file
@@ -0,0 +1,241 @@
//TestClass: RentalFixtureManage5Test, RentalFixtureManage2Test
public with sharing class EquipmentRentalCancelController {
    // 备品申请书
    public Rental_Apply__c rentalApply { get; set; }
    // 明细行项目
    public List<LineInfo> lineInfoList { get; set; }
    //备品申请书ID
    public String rentalApplyId { get; private set; }
    public Boolean hasError { get; private set; }
    public Boolean saveBtn { get; private set; }
    //现有备品数量(基于备品一览数量)
    public Integer EquipmentSetCnt{get;set;}
    public EquipmentRentalCancelController() {
        //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
        rentalApplyId = ApexPages.currentPage().getParameters().get('raid');
    }
    // 画面初始化
    public PageReference init() {
        saveBtn = false;
        hasError = false;
        rentalApply = new Rental_Apply__c();
        lineInfoList = new List<LineInfo>();
        if (rentalApplyId != null && rentalApplyId.length() > 0) {
            // 备品借出申请取得
            List<Rental_Apply__c> raList = [
                select Id, Status__c, RA_Status__c
                  from Rental_Apply__c
                 where Id = :rentalApplyId];
            if (raList.size() > 0) {
                rentalApply = raList[0];
            } else {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '备品申请书不存在,请确认。'));
                saveBtn = true;
                return null;
            }
        } else {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '备品申请书不存在,请确认。'));
            saveBtn = true;
            return null;
        }
        // 备品借出备品set一览取得
        List<Rental_Apply_Equipment_Set__c> raesList = [
            select id, Name, Fixture_Set__c, Fixture_Set__r.Name, Fixture_Set__r.Loaner_code__c, RAES_Status__c, Rental_Start_Date__c, Final_reply_day__c, Yi_StockDown__c,
                   StockDown_time__c, Shippment_loaner_time2__c, Cancel_Select__c, Cancel_Reason__c, Cancel_Mem__c, Loaner_cancel_Remarks__c, Fixture_Set__r.Loaner_name__c,
                   First_RAESD__r.Asset__c,Loaner_cancel_reason__c //20210708 SFDC-C448KZ you start
              from Rental_Apply_Equipment_Set__c
             where Rental_Apply__c = :rentalApply.Id
               and Cancel_Select__c = false
               and Yi_loaner_arranged__c = 0];
        if (raesList.size() == 0) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '备品申请书未分配明细,不能取消分配。'));
            saveBtn = true;
            return null;
        }else{
            EquipmentSetCnt = raesList.size();
        }
        // 明细行做成
        for (Rental_Apply_Equipment_Set__c raes : raesList) {
            LineInfo lineInfo = new LineInfo(raes);
            lineInfoList.add(lineInfo);
        }
        return null;
    }
    // 保存按钮
    // https://sohobb.backlog.jp/view/OLY_OCM-152#comment-20041467
    // TODO OLY_OCM-206 select from 一対一Link, 把 分配数 清 0
    public PageReference saveBtn() {
        List<Rental_Apply_Equipment_Set__c> delList = new List<Rental_Apply_Equipment_Set__c>();
        List<Rental_Apply_Equipment_Set__c> updList = new List<Rental_Apply_Equipment_Set__c>();
        Set<Id> esIdSet = new Set<Id>();
        // 明细行check
        Integer cntSelect = 0;
        hasError = false;
        for (LineInfo line : lineInfoList) {
            if (line.isSelect == true) {
                // 入力規則を利用した
                //String reason = line.raes.Cancel_Reason__c;
                //if (line.status == 'canCancel' && (reason == null || reason.length() == 0)) {
                //    line.raes.Cancel_Reason__c.addError('必须输入取消理由。');
                //    hasError = true;
                //}
                //20210708 SFDC-C448KZ you start
                if (String.isBlank(line.raes.Cancel_Reason__c)) {
                      line.raes.Cancel_Reason__c.addError('请输入取消理由');
                      hasError = true;
                  }
                  if (String.isBlank(line.raes.Loaner_cancel_reason__c)) {
                      line.raes.Loaner_cancel_reason__c.addError('请输入一览取消理由');
                      hasError = true;
                  }
                  if (String.isNotBlank(line.raes.Loaner_cancel_reason__c) && line.raes.Loaner_cancel_reason__c=='其他' && String.isBlank(line.raes.Loaner_cancel_Remarks__c)) {
                     line.raes.Loaner_cancel_Remarks__c.addError('请输入取消理由备注');
                      hasError = true;
                  }
                //20210708 SFDC-C448KZ you end
                cntSelect += 1;
            }
        }
        if (cntSelect == 0) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '未选择取消分配的明细。'));
            hasError = true;
        }
        if (hasError == true) {
            system.debug('=====hasError');
            return null;
        }
        Set<Id> raesdIdSet = new Set<Id>();
        // 保存逻辑
        for (LineInfo line : lineInfoList) {
            //if (line.isSelect == true && line.status == 'canCancel') {
            //    Rental_Apply_Equipment_Set__c upd = new Rental_Apply_Equipment_Set__c(Id = line.raes.Id);
            //    // delList.add(del);
            //    // esIdSet.add(line.raes.Fixture_Set__c);
            //    upd.Cancel_Select__c = true;
            //    upd.Cancel_Date__c = Date.today();
            //    upd.Cancel_Reason__c = line.raes.Cancel_Reason__c;
            //    upd.Loaner_cancel_Remarks__c = line.raes.Loaner_cancel_Remarks__c;
            //    updList.add(upd);
            //}
            //if (line.isSelect == true && line.status == 'OnStock_Pre_Inspection') {
            //    Rental_Apply_Equipment_Set__c upd = new Rental_Apply_Equipment_Set__c(Id = line.raes.Id);
            //    //upd.OnStock_Pre_Inspection__c = true;
            //    upd.Cancel_Select__c = true;
            //    upd.Cancel_Date__c = Date.today();
            //    upd.Cancel_Reason__c = line.raes.Cancel_Reason__c;
            //    upd.Loaner_cancel_Remarks__c = line.raes.Loaner_cancel_Remarks__c;
            //    updList.add(upd);
            //    //esIdSet.add(line.raes.Fixture_Set__c);
            //}
            if (line.isSelect == true) {
                Rental_Apply_Equipment_Set__c upd = new Rental_Apply_Equipment_Set__c();
                upd = line.raes;
                upd.Cancel_Select__c = true;
                upd.Cancel_Date__c = Date.today();
                upd.Cancel_Time__c = MainFixtureSelectController.getCurrentTime();
                upd.Cancel_Reason__c = line.raes.Cancel_Reason__c;
                //20210708 SFDC-C448KZ you start
                upd.Loaner_cancel_reason__c = line.raes.Loaner_cancel_reason__c;
                upd.Loaner_cancel_Remarks__c = line.raes.Loaner_cancel_Remarks__c==null ? line.raes.Loaner_cancel_reason__c : line.raes.Loaner_cancel_Remarks__c;
                //20210708 SFDC-C448KZ you end
                if (String.isNotBlank(upd.First_RAESD__r.Asset__c)) {
                    raesdIdSet.add(upd.First_RAESD__r.Asset__c);
                }
                updList.add(upd);
            }
        }
        // 保存
        Savepoint sp = Database.setSavepoint();
        try {
            // if  (   delList.size()  >   0   )   delete  delList;
            if (!raesdIdSet.isEmpty()) {
                List<Fixture_OneToOne_Link__c> fotos = [Select Id From Fixture_OneToOne_Link__c
                        Where Main_Asset__c =: raesdIdSet
                        for update];
                if (!fotos.isEmpty()) {
                    for (Fixture_OneToOne_Link__c foto : fotos) {
                        foto.Select_Accessory_Asset_Cnt__c = 0;
                    }
                    FixtureUtil.withoutUpdate(fotos);
                }
            }
            if  (   updList.size()  >   0   ) {
                Set<Id> assetIdSet = new Set<Id>();
                for (Rental_Apply_Equipment_Set_Detail__c raesd : [SELECT Id, Asset__c
                                                                     FROM Rental_Apply_Equipment_Set_Detail__c
                                                                    WHERE Rental_Apply_Equipment_Set__c = :updList FOR UPDATE]
                ) {
                    if (String.isNotBlank(raesd.Asset__c)) {
                        assetIdSet.add(raesd.Asset__c);
                    }
                }
                if (assetIdSet.size() > 0) {
                    List<Asset> assetList = [SELECT Id
                             FROM Asset
                            WHERE Id = :assetIdSet FOR UPDATE];
                }
                FixtureUtil.withoutUpdate(updList);
            }
            // system.debug(EquipmentSetCnt+'2223333'+updList.size()   );
            // if  ((  updList.size()  ==  EquipmentSetCnt ||
            //         delList.size()  ==  EquipmentSetCnt ||
            //         delList.size()  +   updList.size()  ==  EquipmentSetCnt )
            //         &&  EquipmentSetCnt !=  0
            //         &&  (   rentalApply.Status__c =='引当完了'
            //             ||  rentalApply.Status__c =='出库指示完了'      )){
            //     Rental_Apply__c RaUpdate    =   new Rental_Apply__c();
            //     RaUpdate.id =   rentalApplyId;
            //     RaUpdate.Status__c  =   '已批准';
            //     update  RaUpdate;
            // }
//bp2            ControllerUtil.setEquipmentSetProvisionFlg(esIdSet);
        }   catch (Exception ex)    {
            system.debug('=====' + ex.getMessage());
            hasError = true;
            ApexPages.addMessages(ex);
            Database.rollback(sp);
            return null;
        }
        return null;
    }
    @TestVisible
    class LineInfo {
        // 选择
        public boolean isSelect { get; set; }
        // 借出备品set一览
        public Rental_Apply_Equipment_Set__c raes { get; set; }
        // 状态:可以删除、可以取消、不能取消
        //public String status { get; private set; }
        public String esName { get; private set; }
        public String loanerCode { get; private set; }
        public LineInfo(Rental_Apply_Equipment_Set__c r) {
            isSelect = false;
            raes = r;
            loanerCode = r.Fixture_Set__r.Loaner_name__c;
            ////cancel
            //if (r.Yi_StockDown__c > 0) {
            //    status = 'canCancel';
            ////下架以后改成待上架的checkbox
            ////cancel
            //} else {
            //    status = 'OnStock_Pre_Inspection';
            //}
            esName = r.Fixture_Set__r.Name;
        }
    }
}
force-app/main/default/classes/EquipmentSetShippmentReceived5Controller.cls
@@ -123,8 +123,9 @@
                select AssetName__c, SerialNumber_F__c, Repair_Status_F__c, OnStock_By_Cancel__c, Inspection_Comment__c,Inspection_result_after_Final__c, Inspection_result_after_NG_Final__c, Check_lost_Item_F__c,Rental_Apply_Equipment_Set__r.Fixture_Set__r.Name, Fixture_QRCode_F__c, Rental_Apply_Equipment_Set__r.Name, Pre_inspection_time__c, StockDown__c, StockDown_time__c, Id, Name, Asset__c, Asset__r.Name, Asset__r.SerialNumber, Asset__r.Product_Serial_No__c,
                       Asset__r.Remark__c, Asset__r.ImageAsset__c, Asset__r.ImageSerial__c, Asset__r.ImageAssetUploadedTime__c, Asset__r.ImageSerialUploadedTime__c,
                       Loaner_CDS_Info__c, Inspection_result__c, Check_lost_Item__c, Pre_disinfection__c, Water_leacage_check__c, Inspection_result_after__c, Arrival_in_wh__c,
                       Asset__r.Pre_Reserve_RAES_Detail__c, Asset__r.Pre_Reserve_RAES_Detail__r.After_Inspection_time__c,
                       Inspection_result_after_ng__c, Inspection_result_ng__c, Lost_item_giveup__c, CDS_complete__c, Loaner_accsessary__c, Inspection_NG_abord_reason__c
                       Asset__r.Pre_Reserve_RAES_Detail__c, Asset__r.Pre_Reserve_RAES_Detail__r.After_Inspection_time__c, Rental_Apply__r.Name, Rental_Apply__r.Hospital__c, Rental_Apply__r.Hospital__r.Name,
                       Rental_Apply__r.Person_In_Charge__c, Rental_Apply__r.Person_In_Charge__r.Name, Rental_Apply__r.demo_purpose2__c, Rental_Apply__r.WorkPlace__c, Rental_Apply__r.OCM_dept_category__c, Fixture_Model_No__c,
                       Inspection_result_after_ng__c, Inspection_result_ng__c, Lost_item_giveup__c, CDS_complete__c, Loaner_accsessary__c, Inspection_NG_abord_reason__c, Is_Body__c
                  from Rental_Apply_Equipment_Set_Detail__c
                 where Rental_Apply_Equipment_Set__c in :esIds
                   and ((Shipment_request_time2__c <> null and Cancel_Select__c = False ) or Repair_Status_F__c = '修理完毕')
@@ -232,6 +233,17 @@
        // 回库はSet単位で、明細一つ一つのquickCheck要らない
        public boolean quickCheck { get; set; }
        public boolean editable { get; set; }
        // 备品借出申请故障报告 按钮显示逻辑
        public boolean showFaultRepor { get; set;}
        public String faultReportFlag { get; set;}
        public String personInChargeId { get; set;}
        public String personInChargeName { get; set;}
        public String demoPurpose2 { get; set;}
        public String raName { get; set;}
        public String hospitalId { get; set;}
        public String hospitalName { get; set;}
        public String workPlace { get; set;}
        public String deptCategory { get; set;}
        public EsdInfo(Rental_apply_equipment_Set_Detail__c rec) {
            this.rec = rec;
@@ -249,6 +261,28 @@
            if (rec.Asset__r.ImageSerialUploadedTime__c != null) {
                imageSerialUploadedTime = rec.Asset__r.ImageSerialUploadedTime__c.format('yyyy/MM/dd HH:mm');
            }
            //当明细 设备为主体 且 NG时 显示按钮
            if (rec.Is_Body__c == true && rec.Inspection_result_after__c == 'NG'){
                showFaultRepor = true;
            }
            List<Rental_Apply_Fault__c> rafList = [SELECT Id ,status__c ,Rental_Apply_Equipment_Set_Detail__c from Rental_Apply_Fault__c where Rental_Apply_Equipment_Set_Detail__c = :rec.Id Order By CreatedDate DESC LIMIT 1];
            if( rafList != null && rafList.size() > 0 ){
                this.faultReportFlag = rafList[0].Id;
            }else {
                this.faultReportFlag = '不存在故障报告单';
            }
            personInChargeId = rec.Rental_Apply__r.Person_In_Charge__c;
            personInChargeName = rec.Rental_Apply__r.Person_In_Charge__r.Name;
            demoPurpose2 = rec.Rental_Apply__r.demo_purpose2__c;
            raName = rec.Rental_Apply__r.Name;
            hospitalId = rec.Rental_Apply__r.Hospital__c;
            hospitalName = rec.Rental_Apply__r.Hospital__r.Name;
            workPlace = rec.Rental_Apply__r.WorkPlace__c;
            deptCategory = rec.Rental_Apply__r.OCM_dept_category__c;
        }
    }
}
force-app/main/default/classes/EquipmentSetShippmentReceived5Controller.cls.bak
New file
@@ -0,0 +1,254 @@
// xudan 20160106 Arrival_wh_time__c -> Arrival_wh_time2__c(回库はSet単位なので、積み上げ項目使わず)
public without sharing class EquipmentSetShippmentReceived5Controller {
    public Rental_Apply_Equipment_Set__c es { get; set; }
    public String crossRegion {get;set;}
    private Map<String, String> roleRegionMap {get;set;}
    public List<EsdInfo> esdList { get; set; }
    public boolean done_flg {get;set;}
    public Boolean saveBtnDisabled { get; private set; }
    public boolean ReturnRefuse {get;private set;}
    public String ErrorMessage {get; set;}
    public String CDSFinished {get;set;}
    public boolean LostFlg {get;set;}
    public String SR_status { get; private set; }
    public String Step_status { get; private set; }
    public Boolean needCDS { get; private set; }
    public String open_type { get; private set; }
    public String Raid {get;set;}
    private String Id;
    public Integer getEsdListSize() {
        return esdList.size();
    }
    public EquipmentSetShippmentReceived5Controller() {
//        Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
        Id = ApexPages.currentPage().getParameters().get('id');
        if (SR_status == null) {
            SR_status = ApexPages.currentPage().getParameters().get('type');
        }
        if (Step_status == null) {
            Step_status = ApexPages.currentPage().getParameters().get('step');
        }
        if (open_type == null) {
            open_type = ApexPages.currentPage().getParameters().get('open');
        }
        roleRegionMap = new Map<String, String> {
            '备品中心北方管理成员' => '北京 备品中心',
            '备品中心华东管理成员' => '上海 备品中心',
            '备品中心南方管理成员' => '广州 备品中心'
        };
    }
    // 画面初始化
    public PageReference init() {
        done_flg = false;
        es = new Rental_Apply_Equipment_Set__c();
        esdList = new List<EsdInfo>();
        Set<Id> esIds = new Set<Id>();
        saveBtnDisabled = false;
        ReturnRefuse = true;
        ErrorMessage = '';
        crossRegion = '';
        if (Id != null) {
            List<String> ids = Id.split(',');
            // 当前User
            String userid = Userinfo.getUserId();
            User user = [select Id,Name,UserRole.Name from User where Id = :userid];
            // 备品set
            List<Rental_Apply_Equipment_Set__c> esList = [select Rental_Apply__c, Id, RAES_Status__c, Name, Shippment_loaner_time2__c
                                                               , Rental_Apply__r.Cross_Region_Assign__c
                                            from Rental_Apply_Equipment_Set__c
                                           where (Rental_Apply__r.Name in :ids or Id in :ids)
                                             //and Cancel_Select__c = False
                                             ];
            //List<Fixture_Set__c> esList = [select Id, Name, CDS_staff__c, Shippment_loaner_time__c, Received_loaner_time__c,
            //                                       delivery_company__c, Return_to_wh_staff__c, Return_to_wh_staff__r.Name, Fedex_number__c, Distributor_method__c,
            //                                       Return_delivery_company__c,Return_wh_chenk_staff__c, Received_confirmation_staff__c, Received_confirmation_staff__r.Name, Return_Fedex_number__c, Return_Distributor_method__c,
            //                                       Arrival_wh_time2__c, Asset_return_time__c,
            //                                       CDS_complete__c, Arrival_in_wh__c, StockDown__c,
            //                                       Lost_item_check_time__c,Last_Reserve_Rental_Apply_Fixture_Set__c,
            //                                       StockDown_time__c
            //                                  from Fixture_Set__c where Name = :Id];
            if (esList.size() > 0) {
                //es = esList[0];
                for (Rental_Apply_Equipment_Set__c raes : esList) {
                    esIds.add(raes.Id);
                    Raid = raes.Rental_Apply__c;
                    if(String.isNotBlank(raes.Rental_Apply__r.Cross_Region_Assign__c)){
                        crossRegion = raes.Rental_Apply__r.Cross_Region_Assign__c;
                        if(roleRegionMap.containsKey(user.UserRole.Name)
                            && roleRegionMap.get(user.UserRole.Name) == raes.Rental_Apply__r.Cross_Region_Assign__c) {
                                crossRegion = '';
                        }
                    }
                }
            } else {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '备品不存在'));
                saveBtnDisabled = true;
                return null;
            }
            //检查验证规则修理最终检测日
            /*   todo
            List<Rental_Apply_Equipment_Set__c> CheckRAES = [select id,Name,RAES_Status__c,Rental_Apply__c,Rental_Apply__r.Repair__c,Cancel_Date__c,Fixture_Set__c
                    from Rental_Apply_Equipment_Set__c where id=:es.Last_Reserve_Rental_Apply_Equipment_Set__c];
            Rental_Apply_Equipment_Set__c Ra_c = new Rental_Apply_Equipment_Set__c();
            Rental_Apply__c Rac = new Rental_Apply__c();
            if(CheckRAES.size()>0){
                Ra_c = CheckRAES[0];
                Raid = Ra_c.Rental_Apply__c;
            }
            system.debug(Ra_c.Rental_Apply__r.Repair__c );
            List<Rental_Apply__c> CheckError = new List<Rental_Apply__c>();
            CheckError = [Select id,name,repair__c,repair__r.Return_Without_Repair_Date__c,repair__r.Repair_Final_Inspection_Date__c,repair__r.Repair_Shipped_Date__c,
                                Campaign__c,Campaign__r.Status
                                            from Rental_Apply__c where id=:Ra_c.Rental_Apply__c
                                            and RA_Status__c !='取消'
                                            and RA_Status__c !='删除'];
            if(CheckError.size()>0){
                Rac = CheckError[0];
            }
            */
            //system.debug('All::::'+Rac.repair__r.Repair_Final_Inspection_Date__c);
            // system.debug('All::::'+Rac.repair__c);
            //  system.debug('All::::'+Ra_c.RAES_Status__c);
            // 本番暂不上线该功能,启用后不能入库操作感觉不对
        }
        // 备品set明细
        List<Rental_Apply_Equipment_Set_Detail__c> eList = [
                select AssetName__c, SerialNumber_F__c, Repair_Status_F__c, OnStock_By_Cancel__c, Inspection_Comment__c,Inspection_result_after_Final__c, Inspection_result_after_NG_Final__c, Check_lost_Item_F__c,Rental_Apply_Equipment_Set__r.Fixture_Set__r.Name, Fixture_QRCode_F__c, Rental_Apply_Equipment_Set__r.Name, Pre_inspection_time__c, StockDown__c, StockDown_time__c, Id, Name, Asset__c, Asset__r.Name, Asset__r.SerialNumber, Asset__r.Product_Serial_No__c,
                       Asset__r.Remark__c, Asset__r.ImageAsset__c, Asset__r.ImageSerial__c, Asset__r.ImageAssetUploadedTime__c, Asset__r.ImageSerialUploadedTime__c,
                       Loaner_CDS_Info__c, Inspection_result__c, Check_lost_Item__c, Pre_disinfection__c, Water_leacage_check__c, Inspection_result_after__c, Arrival_in_wh__c,
                       Asset__r.Pre_Reserve_RAES_Detail__c, Asset__r.Pre_Reserve_RAES_Detail__r.After_Inspection_time__c,
                       Inspection_result_after_ng__c, Inspection_result_ng__c, Lost_item_giveup__c, CDS_complete__c, Loaner_accsessary__c, Inspection_NG_abord_reason__c
                  from Rental_Apply_Equipment_Set_Detail__c
                 where Rental_Apply_Equipment_Set__c in :esIds
                   and ((Shipment_request_time2__c <> null and Cancel_Select__c = False ) or Repair_Status_F__c = '修理完毕')
                 order by Rental_Apply_Equipment_Set__r.Name, Rental_Apply_Equipment_Set__c, Name
        ];
        for (Rental_Apply_Equipment_Set_Detail__c esd : eList) {
            EsdInfo ei = new EsdInfo(esd);
            if ((esd.Check_lost_Item_F__c == 'OK' || esd.Repair_Status_F__c == '修理完毕')
                    && !esd.Arrival_in_wh__c) {
                ei.editable = true;
            }
            esdList.add(ei);
        }
        if (esdList.size() <= 0) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '没有备品set明细'));
            saveBtnDisabled = true;
            return null;
        }
        Step_status = '回收后检测';
        SR_status = 'Shippment';
        system.debug('=====' + Step_status);
        system.debug('=====' + open_type);
        return null;
    }
    // Step 切り替えボタン、发货前-检测
    public PageReference Shippment1() {
        Step_status = '发货前';
        return new PageReference('/apex/EquipmentSetShippmentReceived2?id=' + this.Id + '&type=' + this.SR_status + '&step=' + this.Step_status + '&open=' + this.open_type);
    }
    // Step 切り替えボタン、发货-发货运输单号 等
    public PageReference Shippment2() {
        Step_status = '发货';
        return new PageReference('/apex/EquipmentSetShippmentReceived6?id=' + this.Id);
    }
    // 保存按钮
    public PageReference save() {
        String userid = Userinfo.getUserId();
        List<Rental_Apply_Equipment_Set_Detail__c> eList = new List<Rental_Apply_Equipment_Set_Detail__c>();
        for (EsdInfo esdInfo : esdList) {
            Rental_Apply_Equipment_Set_Detail__c esd = esdInfo.rec;
            if (esdInfo.editable) {
                eList.add(esd);
            }
        }
        Boolean needSaveSet = false;
        Boolean needSaveDetail = false;
        // TODO 没变化不存
        if (Step_status == '回收后检测') {
            for (Rental_Apply_Equipment_Set_Detail__c esd : eList) {
                if (String.isNotBlank(esd.Inspection_result_after_Final__c)) {
                    //esd.After_Inspection_time_Final__c = System.now();
                    //esd.Inspection_staff_After_Final__c = userid;
                } else {
                    esd.After_Inspection_time_Final__c = null;
                    esd.Inspection_staff_After_Final__c = null;
                    if (String.isNotBlank(esd.Inspection_result_after__c)) {
                        //esd.After_Inspection_time__c = System.now();
                        //esd.Inspection_staff_After__c = userid;
                    } else {
                        esd.After_Inspection_time__c = null;
                        esd.Inspection_staff_After__c = null;
                    }
                }
            }
            needSaveDetail = true;
        }
        Savepoint sp = Database.setSavepoint();
        try {
            //if (needSaveSet) ControllerUtil.upRAdEquipmentSet(es);
            //if (needSaveDetail) ControllerUtil.updRAEquipmentSetDetail(eList);
            if (needSaveDetail) FixtureUtil.withoutUpsertObjects(eList);
            //PageReference ref = new Pagereference('/apex/EquipmentSetShippmentReceived5?id=' + Id + '&type=' + SR_status + '&step=' + this.Step_status + '&open=' + this.open_type);
            //ref.setRedirect(true);
            //return ref;
            done_flg = true;
            return null;
        } catch (Exception ex) {
            system.debug('=====' + ex.getMessage());
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, ex.getDmlMessage(0)));
            //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, ex.getDmlMessage(0)+'( '+Step_status+' )'));
            Database.rollback(sp);
            done_flg = false;
            return null;
        }
        return null;
    }
    public class EsdInfo {
        public Rental_Apply_Equipment_Set_Detail__c rec { get; set; }
        public String imageAssetUploadedTime { get; set; }
        public String imageSerialUploadedTime { get; set; }
        // 回库はSet単位で、明細一つ一つのquickCheck要らない
        public boolean quickCheck { get; set; }
        public boolean editable { get; set; }
        public EsdInfo(Rental_apply_equipment_Set_Detail__c rec) {
            this.rec = rec;
            this.editable = false;
            if (rec.Asset__r.Pre_Reserve_RAES_Detail__c != null && rec.Asset__r.Pre_Reserve_RAES_Detail__r.After_Inspection_time__c != null) {
                this.quickCheck = Datetime.now() < rec.Asset__r.Pre_Reserve_RAES_Detail__r.After_Inspection_time__c + 30 ? true : false;
            } else {
                this.quickCheck = false;
            }
            if (rec.Asset__r.ImageAssetUploadedTime__c != null) {
                imageAssetUploadedTime = rec.Asset__r.ImageAssetUploadedTime__c.format('yyyy/MM/dd HH:mm');
            }
            if (rec.Asset__r.ImageSerialUploadedTime__c != null) {
                imageSerialUploadedTime = rec.Asset__r.ImageSerialUploadedTime__c.format('yyyy/MM/dd HH:mm');
            }
        }
    }
}
force-app/main/default/classes/FixtureRentalPDFController.cls.bak
New file
@@ -0,0 +1,833 @@
public without sharing class FixtureRentalPDFController {
    private static Integer MAXLINEHRIGHT = 25;
    private static Integer MAXPAGECOUNT = 22; //32
    private String rentalApplyIdIMG;
    // private String rentalApplyId;//20201120 ljh
    private List<String> rentalApplyId;
    // private List<String> raesidList;  確認
    public List<PDFInfo> records { get; set; }
    public Integer pageCnt { get; set; }
    public Integer pageNum { get; set; }
    public integer AllSum {get;set;}
    public String RentalApplyName  { get; set; }
    public String BorrowTimeString { get; set; }
    public Rental_Apply__c ApplyHeadShow { get; set; }
    public List<lineInfo> DetailsAllList { get; set;}
    public Map<String,String> AssetModelNoMap {get;set;}
    public List<PDFInfoIMG> recordsIMG { get; set; }
    public List<PDFInfoIMG> recordsIMGfist { get; set; }
    public Integer pageCntIMG { get; set; }
    public String headerLength {get;set;}
    public List<List<String>> PageCutList { get; set; }
    public String HospitalName { get; set;}//医疗机构
    public String Shippmentadress { get; set;}//发货地址
    public Integer mainCnt { get; private set;}//主体件数
    public Integer accessoryCnt { get; private set;}//附属品件数
    public String centreAddress { get; set; }
    public Boolean IsShowLU { get; set; } //是否显示签收单左上角文字 true显示 20201119 LJH OCSM_BP5-61 add
    public Boolean IsMain; //是否是现地分配的主单 20201120 LJH OCSM_BP5-61 add
    public string staticResource { get; private set; }
    public string staticResourceFile { get; private set; }
    public Boolean addFlag { get; private set; }//敏感地址使用标记
    public String qrcode { get; private set; }
    public String barcode { get; private set; }
    // 20220413 ljh 抬头显示 add start
    public String AgencyAddressName { get; private set; }
    public Boolean isAgencyOrCenter { get; private set; }
    public String AgencyOrCenterAddress { get; private set; }
    // 20220413 ljh 抬头显示 add end
    public FixtureRentalPDFController() {
        pageNum = Integer.valueOf(ApexPages.currentPage().getParameters().get('page'));
        rentalApplyIdIMG = ApexPages.currentPage().getParameters().get('raid');
        //Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
        // rentalApplyId = ApexPages.currentPage().getParameters().get('raid');//20201120 ljh
        String tempStr = ApexPages.currentPage().getParameters().get('raid');
        addFlag = false;
        rentalApplyId = new List<String>();
        if(tempStr != null){
           rentalApplyId.add(tempStr);
        }
        ApplyHeadShow = new Rental_Apply__c();
        IsShowLU = true;//20201119 LJH OCSM_BP5-61 add
        IsMain = false;//20201123 LJH OCSM_BP5-61 add
    }
    // 画面初始化
    public void init() {
        staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Rental_Apply__c'));
        staticResourceFile = JSON.serialize(PIHelper.getPIIntegrationInfo('Document'));
        // 新规奥林巴斯备品签收单PDF画面初始化
        PageCutList = new List<List<String>>();
        List<Rental_Apply__c> ApplyList = new List<Rental_Apply__c>();
        Map<String,String>  AgencyAddressIdMap = new Map<String,String>(); //20201124 LJH OCSM_BP5-61 add 出借Id,地址Id
        if(rentalApplyId!=null){
            ApplyList = [select id,
                                name,
                                Name_No__c, // 20211209 ljh SFDC-C923SR add
                                Shippment_loaner_time__c,
                                WorkPlace__c,
                                Salesdept__c,
                                Demo_purpose1__c,
                                Demo_purpose2__c,
                                Bollow_Date__c,
                                Campaign__r.EndDate,
                                Follow_UP_Opp__c,
                                Repair__r.Repair_Shipped_Date__c,
                                Return_dadeline_final__c,
                                Shipment_address__r.Post_Code__c,
                                Person_In_Charge__r.Name,Post_Code__c,
                                Shippment_adress_detail__c,
                                Person_In_Charge__r.Phone,
                                Phone_number__c,
                                Hospital__r.Name,Account__r.Department_name__c,
                                Account__r.Name,
                                Direct_shippment_address__c,
                                Dealer__r.Postal_Code__c,
                                ApplyUser__r.Name,
                                applyUser__r.Phone,
                                Loaner_medical_Staff__r.Name,
                                Loaner_medical_Staff__r.Phone,
                                Loaner_received_staff__c,
                                Loaner_received_staff_phone__c,
                                Asset_loaner_start_date__c,
                                Asset_loaner_start_day__c,
                                ApplyPerson_Phone__c,
                                Loaner_centre_mail_address__c,
                              // Main_Cnt__c,
                              // Accessory_Cnt__c,
                                Old_Rental_Apply__c,//20201120 LJH OCSM_BP5-61 add
                                Split_Apply_Reason__c,//20201120 LJH OCSM_BP5-61 add
                                RecordType.DeveloperName,//20201120 LJH OCSM_BP5-61 add
                                Request_shipping_day__c,//20201120 LJH OCSM_BP5-61 add
                                ToAgency__c,//20201123 LJH OCSM_BP5-61 add
                                Agency_Address_Id__c,//20201124 LJH OCSM_BP5-61 add
                                Root_Rental_Apply__c,//20210617 ljh 1732 add
                                BRId__c, // 20211209 ljh SFDC-C923SR add
                                 direct_send__c,
                                QRImg__c,
                                QRId__c,
                                AWS_Data_Id__c,//20220304
                                Direct_Shippment_Address_Encrypt__c,//20220304
                                Phone_Number_Encrypt__c//20220304
                        from  Rental_Apply__c
                        where id = :rentalApplyId];
        }
        if(ApplyList.size()>0){
            ApplyHeadShow = ApplyList[0];
            qrcode = ConsumTrialPDFController.GetImageBase64(ApplyHeadShow.QRId__c);
            barcode = ConsumTrialPDFController.GetImageBase64(ApplyHeadShow.BRId__c);
        }
        //增加借出备品SET一览List,为了获取借出备品SET一览明细
        List<String> RAESSearchList = New List<String>();
        //20201201 ljh  OCSM_BP5-76 add start
        String centerAddressInfo;
        bp3_Setting__c conf = bp3_Setting__c.getOrgDefaults();
        //20201201 ljh  OCSM_BP5-76 add end
        //根据备品中心邮箱判断备品中心
        if(ApplyHeadShow.Loaner_centre_mail_address__c=='OCM_Asset@olympus.com.cn'){
          centreAddress = '请将备品回寄至北京备品中心';
          centerAddressInfo = 'BeiJingCenter';
        }else if(ApplyHeadShow.Loaner_centre_mail_address__c=='OCM_AssetSH@olympus.com.cn'){
          centreAddress = '请将备品回寄至上海备品中心';
          centerAddressInfo = 'ShangHaiCenter';
        }else if(ApplyHeadShow.Loaner_centre_mail_address__c=='OCM_AssetGZ@olympus.com.cn'){
          centreAddress = '请将备品回寄至广州备品中心';
          centerAddressInfo = 'GuangZhouCenter';
        }
        //20201120 LJH OCSM_BP5-61 add start
        //现地管理分单 主单&从单
        //20210617 ljh 1732 update start
        if(ApplyHeadShow.RecordType.DeveloperName == 'AgencyRequest'){
            //记录类型办事处
            IsShowLU = false;
            String tempStr = ApplyHeadShow.Agency_Address_Id__c;
            if(String.isNotBlank(tempStr)){
                AgencyAddressIdMap.put(ApplyHeadShow.Id,tempStr.substring(0,15));
            }
            if(String.isBlank(ApplyHeadShow.Old_Rental_Apply__c)){
                List<Rental_Apply__c> ApplyCopyList = [select Id, Name from  Rental_Apply__c where Root_Rental_Apply__c = :ApplyHeadShow.id  and Split_Apply_Reason__c = '现地管理分单']; //20210611 ljh 1732 update Root_Rental_Apply__c
                if(ApplyCopyList.size()>0){
                    for(Rental_Apply__c ac:ApplyCopyList){
                        String tempId = ac.Id;
                        rentalApplyId.add(tempId);
                    }
                }
            }else{
                List<Rental_Apply__c> ApplyCopyList = [select Id, Name from  Rental_Apply__c where ((Root_Rental_Apply__c = :ApplyHeadShow.Root_Rental_Apply__c and id != :ApplyHeadShow.id and Split_Apply_Reason__c = '现地管理分单')  OR id = :ApplyHeadShow.Root_Rental_Apply__c) ]; //20210611 ljh 1732 update Root_Rental_Apply__c
                if(ApplyCopyList.size()>0){
                    for(Rental_Apply__c ac:ApplyCopyList){
                        String tempId = ac.Id;
                        rentalApplyId.add(tempId);
                    }
                }
            }
        }else{
            if(String.isBlank(ApplyHeadShow.Old_Rental_Apply__c)){
                //是否 现地管理分单 主单
                List<Rental_Apply__c> ApplyCopyList = [select Id, Name from  Rental_Apply__c where Root_Rental_Apply__c = :ApplyList[0].id  and Split_Apply_Reason__c = '现地管理分单']; //20210611 ljh 1732 update Root_Rental_Apply__c
                if(ApplyCopyList.size()>0){
                    IsShowLU = false;
                    IsMain = true;
                    for(Rental_Apply__c ac:ApplyCopyList){
                        String tempId = ac.Id;
                        rentalApplyId.add(tempId);
                    }
                }
            }
        }
        List<Shipment_address__c> ShipmentAddressList = [select Id,Name,Address__c from Shipment_address__c where Id in :AgencyAddressIdMap.values()];
        Map<String,String> ShipmentAddressMap = new Map<String,String>();
        for(Shipment_address__c sa : ShipmentAddressList){
            String tempStr = sa.Id;
            ShipmentAddressMap.put(tempStr.substring(0,15),sa.Address__c);
        }
        Set<String> keySet = AgencyAddressIdMap.keySet();
        for(String ks:keySet){
            AgencyAddressIdMap.put(ks,ShipmentAddressMap.get(AgencyAddressIdMap.get(ks)));
        }
        //20201120 LJH OCSM_BP5-61 add end
        //医疗机构名分行显示
        if(ApplyHeadShow.Hospital__r.Name != null){
            String HospOrgan = ApplyHeadShow.Hospital__r.Name;
            Integer HospSize = HospOrgan == null ? 0 : HospOrgan.length();
            if(HospSize <=19){
                HospitalName = HospOrgan;
            }else{
                HospitalName = HospOrgan.substring(0,19)+'\n'+HospOrgan.substring(19,HospSize);
            }
        }
        //发货地址分行显示
        String ShippMentAdr = null;
        if (ApplyHeadShow.Shippment_adress_detail__c != null) {
            ShippMentAdr = ApplyHeadShow.Shippment_adress_detail__c;
        } else {
            ShippMentAdr = ApplyHeadShow.Direct_shippment_address__c;
            addFlag = true;
        }
        Integer ShipAdrSize = ShippMentAdr == null ? 0 : ShippMentAdr.length();
        if (ShipAdrSize <= 26) {
            Shippmentadress = ShippMentAdr;
        } else if (ShipAdrSize > 26 && ShipAdrSize <= 52) {
            Shippmentadress = ShippMentAdr.substring(0,26)+ '\n' +ShippMentAdr.substring(26,ShipAdrSize);
        } else {
            Shippmentadress = ShippMentAdr.substring(0,26)+'\n'+ShippMentAdr.substring(26,52) + '\n'+ShippMentAdr.substring(52,ShipAdrSize);
        }
        // 增加医院借用期限,输出字段格式化
        if (ApplyHeadShow.Asset_loaner_start_date__c != null) {
            if (ApplyHeadShow.Demo_purpose2__c      == '产品试用'
                ||  ApplyHeadShow.Demo_purpose2__c  ==  '新产品评价'
                ||  ApplyHeadShow.Demo_purpose2__c  ==  FixtureUtil.raDemo_purpose2MAP.get('shiyongwuxunjia')
                ||  ApplyHeadShow.Demo_purpose2__c  ==  FixtureUtil.raDemo_purpose2MAP.get('shiyongyouxunjia')
                ||  ApplyHeadShow.Demo_purpose2__c  ==  '其他'
                ||  ApplyHeadShow.Demo_purpose2__c  ==  '协议借用') {
                BorrowTimeString = String.valueOf(ApplyHeadShow.Asset_loaner_start_date__c) + ' ~ '
                                 + String.valueOf(ApplyHeadShow.Return_dadeline_final__c)
                                 + '前到达奥林巴斯备品中心';
            } else if (ApplyHeadShow.Demo_purpose2__c == '学会展会') {
                if (ApplyHeadShow.Campaign__r.EndDate != null){
                    BorrowTimeString = String.valueOf(ApplyHeadShow.Asset_loaner_start_date__c) + ' ~ '
                                     + String.valueOf(ApplyHeadShow.Campaign__r.EndDate.addDays(5))
                                     + '前到达奥林巴斯备品中心';
                                     // 2018年7月31日 SWAG-B36CY6 by 张玉山 start
                    } else if (ApplyHeadShow.Campaign__r.EndDate == null) {
                       // 2018年7月31日 SWAG-B36CY6 by 张玉山 end
                        BorrowTimeString = '学会结束日为空,无法确定医院借用期限';
                    }else{
                        BorrowTimeString = 'ApexClass104:无法获取数据,请联系开发组';
                    }
            } else if (ApplyHeadShow.Demo_purpose2__c == '已购待货') {
                BorrowTimeString = String.valueOf(ApplyHeadShow.Asset_loaner_start_date__c) + ' ~ '
                                 + '新品发货日起14天内'
                                 + '到达奥林巴斯备品中心';
            } else if (ApplyHeadShow.Demo_purpose2__c == '故障排查') {
                BorrowTimeString = '判定有故障时,' + String.valueOf(ApplyHeadShow.Asset_loaner_start_date__c)
                                 + '~修理品返送日起14天内到达奥林巴斯备品中心\n'
                                 + '判定无故障时,' + String.valueOf(ApplyHeadShow.Asset_loaner_start_date__c)
                                 + '~出库日起10个工作日内到达奥林巴斯备品中心';
            } else if (ApplyHeadShow.Demo_purpose1__c == '维修代用') {
                BorrowTimeString = String.valueOf(ApplyHeadShow.Asset_loaner_start_date__c) + ' ~ '
                                 + '修理品返送日起14天内'
                                 + '到达奥林巴斯备品中心';
            } else {
                BorrowTimeString = '未设定归还期限';
            }
        } else {
            BorrowTimeString = '备品预计出货日为空,无法确定医院借用期限';
        }
        system.debug(' ApplyHeadShow.Demo_purpose1__c'+ ApplyHeadShow.Demo_purpose1__c);
        // 增加医院借用期限,输出字段格式化
        // system.debug('测试位置1+raesidList'+raesidList);
        records = new List<PDFInfo>();
        List<Rental_Apply_Equipment_Set__c> raesList = new List<Rental_Apply_Equipment_Set__c>();
        // List<String> esidList = new List<String>();
        //ToDo Where 確認
        String soql =  'select Id, Name, Rental_Apply__c, Fixture_Set__r.Name'
               + ', Rental_Apply__r.Name, Request_owner__c, Rental_Apply__r.Salesdept__c'
               + ', Rental_Apply__r.WorkPlace__c, Account__c, Rental_Apply__r.Campaign__r.Name'
               + ', Rental_Apply__r.Request_shipping_day__c, Rental_Apply__r.Loaner_received_staff__c'
               + ', Rental_Apply__r.Loaner_received_staff_phone__c, Rental_Apply__r.Shippment_adress_detail__c'
               + ', Rental_End_Date__c, Rental_Apply__r.direct_shippment_address__c'
               + ' from Rental_Apply_Equipment_Set__c'
               + ' where Rental_Apply__c = :rentalApplyId'
               + ' AND Cancel_Select__c = false'
               + ' AND Yi_Shipment_request__c > 0';
        //ToDo条件確認
        //soql += 'and RAES_Status__c != \'引当済\' and RAES_Status__c != \'取消分配\'';
        //今回個別の表示はしないのでコメントアウトします
        // if (raesidListIMG.size() > 0) {
        //     soql += ' AND Id in : raesidListIMG ';
        // }
        // if(ApplyHeadShow.Shippment_loaner_time__c != null) {
        //     soql += ' AND Shippment_loaner_time__c != null';
        // }
        soql += ' order by Name';
        raesList = Database.query(soql);
        //20201120 LJH OCSM_BP5-61 add start
        //申请单-申请一览List
        Map<Id,List<Rental_Apply_Equipment_Set__c>> raRaesMap = new  Map<Id,List<Rental_Apply_Equipment_Set__c>>();
        //20201120 LJH OCSM_BP5-61 add end
        if (raesList.size() > 0) {
            for (Rental_Apply_Equipment_Set__c raes : raesList) {
                //ToDo RentalApplyName取り方が変
                //RentalApplyName = raes.Rental_Apply__r.Name;
                //循环获得RAES_id
                RAESSearchList.add(raes.id);
                //20201120 LJH OCSM_BP5-61 add start
                if(!raRaesMap.containsKey(raes.Rental_Apply__c)){
                    raRaesMap.put(raes.Rental_Apply__c,new Rental_Apply_Equipment_Set__c[]{raes});
                }else{
                    raRaesMap.get(raes.Rental_Apply__c).add(raes);
                }
                //20201120 LJH OCSM_BP5-61 add end
            }
            RentalApplyName = raesList[0].Rental_Apply__r.Name;
        }
        Map<String, List<Rental_Apply_Equipment_Set_Detail__c>> raesdMap = new Map<String, List<Rental_Apply_Equipment_Set_Detail__c>>();
        String NextName = '';
        if(RAESSearchList.size()>0){
            List<Rental_Apply_Equipment_Set_Detail__c> RAESDLine = New List<Rental_Apply_Equipment_Set_Detail__c>();
            RAESDLine = [
                    select id, Equipment_SetD_Borrowed__c,
                        EquipmentSet_Managment_Code_formula__c,
                        Rental_Apply_Equipment_Set__c,
                        Rental_Apply_Equipment_Set__r.Name,
                        Rental_Apply_Equipment_Set__r.Fixture_Set__r.Name,
                        Rental_Apply_Equipment_Set__r.Loaner_code__c,
                        FSD_Name_CHN__c,
                        Fixture_Name_text__c,
                        Fixture_Model_No_F__c,
                        Fixture_Model_No_text__c,
                        Loaner_asset_no__c,
                        Internal_Asset_number_c__c,
                        ProductName__c,
                        Asset__r.Product2.Image_DocumentID__c,
                        Asset__r.OwnershipMachine_No__c,
                        Asset__r.Name,
                        Asset__r.Loaner_accsessary__c,
                        Asset__r.WH_location__c,
                        SerialNumber__c,
                        SerialNumber_text__c,
                        Is_Body__c,
                        // Rental_Apply_Equipment_Set__r.SerialNumber_text__c,
                        Rental_Apply_Equipment_Set__r.Loaner_code_text__c
                    from Rental_Apply_Equipment_Set_Detail__c
                    where Rental_Apply_Equipment_Set__r.Id in :RAESSearchList
                and Cancel_Select__c = False
                AND asset__c != null
                AND Cancel_Select__c = false
                AND Shipment_request_time2__c != null
                    order by Rental_Apply_Equipment_Set__c, Name, ProductName__c asc nulls last, Asset__r.Loaner_accsessary__c];
            mainCnt = 0;
            accessoryCnt = 0;
            for (Rental_Apply_Equipment_Set_Detail__c ra : RAESDLine) {
                if (ra.Is_Body__c) {
                    mainCnt += 1;
                } else {
                    accessoryCnt += 1;
                }
                if (raesdMap.containsKey(ra.Rental_Apply_Equipment_Set__c)) {
                    raesdMap.get(ra.Rental_Apply_Equipment_Set__c).add(ra);
                } else {
                    List<Rental_Apply_Equipment_Set_Detail__c> rsd = new List<Rental_Apply_Equipment_Set_Detail__c>();
                    rsd.add(ra);
                    raesdMap.put(ra.Rental_Apply_Equipment_Set__c,rsd);
                }
            }
            //20201125 LJH OCSM_BP5-61 add start
            raesList = null;
            raesList = raRaesMap.get(rentalApplyId[0]);
            //20201125 LJH OCSM_BP5-61 add end
        }
        DetailsAllList = new List<lineInfo>();
        recordsIMG = new List<PDFInfoIMG>();
        //计算行高总数,用于分页
        integer LineNum = 0;
        System.debug('raesListsize is' + raesList.size());
        for (Integer i = 0; i < raesList.size(); i++) {
            Rental_Apply_Equipment_Set__c raes = raesList[i];
            Map<String,integer> DLSM = new Map<String,integer>();
            Map<String,String> LoanerCodeSM = new Map<String,String>();
            Map<String,String> DetailsLineMap = new Map<String,String>();
            Set<String> AllSet = new Set<String>();
            String DetailsLine = '';
            List<Rental_Apply_Equipment_Set_Detail__c> LineOrderList = raesdMap.get(raes.Id);
            // system.debug('LineOrderList测试'+LineOrderList.size());
            if (LineOrderList!=null) {
                boolean LotFlag = true;
                for (Rental_Apply_Equipment_Set_Detail__c Ec : LineOrderList) {
                    // LoanerCodeSM.put(Ec.Equipment_Set__r.Loaner_code__c, Ec.Equipment_Set__r.Loaner_code__c);
                    system.debug('LoanerCodeSM显示'+LoanerCodeSM);
                    //先数出来有多少重复的
                    //DetailsLine = DetailsLine + Ec.Asset__r.OwnershipMachine_No__c+' ; ';
                    if (DLSM.containsKey(Ec.Asset__r.OwnershipMachine_No__c)) {
                       //OCM内部产品型号 OwnershipMachine_No__c
                       integer j = DLSM.get(Ec.Asset__r.OwnershipMachine_No__c)+1;
                       DLSM.put(Ec.Asset__r.OwnershipMachine_No__c, j);
                    } else {
                       DLSM.put(Ec.Asset__r.OwnershipMachine_No__c, 1);
                    }
                    if (Ec.Asset__r.Loaner_accsessary__c == false) {
                       //有主机
                       LotFlag = false;
                    }
                    //去掉重复的 ToDo条件确认
                    // if (Ec.Asset__r.Loaner_accsessary__c == true) {
                        //if(Ec.SerialNumber__c == ''||Ec.SerialNumber__c==null){
                       AllSet.add(Ec.Asset__r.OwnershipMachine_No__c);
                    // }
                }
                system.debug('DLSM:::::'+DLSM);
                system.debug('AllSet:::::'+AllSet);
                for (String Ecc : AllSet) {
                    //然后做成字符串
                    if (LotFlag) {
                        //都为附属品
                        if(DLSM.get(Ecc)==1) {
                            DetailsLine = DetailsLine + Ecc + ' ; ';
                        } else {
                            DetailsLine = DetailsLine + Ecc + '*' + DLSM.get(Ecc) + ' ; ';
                        }
                    } else {
                        if (DLSM.get(Ecc)==1&&!LoanerCodeSM.containsKey(Ecc)) {
                            DetailsLine = DetailsLine + Ecc+' ; ';
                        } else if (DLSM.get(Ecc)!=1) {
                            DetailsLine = DetailsLine + Ecc+'*'+DLSM.get(Ecc)+' ; ';
                        }
                    }
                }
                if (DetailsLine.length()>0) {
                    DetailsLine = DetailsLine.substring(0, DetailsLine.length()-2);
                }
                // List<Rental_Apply_Equipment_Set_Detail__c> LinJar = raesdMap.get(raes.Equipment_Set__c);
                // Rental_Apply_Equipment_Set_Detail__c LineOrder = new Rental_Apply_Equipment_Set_Detail__c();
                // if (LinJar.size()>0) {
                Integer k = i;
                for (Rental_Apply_Equipment_Set_Detail__c LineOrder : LineOrderList) {
                        // LineOrder = raesdMap.get(raes.Equipment_Set__c)[0];
                        // system.debug('LineOrder::::::'+LineOrder);
                        lineInfo Li = new lineInfo(LineOrder, LotFlag, k);
                        Li.AssetModelNo = DetailsLine;
                        //载入行高 每行44
                        if (DetailsLine.length() != 0) {
                            Li.LineHeight = (DetailsLine.length()/44) + (Math.mod(DetailsLine.length(), 44) > 0 ? 1 : 0);
                        } else {
                            Li.LineHeight = 1;
                        }
                        Li.height = Li.LineHeight * MAXLINEHRIGHT;
                        LineNum = LineNum + Li.LineHeight;
                        DetailsAllList.add(Li);
                        k = null;
                }
                // }
                // for (Rental_Apply_Equipment_Set_Detail__c raesd : LineOrderList) {
                    PDFInfoIMG infoIMG = new PDFInfoIMG(raes, LineOrderList);
                    recordsIMG.add(infoIMG);
                // }
            }
        }
  //      //分页 15行一页,实际显示14行,判断第14行是否为双倍高度
  //      //明细总页数
        integer PageAllNum = integer.valueOf(Math.ceil( LineNum / (MAXPAGECOUNT+1))+1+'');
        pageCnt = integer.valueOf(Math.ceil( DetailsAllList.size() / 17 ) +1+'');
        //for(Integer j = 0 ; j< PageAllNum ;j++){
        //新建一页
        PDFInfo info = new PDFInfo(new Rental_Apply__c(),New List<Rental_Apply_Equipment_Set_Detail__c>());
        // 20220413 ljh  抬头显示 update start
        //20201120 LJH OCSM_BP5-61 update start
        // if(!IsShowLU){
        //     if(!IsMain){
        //         info.isAgencyOrCenter = true;//办事处
        //         info.AgencyAddressName = '请将备品回寄至';
        //         info.AgencyAddressName += ApplyHeadShow.ToAgency__c == null ? '' : ApplyHeadShow.ToAgency__c;
        //         info.AgencyAddressName += '办事处';
        //         info.AgencyOrCenterAddress = AgencyAddressIdMap.get(ApplyHeadShow.Id);
        //     }else{
        //         info.isAgencyOrCenter = false;//备品中心
        //         info.AgencyOrCenterAddress = centerAddressInfo;
        //     }
        // }else{
        //     info.isAgencyOrCenter = false;//备品中心
        //     info.AgencyOrCenterAddress = centerAddressInfo;
        // }
        //20201120 LJH OCSM_BP5-61 update  end
        if(!IsShowLU){
            if(!IsMain){
                isAgencyOrCenter = true;//办事处
                AgencyAddressName = '请将备品回寄至';
                AgencyAddressName += ApplyHeadShow.ToAgency__c == null ? '' : ApplyHeadShow.ToAgency__c;
                AgencyAddressName += '办事处';
                AgencyOrCenterAddress = AgencyAddressIdMap.get(ApplyHeadShow.Id);
            }else{
                isAgencyOrCenter = false;//备品中心
                AgencyOrCenterAddress = centerAddressInfo;
            }
        }else{
            isAgencyOrCenter = false;//备品中心
            AgencyOrCenterAddress = centerAddressInfo;
        }
        // 20220413 ljh  抬头显示 update end
        integer PageCut = 0;
        if (PageAllNum>=7) {
           PageAllNum=7;
        }
        Integer count = DetailsAllList.size() / MAXPAGECOUNT;
        if (Math.mod(DetailsAllList.size(), MAXPAGECOUNT) > 0) {
        count += 1;
        }
        for (Integer K = 0; K < count*MAXPAGECOUNT ; K++) {
            if (DetailsAllList.size()>k) {
               info.lineList.add(DetailsAllList[K]);
               PageCut = PageCut +DetailsAllList[K].LineHeight-1;
            } else {
               info.lineList.add(new lineInfo(new Rental_Apply_Equipment_Set_Detail__c(), false, null));
            }
            System.debug('info.lineList is' + info.lineList);
            if (records.size() < PageAllNum) {
               PageCut = PageCut+1;
            }
            system.debug('PageCut[K]' + PageCut);
            if (info.lineList.size() >= MAXPAGECOUNT) {
               records.add(info);
               system.debug('records内容::::::::'+records);
               info = new PDFInfo(new Rental_Apply__c(),New List<Rental_Apply_Equipment_Set_Detail__c>());
               List<String> G = new List<String>();
               G.add('ANY element');
               PageCutList.add(G);
               PageCut=0;
            }
        }
       // for (Integer K = 0; K < PageAllNum*MAXPAGECOUNT ; K++) {
       //     if (DetailsAllList.size()>k) {
       //         info.lineList.add(DetailsAllList[K]);
       //         PageCut = PageCut +DetailsAllList[K].LineHeight-1;
       //     } else {
       //         info.lineList.add(new lineInfo(new Rental_Apply_Equipment_Set_Detail__c(), false, null));
       //     }
       //     System.debug('info.lineList is' + info.lineList);
       //     if (records.size() < PageAllNum) {
       //         PageCut = PageCut+1;
       //     }
       //     system.debug('PageCut[K]' + PageCut);
       //     if (PageCut >= MAXPAGECOUNT) {
       //         records.add(info);
       //         system.debug('records内容::::::::'+records);
       //         info = new PDFInfo(new Rental_Apply__c(),New List<Rental_Apply_Equipment_Set_Detail__c>());
       //         List<String> G = new List<String>();
       //         G.add('ANY element');
       //         PageCutList.add(G);
       //         PageCut=0;
       //     }
       // }
  //      system.debug('records内容'+records);
        pageCnt = records.size();
        AllSum = DetailsAllList.size();
  //      //pageNum
        recordsIMGfist = new List<PDFInfoIMG>();
        for (integer J = pageNum * 10; J<pageNum * 10 +10; J++) {
            if (J < recordsIMG.size()) {
               recordsIMGfist.add(recordsIMG.get(J));
            }
        }
        pageCntIMG = recordsIMGfist.size();
    }
    // Data Bean
    class PDFInfo {
        public String eSetName { get; private set; } //备品中心管理单号
        // 20220413 ljh  抬头显示 update start
        // public String AgencyAddressName { get; private set; } //回寄地址 20201123 LJH OCSM_BP5-61 add
        // public Boolean isAgencyOrCenter { get; private set; } //备品中心?办事处 20201123 LJH OCSM_BP5-61 add
        // public String AgencyOrCenterAddress { get; private set; }//20201124 LJH OCSM_BP5-61 add
        // 20220413 ljh  抬头显示 update end
        public String requestOwner { get; private set; } //申请人
        public String salesDept { get; private set; } //所属本部
        public String workPlace { get; private set; } //所属办事处
        public String acc { get; private set; } //借用单位
        public String shippingDay { get; private set; } //希望到货日
        public String receivedStaff { get; private set; } //收件人
        public String receivedStaffPhone { get; private set; } //收件人电话
        public String shippmentAdress { get; private set; } //发送地址
        public String HospitalEndDate { get; private set; } //在医院使用期限
        public String LoanerCode {get;private set;} //備品型番
        public List<lineInfo> lineList { get; private set; }
        public String AssetModelNo {get;private set;} //OCM内部产品型号(略称)
        public PDFInfo(Rental_Apply__c raes, List<Rental_Apply_Equipment_Set_Detail__c> raesdList) {
            eSetName = raes.Name;
            requestOwner = raes.Person_In_Charge__c;
            salesDept = raes.Salesdept__c;
            workPlace = raes.WorkPlace__c;
            acc = raes.Account__c == null && raes.Campaign__c != null ? raes.Campaign__c : raes.Account__c;
            shippingDay = raes.Request_shipping_day__c == null ? '' : raes.Request_shipping_day__c.format();
            receivedStaff = raes.Loaner_received_staff__c;
            receivedStaffPhone = raes.Loaner_received_staff_phone__c;
            shippmentAdress = raes.Shippment_adress_detail__c == null ? raes.direct_shippment_address__c : raes.Shippment_adress_detail__c;
            if (raesdList == null) {
                raesdList = new List<Rental_Apply_Equipment_Set_Detail__c>();
            }
            lineList = new List<lineInfo>();
        }
    }
    class lineInfo {
        //bp2
        public String index { get; private set; }  //  序号
        public String setName { get; private set; }  //  备品set型号
        public String dModelNo { get; private set; }  //  备品配套明细型号
        public String dChinaName { get; private set; }  //  中文名称
        public String dSerialNumber { get; private set; }  //  机身号
        public String dLoaner_asset_no { get; private set; }  //  固定资产号码
        public String dManagementnumber { get; private set; }  //  管理号码
        public String dQRCode { get; private set; }  //  二维码
        private Integer maxLineContact;
        public String wh_location { get; private set; }  //  货位号
        public String name1 { get; private set; }
        public String productName1 { get; private set; }
        public String serialNumber1 { get; private set; }
        public String name2 { get; private set; }
        public String productName2 { get; private set; }
        public String serialNumber2 { get; private set; }
        public String LoanerCode {get;private set;} //備品型番
        public String AssetModelNo {get;private set;} //OCM内部产品型号(略称)
        public List<String> AssetModelNoList {get;private set;}//OCM内部产品型号(略称) 集合
        public integer LineHeight {get;private set;} //记录行高
        public integer height {get;private set;}
        // public lineInfo(Equipment_Set_Detail__c esd1, Equipment_Set_Detail__c esd2) {
        //    AssetModelNoList = new List<String>();
        //    name1 = esd1.Equipment_Set__r.Name == null ? ' ' : esd1.Equipment_Set__r.Name;
        //    productName1 = esd1.Asset__r.Name;
        //    serialNumber1 = esd1.SerialNumber__c;
        //    name2 = esd2.Name == null ? ' ' : esd2.Name;
        //    productName2 = esd2.Asset__r.Name;
        //    serialNumber2 = esd2.SerialNumber__c;
        //    height = height ==null ? 25: height;
        //    LoanerCode = esd1.Equipment_Set__r.Loaner_code__c;
        // }
// MAXINDEXCOUNT = 26;
// MAXDCHINNAMECOUNT = 2
// MAXDMODELNOCOUNT = 26
// MAXDSERIALNUMBERCOUNT
// MAXDLANCOUNT = 26;
// MAXDMMCOUNT = 26;
        public lineInfo(Rental_Apply_Equipment_Set_Detail__c raesd, boolean LotFlag, Integer inde) {
           AssetModelNoList = new List<String>();
            //bp2
            maxLineContact = 0;
            index = inde == null ? '' : String.valueOf(inde + 1);
            dChinaName = raesd.Fixture_Name_text__c;
            // dChinaName = '457100: 孔口探头,COTTLE型,带工业金刚石,20.5 cm(工业金刚石研磨表面取代了传统的钢纹,这使得操作省力,更简易,同时获得了更高的精确度。它能以极高的精准度切割或研磨较大骨组织)。';
            // dChinaName = '孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口探头孔口';
            dModelNo = raesd.Fixture_Model_No_text__c;
            dSerialNumber = raesd.SerialNumber_text__c;
            // dLoaner_asset_no = raesd.Loaner_asset_no__c;
            // OLY_OCM-321 发货确认单:固定资产号字段修改显示为固定资产编号(Key) _c__c?
            dLoaner_asset_no = raesd.Internal_Asset_number_c__c;
            dManagementnumber = raesd.EquipmentSet_Managment_Code_formula__c == null ? ' ' : raesd.EquipmentSet_Managment_Code_formula__c;
           name1 = raesd.Equipment_SetD_Borrowed__c == null ? ' ' : raesd.Equipment_SetD_Borrowed__c;
           productName1 = raesd.Asset__r.Name;
           setName = raesd.Rental_Apply_Equipment_Set__r.Fixture_Set__r.Name;
           if(LotFlag){
               serialNumber1 = ' ';
               LoanerCode = ' ';
           }else{
               // serialNumber1 = raesd.Rental_Apply_Equipment_Set__r.SerialNumber_text__c;
               LoanerCode = raesd.Rental_Apply_Equipment_Set__r.Loaner_code_text__c;
           }
           //name2 = esd2.Name == null ? ' ' : esd2.Name;
           //productName2 = esd2.Asset__r.Name;
           //serialNumber2 = esd2.SerialNumber__c;
           height = height ==null ? MAXLINEHRIGHT: height;
           wh_location = raesd.Asset__r.WH_location__c;
        }
    }
    // Data Bean
    class PDFInfoIMG {
        public String eSetName { get; private set; }
        // public Equipment_Set__c es { get; private set; }
        public Fixture_Set__c es { get; private set; }
        public Rental_Apply_Equipment_Set__c raesc { get; private set; }
        public List<lineInfoIMG> lineList { get; private set; }
        public List<lineInfoIMGrase> lineListIMG { get; private set; }
        //public PDFInfoIMG(Rental_Apply_Equipment_Set__c raes, List<Equipment_Set_Detail__c> esdl) {
        //    eSetName = raes.Equipment_Set__r.Name;
        //    es = raes.Equipment_Set__r;
        //    raesc = raes;
        //    if (esdl == null) {
        //        esdl = new List<Equipment_Set_Detail__c>();
        //    }
        //    lineList = new List<lineInfoIMG>();
        //    if (esdl.Size() >= 20) {
        //        for (Integer i = 0; i < 5; i++) {
        //            lineList.add(new lineInfoIMG(esdl[i*4],esdl[i*4+1],esdl[i*4+2],esdl[i*4+3]));
        //        }
        //    } else {
        //        Integer size = esdl.Size();
        //        for (Integer i = 0; i < 20 - size; i++) {
        //            esdl.add(new Equipment_Set_Detail__c(Name=' '));
        //        }
        //        for (Integer i = 0; i < 5; i++) {
        //            lineList.add(new lineInfoIMG(esdl[i*4],esdl[i*4+1],esdl[i*4+2],esdl[i*4+3]));
        //        }
        //    }
        // }
        public PDFInfoIMG(Rental_Apply_Equipment_Set__c raes, List<Rental_Apply_Equipment_Set_Detail__c> raesdcl) {
           eSetName = raes.Fixture_Set__r.Name;
           es = raes.Fixture_Set__r;
           if (raesdcl == null) {
               raesdcl = new List<Rental_Apply_Equipment_Set_Detail__c>();
           }
           lineListIMG = new List<lineInfoIMGrase>();
           if (raesdcl.Size() >= 20) {
               for (Integer i = 0; i < 5; i++) {
                   lineListIMG.add(new lineInfoIMGrase(raesdcl[i*4],raesdcl[i*4+1],raesdcl[i*4+2],raesdcl[i*4+3]));
               }
           } else {
               Integer size = raesdcl.Size();
               for (Integer i = 0; i < 20 - size; i++) {
                   raesdcl.add(new Rental_Apply_Equipment_Set_Detail__c());
               }
               for (Integer i = 0; i < 5; i++) {
                   lineListIMG.add(new lineInfoIMGrase(raesdcl[i*4],raesdcl[i*4+1],raesdcl[i*4+2],raesdcl[i*4+3]));
               }
           }
        }
    }
    class lineInfoIMG {
        //public List<esdInfo> esdl { get; private set; }
        //public lineInfoIMG(Equipment_Set_Detail__c e1, Equipment_Set_Detail__c e2, Equipment_Set_Detail__c e3, Equipment_Set_Detail__c e4) {
        //    esdl = new List<esdInfo>();
        //    esdl.add(new esdInfo(e1));
        //    esdl.add(new esdInfo(e2));
        //    esdl.add(new esdInfo(e3));
        //    esdl.add(new esdInfo(e4));
        //    //esdl.add(e5);
        //}
    }
    class lineInfoIMGrase {
        public List<esdInfo> esdl { get; private set; }
        public lineInfoIMGrase(Rental_Apply_Equipment_Set_Detail__c e1, Rental_Apply_Equipment_Set_Detail__c e2, Rental_Apply_Equipment_Set_Detail__c e3, Rental_Apply_Equipment_Set_Detail__c e4) {
           esdl = new List<esdInfo>();
           esdl.add(new esdInfo(e1));
           esdl.add(new esdInfo(e2));
           esdl.add(new esdInfo(e3));
           esdl.add(new esdInfo(e4));
           //esdl.add(e5);
        }
    }
    class esdInfo {
        // public Rental_Apply_Equipment_Set_Detail__c esd { get; private set; }
        public Rental_Apply_Equipment_Set_Detail__c raesl { get; private set; }
        public Integer nameLength { get; private set; }
        public String ProductName { get; private set; }
        public esdInfo(Rental_Apply_Equipment_Set_Detail__c e) {
            raesl = e;
            String name = e.ProductName__c;
            nameLength = name == null ? 0 : name.length();
            if(nameLength <= 21){
               //一行
               ProductName = name;
            }else if(nameLength > 21 && nameLength <= 74){
               //两行
               if(nameLength <= 42){
                   //7px
                   //for(Integer i = 0; i < 2 ; i++){
                       ProductName = name.substring(0,21)+'<br/>'+name.substring(21,nameLength);
                   //}
               }else{
                   //4px
                   //for(Integer i = 0; i < 2 ; i++){
                       ProductName = name.substring(0,37)+'<br/>'+name.substring(37,nameLength);
                   //}
               }
            }else{
               //三行
               //for(Integer i = 0; i < 3 ; i++){
                       ProductName = name.substring(0,37)+'<br/>' + name.substring(37,74)+'<br/>'+name.substring(74,nameLength);
               //}
            }
        }
    }
}
force-app/main/default/classes/FixtureSetDetailHandler.cls
@@ -19,8 +19,37 @@
    }
    private void beforeSetValue() {
        Map<String,Fixture_Set_Detail__c> fsdMap = new Map<String,Fixture_Set_Detail__c>();
        for (Fixture_Set_Detail__c nObj : newList) {
            nObj.Name_CHN_Created__c = nObj.Name_CHN__c;
            // 20230727 ljh 备品类型I和备品类型II放到保有设备上显示 start
            if(nObj.Loaner_category__c){
                fsdMap.put(nObj.Fixture_Model_No_F__c,nObj);
            }
        }
        // 20230727 ljh 备品类型I和备品类型II放到保有设备上显示 start
        if(fsdMap.size() > 0){
            List<Product2>  Product2List = [SELECT Id,Fixture_Model_No_T__c,Loaner_categoryI__c,Loaner_categoryII__c
                                                 FROM Product2
                                                WHERE Fixture_Model_No_T__c IN :fsdMap.keySet()];
            if(Product2List.size() > 0){
                Map<String,Product2> updateMap = new Map<String,Product2>();
                for(Product2 pro:Product2List){
                    Product2 p2 = new Product2();
                    p2.Id = pro.Id;
                    p2.Loaner_categoryI__c = fsdMap.get(pro.Fixture_Model_No_T__c).Loaner_categoryI__c;
                    p2.Loaner_categoryII__c =fsdMap.get(pro.Fixture_Model_No_T__c).Loaner_categoryII__c;
                    if(((String.isNotBlank(p2.Loaner_categoryI__c) && p2.Loaner_categoryI__c.equals(pro.Loaner_categoryI__c)) || (String.isBlank(p2.Loaner_categoryI__c)&&String.isBlank(pro.Loaner_categoryI__c)))
                        && ((String.isNotBlank(p2.Loaner_categoryII__c) && p2.Loaner_categoryII__c.equals(pro.Loaner_categoryII__c)) || (String.isBlank(p2.Loaner_categoryII__c)&&String.isBlank(pro.Loaner_categoryII__c)))){
                        continue;
                    }
                    updateMap.put(pro.Id,p2);
                }
                if(updateMap.size() > 0){
                    update updateMap.values();
                }
            }
        }
        // 20230727 ljh 备品类型I和备品类型II放到保有设备上显示 start
    }
}
force-app/main/default/classes/FixtureSetDetailHandler.cls.bak
New file
@@ -0,0 +1,26 @@
public without sharing class FixtureSetDetailHandler extends Oly_TriggerHandler {
    private Map<Id, Fixture_Set_Detail__c> newMap;
    private Map<Id, Fixture_Set_Detail__c> oldMap;
    private List<Fixture_Set_Detail__c> newList;
    private List<Fixture_Set_Detail__c> oldList;
    public FixtureSetDetailHandler() {
        this.newMap = (Map<Id, Fixture_Set_Detail__c>) Trigger.newMap;
        this.oldMap = (Map<Id, Fixture_Set_Detail__c>) Trigger.oldMap;
        this.newList = (List<Fixture_Set_Detail__c>) Trigger.new;
        this.oldList = (List<Fixture_Set_Detail__c>) Trigger.old;
    }
    protected override void beforeInsert() {
        beforeSetValue();
    }
    protected override void beforeUpdate() {
        beforeSetValue();
    }
    private void beforeSetValue() {
        for (Fixture_Set_Detail__c nObj : newList) {
            nObj.Name_CHN_Created__c = nObj.Name_CHN__c;
        }
    }
}
force-app/main/default/classes/FixtureSetHandler.cls
@@ -1,3 +1,4 @@
// FixtureSetHandlerTest
public without sharing class FixtureSetHandler extends Oly_TriggerHandler {
    private Map<Id, Fixture_Set__c> newMap;
    private Map<Id, Fixture_Set__c> oldMap;
@@ -16,6 +17,7 @@
    }
    protected override void beforeUpdate() {
        beforeSetValue();
        upToAsset();// 20230719 ljh DB202306212211 p9
    }
    private void beforeSetValue() {
@@ -23,4 +25,59 @@
            nObj.Loaner_code__c = nObj.Name;
        }
    }
    /**
     * @Author: [lijinhuan]
     * @description: 备品类型I和备品类型II放到保有设备上显示
     * @return {*}
     */
    private void upToAsset() {
        Map<String,Fixture_Set__c> fsMap= new Map<String,Fixture_Set__c>();
        // Set<String> ModelNoSet = new  Set<String>();
        for (Fixture_Set__c nObj : newList) {
            Fixture_Set__c oObj;
            if (Trigger.isUpdate) {
                oObj = oldMap.get(nObj.Id);
            }
            // 发生改变
            if( (String.isNotBlank(nObj.Loaner_categoryI__c) && nObj.Loaner_categoryI__c != oObj.Loaner_categoryI__c)
                || (String.isBlank(nObj.Loaner_categoryI__c) && String.isNotBlank(oObj.Loaner_categoryI__c))
                || (String.isNotBlank(nObj.Loaner_categoryII__c) && nObj.Loaner_categoryII__c != oObj.Loaner_categoryII__c)
                || (String.isBlank(nObj.Loaner_categoryII__c) && String.isNotBlank(oObj.Loaner_categoryII__c))
            ){
                if(String.isNotBlank(nObj.Fixture_Set_Body_Model_No__c)){
                    String model = nObj.Fixture_Set_Body_Model_No__c.toUpperCase();
                    fsMap.Put(model,nObj);
                }
            }
            // if(Trigger.isDelete && String.isNotBlank(oObj.Fixture_Set_Body_Model_No__c ) && (String.isNotBlank(oObj.Loaner_categoryI__c)||String.isNotBlank(oObj.Loaner_categoryII__c))){
            //     ModelNoSet.add(oObj.Fixture_Set_Body_Model_No__c);
            // }
        }
        // if(fsMap.size() > 0 || ModelNoSet.size() > 0){
        if(fsMap.size() > 0){
            // 查询这个配套的产品,赋值给产品
            List<Product2>  Product2List = [SELECT Id,Fixture_Model_No_T__c,Loaner_categoryI__c,Loaner_categoryII__c
                                                 FROM Product2
                                                // WHERE Fixture_Model_No_T__c IN :fsMap.keySet() OR Fixture_Model_No_T__c IN :ModelNoSet ];
                                                WHERE Fixture_Model_No_T__c IN :fsMap.keySet() ];
            if(Product2List.size() > 0){
                Map<String,Product2> updateMap = new Map<String,Product2>();
                for(Product2 pro:Product2List){
                    Product2 p2 = new Product2();
                    p2.Id = pro.Id;
                    p2.Loaner_categoryI__c = fsMap.get(pro.Fixture_Model_No_T__c.toUpperCase()).Loaner_categoryI__c;
                    p2.Loaner_categoryII__c = fsMap.get(pro.Fixture_Model_No_T__c.toUpperCase()).Loaner_categoryII__c;
                    if(((String.isNotBlank(p2.Loaner_categoryI__c) && p2.Loaner_categoryI__c.equals(pro.Loaner_categoryI__c)) || (String.isBlank(p2.Loaner_categoryI__c)&&String.isBlank(pro.Loaner_categoryI__c)))
                        && ((String.isNotBlank(p2.Loaner_categoryII__c) && p2.Loaner_categoryII__c.equals(pro.Loaner_categoryII__c)) || (String.isBlank(p2.Loaner_categoryII__c)&&String.isBlank(pro.Loaner_categoryII__c)))){
                        continue;
                    }
                    updateMap.put(pro.Id,p2);
                }
                if(updateMap.size() > 0){
                    update updateMap.values();
                }
            }
        }
    }
}
force-app/main/default/classes/FixtureSetHandler.cls.bak
New file
@@ -0,0 +1,26 @@
public without sharing class FixtureSetHandler extends Oly_TriggerHandler {
    private Map<Id, Fixture_Set__c> newMap;
    private Map<Id, Fixture_Set__c> oldMap;
    private List<Fixture_Set__c> newList;
    private List<Fixture_Set__c> oldList;
    public FixtureSetHandler() {
        this.newMap = (Map<Id, Fixture_Set__c>) Trigger.newMap;
        this.oldMap = (Map<Id, Fixture_Set__c>) Trigger.oldMap;
        this.newList = (List<Fixture_Set__c>) Trigger.new;
        this.oldList = (List<Fixture_Set__c>) Trigger.old;
    }
    protected override void beforeInsert() {
        beforeSetValue();
    }
    protected override void beforeUpdate() {
        beforeSetValue();
    }
    private void beforeSetValue() {
        for (Fixture_Set__c nObj : newList) {
            nObj.Loaner_code__c = nObj.Name;
        }
    }
}
force-app/main/default/classes/MainFixtureSelectController.cls
@@ -141,7 +141,7 @@
    public Set<String> benbuSet;
    public Set<String> cunfangdiSet;
    public static String wrapperStr{set;get;}
    public String QueueNumber { set; get; }  //排队
    public MainFixtureSelectController() {
        //isNeedCheckEvent = true;
@@ -205,7 +205,10 @@
                    parentObj = parentObjs.get(0);
                    // 已排队的情况下,初始化时加载排队画面
                    if (sonObj.ExternalKey__c != null) {
                    // 20230610 ljh 判断页面显示 start
                    QueueNumber = String.valueOf(sonObj.Queue_Number__c);
                    // if (sonObj.ExternalKey__c != null) {
                    if (String.isNotBlank(QueueNumber)) {
                        // QueuePageByAssetId的URL, 加载排队画面用
                        queueByAsset = '/apex/QueuePageByAssetId?parentId=' + parentObj.Id + '&isNotShow=' + true;
                    }
@@ -1378,9 +1381,11 @@
                        viewList[viewList.size() - 1].canEdit = false;
                    }
                    groupByTargetList.add(rsdObj);
                    // QueuePageByAssetId的URL, 加载排队画面用
                    queueByAsset = '/apex/QueuePageByAssetId?parentId=' + rsdObj.Rental_Apply_Equipment_Set__c + '&isNotShow=' + true;
                    // 20230610 ljh 判断页面显示
                    if (String.isNotBlank(QueueNumber)) {
                        queueByAsset = '/apex/QueuePageByAssetId?parentId=' + rsdObj.Rental_Apply_Equipment_Set__c + '&isNotShow=' + true;
                    }
                    assetId  = rsdObj.Asset__c;
                    rentalId = rsdObj.Rental_Apply_Equipment_Set__c;
                    modelNo  = rsdObj.Fixture_Model_No_text__c;
force-app/main/default/classes/MainFixtureSelectController.cls.bak
New file
@@ -0,0 +1,2259 @@
/**
 * 主体备品选择の設定
 * TestClass
 * MainFixtureSelectControllerTest
 * RentalFixtureManage1Test
 * RentalFixtureManage4Test
 */
global without sharing class MainFixtureSelectController extends CreateRelationListPagingCtrlBase {
    public override Integer getSearchNumMax() {
        //各ページに制御あれば、最大件数を指定する
        // searchNumMax = Integer.valueOf(Label.Product_Select_Limit);
        // searchNumMax = 20;
        pagesize = '20';
        return searchNumMax;
    }
    /* 選択されたデータ取得用Soql Fromから*/
    public override String getSelectedDataSql() {
        // オブジェクトAPI名
        selectedDataSql = ' From Rental_Apply_Equipment_Set_Detail__c';
        selectedDataSql += ' where Rental_Apply_Equipment_Set__c = \'' + String.escapeSingleQuotes(parentId) + '\'';
        selectedDataSql += '   and Is_Body__c = true';
        selectedDataSql += '   and Cancel_Select__c = false';
        selectedDataSql += '   and ApplyPersonAppended_F__c = false';
        selectedDataSql += ' order by Equipment_Type__c DESC  nulls last, FSD_Fixture_Model_No__c ASC nulls last';
        return selectedDataSql;
    }
    public override String getOriginObjName() {
        // オブジェクトAPI名
        originObjName = 'Asset';
        return originObjName;
    }
    public override String getOriginObjColumns() {
        // 項目セット
        originObjColumns = 'Id, Last_Reserve_RAES_Detail__c, Last_Reserve_RAES_Detail__r.Rental_Apply_Equipment_Set__c';
        return originObjColumns;
    }
    public override String getObjName() {
        // オブジェクトAPI名
        objName = 'Rental_Apply_Equipment_Set_Detail__c';
        return objName;
    }
    public override String getColumnLeftFieldSetName() {
        // 左の項目セット
        columnLeftFieldSetName = 'MainFixtureSelect_LeftFieldSet';
        return columnLeftFieldSetName;
    }
    public override String getColumnRightFieldSetName() {
        // 右の項目セット
        columnRightFieldSetName = 'MainFixtureSelect_RightFieldSet';
        return columnRightFieldSetName;
    }
    public override List<String> getColumnFieldList() {
        // strColumus 里加 field
        // FixtureUtil#raesdGroupByAssetId()の項目も必要
        return new List<String>{'Id', 'Rental_Apply_Equipment_Set__c', 'FSD_Id__c', 'Select_Time__c', 'Rental_Apply_Equipment_Set__r.Final_reply_day_text__c',
                'IndexFromUniqueKey__c', 'Queue_Number__c', 'SalesProvince__c', 'Fixture_Model_No_text__c', 'DeliverySlip__c', 'StockDown__c', 'Fixture_Model_No_F__c',
                'Rental_Apply__r.Internal_asset_location_F__c', 'Rental_Apply__r.Salesdept__c', 'Rental_Apply__r.Equipment_Type_F__c', 'Rental_Apply__r.Salesdepartment__c',
                'RAESD_Status__c', 'FSD_Fixture_Model_No__c', 'Is_Body_F__c', 'FSD_OneToOneAccessory_Cnt__c', 'Internal_asset_location__c',
                'Asset__r.Last_Reserve_RAES_Detail__r.Rental_Apply_Equipment_Set__c', 'Asset__r.Last_Reserve_RAES_Detail__r.Select_Time__c',
                'Asset__r.Fixture_Status__c', 'Asset__r.Last_Reserve_RAES_Detail__c', 'Asset__r.Main_OneToOne__c', 'Asset__r.You_Xiao_Ku_Cun__c',
                'Rental_Apply__r.demo_purpose2__c','Rental_Apply__r.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c',
                'Rental_Apply__r.next_action__c','Rental_Apply__r.QIS_number__r.ReplaceDeliveryDate__c', 'ExternalKey__c'
        };
    }
    public override String getFKColumnField() {
        // getObjName 连 getOriginObjName 的 FK
        return 'Asset__c';
    }
    public override String getRecordTypeId() {
        //ページレイアウトを収得するのレコードタイプ
        recordTypeId = '';
        return recordTypeId;
    }
    // ページコントローラに検索処理は、WhereSoql作成のみ、パラメータとして、コンポーネントに渡される
    public override String getSqlWhereStr() {
        sqlWhereStr = '';
        if (getIsNeedRunSearch()) {
            sqlWhereStr = this.makeSoql(keywdSort);
        }
        return sqlWhereStr;
    }
    public override String getOrderbyStr() {
        String ordStr = '';
        if (isFirstTime) {
            ordStr = ', Equipment_Type__c DESC  nulls last';
            isFirstTime = false;
        }
        return 'order by Ji_Zhong_Guan_Li_Ku_Cun__c DESC, Pre_Arrival_wh_time__c ASC NULLS FIRST, Last_Reserve_RAES_Detail__r.Asset_return_Day__c ASC' + ordStr;
    }
    public override Boolean getIsNeedRunSearch() {
        return true;
    }
    // ClickEvent用URL
    public String queueByAsset {
        get {
            return queueByAsset;
        }
        set;
    }
    /*****************検索用******************/
    /*****************ソート時再検索条件(画面からの入力条件を無視するため)******************/
    private String keywdSort = null;
    public String keyword { get; set; }
    public String assetId { get; set; }
    public String rentalId { get; set; }
    public String raesdId { get; set; }
    public String modelNo { get; set; }
    public String saveType { get; set; }
    public Rental_Apply_Equipment_Set__c parentObj { get; private set; }
    public Rental_Apply_Equipment_Set_Detail__c sonObj { get; set; }
    public Boolean bieField { get; set; }   //别省、别本部、别存放地、别用途
    public String bieCunFangDi { get; set; }     //别存放地
    public String bieBenBu { get; set; }         //别本部
    public String bieChanPinFenLei { get; set; } //产品分类 Test用
    public String campaignType { get; set; } //学会类型
    public String bieBeiPinFenLei { get; set; }  //别备品分类
    public Boolean changeCampaignType { set; get; }  //学会类型改变Flag
    //public List<String> bieBeiPinFenLeiList { get; set; }  //别备品分类
    public Boolean isFirstTime = true;
    public Boolean is2B1 = true;
    public String pCunFangDi;
    public Set<String> benbuSet;
    public Set<String> cunfangdiSet;
    public static String wrapperStr{set;get;}
    public MainFixtureSelectController() {
        //isNeedCheckEvent = true;
        parentId = ApexPages.currentPage().getParameters().get('pt_recid');
        //bieBeiPinFenLeiList = new List<String>();
        is2B1 = UserInfo.getProfileId() == System.Label.ProfileId_EquipmentCenter;
        benbuSet = new Set<String>();
        cunfangdiSet = new Set<String>();
        this.bieField = true;
        changeCampaignType = false;
        //借出备品一览の情報を取得
        if (!String.isBlank(this.parentId)) {
            List<Rental_Apply_Equipment_Set_Detail__c> raesdObjs = [
                    SELECT Id, Rental_Apply_Equipment_Set__c, Asset__c, Queue_Day__c,
                           FSD_Fixture_Model_No__c, Fixture_Model_No_text__c, QuenType__c,
                           Is_Body__c, FSD_Is_OneToOne__c, Select_Time__c, ExternalKey__c,Rental_Apply__c,
                           Cancel_Select__c, Fixture_Model_No_F__c, Queue_Number__c, Internal_asset_location__c,
                           Salesdepartment__c, Product_category_F__c, Equipment_Type__c, Rental_Apply__r.Internal_asset_location_F__c,
                           Cancel_Reason__c,Loaner_cancel_reason__c,Loaner_cancel_Remarks__c,
                           Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c,
                           Salesdepartment_before__c, Equipment_Type_text__c, Product_category_text__c
                     FROM Rental_Apply_Equipment_Set_Detail__c
                    WHERE Rental_Apply_Equipment_Set__c = :parentId
                      and Is_Body__c = true
                      and Cancel_Select__c = false];
            if (!raesdObjs.isEmpty()) {
                sonObj = raesdObjs[0];
                List<Rental_Apply_Equipment_Set__c> parentObjs = [
                        SELECT Id, Rental_Apply__r.Name,
                               Rental_Apply__r.Owner.Name,
                               Rental_Apply__r.Owner.Profile.Name,
                               Rental_Apply__r.Salesdept__c,
                               Rental_Apply__r.WorkPlace__c,
                               Rental_Apply__r.Request_shipping_day__c,
                               Fu_Shu_Pin_Fen_Pei_Jia__c,
                               Rental_Apply__r.Demo_purpose1__c,
                               Rental_Apply__r.demo_purpose2__c,
                               Rental_Apply__r.CampaignType__c,
                               Fixture_Set__r.Product_Category_GI_SP__c,
                               Fixture_Set__r.Equipment_Type__c,
                               Rental_Apply__r.Request_return_day__c,
                               Rental_Apply__r.Salesdepartment__c,
                               Rental_Apply__r.Equipment_Type_F__c,
                               Rental_Apply__r.Internal_asset_location_F__c,
                               Fixture_Set__r.Fixture_Set_Body_Model_No__c,
                               Rental_Apply__r.Product_category__c,
                               Rental_Apply__r.Loaner_centre_mail_address__c,
                               First_RAESD__r.Is_Body__c,
                               Irreplaceable_flag__c,
                               Rental_Start_Date__c,
                               Rental_End_Date__c,
                               Rental_Apply__c,
                               Fixture_Set__c,
                               RequestNoJoinStr2__c
                        FROM Rental_Apply_Equipment_Set__c
                        where Id = :parentId];
                if (!parentObjs.isEmpty()) {
                    parentObj = parentObjs.get(0);
                    // 已排队的情况下,初始化时加载排队画面
                    if (sonObj.ExternalKey__c != null) {
                        // QueuePageByAssetId的URL, 加载排队画面用
                        queueByAsset = '/apex/QueuePageByAssetId?parentId=' + parentObj.Id + '&isNotShow=' + true;
                    }
                    bieCunFangDi = parentObj.Rental_Apply__r.Internal_asset_location_F__c;
                    pCunFangDi = bieCunFangDi;
                    // 本部初始值
                    bieBenBu = parentObj.Rental_Apply__r.Salesdepartment__c;
                    /*if (String.isNotBlank(sonObj.QuenType__c) && String.isNotBlank(sonObj.Salesdepartment_before__c)) {
                        bieBenBu = sonObj.Salesdepartment_before__c;
                    } else {
                        bieBenBu = parentObj.Rental_Apply__r.Salesdepartment__c;
                    }*/
                    // 备品分类初始值
                    bieBeiPinFenLei = parentObj.Rental_Apply__r.Equipment_Type_F__c;
                    /*if (String.isNotBlank(sonObj.QuenType__c) && String.isNotBlank(sonObj.Equipment_Type_text__c)) {
                        bieBeiPinFenLei = sonObj.Equipment_Type_text__c;
                    } else {
                        bieBeiPinFenLei = parentObj.Rental_Apply__r.Equipment_Type_F__c;
                    }*/
                    // 产品分类初始值
                    bieChanPinFenLei = parentObj.Rental_Apply__r.Product_category__c;
                    /*if (String.isNotBlank(sonObj.QuenType__c) && String.isNotBlank(sonObj.Product_category_text__c)) {
                        if (sonObj.Product_category_text__c == 'GI,SP') {
                            bieChanPinFenLei = '';
                        } else {
                            bieChanPinFenLei = sonObj.Product_category_text__c;
                        }
                    } else {
                        bieChanPinFenLei = parentObj.Rental_Apply__r.Product_category__c;
                    }*/
                    // bieBeiPinFenLeiList = FixtureUtil.setAssetRAESEquipment_Type(parentObj.Rental_Apply__r.demo_purpose2__c);
                    //if (bieBeiPinFenLeiList.size() == 0 && String.isNotBlank(parentObj.Rental_Apply__r.Equipment_Type_F__c)) {
                    //    for (String et : parentObj.Rental_Apply__r.Equipment_Type_F__c.split(',')) {
                    //        bieBeiPinFenLeiList.add(et);
                    //    }
                    //}
                    // benbuList = FixtureUtil.setAssetRAESSalesdepartment(parentObj.Rental_Apply__r.demo_purpose2__c);
                    // fenleiList = FixtureUtil.setAssetRAESEquipment_Type(parentObj.Rental_Apply__r.demo_purpose2__c);
                    // System.debug(fenleiList);
                    campaignType = parentObj.Rental_Apply__r.CampaignType__c;
                }
                if (String.isBlank(bieCunFangDi)) {
                    throw new ControllerUtil.myException('不能明确存放地, 请确认数据。');
                }
            } else {
                throw new ControllerUtil.myException('没有可以操作的主体备品或者主体数据不正确。');
            }
        } else {
            // OLY_OCM-721 Bug fix 选择配套时报错: null point
            // 追加parentId是否为空的检查,如果URL参数的parentId为空就报错: 参数错误:请指定Id。。
            throw new ControllerUtil.myException('参数错误:请指定Id。');
        }
    }
    public void init() {
        isNeedSearchFirst = true;
        //isNeedCheckEvent = true;
        searchOppSetParam();
        getSqlWhereStr();
    }
    //别存放地 SelectOption
    public List<SelectOption> getbieCunFangDiOps() {
        //备品存放地(现在)
        // return FixtureUtil.bieCunFangDiOpsMap.get(sonObj.Internal_asset_location__c);
        // return new List<SelectOption>{
        //     new SelectOption(sonObj.Rental_Apply__r.Internal_asset_location_F__c, sonObj.Rental_Apply__r.Internal_asset_location_F__c)
        // };
        cunfangdiSet = new Set<String>();
        List<SelectOption> opList;
        if (UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin
                || System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId())
                || is2B1) {
            opList = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心');
        } else {
            if (String.isBlank(bieCunFangDi)) {
                opList = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心');
            } else {
                opList = new List<SelectOption>{
                    new SelectOption(bieCunFangDi, bieCunFangDi)
                };
            }
        }
        for (SelectOption op : opList) {
            if (String.isNotBlank(op.getValue())) {
                cunfangdiSet.add(op.getValue());
            }
        }
        return opList;
    }
    //别本部 SelectOption
    public List<SelectOption> getbieBenBuOps() {
        //所在地区(本部) 现在
        // return FixtureUtil.bieBenBuOpsMap.get(sonObj.Salesdepartment__c);
        benbuSet = new Set<String>();
        List<SelectOption> opList;
        List<SelectOption> retList = new List<SelectOption>();
        if (String.isBlank(bieCunFangDi)) {
            opList = FixtureUtil.bieBenBuOpsMap.get('All');
        } else {
            opList = FixtureUtil.bieBenBuOpsMap.get(bieCunFangDi);
        }
        retList.add(new SelectOption('全部', '--全部--'));
        for (SelectOption op : opList) {
            if (String.isNotBlank(op.getValue())) {
                benbuSet.add(op.getValue());
                retList.add(new SelectOption(op.getValue(),op.getLabel()));
            }
        }
        return retList;
    }
    //产品分类 SelectOption
    public List<SelectOption> getbieChanPinFenLeiOps() {
        //产品分类(GI/SP) F Product_category_F__c
        // return FixtureUtil.bieChanPinFenLeiOpsMap.get(sonObj.Product_category_F__c);
        // return FixtureUtil.bieChanPinFenLeiOpsMap.get('GISP');
        List<SelectOption> pickListValuesList = FixtureUtil.bieChanPinFenLeiOpsMap.get('GISP');
        return pickListValuesList;
    }
    //别备品分类 SelectOption
    public List<SelectOption> getbieBeiPinFenLeiOps() {
        //备品分类(现在) Equipment_Type__c
        // return FixtureUtil.bieBeiPinFenLeiOpsMap.get(sonObj.Equipment_Type__c);
        return FixtureUtil.bieBeiPinFenLeiOpsMap.get('备品分类');
    }
    //学会类型 SelectOption
    public List<SelectOption> getcampaignTypeOps() {
        //学会类型 CampaignType__c
        return FixtureUtil.getPlickList('Rental_Apply__c', 'CampaignType__c');
    }
    private void searchOppSetParam() {
        keywdSort = keyword;
    }
    public PageReference searchOpp() {
        searchOppSetParam();
        if (!getIsNeedRunSearch()) {
            return null;
        }
        // 選択済みの製品を取得
        myComponentController.getSelectedDataInfo();
        getSqlWhereStr();
        // コンポーネントにSoqlを発行して、ページングする
        myComponentController.searchAndPaging();
        return null;
    }
    //获取当前时间 getCurrentTime
    public static Time getCurrentTime() {
        DateTime now = DateTime.now();
        System.debug('GMT: ' + now);
        Integer hours = now.hour();
        Integer minutes = now.minute();
        Integer seconds = now.second();
        Integer milliseconds = now.millisecond();
        System.debug('local time: ' + hours + ':' + minutes + ':' + seconds + ':' + milliseconds);
        Time currentTime = Time.newInstance(hours, minutes, seconds, milliseconds);
        return currentTime;
    }
    /*
     * MainFixture的排队  // TODO 4つの項目で1つのblockです
     * @param raseId Rental_Apply_Equipment_Set__cのId
     * @param astId AssetのId
     * @return map {code: message:}
     */
    @RemoteAction
    global static Map<String, String> queue(Id raseId, Id assetId) {
        // 返回对象
        Map<String, String> responseMap = new Map<String, String>();
        // 検索条件
        Date dateToday = Date.today();
        System.debug('测试queue的raseId:' + raseId);
        System.debug('测试queue的assetId:' + assetId);
        Savepoint sp = Database.setSavepoint();
        try {
            // 排队时不是以Asset.Id为检索基准的,是以当前选中这一条的四个别字段和同一产品型号为条件来操作的
            // 先检索当前选中这条数据的四个别字段和 F__c
            List<Asset> aSetSelect = [Select Id, Fixture_Model_No_F__c,
                    Salesdepartment__c, SalesProvince__c, Product_category__c, Equipment_Type__c, Internal_asset_location__c
                     From Asset
                    Where Id = :assetId
                      FOR Update];
            if (aSetSelect.size() == 0) {
                throw new ControllerUtil.myException('选择的数据有问题,请重试');
            }
            // 操作対象
            List<Rental_Apply_Equipment_Set_Detail__c> rasedList = [
                    SELECT Id, Asset__c, Fixture_Model_No_text__c,
                           Salesdepartment_before__c, Product_category_text__c, Equipment_Type_text__c,
                           Queue_Number__c,
                           Queue_Day__c,
                           Select_Time__c,
                           UniqueKey__c,
                           StockDown__c,
                           Internal_asset_location_before__c
                    FROM Rental_Apply_Equipment_Set_Detail__c
                    where Rental_Apply_Equipment_Set__c = :raseId
                      and Cancel_Select__c = false
                      and Is_Body__c = true
                      FOR Update];
            if (rasedList.size() == 0) {
                throw new ControllerUtil.myException('排队数据不存在');
            }
            Rental_Apply_Equipment_Set_Detail__c raesd = rasedList[0];
            // 下架后不能排队、入力規則 Cannot_Change_Asset にてチェック済み
            // 排队的数据, 不能再次排自己
            if(raesd.Fixture_Model_No_text__c == aSetSelect[0].Fixture_Model_No_F__c
                    && raesd.Salesdepartment_before__c == aSetSelect[0].Salesdepartment__c
                    && raesd.Product_category_text__c == aSetSelect[0].Product_category__c
                    && raesd.Equipment_Type_text__c == aSetSelect[0].Equipment_Type__c
                    && raesd.Internal_asset_location_before__c == aSetSelect[0].Internal_asset_location__c
                    // 排队中的明细才会报以下错误
                    && raesd.Queue_Number__c > 0
                    && raesd.Queue_Day__c != null) {
                throw new ControllerUtil.myException('已经排了这个型号,不需要排队');
            }
            Map<String, Rental_Apply_Equipment_Set_Detail__c> mfUpsert = new Map<String, Rental_Apply_Equipment_Set_Detail__c>();
            mfUpsert.put(raesd.UniqueKey__c, raesd);
            // 因为排过队的再次排队受到有效库存数影响所以需要清空
            // 排队したの場合、まず排队しないことに変更
            if (raesd.queue_Day__c != null) {
                raesd.Queue_User__c   = null;
                raesd.Queue_Number__c = null;
                raesd.Queue_Day__c    = null;
                raesd.Queue_Time__c   = null;
                raesd.Asset__c        = null;
            }
            // 分配したの場合、まず分配しないことに変更
            else if (raesd.Select_Time__c != null) {
                raesd.Select_Time__c  = null;
                raesd.Asset__c        = null;
                // 已出库指示的排队后清除出库指示信息
                raesd.Shipment_request_time2__c = null;
                raesd.Shipment_request__c = false;
            }
            if (!mfUpsert.isEmpty()) {
                Oly_TriggerHandler.bypass(AssetHandlerCheck.class.getName());
                FixtureUtil.withoutUpsertRaesd(mfUpsert.values());
                Oly_TriggerHandler.clearBypass(AssetHandlerCheck.class.getName());
            }
            // ここまで まだ コミットしていないっです。
            String soqlStr = 'Select Id, Last_Reserve_RAES_Detail__c, Fixture_Model_No_F__c, You_Xiao_Ku_Cun__c,'
                        + ' Salesdepartment__c, SalesProvince__c, Product_category__c, Equipment_Type__c, Internal_asset_location__c'
                         + ' From Asset '
                        + ' Where Asset_Owner__c = \'Olympus\''
                        + ' and Asset_loaner_category__c != \'耗材\''
                        + ' and RecordTypeId = \'01210000000kOPR\''
                        + ' and Delete_Flag__c = False'
                        + ' and Freeze_sign_Abandoned_Flag__c = False'
                        + ' and Product2.Fixture_Model_No_T__c = ' + FixtureUtil.getSoqlString(aSetSelect[0].Fixture_Model_No_F__c)
                        + ' and Salesdepartment__c = ' + FixtureUtil.getSoqlString(aSetSelect[0].Salesdepartment__c)
                        + ' and Internal_asset_location__c = ' + FixtureUtil.getSoqlString(aSetSelect[0].Internal_asset_location__c)
                        // + ' and SalesProvince__c = ' + FixtureUtil.getSoqlString(aSetSelect[0].SalesProvince__c)
                        + ' and Product_category__c = ' + FixtureUtil.getSoqlString(aSetSelect[0].Product_category__c)
                        + ' and Equipment_Type__c = ' + FixtureUtil.getSoqlString(aSetSelect[0].Equipment_Type__c)
                        + ' and ' + FixtureUtil.getAssetSoqlBase()
                        + ' order by Id';
            // 检索符合这四个别字段和同一产品型号的数据存在与否
            List<Asset> aSetCheck = Database.query(soqlStr);
            // List<Asset> aSetCheck = [Select Id, Last_Reserve_RAES_Detail__c, Fixture_Model_No_F__c, You_Xiao_Ku_Cun__c,
            //         Salesdepartment__c, SalesProvince__c, Product_category__c, Equipment_Type__c, Internal_asset_location__c
            //          From Asset
            //         Where Asset_Owner__c = 'Olympus'
            //           and Asset_loaner_category__c != '耗材'
            //           and RecordTypeId = '01210000000kOPR'
            //           and Delete_Flag__c = False
            //           and Freeze_sign_Abandoned_Flag__c = False
            //           and Product2.Fixture_Model_No_T__c = :aSetSelect[0].Fixture_Model_No_F__c
            //           and Salesdepartment__c = :aSetSelect[0].Salesdepartment__c
            //           and SalesProvince__c = :aSetSelect[0].SalesProvince__c
            //           and Product_category__c = :aSetSelect[0].Product_category__c
            //           and Equipment_Type__c = :aSetSelect[0].Equipment_Type__c
            //         order by Id];
            for (Asset ass : aSetCheck) {
                if (ass.Last_Reserve_RAES_Detail__c == null && ass.You_Xiao_Ku_Cun__c > 0) {
                    throw new ControllerUtil.myException('有可以分配主体不需要排队');
                }
            }
            // 不存在则画面提示错误信息
            if (aSetCheck.size() == 0) {
                throw new ControllerUtil.myException('排队选择主体数据不存在');
            }
            // 之前因为只是做Check,不是实际的排队操作,不rollback的话后面的排队数不对
            Database.rollback(sp);
            // OLY_OCM-1157 因为暂时直觉的保有设备的变量有影响,所以明细Handler先不清空(有影响的地方是明细和保有设备的Handler)
            AssetHandler.queueRaesdMap = null;
            // lock 符合条件的第一条Asset数据、进行排队。
            List<Asset> aSet = [Select Id, Name, Last_Reserve_RAES_Detail__c, Fixture_Model_No_F__c,
                    Salesdepartment__c, SalesProvince__c, Product_category__c, Equipment_Type__c,
                    Internal_asset_location__c, EquipmentSet_Managment_Code__c
                     From Asset
                    Where Id = :aSetCheck[0].Id
                    FOR Update];
            if (aSet.size() == 0) {
                throw new ControllerUtil.myException('数据正在被其他用户操作,请重试');
            }
            // 操作対象
            rasedList = [
                    SELECT Id, Asset__c, Fixture_Model_No_text__c,
                           Salesdepartment_before__c, Product_category_text__c, Equipment_Type_text__c,
                           Queue_Number__c,
                           Queue_Day__c,
                           Select_Time__c,
                           UniqueKey__c,
                           StockDown__c
                    FROM Rental_Apply_Equipment_Set_Detail__c
                    where Rental_Apply_Equipment_Set__c = :raseId
                      and Cancel_Select__c = false
                      and Is_Body__c = true
                      FOR Update];
            if (rasedList.size() == 0) {
                throw new ControllerUtil.myException('排队数据不存在');
            }
            raesd = rasedList[0];
            mfUpsert.put(raesd.UniqueKey__c, raesd);
            String modelNo = aSet[0].Fixture_Model_No_F__c;
            System.debug('queue aSet is:' + aSet);
            //借出备品配套一览明细 Rental_Apply_Equipment_Set_Detail__c  Asset__c
            //排队顺 Queue_Number__c
            //排队日 Queue_Day__c
            AggregateResult[] queueMaxNumbers = [
                    SELECT max(Queue_Number__c) maxr, min(Queue_Number__c) minr
                    FROM Rental_Apply_Equipment_Set_Detail__c
                    where Id != :raesd.Id
                    and Fixture_Model_No_text__c = :modelNo
                    and Select_Time__c = null
                    and Queue_Day__c != null
                    and Queue_Number__c != null
                    and Queue_Number__c > 0
                    and Salesdepartment_before__c = :aSet[0].Salesdepartment__c     // 所在地区(本部) 借出时
                    and Product_category_text__c  = :aSet[0].Product_category__c    // 产品分类(GI/SP)(借出时)
                    and Equipment_Type_text__c    = :aSet[0].Equipment_Type__c      // 备品分类(借出时)
                    and Internal_asset_location_before__c = :aSet[0].Internal_asset_location__c      // 备品存放地
            ];
            // 一览明细的Asset__c保留下来,后面的处理需要使用
            Id oldAssId = raesd.Asset__c;
            //暂定分配の場合排队中変更,Triggerで新しいの暂定分配を設定
            if (raesd.Queue_Number__c == 0 && raesd.Queue_Day__c != null) {
                raesd.Queue_User__c   = UserInfo.getUserId();
                raesd.Queue_Number__c = Integer.valueOf(queueMaxNumbers[0].get('minr'));
                raesd.Queue_Day__c    = Date.today();
                raesd.Queue_Time__c   = getCurrentTime();
                raesd.Select_Time__c  = null;
                raesd.Asset__c        = null;
                // 已出库指示的排队后清除出库指示信息
                raesd.Shipment_request_time2__c = null;
                raesd.Shipment_request__c = false;
            } else {
                Integer queueMaxNumber = 1;
                if (queueMaxNumbers.isEmpty()) {
                    queueMaxNumber = 0;
                } else if (queueMaxNumbers[0].get('maxr') != null) {
                    queueMaxNumber = Integer.valueOf(queueMaxNumbers[0].get('maxr')) + 1;
                }
                // 排队成功、更新DB
                raesd.Queue_User__c   = UserInfo.getUserId();
                raesd.Queue_Number__c = queueMaxNumber;
                raesd.Queue_Day__c    = Date.today();
                raesd.Queue_Time__c   = getCurrentTime();
                // 备品配套明细型号(借出时)
                raesd.Fixture_Model_No_text__c = aSet[0].Fixture_Model_No_F__c;
                // 所在地区(本部) 借出时
                raesd.Salesdepartment_before__c = aSet[0].Salesdepartment__c;
                // 所在地区(省) 借出时
                raesd.SalesProvince_before__c = aSet[0].SalesProvince__c;
                // 产品分类(GI/SP)(借出时)
                raesd.Product_category_text__c = aSet[0].Product_category__c;
                // 备品分类(借出时)
                raesd.Equipment_Type_text__c = aSet[0].Equipment_Type__c;
                // 备品存放地(借出时)
                raesd.Internal_asset_location_before__c = aSet[0].Internal_asset_location__c;
                // 备品名称(借出时) clear しない、申請時 値設定するので、
                // 今排队保存排队信息时,别的和配套明细相连的字段都保留了排队的信息,为了逻辑的统一性,这个字段也需要保存
                raesd.Fixture_Name_text__c = aSet[0].Name;
                raesd.Select_Time__c  = null;
                raesd.Asset__c        = null;
                // 已出库指示的排队后清除出库指示信息
                raesd.Shipment_request_time2__c = null;
                raesd.Shipment_request__c = false;
                // OLY_OCM-243 追加字段对应 备品管理编码(借出时) 排队时清除与asset相连的借出时相关的字段
                raesd.EquipmentSet_Managment_Code_text__c = null;
                // 机身编号(借出时)
                raesd.SerialNumber_text__c = null;
                // 备品成本(借出时)
                raesd.Asset_cost_del_before__c = null;
            }
            Map<Id, Fixture_OneToOne_Link__c> fOtoMap = new Map<Id, Fixture_OneToOne_Link__c>();
            // 此处共通化处理,在调用 FixtureUtil.clearOneToOneAccessory()方法
            FixtureUtil.clearOneToOneAccessory(raseId, mfUpsert, oldAssId, fOtoMap);
            // FixtureUtil.withoutUpdate(new Rental_Apply_Equipment_Set_Detail__c[]{raesd});
            if (!mfUpsert.isEmpty()) {
                Oly_TriggerHandler.bypass(AssetHandlerCheck.class.getName());
                FixtureUtil.withoutUpsertRaesd(mfUpsert.values());
                Oly_TriggerHandler.clearBypass(AssetHandlerCheck.class.getName());
            }
            //更新一对一
            if (!fOtoMap.isEmpty()) {
                Oly_TriggerHandler.bypass(AssetHandlerCheck.class.getName());
                FixtureUtil.withoutUpdate(fOtoMap.values());
                Oly_TriggerHandler.clearBypass(AssetHandlerCheck.class.getName());
            }
            responseMap.put('code', '0');
            responseMap.put('message', '排队成功');
            return responseMap;
        } catch (DmlException ex) {
            Database.rollback(sp);
            // 1件目のエラーのみ表示
            responseMap.put('code', '1');
            responseMap.put('message', ex.getDmlMessage(0));
            System.debug(Logginglevel.ERROR, ex.getMessage());
            System.debug(Logginglevel.ERROR, ex.getStackTraceString());
            return responseMap;
        } catch (Exception e) {
            Database.rollback(sp);
            responseMap.put('code', '1');
            responseMap.put('message', e.getMessage());
            System.debug(Logginglevel.ERROR, e.getMessage());
            System.debug(Logginglevel.ERROR, e.getStackTraceString());
            return responseMap;
        }
    }
    public PageReference save() {
        //20170906 upsert by UniqueKey__c
        Map<String, Rental_Apply_Equipment_Set_Detail__c> mfUpsert = new Map<String, Rental_Apply_Equipment_Set_Detail__c>();
        Map<Id, Fixture_OneToOne_Link__c> fOtoMap = new Map<Id, Fixture_OneToOne_Link__c>();
        Savepoint sp = Database.setSavepoint();
        Set<String> clearUniqueKeySet = new Set<String>();
        try {
            // Asset的Last_Reserve_RAES_Detail__c设值:未保存的情况下,robj.Id是null。需要先保存后设值
            //List<Rental_Apply_Equipment_Set_Detail__c> rasedList = new List<Rental_Apply_Equipment_Set_Detail__c>();
            //List<Asset> aSetList = new List<Asset>();
//Do it in Trigger            Map<Id, Asset> assetUpdateMap = new Map<Id, Asset>();
            for (Integer indexNum = 0; indexNum < viewList.size(); indexNum++) {
                WrapperInfo wprInfo = viewList[indexNum];
                Rental_Apply_Equipment_Set_Detail__c robj = (Rental_Apply_Equipment_Set_Detail__c) wprInfo.sobj;
                //清空Id,因为要有Id不能重新设置主字段备品借出一览
                robj.Id = null;
                //设置一览为当前主体的一览
                robj.Rental_Apply_Equipment_Set__c = sonObj.Rental_Apply_Equipment_Set__c;
                // 画面上にチェックした、1件しかない
                if (wprInfo.check) {
                    // 操作対象
                    List<Rental_Apply_Equipment_Set_Detail__c> rasedList = [
                            SELECT Id, Asset__c, Asset__r.Main_OneToOne__c,
                                   Queue_Number__c, ExternalKey__c,
                                   Queue_Day__c
                            FROM Rental_Apply_Equipment_Set_Detail__c
                            where Id = :sonObj.id
                              FOR Update];
                    if (rasedList.isEmpty()) {
                        throw new ControllerUtil.myException('分配的主体备品不存在,请刷新画面后重新操作');
                    }
                    //1822 yc 20211021 已购待货目的,新品已有发货日不能出库 start
                    if(robj.Rental_Apply__r.demo_purpose2__c=='已购待货' && robj.Rental_Apply__r.Follow_UP_Opp__r.Shipping_Finished_Day_Func__c!= null){
                        throw new ControllerUtil.myException('已购待货目的,新品已有发货日,不能继续了。');
                    }
                    if(robj.Rental_Apply__r.demo_purpose2__c=='索赔QIS' && robj.Rental_Apply__r.next_action__c=='无偿更换' && robj.Rental_Apply__r.QIS_number__r.ReplaceDeliveryDate__c!= null){
                        throw new ControllerUtil.myException('索赔QIS目的,QIS已有新品发货日,不能继续了。');
                    }
                    //1822 yc 20211021 已购待货目的,新品已有发货日不能出库 end
                    // 分配
                    if (robj.Select_Time__c == null || rasedList[0].Asset__c != robj.Asset__c) {
                        // Last_Reserve_RAES_Detail__c 最新备品申请借出明细历史
                        // 1件しかない
                        List<Asset> aSetList =
                                [Select Id, Quantity,
                                        Out_of_wh__c,
                                        Manage_type__c,
                                        You_Xiao_Ku_Cun__c,
                                        Last_Reserve_RAES_Detail__c,
                                        Last_Reserve_RAES_Detail__r.Select_Time__c
                                   From Asset
                                  where Id = :robj.Asset__c
                                   AND (Last_Reserve_RAES_Detail__c = null OR Last_Reserve_RAES_Detail__r.Select_Time__c = null)
                                   // 因为有暂定分配 所以where 里不加这个条件 AND You_Xiao_Ku_Cun__c > 0 // 有效库存
                                    for Update];
                        // 不能lock到数据的时候
                        if (aSetList.isEmpty()) {
                            throw new ControllerUtil.myException('请选择未分配的主体备品,请刷新画面后重新操作');
                        }
                        // 备品有效库存 的 check
                        // 暂定分配, 没有有效库存的时候 不报错
                        if (String.isNotBlank(aSetList[0].Last_Reserve_RAES_Detail__c)
                                && aSetList[0].Last_Reserve_RAES_Detail__r.Select_Time__c == null
                                && aSetList[0].You_Xiao_Ku_Cun__c <= 0
                                && aSetList[0].Last_Reserve_RAES_Detail__c == sonObj.Id
                        ) {
                        }
                        // 有有效库存的时候 不报错
                        else if (aSetList[0].You_Xiao_Ku_Cun__c > 0) {
                        }
                        else {
                            throw new ControllerUtil.myException('第' + (indexNum + 1) +'行,没有足够有效库存,请刷新画面后重新操作');
                        }
                        Asset aSet = aSetList[0];
                        robj.Select_Time__c = System.now();
                        // 分配時 更新 Out_of_wh__c
                        if (aSet.Out_of_wh__c == null || aSet.Out_of_wh__c == 0) {
                            aSet.Out_of_wh__c = 0;
                        }
// Handlerにて 値設定する
//                        aSet.Out_of_wh__c = aSet.Out_of_wh__c + 1;
//                        assetUpdateMap.put(aSet.Id, aSet);
                        String uniqueKeyStr = parentObj.RequestNoJoinStr2__c + ':'+ robj.Rental_Apply_Equipment_Set__c
                                + ':' + robj.FSD_Id__c + ':' + robj.IndexFromUniqueKey__c;
                        robj.UniqueKey__c = uniqueKeyStr;
                        robj.Queue_Number__c = null;
                        robj.Queue_Day__c = null;
                        robj.Queue_Time__c = null;
                        robj.Shipment_request_time2__c = null;
                        robj.Shipment_request__c = false;
                        robj.ExternalKey__c = null;
                        mfUpsert.put(robj.UniqueKey__c, robj);
// Handlerにて 値設定する
//                        if (String.isBlank(aSet.Last_Reserve_RAES_Detail__c)){
//                            aSet.Last_Reserve_RAES_Detail__c = robj.Id;
//                            assetUpdateMap.put(aSet.Id, aSet);
//                        } else if (aSet.Last_Reserve_RAES_Detail__c != robj.Id) {
//                            aSet.Last_Reserve_RAES_Detail__c = robj.Id;
//                            assetUpdateMap.put(aSet.Id, aSet);
//                        }
                        // 一对一的情况,主体备品和配套的附属品一起分配
                        if (robj.FSD_OneToOneAccessory_Cnt__c > 0) {
                            // 1. select from Rental_Apply_Equipment_Set_Detail__c 找出需要分配的对象
                            // 此处共通化处理,调用 FixtureUtil.clearOneToOneAccessory()方法
                            //   a.未分配时,Asset__c还没值,所以不用判断OneToOne_Flag__c
                            //   b.从一对一的, 改到不是一对一的情况,一对一分配的附属品字段清除逻辑,需要判断OneToOne_Flag__c
                            //   c.清除一对一link表的相关逻辑
                            //   d.fOtoMap 之前的一对一分配数也需要一起清空 + 今回の更新一对一分配的Link表
                            List<Rental_Apply_Equipment_Set_Detail__c> raesdList
                                    = FixtureUtil.clearOneToOneAccessory(parentId, mfUpsert, sonObj.Asset__c, fOtoMap);
                            // 分配的是一对一的时候
                            if (robj.Asset__r.Main_OneToOne__c) {
                                // 2. SELECT Fixture_OneToOne_Link__c where Main_Asset__c = robj.Asset__c
                                // 被分配对象 {Fixture_Model_No_F__c: [Asset.Id]}
                                Map<String, List<Fixture_OneToOne_Link__c>> oneToOneListMap = new Map<String, List<Fixture_OneToOne_Link__c>>();
                                Map<Id, Asset> assetKuCunMap = new Map<Id, Asset>();
                                List<Fixture_OneToOne_Link__c> fo2oList = [
                                        SELECT Id, Main_Asset__c,
                                               Accessory_Asset__c,
                                               Accessory_Asset__r.Fixture_Model_No_F__c,
                                               Quantity__c, Inventory_Frozen_Quantity__c
                                          FROM Fixture_OneToOne_Link__c
                                         WHERE Accessory_Asset__c != null                   // 念のため
                                           AND Main_Asset__c = :robj.Asset__c];
                                for (Fixture_OneToOne_Link__c fo2o : fo2oList) {
                                    if (!oneToOneListMap.containsKey(fo2o.Accessory_Asset__r.Fixture_Model_No_F__c)) {
                                        oneToOneListMap.put(fo2o.Accessory_Asset__r.Fixture_Model_No_F__c, new List<Fixture_OneToOne_Link__c>());
                                    }
                                    assetKuCunMap.put(fo2o.Accessory_Asset__c, null);
                                    List<Fixture_OneToOne_Link__c> oneToOneAsetIdList = oneToOneListMap.get(fo2o.Accessory_Asset__r.Fixture_Model_No_F__c);
                                    fo2o.Quantity__c = fo2o.Quantity__c == null ? 1 : fo2o.Quantity__c;
// OCSM_BP3-29 分配一对一附属品的时候 考虑 盘点冻结数 start
                                    Integer fo2oQty = (fo2o.Quantity__c - (fo2o.Inventory_Frozen_Quantity__c == null ? 0 : fo2o.Inventory_Frozen_Quantity__c)).intValue();
//                                    for (Integer qty = 0; qty < fo2o.Quantity__c; qty++) {
                                    for (Integer qty = 0; qty < fo2oQty; qty++) {
// OCSM_BP3-29 分配一对一附属品的时候 考虑 盘点冻结数 end
                                        oneToOneAsetIdList.add(fo2o);
                                    }
                                    oneToOneListMap.put(fo2o.Accessory_Asset__r.Fixture_Model_No_F__c, oneToOneAsetIdList);
                                }
                                assetKuCunMap = new Map<Id, Asset>(
                                        [Select Id, Quantity,
                                                Out_of_wh__c,
                                                Manage_type__c,
                                                You_Xiao_Ku_Cun__c
                                           From Asset
                                          where Id IN :assetKuCunMap.keyset()
                                            for Update]);
                                // 对 raesdList 进行一对一分配
                                Map<Id, Rental_Apply_Equipment_Set_Detail__c> cancelCopyOldMap = new Map<Id, Rental_Apply_Equipment_Set_Detail__c>();
                                oneToOneSelect(raesdList, oneToOneListMap, assetKuCunMap, fOtoMap
                                        , robj.Select_Time__c
                                        , mfUpsert, cancelCopyOldMap);
                                // 有 cancelCopyOldMap 的话, 做重新分配, 然后继续分配
                                if (cancelCopyOldMap.size() > 0) {
                                    FixtureUtil.withoutUpdate(cancelCopyOldMap.values());
                                    // 要做一对一分配的明细, 参考 clearOneToOneAccessory sql
                                    raesdList = [SELECT Id, UniqueKey__c, Asset__c,
                                                FSD_Fixture_Model_No__c, FSD_Name_CHN__c, Fixture_OneToOne_Link_Id__c,
                                                Select_Time__c, Shipment_request_time2__c, Shipment_request__c, OneToOne_Flag__c, StockDown__c, DeliverySlip__c
                                            from Rental_Apply_Equipment_Set_Detail__c
                                            where Rental_Apply_Equipment_Set__c = :parentId
                                            and Cancel_Select__c = false
                                            and FSD_Is_OneToOne__c = true
                                            and UniqueKey__c != null
                                            and Is_Body__c = false
                                            and Canceled__c IN :cancelCopyOldMap.keySet()
                                            order by FSD_Fixture_Model_No__c];
                                    oneToOneSelect(raesdList, oneToOneListMap, assetKuCunMap, fOtoMap
                                            , robj.Select_Time__c
                                            , mfUpsert, cancelCopyOldMap);
                                }
                            }
                        }
                        if (String.isBlank(robj.Id)
                                && !String.isBlank(uniqueKeyStr)) {
                            // 新規の場合、ここ単純に Id にて判断
                            clearUniqueKeySet.add(uniqueKeyStr);
                        }
//Do it in Trigger
//                        // Asset 1件しかない
//                        update assetUpdateMap.values();
                        // 判断分配的明细是否已经排队,如果已排队,需要清除备品借出排队序列表中对应的数据
                        if (String.isNotBlank(rasedList[0].ExternalKey__c)) {
                            List<Rental_Apply_Sequence__c> rasList = [
                                    SELECT Id
                                    FROM Rental_Apply_Sequence__c
                                    WHERE Apply_Set_Detail__c =: rasedList[0].Id
                                      AND Invalid_Flag__c = false];
                            // 更新备品借出排队序列表
                            if (!rasList.isEmpty()) {
                                FixtureUtil.withoutDelete(rasList);
                            }
                        }
                    }
                    // 主体1件しかない
                    break;
                }
            }
            System.debug(mfUpsert);
            // Upsert
            if (!mfUpsert.isEmpty()) {
                Oly_TriggerHandler.bypass(AssetHandlerCheck.class.getName());
                FixtureUtil.withoutUpsertRaesd(mfUpsert.values());
                Oly_TriggerHandler.clearBypass(AssetHandlerCheck.class.getName());
//Do it in Trigger
//Do it in Trigger 分配時 更新 Out_of_wh__c
//                for (Rental_Apply_Equipment_Set_Detail__c robj : mfUpsert) {
//                    if (robj.Is_Body_F__c) {
//                        System.debug('测试robj.Is_Body_F__c' + robj.Is_Body_F__c);
//                        Asset aSet = aSetList[0];
//                        if (String.isBlank(aSet.Last_Reserve_RAES_Detail__c)){
//                            aSet.Last_Reserve_RAES_Detail__c = robj.Id;
//                            assetUpdateMap.put(aSet.Id, aSet);
//                        } else if (aSet.Last_Reserve_RAES_Detail__c != robj.Id) {
//                            aSet.Last_Reserve_RAES_Detail__c = robj.Id;
//                            assetUpdateMap.put(aSet.Id, aSet);
//                        }
//                        // 1件しかない
//                        update assetUpdateMap.values();
//                        break;
//                    }
//                }
            }
            //更新一对一
            if (!fOtoMap.isEmpty()) {
                Oly_TriggerHandler.bypass(AssetHandlerCheck.class.getName());
                FixtureUtil.withoutUpdate(fOtoMap.values());
                Oly_TriggerHandler.clearBypass(AssetHandlerCheck.class.getName());
            }
        } catch (Exception ex) {
            System.debug('测试bug');
            System.debug(ex.getStackTraceString());
            ApexPages.addMessages(ex);
            Database.rollback(sp);
            // Id をクリア
            for (Rental_Apply_Equipment_Set_Detail__c robj : mfUpsert.values()) {
                if (clearUniqueKeySet.contains(robj.UniqueKey__c)) {
                    robj.Id = null;
                }
            }
            return null;
        }
        if (saveType == '1') {
            searchOpp();
            saveType = '';
            return null;
        } else if (saveType == '2') {
            // ソート時の変更ある
            myComponentController.sortTable();
            saveType = '';
            return null;
        } else {
            //附属品选择画面
            PageReference pg = new PageReference('/apex/AccessorySelect');
            pg.getParameters().put('pt_recid',parentId);
            pg.setRedirect(true);
            return pg;
        }
    }
    // https://sohobb.backlog.jp/view/OLY_OCM-152#comment-20041467
    // 1. G9 の場合、 もし、一対一 分配した 本体の場合、付属品(一対一付属品)も一緒に キャンセルしますか?
    // → 一対一Linkがある場合は、付属品も一緒に取り消します。そうすればG10と矛盾しませんよね。
    // 下架后 才能取消主体 OLY_OCM-173
    public PageReference cancel() {
        Savepoint sp = Database.setSavepoint();
        try{
            List<Rental_Apply_Equipment_Set_Detail__c> raesds = new List<Rental_Apply_Equipment_Set_Detail__c>();
            List<Id> delIds = new List<Id>();
            for (WrapperInfo wprInfo : viewList) {
                Rental_Apply_Equipment_Set_Detail__c robj = (Rental_Apply_Equipment_Set_Detail__c) wprInfo.sobj;
                //出库后不能取消
                //关联主体分配画面,一览Handler
                //附属品分配画面
                if (wprInfo.check) {
                    if (String.isNotBlank(robj.DeliverySlip__c)) {
                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '已经发货的明细不能取消'));
                        return null;
                    } else if (robj.StockDown__c == false) {
                        if (robj.Cancel_Reason__c == '重新分配') {
                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '下架前重新分配,直接从画面重新选择即可'));
                            return null;
                        } else {
                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '下架前取消主体,请取消备品配套'));
                            return null;
                        }
                    } else if (robj.Cancel_Reason__c != '重新分配') {
                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '不是 [重新分配],不能单独取消主体,请取消备品配套'));
                        return null;
                    } else {
                        // 状态为待分配,备品中心created的明细,可以delete;其余的不可以删除
                        if (robj.CreatedBy.ProfileId == System.Label.ProfileId_EquipmentCenter && robj.Select_Time__c == null) {
                            // 删除明细Id<List>
                            delIds.add(robj.Id);
                            // 删除明细,会对应的删除相关的备品借出排队序列表数据,不用特别加处理
                        } else {
                            if (String.isBlank(robj.Cancel_Reason__c)) {
                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入取消理由'));
                                return null;
                            }
                            //20210818 SFDC-C448KZ ljh start
                            if (String.isBlank(robj.Loaner_cancel_reason__c)) {
                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入明细取消理由'));
                                return null;
                            }
                            if (robj.Loaner_cancel_reason__c=='其他' && String.isBlank(robj.Loaner_cancel_Remarks__c)) {
                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入取消理由备注'));
                                return null;
                            }
                            // if (String.isBlank(robj.Loaner_cancel_Remarks__c)) {
                            //     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入备品申请取消理由备注'));
                            //     return null;
                            // }
                            //20210818 SFDC-C448KZ ljh end
                            wprInfo.check = false;
                            // 取消分配
                            robj.Cancel_Select__c = true;
                            // 备品申请取消时间
                            robj.Cancel_Date__c = Date.today();
                            robj.Cancel_Time__c = getCurrentTime();
                            // 取消者
                            robj.Cancel_Mem__c = UserInfo.getUserId();
                            // 取消理由备注
                            //robj.Loaner_cancel_Remarks__c
                            robj.Loaner_cancel_Remarks__c = robj.Loaner_cancel_Remarks__c==null ? robj.Loaner_cancel_reason__c : robj.Loaner_cancel_Remarks__c;
                            //20210818 SFDC-C448KZ ljh end
                            // 判断分配的明细是否已经排队,如果已排队,需要清除备品借出排队序列表中对应的数据
                            if (String.isNotBlank(robj.ExternalKey__c)) {
                                List<Rental_Apply_Sequence__c> rasList = [
                                        SELECT Id
                                        FROM Rental_Apply_Sequence__c
                                        WHERE Apply_Set_Detail__c =: robj.Id
                                          AND Invalid_Flag__c = false];
                                // 更新备品借出排队序列表
                                if (!rasList.isEmpty()) {
                                    FixtureUtil.withoutDelete(rasList);
                                }
                            }
                            robj.ExternalKey__c = null;
                            //※已经分配的場合  トリがでやります
                            //if(!String.isBlank(robj.Asset__c) && robj.Select_Time__c != null) {
                                //借出备品Set一览明细 trigger 里 clear Asset__c
                                //借出备品Set一览明细.分配时间
                                // if (robj.Select_Time__c != null) {
                                //     robj.Select_Time__c = null;
                                // }
                            //}
                            raesds.add(robj);
                        }
                    }
                }
            }
            if (delIds.size() > 0) {
                // 削除
                FixtureUtil.delRAESDByIds(parentObj, delIds);
            }
            if (raesds.size() > 0) {
                FixtureUtil.withoutUpdate(raesds);
                // 取消操作,只是取消已选择的分配,画面刷新
                PageReference pg = new PageReference('/apex/MainFixtureSelect');
                pg.getParameters().put('pt_recid',parentId);
                pg.setRedirect(true);
                return pg;
            }
        }
        catch (Exception e) {
            ApexPages.addMessages(e);
            Database.rollback(sp);
            return null;
        }
        return null;
    }
    public PageReference turnback() {
        PageReference ret = null;
        if (!String.isBlank(this.parentId)) {
            ret = new PageReference('/' + this.parentId);
        }
        return ret;
    }
    /**
    *#OLY_OCM-668 取消主体分配
    *@return PageReferences 刷新主体选择画面
    */
    public PageReference unassign(){
        Map<String, Rental_Apply_Equipment_Set_Detail__c> mfUpsert = new Map<String, Rental_Apply_Equipment_Set_Detail__c>();
        Map<Id, Fixture_OneToOne_Link__c> fOtoMap = new Map<Id, Fixture_OneToOne_Link__c>();
        Savepoint sp = Database.setSavepoint();
        Set<String> clearUniqueKeySet = new Set<String>();
        try{
            Integer checkCount = 0;
            for (Integer indexNum = 0; indexNum < viewList.size(); indexNum++) {
                WrapperInfo wprInfo = viewList[indexNum];
                Rental_Apply_Equipment_Set_Detail__c robj = (Rental_Apply_Equipment_Set_Detail__c) wprInfo.sobj;
                robj.Id = null;
                robj.Rental_Apply_Equipment_Set__c = sonObj.Rental_Apply_Equipment_Set__c;
                if (wprInfo.check) {
                    checkCount += 1;
                    // 操作対象
                    List<Rental_Apply_Equipment_Set_Detail__c> raesdList = [
                            SELECT Id, StockDown_time__c,Cancel_Date__c,
                                UniqueKey__c,
                                Fixture_OneToOne_Link_Id__c,
                                Asset__c,
                                Select_Time__c,
                                Shipment_request_time2__c,
                                Shipment_request__c ,
                                Fixture_Model_No_text__c ,
                                FSD_Fixture_Model_No__c,
                                SerialNumber_text__c,
                                SalesProvince_before__c,
                                Salesdepartment_before__c,
                                Product_category_text__c,
                                Equipment_Type_text__c,
                                Asset_cost_del_before__c,
                                Internal_asset_location_before__c,
                                Fixture_Name_text__c ,
                                FSD_Name_CHN__c,
                                EquipmentSet_Managment_Code_text__c
                            FROM Rental_Apply_Equipment_Set_Detail__c
                            where Id = :sonObj.Id
                            FOR Update];
                    if (raesdList.isEmpty()) {
                        throw new ControllerUtil.myException('没有下架前已分配的主体');
                    }
                    Rental_Apply_Equipment_Set_Detail__c robjOnline = raesdList[0];
                    if(robjOnline.Cancel_Date__c != null){
                        throw new ControllerUtil.myException('第' + (indexNum + 1) +'行,已经取消申请了,不能取消分配');
                    }
                    if(robjOnline.StockDown_time__c != null){
                        throw new ControllerUtil.myException('第' + (indexNum + 1) +'行,已下架,不可以取消分配');
                    }
                    if(robjOnline.Asset__c == null){
                        throw new ControllerUtil.myException('第' + (indexNum + 1) +'行,还没有被分配,不可以取消分配');
                    }
                    // 已分配且未下架才可执行取消
                    List<Asset> aSetList =
                            [SELECT Id, Quantity,
                                    Out_of_wh__c,
                                    Manage_type__c,
                                    You_Xiao_Ku_Cun__c,
                                    Last_Reserve_RAES_Detail__c,
                                    Last_Reserve_RAES_Detail__r.Select_Time__c
                               FROM Asset
                              WHERE Id = :robj.Asset__c
                                FOR UPDATE
                            ];
                    // 不能lock到数据的时候
                    if (aSetList.isEmpty()) {
                        throw new ControllerUtil.myException('第' + (indexNum + 1) +'行,不是有效的主体,请刷新画面后重新操作');
                    }
                    // 相关字段置为 null
                    robj.Asset__c = null;
                    robj.Select_Time__c = null;
                    robj.Shipment_request_time2__c = null;
                    robj.Shipment_request__c = false;
                    // 备品配套明细型号(借出时)
                    robj.Fixture_Model_No_text__c = robj.FSD_Fixture_Model_No__c;
                    // 机身编号(借出时)
                    robj.SerialNumber_text__c = null;
                    // 所在地区(省) 借出时
                    robj.SalesProvince_before__c = null;
                    // 所在地区(本部) 借出时
                    robj.Salesdepartment_before__c = null;
                    // 产品分类(GI/SP)(借出时)
                    robj.Product_category_text__c = null;
                    // 备品分类(借出时)
                    robj.Equipment_Type_text__c = null;
                    // 备品成本(借出时)
                    robj.Asset_cost_del_before__c = null;
                    // 备品存放地(借出时)
                    robj.Internal_asset_location_before__c = null;
                    //备品名称(借出时)
                    robj.Fixture_Name_text__c = robj.FSD_Name_CHN__c;
                    // 备品管理编码(借出时)
                    robj.EquipmentSet_Managment_Code_text__c = null;
                    // 清空排队信息
                    robj.Queue_Conment__c = null;
                    robj.Queue_Day__c = null;
                    robj.Queue_User__c = null;
                    //取消分配 update byrentx 20210809 start 取消分配时不清空 排队日(首次)
                    // robj.Queue_Day_Text__c = null;
                    //取消分配 update byrentx 20210809 end 取消分配时不清空 排队日(首次)
                    robj.Queue_Number__c = null;
                    // 判断分配的明细是否已经排队,如果已排队,需要清除备品借出排队序列表中对应的数据
                    if (String.isNotBlank(robj.ExternalKey__c)) {
                        List<Rental_Apply_Sequence__c> rasList = [
                                SELECT Id
                                FROM Rental_Apply_Sequence__c
                                WHERE Apply_Set_Detail__c =: robjOnline.Id
                                  AND Invalid_Flag__c = false];
                        // 更新备品借出排队序列表
                        if (!rasList.isEmpty()) {
                            FixtureUtil.withoutDelete(rasList);
                        }
                    }
                    robj.ExternalKey__c = null;
                    String uniqueKeyStr = parentObj.RequestNoJoinStr2__c + ':'+ robj.Rental_Apply_Equipment_Set__c
                            + ':' + robj.FSD_Id__c + ':' + robj.IndexFromUniqueKey__c;
                    robj.UniqueKey__c = uniqueKeyStr;
                    // 一对一的情况,主体备品和配套的附属品一起取消
                    if (robj.FSD_OneToOneAccessory_Cnt__c > 0) {
                        // 1. select from Rental_Apply_Equipment_Set_Detail__c 找出需要分配的对象
                        // 此处共通化处理,调用 FixtureUtil.clearOneToOneAccessory()方法
                        //   a.未分配时,Asset__c还没值,所以不用判断OneToOne_Flag__c
                        //   b.从一对一的, 改到不是一对一的情况,一对一分配的附属品字段清除逻辑,需要判断OneToOne_Flag__c
                        //   c.清除一对一link表的相关逻辑
                        //   d.fOtoMap 之前的一对一分配数也需要一起清空 + 今回の更新一对一分配的Link表
                        robj.Fixture_OneToOne_Link_Id__c = null;
                        raesdList = FixtureUtil.clearOneToOneAccessory(parentId, mfUpsert, sonObj.Asset__c, fOtoMap);
                    }
                    mfUpsert.put(robj.UniqueKey__c, robj);
                    if (String.isBlank(robj.Id)
                            && !String.isBlank(uniqueKeyStr)) {
                        // 新規の場合、ここ単純に Id にて判断
                        clearUniqueKeySet.add(uniqueKeyStr);
                    }
                    break;
                }
            }
            // 没有任何勾选
            if (checkCount == 0){
                throw new ControllerUtil.myException('请选择已分配的主体备品');
            }
            if (!mfUpsert.isEmpty()) {
                Oly_TriggerHandler.bypass(AssetHandlerCheck.class.getName());
                FixtureUtil.withoutUpsertRaesd(mfUpsert.values());
                Oly_TriggerHandler.clearBypass(AssetHandlerCheck.class.getName());
            }
            //更新一对一
            if (!fOtoMap.isEmpty()) {
                Oly_TriggerHandler.bypass(AssetHandlerCheck.class.getName());
                FixtureUtil.withoutUpdate(fOtoMap.values());
                Oly_TriggerHandler.clearBypass(AssetHandlerCheck.class.getName());
            }
        } catch (Exception ex) {
            ApexPages.addMessages(ex);
            Database.rollback(sp);
            // Id をクリア
            for (Rental_Apply_Equipment_Set_Detail__c robj : mfUpsert.values()) {
                if (clearUniqueKeySet.contains(robj.UniqueKey__c)) {
                    robj.Id = null;
                }
            }
            return null;
        }
        //刷新画面
        PageReference pg = new PageReference('/apex/MainFixtureSelect');
        pg.getParameters().put('pt_recid',parentId);
        pg.setRedirect(true);
        return pg;
    }
    private String makeSoql(String keyword) {
        // 検索条件
        String dateToday = String.valueOf(Date.today());
        // from asset
        String soql ='';
        soql += 'where Asset_Owner__c = \'Olympus\' AND ' + FixtureUtil.getAssetSoqlBase();
        soql += '  and Asset_loaner_category__c != \'耗材\'';
        soql += '  and RecordTypeId = \'01210000000kOPR\'';
        soql += '  and Quantity > 0';
        soql += '  and (Abandoned_Inventory__c = 0 OR Abandoned_Inventory__c = null)'; // 待废弃数(丢失/盘亏)
        soql += '  and (Abandoned_RealThing__c = 0 OR Abandoned_RealThing__c = null)'; // 待废弃数(实物)
        soql += '  and (Frozen_Quantity__c = 0 OR Frozen_Quantity__c = null)'; // 冻结数
        soql += '  and Loaner_accsessary__c = false';
        soql += '  and Equipment_Type__c != \'检测用备品\'';
        soql += '  and Delete_Flag__c = False ';
        soql += '  and Freeze_sign_Abandoned_Flag__c = False';
        soql += '  and Internal_asset_location__c != null';
        soql += '  and (Consumable_Guaranteen_end__c = null or Consumable_Guaranteen_end__c >=' + dateToday + ')';
//借出中的Asset也要出显示出来
//        soql += '  and Last_Reserve_RAES_Detail__c = null';
        // Fixture_OneToOne_Link__c, 当配套的Mst定义成 一对一 的时候
        if (sonObj != null && sonObj.FSD_Is_OneToOne__c) {
            soql += '  and Fixture_OneToOne_Link__c <> null';
        }
        // 不检索seledted的数据  在 CreateRelationListPagingCmpCtrl 里 已经 去除了 selectedFKIdList
        if (sonObj != null && !String.isBlank(sonObj.Asset__c)) {
            soql += '  and Id != \'' + String.escapeSingleQuotes(sonObj.Asset__c) + '\'';
        }
        //自己状态
        // soql += '';
        if (!String.isBlank(keyword)) {
            String[] vals = keyword.split(' ');
             soql += ' and (';
             String fmodelno = '';
            for (String v : vals) {
                v = String.escapeSingleQuotes(v.replace('%', '\\%').replace('*', '%'));
                fmodelno += ' Product2.Fixture_Model_No_T__c like \'' + v + '\' ';
                fmodelno += ' or Product2.Name like \'' + v + '\' ';
                fmodelno += 'or';
            }
            fmodelno = fmodelno.removeEnd('or');
            soql += fmodelno + ' )';
        } else {
            soql += ' and Product2.Fixture_Model_No_T__c = \'' + String.escapeSingleQuotes(sonObj.FSD_Fixture_Model_No__c) + '\'';
        }
        //// TODO 暂时注释 画面から别省别本部别库存の判断
        //别存放地
        if (String.isNotBlank(bieCunFangDi) && bieCunFangDi != 'All') {
            soql += ' and Internal_asset_location__c = \'' + String.escapeSingleQuotes(bieCunFangDi) + '\'';
        }
        // else {
        //     String cunfangdiStr = '';
        //     for (String cunfangdi : cunfangdiSet) {
        //         cunfangdiStr += ' Internal_asset_location__c = \'' + String.escapeSingleQuotes(cunfangdi) + '\' OR';
        //     }
        //     soql += ' and (' + cunfangdiStr.removeEnd('OR') + ')';
        // }
        //别本部
        if (String.isNotBlank(bieBenBu) && !bieBenBu.contains('全部')) {
            // soql += ' and Salesdepartment__c = \'' + String.escapeSingleQuotes(bieBenBu) + '\'';
            List<String> bieBenBuList = bieBenBu.split(',');
            soql += RentalFixtureSetAssignController.setSoql('Salesdepartment__c', bieBenBuList);
            /*String benbuStr = '';
            for (String benbu : bieBenBuList) {
                benbuStr += ' Salesdepartment__c = \'' + String.escapeSingleQuotes(benbu) + '\' OR';
            }
            soql += ' and (' + benbuStr.removeEnd('OR') + ')';*/
        }
        else if (benbuSet.size() > 0) {
            String benbuStr = '';
            for (String benbu : benbuSet) {
                benbuStr += ' Salesdepartment__c = \'' + String.escapeSingleQuotes(benbu) + '\' OR';
            }
            soql += ' and (' + benbuStr.removeEnd('OR') + ')';
        }
        //产品分类
        if (String.isNotBlank(bieChanPinFenLei)) {
            soql += ' and Product_category__c = \'' + String.escapeSingleQuotes(bieChanPinFenLei) + '\'';
        }
        //别备品分类
        if (String.isNotBlank(bieBeiPinFenLei) && !bieBeiPinFenLei.contains('全部')) {
            List<String> bieBeiPinFenLeiList = bieBeiPinFenLei.split(',');
            soql += RentalFixtureSetAssignController.setSoql('Equipment_Type__c', bieBeiPinFenLeiList);
        }
        // 跳过已经选择的备品set明细
        // where not in selectedFKIdList 共通に作る ここでいらない
        system.debug(soql);
        //system.assertEquals('qyj',soql);
        return soql;
    }
    public override void setViewList(List<sObject> queryList) {
        viewList = new List<WrapperInfo>();
        List<Rental_Apply_Equipment_Set_Detail__c> groupByTargetList = new List<Rental_Apply_Equipment_Set_Detail__c>();
        if (selectedData.size() == 0) {
            // 因为是主体,肯定有数据,主体没有的情况,提示错误信息
            throw new ControllerUtil.myException('主体不存在,请选择有主体的数据。');
        }
        // 自己的数据打勾,被检索出来的数据不打勾
        // 選択済みの明细をviewListに追加
        if (selectedData.size() > 0) {
            for (Integer i = 0; i < selectedData.size(); i++) {
                /* not include the selected data num */
                // 501を超えた場合前500のみを出す
                //if (i == getSearchNumMax()) continue;
                Rental_Apply_Equipment_Set_Detail__c rsdObj = (Rental_Apply_Equipment_Set_Detail__c) selectedData[i];
                System.debug('rsdObj.Asset__c' + rsdObj.Asset__c);
                if (!String.isBlank(rsdObj.Asset__c)) {
                    viewList.add(new WrapperInfo(rsdObj, myComponentController));
                    viewList[viewList.size() - 1].lineNo = viewList.size() - 1;
                    viewList[viewList.size() - 1].check = true;
                    viewList[viewList.size() - 1].oldCheck = true;
                    if (is2B1 && pCunFangDi != rsdObj.Internal_asset_location__c) {
                        viewList[viewList.size() - 1].canEdit = false;
                    }
                    groupByTargetList.add(rsdObj);
                    // QueuePageByAssetId的URL, 加载排队画面用
                    queueByAsset = '/apex/QueuePageByAssetId?parentId=' + rsdObj.Rental_Apply_Equipment_Set__c + '&isNotShow=' + true;
                    assetId  = rsdObj.Asset__c;
                    rentalId = rsdObj.Rental_Apply_Equipment_Set__c;
                    modelNo  = rsdObj.Fixture_Model_No_text__c;
                    raesdId = rsdObj.Id;
                }
            }
        }
        // queryList に 数式項目を取得
        Savepoint sp = Database.setSavepoint();
        // 下にrollbackがあります
        System_UserSetting__c config = System_UserSetting__c.getInstance(UserInfo.getUserId());
        config.RentalApply_ByPass__c = true;
        // 組織のカスタム設定が作成してないの可能性がありますのでここでupsert
        FixtureUtil.withoutUpsertObjects(new System_UserSetting__c[]{config});
        //没有最新预计返回日用的一览
        Rental_Apply_Equipment_Set__c raes = new Rental_Apply_Equipment_Set__c(
            Rental_Apply__c = parentObj.Rental_Apply__c,
            Fixture_Set__c = parentObj.Fixture_Set__c,
            DataMigration_Flag__c = true);
        FixtureUtil.withoutInsert(new Rental_Apply_Equipment_Set__c[]{raes});
        // 数式項目値を取れるのために、一回Insertする
        List<Rental_Apply_Equipment_Set_Detail__c> tempList = new List<Rental_Apply_Equipment_Set_Detail__c>();
        for (Integer i = 0; i < queryList.size(); i++) {
            // 501を超えた場合前500のみを出す
            if (i == getSearchNumMax()) { break; }
            // 一覧のsize
            // ここnewではない、makeSelectedDataInfoのdataをcloneしてください。
            Rental_Apply_Equipment_Set_Detail__c mf = ((Rental_Apply_Equipment_Set_Detail__c) selectedData[0]).clone(false);
            // ****************注意:这里不能随意清空字段,如果要清空一定要慎重再慎重,因为保存的时候可能会把有值的字段清空掉
            // 因为检索的时候需要显示检索出来的Asset信息,所以需要清除Clone出来的值,好让数据可以的Handler里面赋成当前Asset值
            // mf.Fixture_Model_No_text__c = null; OLY_OCM-431 不设定, 设定的话 画面会显示成 代替品
            mf.SerialNumber_text__c = null;
            mf.SalesProvince_before__c = null;
            mf.Salesdepartment_before__c = null;
            mf.Product_category_text__c = null;
            mf.Equipment_Type_text__c = null;
            mf.Asset_cost_del_before__c = null;
            mf.Internal_asset_location_before__c = null;
            mf.Fixture_Name_text__c = mf.FSD_Name_CHN__c;
            mf.EquipmentSet_Managment_Code_text__c = null;
            Asset ass = (Asset)queryList[i];
            mf.Asset__c                             = ass.Id;
            /* ---------------- OLY_OCM-603 Start 最新预定归还日显示保有设备新建的公式字段 */
            // if (ass.Last_Reserve_RAES_Detail__c != null) {
                //有last的话一览为最新借出一览明细的一览(显示最新预计归还日)
                // mf.Rental_Apply_Equipment_Set__c = ass.Last_Reserve_RAES_Detail__r.Rental_Apply_Equipment_Set__c;
            // } else {
                //没有last的话一览为新建的一览(最新预计归还日为空)
                mf.Rental_Apply_Equipment_Set__c = raes.Id;
            // }
            /* ---------------- OLY_OCM-603 End */
            mf.DataMigration_Flag__c                = true;
            tempList.add(mf);
        }
        Database.SaveResult[] results = FixtureUtil.withoutInsert(tempList, false);
        final String soqlStr = 'Select {0} {1} ';
        String whereStr = ' FROM Rental_Apply_Equipment_Set_Detail__c WHERE ID in: tempList';
        String soql = String.format(soqlStr, new String[] {myComponentController.strColumus , whereStr});
        tempList = FixtureUtil.queryTempList(soql, tempList);
        if (queryList.size() != tempList.size()) {
            //error message 検索処理正しくありません、システム管理者に連絡してください。
            for (Integer i = 0; i < results.size(); i ++) {
                Database.SaveResult dmlResult = results[i];
                if (!dmlResult.isSuccess()) {
                    System.debug(System.LoggingLevel.ERROR, '第[' + (i + 1) + ']条 insert error:' + dmlResult);
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,
                    '第[' + (i + 1) + ']条 insert error:' + dmlResult));
                    // 1件目だけlogに出す
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,
                        System.Label.CreateRelationListSearchError));
                    Database.rollback(sp);
                    return;
                }
            }
        }
        // 強制ロールバックしますが、数式の値が取れたインスタンスがfsDMapに保持
        Database.rollback(sp);
        Map<String, SObject> fsDMap = new Map<String, SObject>();
        for (Rental_Apply_Equipment_Set_Detail__c fsd : tempList) {
            Rental_Apply_Equipment_Set_Detail__c robj = fsd.clone(false);
            robj.DataMigration_Flag__c = false;
            fsDMap.put(fsd.Asset__c, robj);
        }
        // queryListとfsDMapよりnew WrapperInfo()して、viewListに追加
        for (Integer i = 0; i < queryList.size(); i++) {
            // 501を超えた場合前500のみを出す
            if (i == getSearchNumMax()) { break; }
            Rental_Apply_Equipment_Set_Detail__c mf = (Rental_Apply_Equipment_Set_Detail__c) fsDMap.get(queryList[i].Id);
            viewList.add(new WrapperInfo(mf, myComponentController));
            viewList[viewList.size() - 1].lineNo = viewList.size() - 1;
            if (is2B1 && pCunFangDi != mf.Internal_asset_location__c) {
                viewList[viewList.size() - 1].canEdit = false;
            }
            groupByTargetList.add(mf);
        }
system.debug('●●●●● setViewList END ' );
        // 一覧に対して、groupbyの項目の値を取得
        Map<Id, Map<String, FixtureUtil.groupBean>> rsdMap = FixtureUtil.raesdGroupByAssetId(
                groupByTargetList, myComponentController.columus);
        for (Rental_Apply_Equipment_Set_Detail__c rsdObj : groupByTargetList) {
            Map<String, FixtureUtil.groupBean> rsdGroupInfo = rsdMap.get(rsdObj.Asset__c);
            for (String apikey : rsdGroupInfo.keySet()){
                if (apikey.indexOf('_Jia__c') >= 0) {
                    if (apikey == 'Fu_Shu_Pin_Fen_Pei_Jia__c' || apikey == 'Zhu_Ti_Fen_Pei_Jia__c') {
                        // 別途設定する
                        continue;
                    } else {
                        rsdObj.put(apikey, rsdGroupInfo.get(apikey).gnum);
                    }
                }
            }
            // 自己:分配 或者 暂定分配 了的 就是这个asset的时候
            if (sonObj.Asset__c == rsdObj.Asset__c) {
                // RAESD_Status__c 里可能会出 暂定分配
                rsdObj.Zhu_Ti_Fen_Pei_Jia__c = rsdObj.RAESD_Status__c;
            }
            // 自己是排队中 and 看别人是已分配, 的时候
            else if (sonObj.Queue_Number__c > 0
                    && rsdObj.Asset__r.Last_Reserve_RAES_Detail__r.Select_Time__c != null) {
                // 自己显示 Mei_You_Ku_Cun
                rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Mei_You_Ku_Cun.ordinal());
            }
            // 自己不是排队中 and 看别人是已分配, 的时候
            else if ((sonObj.Queue_Number__c == 0 || sonObj.Queue_Number__c == null)
                    && rsdObj.Asset__r.Last_Reserve_RAES_Detail__r.Select_Time__c != null) {
                // 自己显示 Mei_You_Ku_Cun
                rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Mei_You_Ku_Cun.ordinal());
            }
            // 自己是排队中 and 看别人是 没有分配 的时候
            else if (sonObj.Queue_Number__c > 0
                    && String.isBlank(rsdObj.Asset__r.Last_Reserve_RAES_Detail__c)
            ) {
                if (rsdObj.Asset__r.You_Xiao_Ku_Cun__c > 0) {
                    // 自己显示 Ke_Yi_Fen_Pei
                    rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Ke_Yi_Fen_Pei.ordinal());
                } else {
                    // 自己显示 Mei_You_Ku_Cun
                    rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Mei_You_Ku_Cun.ordinal());
                }
            }
            // 自己不是排队中 and 看别人是 没有分配 的时候
            else if ((sonObj.Queue_Number__c == 0 || sonObj.Queue_Number__c == null)
                    && String.isBlank(rsdObj.Asset__r.Last_Reserve_RAES_Detail__c)
            ) {
                if (rsdObj.Asset__r.You_Xiao_Ku_Cun__c > 0) {
                    // 自己显示 Ke_Yi_Fen_Pei
                    rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Ke_Yi_Fen_Pei.ordinal());
                } else {
                    // 自己显示 Mei_You_Ku_Cun
                    rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Mei_You_Ku_Cun.ordinal());
                }
            }
            // 自己是排队中 and 看别人是 暂定分配 的时候
            else if (sonObj.Queue_Number__c > 0
                    && String.isNotBlank(rsdObj.Asset__r.Last_Reserve_RAES_Detail__c)
                    && rsdObj.Asset__r.Last_Reserve_RAES_Detail__r.Select_Time__c == null
            ) {
                // 自己显示 Ke_Yi_Fen_Pei
                rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Ke_Yi_Fen_Pei.ordinal());
            }
            // 自己不是排队中 and 看别人是 暂定分配 的时候
            else if ((sonObj.Queue_Number__c == 0 || sonObj.Queue_Number__c == null)
                    && String.isNotBlank(rsdObj.Asset__r.Last_Reserve_RAES_Detail__c)
                    && rsdObj.Asset__r.Last_Reserve_RAES_Detail__r.Select_Time__c == null
            ) {
                // 自己显示 Ke_Yi_Fen_Pei
                rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Ke_Yi_Fen_Pei.ordinal());
            }
            // else: 要做到 原则不会发生  // 会后这个 TODO 有关联 ?? TODO why要看? 要看的话 另外3个别字段不看吗?
            else {
                // 以下は 念のためのロジック
                // 看别人是 (暂定分配 or 没有分配), 的时候
                if (rsdObj.Asset__r.You_Xiao_Ku_Cun__c > 0
                        && (String.isBlank(rsdObj.Asset__r.Last_Reserve_RAES_Detail__c)
                                || rsdObj.Asset__r.Last_Reserve_RAES_Detail__r.Select_Time__c == null)
                ) {
                    // 自己显示 Ke_Yi_Fen_Pei
                    rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Ke_Yi_Fen_Pei.ordinal());
                }
                else {
                    // 自己显示 Mei_You_Ku_Cun
                    rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.AssetFixtureStatus.Mei_You_Ku_Cun.ordinal());
                }
            }
            // if (rsdObj.Select_Time__c != null) {
            //     rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.HistoryStatus.Yi_Fen_Pei.ordinal());
            // } else if (rsdObj.Queue_Number__c == 0 && rsdObj.Queue_Day__c != null) {
            // // 暂定分配 未分配并且排队的第一个
            //     rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(FixtureUtil.HistoryStatus.Zan_Ding_Fen_Pei.ordinal());
            // }else if (rsdObj.Queue_Number__c > 0) {
            //     //已排队状态设值
            //     rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Pai_Dui_Zhong.ordinal());
            // } else if (rsdObj.Cancel_Select__c) {
            //     rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.raesdStatusMap.get(FixtureUtil.HistoryStatus.Qu_Xiao.ordinal());
            // }else {
            //     rsdObj.Zhu_Ti_Fen_Pei_Jia__c = FixtureUtil.assetFixtureStatusMap.get(subjectStatus);
            // }
       }
       wrapperStr = JSON.serialize(viewList);
       System.debug(LoggingLevel.INFO, '*** wrapperStr: ' + wrapperStr);
system.debug('●●●●● raesdGroupByAssetId END ' );
    }
    public String getWrapperJSON(){
        System.debug(LoggingLevel.INFO, '*** wrapperStr: ' + wrapperStr);
        return wrapperStr;
    }
    /**
     * OLY_OCM-431 raesdList 是一对一分配对象, 但是里面有之前是手动分配的已下架明细
     * 对 raesdList 进行一对一分配
     * @param raesdList select from Rental_Apply_Equipment_Set_Detail__c 找出需要分配的对象
     * @param oneToOneListMap 被分配对象 {Fixture_Model_No_F__c: [Asset.Id]}
     * @param assetKuCunMap 分配前的 Asset 的有效库存 (You_Xiao_Ku_Cun__c) {Id<Asset>: Asset{You_Xiao_Ku_Cun__c}}
     * @param fOtoMap 之前的一对一分配数也需要一起清空 + 今回の更新一对一分配的Link表
     * @param selectTime 主体的分配时间
     * @param rtnMfUpsert 更新用, 有返回的功能
     * @param rtnOldMap 重新分配 对象Map, 有返回的功能
     */
    private void oneToOneSelect(List<Rental_Apply_Equipment_Set_Detail__c> raesdList
            , Map<String, List<Fixture_OneToOne_Link__c>> oneToOneListMap
            , Map<Id, Asset> assetKuCunMap
            , Map<Id, Fixture_OneToOne_Link__c> fOtoMap
            , Datetime selectTime
            , Map<String, Rental_Apply_Equipment_Set_Detail__c> rtnMfUpsert
            , Map<Id, Rental_Apply_Equipment_Set_Detail__c> rtnOldMap) {
        List<Rental_Apply_Equipment_Set_Detail__c> rtnOldList = new List<Rental_Apply_Equipment_Set_Detail__c>();
        for (Rental_Apply_Equipment_Set_Detail__c accessoryObj : raesdList) {
            List<Fixture_OneToOne_Link__c> oneToOneAsetIdList = oneToOneListMap.get(accessoryObj.FSD_Fixture_Model_No__c);
            if (oneToOneAsetIdList == null || oneToOneAsetIdList.isEmpty()) {
                // 没有一对一了, 不分配
            } else {
                // 有一对一定义的附属品
                // 备品有效库存
                Integer num = Integer.valueof(assetKuCunMap.get(oneToOneAsetIdList[0].Accessory_Asset__c).You_Xiao_Ku_Cun__c);
                // TODO if (num < oneToOneAsetIdList.size()) {
                if (num < 1) {
                    // [' + accessoryObj.FSD_Fixture_Model_No__c + '] 的一对一定义没有足够库存,请确认一对一定义');
                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '一对一没有全部分配'));
                }
                else {
                    // 已下架, 没有出库的话的话, 要先做 重新分配
                    if (accessoryObj.StockDown__c && String.isBlank(accessoryObj.DeliverySlip__c)) {
                        // 在庫まずみない
                        rtnOldList.add(accessoryObj);
                        rtnOldMap.put(accessoryObj.Id, accessoryObj);
                        accessoryObj.Cancel_Select__c = true;
                        accessoryObj.Cancel_Reason__c = '重新分配';
                        accessoryObj.Loaner_cancel_Remarks__c = '下架后一对一重新分配';
                    }
                    // 不是已下架的话, 可以分配
                    else {
                        if (!fOtoMap.containsKey(oneToOneAsetIdList[0].Id)) {
                            oneToOneAsetIdList[0].Select_Accessory_Asset_Cnt__c = 0;
                            fOtoMap.put(oneToOneAsetIdList[0].Id, oneToOneAsetIdList[0]);
                        }
                        // 有 一对一 附属品
                        // accessoryObj.UniqueKey__c   // and UniqueKey__c != null
                        accessoryObj.Fixture_OneToOne_Link_Id__c = oneToOneAsetIdList[0].Id; // 有 remove(0), 所以取[0]
                        accessoryObj.Asset__c = oneToOneAsetIdList[0].Accessory_Asset__c;
                        accessoryObj.Select_Time__c = selectTime;      // 主体的分配时间
                        accessoryObj.Shipment_request_time2__c = null;
                        accessoryObj.Shipment_request__c = false;
                        rtnMfUpsert.put(accessoryObj.UniqueKey__c, accessoryObj);
                        Fixture_OneToOne_Link__c fot = fOtoMap.get(oneToOneAsetIdList[0].Id);
                        fot.Select_Accessory_Asset_Cnt__c += 1;
                        fOtoMap.put(oneToOneAsetIdList[0].Id, fot);
                        oneToOneAsetIdList.remove(0);
                    }
                }
            }
        }
        // 确认 rtnOldMap 还能不能一对一分配
        for (Rental_Apply_Equipment_Set_Detail__c accessoryObj : rtnOldList) {
            List<Fixture_OneToOne_Link__c> oneToOneAsetIdList = oneToOneListMap.get(accessoryObj.FSD_Fixture_Model_No__c);
            if (oneToOneAsetIdList == null || oneToOneAsetIdList.isEmpty()) {
                // 没有一对一了, 不分配
                rtnOldMap.remove(accessoryObj.Id);
            } else {
                // 有一对一定义的附属品
            }
        }
    }
    //特殊排队
    public PageReference specialScheduel(){
        List<Rental_Apply_Equipment_Set__c> mfUpdate = new List<Rental_Apply_Equipment_Set__c>();
        Savepoint sp = Database.setSavepoint();
        try {
            // 先判断当前操作用户的存放地和申请单的存放地是否一致
            if (!enableRunCheck()) {
                throw new ControllerUtil.myException('无权限操作当前单据进行排队!');
            }
            if(String.isEmpty(bieCunFangDi)){
                throw new ControllerUtil.myException('特殊排队时,请选择备品存放地');
            }
            if(bieCunFangDi != parentObj.Rental_Apply__r.Internal_asset_location_F__c){
                throw new ControllerUtil.myException('特殊排队时,不能跨备品存放地排队');
            }
            /*if(String.isEmpty(bieChanPinFenLei)){
                throw new ControllerUtil.myException('特殊排队时,产品分类必填!');
            }*/
            if(String.isEmpty(bieBeiPinFenLei)){
                throw new ControllerUtil.myException('特殊排队时,请选择备品分类');
            }
            if(bieBeiPinFenLei.contains('全部')){
                throw new ControllerUtil.myException('特殊排队时,备品分类不能选择全部!');
            }
            if(String.isEmpty(bieBenBu)){
                throw new ControllerUtil.myException('特殊排队时,请选择本部');
            }
            if(bieBenBu.contains('全部')){
                throw new ControllerUtil.myException('特殊排队时,本部不能选择全部!');
            }
            if(parentObj.Rental_Apply__r.Demo_purpose1__c == '维修代用' || parentObj.Rental_Apply__r.Demo_purpose1__c == '协议借用'){
                 throw new ControllerUtil.myException('当前使用目的不允许特殊排队!');
            }
            // 当申请人=FSE、使用目的2=学会展会时,不可以操作特殊排队
            if(parentObj.Rental_Apply__r.demo_purpose2__c == '学会展会' && parentObj.Rental_Apply__r.Owner.Profile.Name.contains('FSE')){
                 throw new ControllerUtil.myException('服务培训/学会申请单无特殊排队!');
            }
            if((bieBenBu.contains('MA本部') || bieBenBu.contains('产品培训')) && (bieBenBu.countMatches('本部') > 1 || bieBenBu.contains('备品中心'))){
                throw new ControllerUtil.myException('MA本部/产品培训本部不能与其他本部同时选择!');
            }
            if((bieBeiPinFenLei.contains('产品试用') && bieBeiPinFenLei.contains('协议借用'))
                || (bieBeiPinFenLei.contains('协议借用') && bieBeiPinFenLei.contains('维修'))
                || (bieBeiPinFenLei.contains('产品试用') && bieBeiPinFenLei.contains('维修'))){
                throw new ControllerUtil.myException('维修类、试用类、协议借用类不能同时选择!');
            }
            if(parentObj.Rental_Apply__r.Demo_purpose1__c == '产品试用'
                && (bieBeiPinFenLei.contains('协议借用') || bieBeiPinFenLei.contains('维修'))){
                throw new ControllerUtil.myException('产品试用的申请单,不可以选择维修类、协议借用类的备品分类');
            }
            if((parentObj.Rental_Apply__r.demo_purpose2__c == '试用(无询价)'
                    || parentObj.Rental_Apply__r.demo_purpose2__c == '试用(有询价)'
                    || parentObj.Rental_Apply__r.demo_purpose2__c == '已购待货'
                    || parentObj.Rental_Apply__r.demo_purpose2__c == '新产品评价')
                && sonObj.Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c == '新产品') {
                throw new ControllerUtil.myException('不能参与特殊排队');
            }
            startQueue('特殊排队');
            if(allSpecialQueue() && parentObj.Rental_Apply__r.CampaignType__c != null){
                Rental_Apply__c raObj = new Rental_Apply__c();
                raObj.Id = parentObj.Rental_Apply__c;
                raObj.CampaignType__c = null;
                update raObj;
            }
        } catch (Exception e) {
            System.debug('e.getMessage()***'+ e.getMessage());
            ApexPages.addMessages(e);
            Database.rollback(sp);
            return null;
        }
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'排队成功'));
        // 排队成功后,加载排队画面
        queueByAsset = '/apex/QueuePageByAssetId?parentId=' + parentObj.Id + '&isNotShow=' + true;
        // 排队成功后,需要重新获取sonObj和parentObj
        List<Rental_Apply_Equipment_Set_Detail__c> raesdObjs = [
                SELECT Id, Rental_Apply_Equipment_Set__c, Asset__c, Queue_Day__c,
                       FSD_Fixture_Model_No__c, Fixture_Model_No_text__c, QuenType__c,
                       Is_Body__c, FSD_Is_OneToOne__c, Select_Time__c, ExternalKey__c,Rental_Apply__c,
                       Cancel_Select__c, Fixture_Model_No_F__c, Queue_Number__c, Internal_asset_location__c,
                       Salesdepartment__c, Product_category_F__c, Equipment_Type__c, Rental_Apply__r.Internal_asset_location_F__c,
                       Cancel_Reason__c,Loaner_cancel_reason__c,Loaner_cancel_Remarks__c,
                       Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c,
                       Salesdepartment_before__c, Equipment_Type_text__c, Product_category_text__c
                 FROM Rental_Apply_Equipment_Set_Detail__c
                WHERE Rental_Apply_Equipment_Set__c = :parentId
                  and Is_Body__c = true
                  and Cancel_Select__c = false];
        if (!raesdObjs.isEmpty()) {
            sonObj = raesdObjs[0];
            List<Rental_Apply_Equipment_Set__c> parentObjs = [
                    SELECT Id, Rental_Apply__r.Name,
                           Rental_Apply__r.Owner.Name,
                           Rental_Apply__r.Owner.Profile.Name,
                           Rental_Apply__r.Salesdept__c,
                           Rental_Apply__r.WorkPlace__c,
                           Rental_Apply__r.Request_shipping_day__c,
                           Fu_Shu_Pin_Fen_Pei_Jia__c,
                           Rental_Apply__r.Demo_purpose1__c,
                           Rental_Apply__r.demo_purpose2__c,
                           Rental_Apply__r.CampaignType__c,
                           Fixture_Set__r.Product_Category_GI_SP__c,
                           Fixture_Set__r.Equipment_Type__c,
                           Rental_Apply__r.Request_return_day__c,
                           Rental_Apply__r.Salesdepartment__c,
                           Rental_Apply__r.Equipment_Type_F__c,
                           Rental_Apply__r.Internal_asset_location_F__c,
                           Fixture_Set__r.Fixture_Set_Body_Model_No__c,
                           Rental_Apply__r.Product_category__c,
                           Rental_Apply__r.Loaner_centre_mail_address__c,
                           First_RAESD__r.Is_Body__c,
                           Irreplaceable_flag__c,
                           Rental_Start_Date__c,
                           Rental_End_Date__c,
                           Rental_Apply__c,
                           Fixture_Set__c,
                           RequestNoJoinStr2__c
                    FROM Rental_Apply_Equipment_Set__c
                    where Id = :parentId];
            if (!parentObjs.isEmpty()) {
                parentObj = parentObjs.get(0);
            }
        }
        return null;
    }
    //默认排队
    public PageReference defaultScheduel(){
        Savepoint sp = Database.setSavepoint();
        try {
            // 先判断当前操作用户的存放地和申请单的存放地是否一致
            if (!enableRunCheck()) {
                throw new ControllerUtil.myException('无权限操作当前单据进行排队!');
            }
            if(parentObj.Rental_Apply__r.demo_purpose2__c == '学会展会'
                && !(parentObj.Rental_Apply__r.Salesdepartment__c.contains('MA本部')
                    || parentObj.Rental_Apply__r.Salesdepartment__c.contains('产品培训'))
                && String.isEmpty(campaignType)){
                throw new ControllerUtil.myException('请选择学会类型!');
            }
            if(sonObj.QuenType__c == '默认排队'
                && sonObj.Queue_Number__c > 0
                && sonObj.Queue_Day__c != null
                && campaignType == parentObj.Rental_Apply__r.CampaignType__c){
                throw new ControllerUtil.myException('已参与默认排队');
            }
            startQueue('默认排队');
        }
        catch (Exception e) {
            System.debug('e.getMessage()***'+ e.getMessage());
            ApexPages.addMessages(e);
            Database.rollback(sp);
            return null;
        }
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'排队成功'));
        // 排队成功后,加载排队画面
        queueByAsset = '/apex/QueuePageByAssetId?parentId=' + parentObj.Id + '&isNotShow=' + true;
        // 排队成功后,需要重新获取sonObj和parentObj
        List<Rental_Apply_Equipment_Set_Detail__c> raesdObjs = [
                SELECT Id, Rental_Apply_Equipment_Set__c, Asset__c, Queue_Day__c,
                       FSD_Fixture_Model_No__c, Fixture_Model_No_text__c, QuenType__c,
                       Is_Body__c, FSD_Is_OneToOne__c, Select_Time__c, ExternalKey__c,Rental_Apply__c,
                       Cancel_Select__c, Fixture_Model_No_F__c, Queue_Number__c, Internal_asset_location__c,
                       Salesdepartment__c, Product_category_F__c, Equipment_Type__c, Rental_Apply__r.Internal_asset_location_F__c,
                       Cancel_Reason__c,Loaner_cancel_reason__c,Loaner_cancel_Remarks__c,
                       Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c,
                       Salesdepartment_before__c, Equipment_Type_text__c, Product_category_text__c
                 FROM Rental_Apply_Equipment_Set_Detail__c
                WHERE Rental_Apply_Equipment_Set__c = :parentId
                  and Is_Body__c = true
                  and Cancel_Select__c = false];
        if (!raesdObjs.isEmpty()) {
            sonObj = raesdObjs[0];
            List<Rental_Apply_Equipment_Set__c> parentObjs = [
                    SELECT Id, Rental_Apply__r.Name,
                           Rental_Apply__r.Owner.Name,
                           Rental_Apply__r.Owner.Profile.Name,
                           Rental_Apply__r.Salesdept__c,
                           Rental_Apply__r.WorkPlace__c,
                           Rental_Apply__r.Request_shipping_day__c,
                           Fu_Shu_Pin_Fen_Pei_Jia__c,
                           Rental_Apply__r.Demo_purpose1__c,
                           Rental_Apply__r.demo_purpose2__c,
                           Rental_Apply__r.CampaignType__c,
                           Fixture_Set__r.Product_Category_GI_SP__c,
                           Fixture_Set__r.Equipment_Type__c,
                           Rental_Apply__r.Request_return_day__c,
                           Rental_Apply__r.Salesdepartment__c,
                           Rental_Apply__r.Equipment_Type_F__c,
                           Rental_Apply__r.Internal_asset_location_F__c,
                           Fixture_Set__r.Fixture_Set_Body_Model_No__c,
                           Rental_Apply__r.Product_category__c,
                           Rental_Apply__r.Loaner_centre_mail_address__c,
                           First_RAESD__r.Is_Body__c,
                           Irreplaceable_flag__c,
                           Rental_Start_Date__c,
                           Rental_End_Date__c,
                           Rental_Apply__c,
                           Fixture_Set__c,
                           RequestNoJoinStr2__c
                    FROM Rental_Apply_Equipment_Set__c
                    where Id = :parentId];
            if (!parentObjs.isEmpty()) {
                parentObj = parentObjs.get(0);
            }
        }
        return null;
    }
    // 判断当前操作用户的存放地和申请单的存放地是否一致
    public Boolean enableRunCheck() {
        // 用户分公司:北京,上海,广州
        User u = [SELECT Id, Branch__c FROM User WHERE Id =:UserInfo.getUserId() Limit 1];
        // 申请单 申请者Email
        if (FixtureUtil.locationMap.get(u.Branch__c + ' 备品中心') != parentObj.Rental_Apply__r.Loaner_centre_mail_address__c) {
            return false;
        } else {
            return true;
        }
        return false;
    }
    //排队No置顶
    public PageReference topInLine(){
        Savepoint sp = Database.setSavepoint();
        try {
            QueuePageByAssetIdController qpbaController = new QueuePageByAssetIdController();
            qpbaController.saveQueue(sonObj, 1, true, false);
        }
        catch (Exception e) {
            System.debug('e.getMessage()***'+ e.getMessage()+e.getLineNumber());
            ApexPages.addMessages(e);
            Database.rollback(sp);
            return null;
        }
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'排队置顶成功'));
        return null;
    }
    // 如果默认分配改为特殊排队了,需要确认申请单中所有的一览是否都没有默认排队
    public Boolean allSpecialQueue(){
        List<Rental_Apply_Equipment_Set_Detail__c> details = [SELECT Id
                                                                FROM Rental_Apply_Equipment_Set_Detail__c
                                                                WHERE Rental_Apply__c =: parentObj.Rental_Apply__c
                                                                  AND Cancel_Select__c = false
                                                                  AND Is_Body__c = true
                                                                  AND QuenType__c = '默认排队'];
        if (details != null && details.size() > 0) {
            return false;
        }
        return true;
    }
    public void startQueue(String queuetype){
        System.debug(LoggingLevel.INFO, '*** queuetype: ' + queuetype);
        // 查询排队需要处理的数据
        List<Rental_Apply_Equipment_Set_Detail__c> raesdObjs = [
                SELECT Id, Rental_Apply_Equipment_Set__c, Asset__c,Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c,
                       FSD_Fixture_Model_No__c, Fixture_Model_No_text__c,Rental_Apply__r.demo_purpose2__c,Queue_Day__c,ExternalKey__c,
                       Is_Body__c, FSD_Is_OneToOne__c, Select_Time__c,Rental_Apply__r.EquipmentGuaranteeFlg__c,Allow_Adjust_Queue_Flag__c,
                       Cancel_Select__c, Fixture_Model_No_F__c, Queue_Number__c, Internal_asset_location__c,Fixture_Model_No__c,Rental_Apply__c,
                       Internal_asset_location_before__c,Salesdepartment__c, Product_category_F__c, Product_category_text__c,Equipment_Type_text__c,
                       Salesdepartment_before__c,Rental_Apply__r.Request_shipping_day__c,QuenType__c,IsAdjust__c,Rental_Apply__r.Request_approval_time__c,
                       Equipment_Type__c, Rental_Apply__r.Internal_asset_location_F__c,Cancel_Reason__c,Loaner_cancel_reason__c,Loaner_cancel_Remarks__c,
                       Queue_Time_F__c, IndexFromUniqueKey__c
                FROM Rental_Apply_Equipment_Set_Detail__c
                WHERE Rental_Apply_Equipment_Set__c =:parentObj.Id
                AND Cancel_Select__c = false
                AND Is_Body__c = true
                FOR Update];
        if(queuetype == '默认排队'){
            if(changeCampaignType){
                List<Rental_Apply_Equipment_Set_Detail__c> oldQueenList = [
                        SELECT Id, Rental_Apply_Equipment_Set__c, Asset__c,Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c,
                               FSD_Fixture_Model_No__c, Fixture_Model_No_text__c,Rental_Apply__r.demo_purpose2__c,Queue_Day__c,ExternalKey__c,
                               Is_Body__c, FSD_Is_OneToOne__c, Select_Time__c,Rental_Apply__r.EquipmentGuaranteeFlg__c,Allow_Adjust_Queue_Flag__c,
                               Cancel_Select__c, Fixture_Model_No_F__c, Queue_Number__c, Internal_asset_location__c,Fixture_Model_No__c,Rental_Apply__c,
                               Internal_asset_location_before__c,Salesdepartment__c, Product_category_F__c, Product_category_text__c,Equipment_Type_text__c,
                               Salesdepartment_before__c,Rental_Apply__r.Request_shipping_day__c,QuenType__c,IsAdjust__c,Rental_Apply__r.Request_approval_time__c,
                               Equipment_Type__c, Rental_Apply__r.Internal_asset_location_F__c,Cancel_Reason__c,Loaner_cancel_reason__c,Loaner_cancel_Remarks__c,
                               Queue_Time_F__c, IndexFromUniqueKey__c
                        FROM Rental_Apply_Equipment_Set_Detail__c
                        WHERE Rental_Apply__c =: parentObj.Rental_Apply__c
                        AND Id !=: sonObj.Id
                        AND QuenType__c = '默认排队'
                        AND Queue_Number__c > 0
                        AND Cancel_Select__c = false
                        AND Is_Body__c = true
                        FOR Update];
                raesdObjs.addAll(oldQueenList);
            }
            // 学会类型发生变化时,更新申请单
            if (campaignType != parentObj.Rental_Apply__r.CampaignType__c) {
                Rental_Apply__c raObj = new Rental_Apply__c();
                raObj.Id = parentObj.Rental_Apply__c;
                raObj.CampaignType__c = campaignType;
                update raObj;
            }
        }
        List<String> modelList = new List<String>();
        List<String> departmentsList = new List<String>();
        List<String> departmentList = new List<String>();
        List<String> locationList = new List<String>();
        List<String> categoryList = new List<String>();
        List<String> equipmentList = new List<String>();
        List<String> equipmentsList = new List<String>();
        List<String> locationsetList = new List<String>();
        List<String> sequencekeylist = new List<String>();
        List<String> detailIds = new List<String>();
        List<String> queuekeyList = new List<String>();
        List<Rental_Apply_Sequence__c> allsequenceList = new List<Rental_Apply_Sequence__c>();
        Map<String,List<Rental_Apply_Equipment_Set_Detail__c>> detailMap = new Map<String,List<Rental_Apply_Equipment_Set_Detail__c>>();
        List<String> queueIds = new List<String>();
        List<Rental_Apply_Equipment_Set_Detail__c> updateList = new List<Rental_Apply_Equipment_Set_Detail__c>();
        List<String> changeddetailIds = new List<String>();
        for (Rental_Apply_Equipment_Set_Detail__c raesd : raesdObjs) {
            String oldKey = raesd.ExternalKey__c;
            // 改变学会类型,会改变本申请单中已默认排队的其余一览,所以校验放在此处
            String modelType = raesd.Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c;
            if(modelType == null && queuetype == '默认排队'
                && (parentObj.Rental_Apply__r.demo_purpose2__c == '试用(无询价)'
                    || parentObj.Rental_Apply__r.demo_purpose2__c == '试用(有询价)'
                    || parentObj.Rental_Apply__r.demo_purpose2__c == '已购待货'
                    || parentObj.Rental_Apply__r.demo_purpose2__c == '新产品评价'
                    || (parentObj.Rental_Apply__r.demo_purpose2__c == '学会展会' && campaignType == '营业本部学会'))){
                throw new ControllerUtil.myException('备品产品类型为空!');
            }
            RentalFixtureSetAssignController.KeyObj obj = null;
            if(queuetype == '默认排队'){
                RentalFixtureSetAssignController.ApplyObj applyObj = new RentalFixtureSetAssignController.ApplyObj();
                applyObj.location = parentObj.Rental_Apply__r.Internal_asset_location_F__c;
                applyObj.productType = parentObj.Rental_Apply__r.Product_category__c;
                applyObj.salesdepartment = parentObj.Rental_Apply__r.Salesdepartment__c ;
                applyObj.purpose1 = parentObj.Rental_Apply__r.Demo_purpose1__c;
                applyObj.purpose2 = parentObj.Rental_Apply__r.demo_purpose2__c;
                applyObj.campaignType = campaignType;
                obj = RentalFixtureSetAssignController.getdefultInfo(raesd,applyObj,bieCunFangDi);
                // 排队后,默认排队值需要在画面端显示  本部
                bieBenBu = obj.salesdepartments;
                // 排队后,默认排队值需要在画面端显示  备品分类
                bieBeiPinFenLei = obj.equipmenttypes;
                // 备品存放地和产品分类默认是申请单上的数据,不用特意设置
            }else{
                RentalFixtureSetAssignController.KeyObj keyObj = new RentalFixtureSetAssignController.KeyObj();
                keyObj.model = raesd.Fixture_Model_No__c;
                keyObj.location = parentObj.Rental_Apply__r.Internal_asset_location_F__c;
                keyObj.productType = String.isBlank(bieChanPinFenLei)?'GI,SP':bieChanPinFenLei;
                System.debug('bieBeiPinFenLei===========================' + bieBeiPinFenLei);
                keyObj.equipmenttypes = bieBeiPinFenLei;
                keyObj.salesdepartments = bieBenBu;
                RentalFixtureSetAssignController.getsequencekeyList(keyObj);
                obj = keyObj;
                System.debug('obj.equipmenttypes===========================' + obj.equipmenttypes);
                System.debug('obj.sequencekeyList===========================' + obj.sequencekeyList);
            }
            queueIds.add(raesd.Id);
            // keyObjMap.put(raesd.Id,obj);
            modelList.add(obj.model);
            departmentsList.addAll(obj.salesdepartmentList);
            locationList.add(obj.location);
            equipmentsList.addAll(obj.equipmentList);
            categoryList.addAll(obj.productTypes);
            sequencekeylist.addAll(obj.sequencekeylist);
            String key = obj.model + obj.location + obj.salesdepartments + obj.equipmenttypes + obj.productType;
            if(key == oldKey){
                changeddetailIds.add(raesd.Id);
            }
            // 备品配套明细型号(借出时)
            raesd.Fixture_Model_No_text__c = obj.model;
            // 所在地区(本部) 借出时
            raesd.Salesdepartment_before__c = obj.salesdepartments;
            // 产品分类(GI/SP)(借出时)
            raesd.Product_category_text__c = obj.productType;
            // 备品分类(借出时)
            raesd.Equipment_Type_text__c = obj.equipmenttypes;
            // 备品存放地(借出时)
            raesd.Internal_asset_location_before__c = obj.location;
            raesd.ExternalKey__c = key;
            raesd.QuenType__c = queuetype;
            raesd.Queue_User__c   = UserInfo.getUserId();
            raesd.Queue_Day__c    = Date.today();
            raesd.Queue_Time__c   = getCurrentTime();
            raesd.Select_Time__c  = null;
            raesd.Asset__c        = null;
            // 已出库指示的排队后清除出库指示信息
            raesd.Shipment_request_time2__c = null;
            raesd.Shipment_request__c = false;
            raesd.Queue_Number__c = -1;
            raesd.IsAdjust__c     = false;
            // OLY_OCM-243 追加字段对应 备品管理编码(借出时) 排队时清除与asset相连的借出时相关的字段
            raesd.EquipmentSet_Managment_Code_text__c = null;
            // 机身编号(借出时)
            raesd.SerialNumber_text__c = null;
            // 备品成本(借出时)
            raesd.Asset_cost_del_before__c = null;
            detailIds.add(raesd.Id);
            updateList.add(raesd);
            // KeyObj obj = keyObjMap.get(raesd.Id);
            System.debug(LoggingLevel.INFO, '*** KeyObj obj: ' + obj);
            for(String sales:obj.salesdepartmentList){
                for(String equip:obj.equipmentList){
                    for(String type:obj.productTypes){
                        Rental_Apply_Sequence__c newSequence = new Rental_Apply_Sequence__c();
                        newSequence.ExternalKey__c = obj.model + obj.location + sales + equip + type;
                        newSequence.Demo_Purpose2__c = raesd.Rental_Apply__r.demo_purpose2__c;
                        newSequence.Apply_Set_Detail__c = raesd.Id;
                        newSequence.Series_No__c = raesd.Queue_Number__c;
                        newSequence.Salesdepartment__c = sales;
                        newSequence.Product_category__c = type;
                        newSequence.Rental_Apply__c = raesd.Rental_Apply__c;
                        newSequence.Internal_asset_location__c = obj.location;
                        newSequence.Fixture_Model_No__c = obj.model;
                        newSequence.Equipment_Type__c = equip;
                        allsequenceList.add(newSequence);
                    }
                }
            }
            queuekeyList.add(key);
            departmentList.addAll(RentalFixtureSetAssignController.transferStringToList(obj.salesdepartments));
            equipmentList.addAll(RentalFixtureSetAssignController.transferStringToList(obj.equipmenttypes));
        }
        System.debug(LoggingLevel.INFO, '**1111* updateList: ' + updateList);
        System.debug(LoggingLevel.INFO, '*** queueIds: ' + queueIds);
        System.debug(LoggingLevel.INFO, '*** modelList: ' + modelList);
        System.debug(LoggingLevel.INFO, '*** departmentsList: ' + departmentsList);
        System.debug(LoggingLevel.INFO, '*** locationList: ' + locationList);
        System.debug(LoggingLevel.INFO, '*** categoryList: ' + categoryList);
        System.debug(LoggingLevel.INFO, '*** equipmentList: ' + equipmentList);
        String soqlStr = 'Select Id, Last_Reserve_RAES_Detail__c, Fixture_Model_No_F__c, You_Xiao_Ku_Cun__c,'
                    + ' Salesdepartment__c, SalesProvince__c, Product_category__c, Equipment_Type__c, Internal_asset_location__c'
                     + ' From Asset '
                    + ' Where Asset_Owner__c = \'Olympus\''
                    + ' and Asset_loaner_category__c != \'耗材\''
                    + ' and RecordTypeId = \'01210000000kOPR\''
                    + ' and Delete_Flag__c = False'
                    + ' and Freeze_sign_Abandoned_Flag__c = False'
                    + ' and Product2.Fixture_Model_No_T__c IN:modelList'
                    + ' and Salesdepartment__c IN: departmentsList'
                    + ' and Internal_asset_location__c IN: locationList'
                    + ' and Product_category__c IN:categoryList'
                    + ' and Equipment_Type__c IN: equipmentList'
                    + ' and ' + FixtureUtil.getAssetSoqlBase()
                    + ' order by Id';
        // 检索符合这四个别字段和同一产品型号的数据存在与否
        System.debug(LoggingLevel.INFO, '*** soqlStr: ' + soqlStr);
        List<Asset> aSetCheck = Database.query(soqlStr);
        for (Asset ass : aSetCheck) {
            String key = ass.Fixture_Model_No_F__c + ass.Internal_asset_location__c + ass.Salesdepartment__c + ass.Equipment_Type__c + ass.Product_category__c;
            System.debug(LoggingLevel.INFO, '*** key: ' + key);
            if (ass.Last_Reserve_RAES_Detail__c == null && ass.You_Xiao_Ku_Cun__c > 0) {
                throw new ControllerUtil.myException(ass.Fixture_Model_No_F__c +' 有可以分配主体不需要排队');
            }
        }
        System.debug(LoggingLevel.INFO, '*** queuekeyList: ' + queuekeyList);
        Map<String,List<Rental_Apply_Equipment_Set_Detail__c>> queueMap = new Map<String,List<Rental_Apply_Equipment_Set_Detail__c>>();
        List<Rental_Apply_Equipment_Set_Detail__c> queueList = [SELECT Id, Rental_Apply_Equipment_Set__c, Asset__c,Rental_Apply_Equipment_Set__r.Fixture_Set__r.Product_Type__c,
                                                                   FSD_Fixture_Model_No__c, Fixture_Model_No_text__c,Externalkey__c,Rental_Apply__r.demo_purpose2__c,Equipment_Type_text__c,
                                                                   Is_Body__c, FSD_Is_OneToOne__c, Select_Time__c,Rental_Apply__r.EquipmentGuaranteeFlg__c,Fixture_Model_No__c,
                                                                   Cancel_Select__c, Fixture_Model_No_F__c, Queue_Number__c, Internal_asset_location__c,IsAdjust__c,Queue_Day__c,Queue_Time__c,
                                                                   Salesdepartment__c, Product_category_F__c, Equipment_Type__c, Rental_Apply__r.Internal_asset_location_F__c,
                                                                   Cancel_Reason__c,Loaner_cancel_reason__c,Loaner_cancel_Remarks__c ,Rental_Apply__r.Request_shipping_day__c,Rental_Apply__r.Request_approval_time__c,
                                                                   Queue_Time_F__c,IndexFromUniqueKey__c
                                                            FROM Rental_Apply_Equipment_Set_Detail__c
                                                            WHERE Externalkey__c IN :queuekeyList
                                                            AND Cancel_Select__c = false
                                                            AND Is_Body__c = true
                                                            AND Id NOT IN:queueIds
                                                            AND Queue_Number__c > 0
                                                            FOR Update];
        updateList.addAll(queueList);
        System.debug(LoggingLevel.INFO, '***old updateList: ' + updateList.size());
        updateList = Batch_QueueAllDetail.getSortDetailList(updateList);
        System.debug(LoggingLevel.INFO, '*** updateList: ' + updateList.size());
        update updateList;
        System.debug(LoggingLevel.INFO, '*** allsequenceList: ' + allsequenceList.size());
        List<Rental_Apply_Sequence__c> oldSequenceList = [SELECT Id,ExternalKey__c,Fixture_Model_No__c FROM Rental_Apply_Sequence__c
                                                        WHERE Apply_Set_Detail__c IN:detailIds];
        System.debug(LoggingLevel.INFO, '*** oldSequenceList.size(): ' + oldSequenceList.size());
        Set<String> keys = new Set<String>();
        for(Rental_Apply_Sequence__c se:oldSequenceList){
            keys.add(se.ExternalKey__c);
        }
        Integer count = [SELECT count() FROM Rental_Apply_Sequence__c WHERE ExternalKey__c IN:keys];
        if(updateList.size() + count + oldSequenceList.size() > 9900){
            throw new ControllerUtil.myException('当前排队数据量过大,请稍后操作');
        }
        List<Rental_Apply_Sequence__c> olddleteSequenceList = [SELECT Id,ExternalKey__c,Fixture_Model_No__c FROM Rental_Apply_Sequence__c
                                                        WHERE Apply_Set_Detail__c IN:changeddetailIds];
        delete olddleteSequenceList;
        if(updateList.size() + count + oldSequenceList.size() + allsequenceList.size() > 9900){
            throw new ControllerUtil.myException('当前排队数据量过大,请稍后操作');
        }
        insert allsequenceList;
        List<String> newSequenceIds = new List<String>();
        for(Rental_Apply_Sequence__c se:allsequenceList){
            newSequenceIds.add(se.Id);
        }
        allsequenceList = [SELECT Id,ExternalKey__c,Demo_Purpose2__c,Rental_Apply__r.Request_shipping_day__c,Rental_Apply__r.EquipmentGuaranteeFlg__c,
                                    Apply_Set_Detail__c,Apply_Set_Detail_ExternalKey__c,Rental_Apply__r.Request_approval_time__c,Apply_Set_Detail__r.IsAdjust__c,
                                    Series_No__c,Salesdepartment__c,Product_category__c,Apply_Set_Detail__r.Queue_Day__c,Apply_Set_Detail__r.Queue_Time__c,
                                    Rental_Apply__c,Internal_asset_location__c,Series_Unequal_Queue_Flag__c,
                                    Apply_Set_Detail__r.Queue_Number__c,
                                    Fixture_Model_No__c,Equipment_Type__c,
                                    Apply_Set_Detail__r.Queue_Time_F__c,
                                    Apply_Set_Detail__r.IndexFromUniqueKey__c
                            FROM Rental_Apply_Sequence__c
                            WHERE Id IN:newSequenceIds];
        List<String> nodusequencekeylist = new List<String>(new Set<String>(sequencekeylist));
        System.debug(LoggingLevel.INFO, '*** nodusequencekeylist: ' + JSON.serialize(nodusequencekeylist));
        System.debug(LoggingLevel.INFO, '*** nodusequencekeylist.size(): ' + nodusequencekeylist.size());
        if(nodusequencekeylist.size() > 950){
            throw new ControllerUtil.myException('当前排队数据量过大,请选择单个主体操作');
        }
        List<Rental_Apply_Sequence__c> updateSequenceList = new List<Rental_Apply_Sequence__c>();
        List<Rental_Apply_Sequence__c> newSequenceList = new List<Rental_Apply_Sequence__c>();
        List<Rental_Apply_Sequence__c> applysequenceList = [SELECT Id,ExternalKey__c,Demo_Purpose2__c,Rental_Apply__r.Request_shipping_day__c,Rental_Apply__r.EquipmentGuaranteeFlg__c,
                                                                Apply_Set_Detail__c,Apply_Set_Detail_ExternalKey__c,Rental_Apply__r.Request_approval_time__c,Apply_Set_Detail__r.IsAdjust__c,
                                                                Series_No__c,Salesdepartment__c,Product_category__c,Apply_Set_Detail__r.Queue_Day__c,Apply_Set_Detail__r.Queue_Time__c,
                                                                Rental_Apply__c,Internal_asset_location__c,Series_Unequal_Queue_Flag__c,
                                                                Apply_Set_Detail__r.Queue_Number__c,
                                                                Fixture_Model_No__c,Equipment_Type__c,
                                                                Apply_Set_Detail__r.Queue_Time_F__c,
                                                                Apply_Set_Detail__r.IndexFromUniqueKey__c
                                                        FROM Rental_Apply_Sequence__c
                                                        WHERE ExternalKey__c IN: nodusequencekeylist
                                                        AND Series_No__c > 0
                                                        AND Invalid_Flag__c = false
                                                        FOR Update];
        // System.debug(LoggingLevel.INFO, '*** JSON.serialize(applysequenceList): ' + JSON.serialize(applysequenceList));
        newSequenceList.addAll(applysequenceList);
        newSequenceList.addAll(allsequenceList);
        System.debug(LoggingLevel.INFO, '*** newSequenceList.size(): ' + newSequenceList.size());
        newSequenceList = Batch_QueueAllDetail.getSortSequenceList(newSequenceList);
        if(updateList.size() + count + oldSequenceList.size() + allsequenceList.size() + newSequenceList.size() > 9900){
            throw new ControllerUtil.myException('当前排队数据量过大,请选择单个主体操作');
        }
        System.debug(LoggingLevel.INFO, '*** newSequenceList: ' + newSequenceList);
        upsert newSequenceList;
    }
}
force-app/main/default/components/RelationListPagingCmp.component
@@ -379,24 +379,19 @@
        sbwidth = scrollbarWidth();
        i++;
        tableWidth = j$('body .pbBody table#tableHeader').width();
        // var widthTemp = 0;
        j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
            var colClass = getColClassName(this);
            if (colClass != 'col_Scroll') {
                var temp = j$('body .pbBody table.list tr.headerRow td.' + colClass).width();
                listColClassWidthMap[colClass] = temp;
                //widthTemp += temp;
            }
        });
        var blockWidthNew = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width()-sbwidth;
        // console.log(widthTemp+'~'+blockWidthNew+'~'+tableWidth);
        // var blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width()-sbwidth;
        var blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width() - widthAjustment - sbwidth - 20;
        var tableHeader_L =  j$(escapeVfId('tableHeader_L')).width();
        console.log('~'+tableHeader_L);
        j$('div#in_Div_L').css('width', tableHeader_L+ 'px'); 
        j$('table#tableData_L').css('width', tableHeader_L + 'px');
        // j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
        if(tableWidth > blockWidthNew){
            j$('div#in_Div').css('width', blockWidthNew + 'px'); // 20230519 ljh
            j$('div#out_Div').css('width', blockWidthNew + 'px'); // 20230519 ljh
        console.log('tableWidth:'+tableWidth+'blockWidth:'+blockWidth);
        if(tableWidth > blockWidth){
            console.log('111');
            j$('div#in_Div').css('width', blockWidth+ 'px'); // 20230519 ljh +20
            j$('div#out_Div').css('width', blockWidth + 'px'); // 20230519 ljh
            j$('table#tableHeader').css('width', tableWidth + 'px'); // 20230725 ljh
            j$('table#tableData').css('width', tableWidth + 'px'); // 20230725 ljh
        }
        j$('div#in_Div').scroll(function() {
            j$('div#out_Div').scrollLeft(j$(this).scrollLeft());
@@ -407,6 +402,15 @@
        });
        j$('div#in_Div_L').scroll(function() {
            j$('div#in_Div').scrollTop(j$(this).scrollTop());
        });
        j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
            var colClass = getColClassName(this);
            if (colClass != 'col_Scroll') {
                var temp = j$('body .pbBody table.list tr.headerRow td.' + colClass).width();
                console.log('colClass'+temp);
                listColClassWidthMap[colClass] = temp;
            }
        });
       
    }
@@ -480,4 +484,4 @@
</script>
        </apex:outputPanel>
    <!-- </apex:form> -->
</apex:component>
</apex:component>
force-app/main/default/components/RelationListPagingCmp.component.bak
New file
@@ -0,0 +1,483 @@
<apex:component controller="CreateRelationListPagingCmpCtrl" allowDML="true" id="cmpinnerid" >
    <!-- <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> -->
    <apex:stylesheet value="{!URLFOR($Resource.RelationListPagingCmpCss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <style>
        /*URLFOR($Resource なのでRelationListPagingCmpCssに入れません*/
        body .pbBody table.list tr.headerRow td.colViewing {
          /* デフォルト値、最小化アイコンを表示 */
          background-image:url('{!URLFOR($Resource.IconResizeMinus_5)}') ;
          background-repeat:no-repeat;
        }
        body .pbBody table.list tr.headerRow td.colUnHideIcon {
          /* 最大化アイコンを表示 */
          background-image:url('{!URLFOR($Resource.IconResizePlus_5)}');
          background-repeat:no-repeat;
        }
    </style>
    <apex:attribute name="pgController"
        type="CreateRelationListPagingCtrlBase"
        assignTo="{!pageController}"
        required="true"
        description="The controller for the page." />
    <apex:attribute name="hasCheckbox"
        type="Boolean"
        assignTo="{!hasChkBox}"
        required="true"
        description="Set If List Row able to be checked." />
    <apex:attribute name="noSort"
        type="Boolean"
        assignTo="{!noSortHeader}"
        required="false"
        default="true"
        description="Set If Dont need Sort" />
    <apex:attribute name="isRadio"
        type="Boolean"
        assignTo="{!isRadioBox}"
        required="false"
        description="Set if need selectRadio not inputCheckbox" />
    <apex:attribute name="bottomSpace"
        type="Integer"
        assignTo="{!bottomSp}"
        required="false"
        description="Set if need more bottomSpace" />
    <apex:attribute name="tabStyle"
        type="String"
        assignTo="{!tabS}"
        required="false"
        description="Set if need Set dataBlock's tabStyle" />
    <apex:attribute name="userCPaging"
        type="Boolean"
        assignTo="{!userCustomPaging}"
        required="false"
        default="false"
        description="Set if need Set Use CustomPaging" />
    <!-- <apex:form id="allForm"> -->
        <apex:actionFunction action="{!init}" name="init" rerender="allPanel, message, checEventFrame, canGoPage" oncomplete="unblockUI();windowResize();runSFDCAddRemote({!MetadataConnectionWarning});"/>
        <apex:actionFunction action="{!searchPrevious}" name="searchPrevious" rerender="allPanel, message, checEventFrame" status="statusPreload"  oncomplete="unblockUI();windowResize();"/>
        <apex:actionFunction action="{!searchNext}" name="searchNext" rerender="allPanel, message, checEventFrame" status="statusPreload"  oncomplete="unblockUI();windowResize();"/>
        <apex:actionFunction action="{!searchGoPage}" name="searchGoPage" rerender="allPanel, message, checEventFrame" status="statusPreload"  oncomplete="unblockUI();windowResize();"/>
        <!-- ToDoエラー表示確認message -->
        <apex:actionFunction name="sortTablefunc" action="{!sortTable}" rerender="allPanel, message, checEventFrame" status="statusPreload" onComplete="unblockUI();windowResize();">
            <apex:param name="sortKey" value="" />
        </apex:actionFunction>
        <apex:outputPanel id="allPanel">
            <apex:pageBlock id="dataBlock" tabStyle="{!IF(tabS<>null,tabS,'Report')}">
                <apex:outputPanel >
                    <!-- 総件数 -->
                    <apex:inputHidden id="recordAllCount" value="{!recordAllCount}"/> <!-- recordAllCount画面上で設定します?しなければinputHiddenを使わないでください -->
                    <apex:inputHidden id="currentPageRecordCnt" value="{!currentPageRecordCnt}"/>
                    <!-- 左 ヘッダ -->
                    <div id="out_Div_L">
                        <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;table-layout:fixed" border="" id="tableHeader_L">
                            <!-- 20230511 ljh lightning start -->
                            <!-- <tr class="dataRow" height="1px">
<apex:outputPanel layout="none" rendered="{!hasChkBox}">
                                <td class="col_chk"></td>
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!Not(hasChkBox)}">
                                <td class="col_noChk"></td>
</apex:outputPanel>
<apex:variable value="{!0}" var="cnt" />
<apex:repeat value="{!titleLeft}" var="t">
                                <td class="col_{!columnLeftCss[cnt]}"></td>
    <apex:variable value="{!cnt + 1}" var="cnt" />
</apex:repeat>
                            <tr> -->
                            <!-- 20230511 ljh lightning end -->
                            <tr class="headerRow" height="30px">
<apex:outputPanel layout="none" rendered="{!hasChkBox}">
    <apex:outputPanel layout="none" rendered="{!Not(isRadioBox)}">
                                <!-- 20230511 ljh lightning start -->
                                <!-- <td style="width:20px" class="col_chk" align="center"> -->
                                <td style="width:32px" class="col_chk" align="center">
                                <!-- 20230511 ljh lightning end -->
                                    <input type='checkbox' onClick='checkAll()' id='checker'/>
                                </td>
    </apex:outputPanel>
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!isRadioBox}">
                            <!-- 20230511 ljh lightning start -->
                             <!-- <td class="col_chk"></td> -->
                             <td style="width:32px;" class="col_chk"></td>
                             <!-- 20230511 ljh lightning start -->
</apex:outputPanel>
<apex:outputPanel layout="none" rendered="{!Not(hasChkBox)}">
                                <!-- 20230511 ljh lightning start-->
                                <!-- <td class="col_noChk"></td> -->
                                <td class="col_noChk" style="display:none"></td>
                                <!-- 20230511 ljh lightning end-->
</apex:outputPanel>
<apex:variable value="{!0}" var="cnt" />
<apex:repeat value="{!titleLeft}" var="t">
                                <td class="col_{!columnLeftCss[cnt]}">
                                    <apex:outputPanel layout="none" rendered="{!Not(noSortHeader)}">
                                      <a href="#" name="out_Div_a" onclick="sortTableJs('{!cnt}');return false;" style="text-decoration: underline;">
                                        <!-- 20220107 ljh update start -->
                                        <!-- <apex:outputText value="{!SUBSTITUTE(t,'(Sys)','')}"/> -->
                                        <apex:outputText value="{!IF(t=='批准时间(申请提交时间)', '批准时间', IF(t=='排队时间F', '排队时间', SUBSTITUTE(t,'(Sys)','')))}"/>
                                        <!-- 20220107 ljh update end -->
                                    </a>{!sortOrder[cnt]}
                                    </apex:outputPanel>
                                    <apex:outputPanel layout="none" rendered="{!noSortHeader}">
                                    <!-- 20220107 ljh update start -->
                                      <!-- <apex:outputText value="{!SUBSTITUTE(t,'(Sys)','')}"/> -->
                                      <apex:outputText value="{!IF(t=='批准时间(申请提交时间)', '批准时间', IF(t=='排队时间F', '排队时间', SUBSTITUTE(t,'(Sys)','')))}"/>
                                      <!-- 20220107 ljh update end -->
                                    </apex:outputPanel>
                                </td>
    <apex:variable value="{!cnt + 1}" var="cnt" />
</apex:repeat>
                            </tr>
                        </table>
                    </div>
                    <!-- 右 ヘッダ -->
                    <div id="out_Div">
                        <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;table-layout:fixed;" border="" id="tableHeader">
                            <!-- 20230512 ljh lightning start-->
                            <!-- <tr class="dataRow" height="1px">
                            <apex:variable value="{!0}" var="cnt" />
                            <apex:repeat value="{!titleRight}" var="t">
                                <td class="col_{!columnRightCss[cnt]}"></td>
                                <apex:variable value="{!cnt + 1}" var="cnt" />
                            </apex:repeat>
                            <td class="col_Scroll"></td>
                            </tr>-->
                            <!-- 20230512 ljh lightning end-->
                            <tr class="headerRow" height="30px">
                            <apex:variable value="{!0}" var="cnt" />
                            <apex:repeat value="{!titleRight}" var="t">
                                <!-- 20230511 ljh lightning start -->
                                <!-- <td class="col_{!columnRightCss[cnt]} "> -->
                                <td class="col_{!columnRightCss[cnt]} colViewing" onclick ="ToggleWidth(this);return false;">
                                <!-- 20230511 ljh lightning end -->
                                    <apex:outputPanel layout="none" rendered="{!Not(noSortHeader)}">
                                      <a href="#" name="out_Div_a" onclick="sortTableJs('{!cnt + titleLeft.size}');return false;" style="text-decoration: underline;">
                                        <!-- 20220107 ljh update start -->
                                        <!-- <apex:outputText value="{!SUBSTITUTE(t,'(Sys)','')}"/> -->
                                        <apex:outputText value="{!IF(t=='批准时间(申请提交时间)', '批准时间', IF(t=='排队时间F', '排队时间', SUBSTITUTE(t,'(Sys)','')))}"/>
                                        <!-- 20220107 ljh update end -->
                                    </a>{!sortOrder[cnt + titleLeft.size]}
                                    </apex:outputPanel>
                                    <apex:outputPanel layout="none" rendered="{!noSortHeader}">
                                    <!-- 20220107 ljh update start -->
                                      <!-- <apex:outputText value="{!SUBSTITUTE(t,'(Sys)','')}"/> -->
                                      <apex:outputText value="{!IF(t=='批准时间(申请提交时间)', '批准时间', IF(t=='排队时间F', '排队时间', SUBSTITUTE(t,'(Sys)','')))}"/>
                                    <!-- 20220107 ljh update end -->
                                    </apex:outputPanel>
                                </td>
                                <apex:variable value="{!cnt + 1}" var="cnt" />
                            </apex:repeat>
                            <td class="col_Scroll"></td>
                            </tr>
                        </table>
                    </div>    <!-- out_Div -->
                    <div style="clear:both;height:0px;"></div>
                    <!-- 左 データリスト -->
                    <div id="in_Div_L">
                        <!-- 20230512 ljh lightning add table-layout:fixed" -->
                        <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;table-layout:fixed;" border="" id="tableData_L">
<apex:variable value="{!1}" var="cnt" />
<apex:repeat value="{!pageController.viewList}" var="or" id="oppTable_L">
                            <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
    <apex:outputPanel layout="none" rendered="{!hasChkBox}">
                                <!-- 20230512 ljh lightning add style="width:32px;" -->
                                <td class="dataCellBorder1" style="width:32px;height:38px;" align="center">
        <apex:outputPanel layout="none" rendered="{!Not(isRadioBox)}">
                                  <apex:inputCheckbox value="{!or.check}" id="rowCheck" styleClass="rowchkcls" disabled="{!!or.canEdit}" onchange="setChangeFlg('{!or.lineNo}')"/>
        </apex:outputPanel>
        <apex:outputPanel layout="none" rendered="{!isRadioBox}">
                                  <apex:inputCheckbox value="{!or.check}" id="rowRadioCheck" styleClass="rowchkcls" disabled="{!!or.canEdit}" onchange="setRadioChangeFlg(this, '{!or.lineNo}', '{!isNeedCheckEvent}')"/>
        </apex:outputPanel>
                                  <apex:inputCheckbox value="{!or.oldCheck}" id="rowOldCheck" style="display:none"/>
                                  <apex:inputText value="{!or.orderNo}" styleClass="ordernocls" style="display:none"/>
                                </td>
    </apex:outputPanel>
    <apex:outputPanel layout="none" rendered="{!Not(hasChkBox)}">
                                <!-- 20230602 ljh 高度固定 38px; -->
                                <td class="col_noChk" style="height: 38px;">
                                  <apex:inputCheckbox value="{!or.check}" styleClass="rowchkcls" style="display:none"/>
                                  <apex:inputText value="{!or.orderNo}" styleClass="ordernocls" style="display:none"/>
                                </td>
    </apex:outputPanel>
    <apex:variable value="{!0}" var="cnt_2" />
    <apex:repeat value="{!columnsLeftApi}" var="c">
                                <!-- 20230602 ljh 高度固定 38px; -->
                                <td class="dataCellBorder1 col_{!columnLeftCss[cnt_2]}" style="height: 38px;">
        <apex:outputPanel rendered="{!(c.size==1 && columnLeftRW[c[0]]=='r')}" layout="none">
            <!-- in_Div_LのAccount名は特殊対応、リンクにする -->
            <apex:outputPanel rendered="{!c[0]=='Name'}" layout="none">
                                  <apex:outputLink value="/{!or.sobj.Id}" target="LINK_{!or.sobj.Id}"><apex:outputField value="{!or.sobj[c[0]]}" /></apex:outputLink>
            </apex:outputPanel>
            <apex:outputPanel rendered="{!c[0]<>'Name'}" layout="none">
                                  <apex:outputField value="{!or.sobj[c[0]]}"/>
            </apex:outputPanel>
        </apex:outputPanel>
        <apex:outputPanel rendered="{!(c.size==2 && or.sobj[c[0]] != null)}" layout="none">
                                  <apex:outputField value="{!or.sobj[c[0]][c[1]]}"/>
        </apex:outputPanel>
        <apex:outputPanel rendered="{!(c.size==1 && columnLeftRW[c[0]]=='w')}" layout="none">
                                  <apex:inputField value="{!or.sobj[c[0]]}" onchange="setChangeFlg('{!or.lineNo}');if(typeof onFieldChanged == 'function') {onFieldChanged(this, {!or.lineNo});}"/>
        </apex:outputPanel>
        <apex:outputPanel rendered="{!(c.size==1 && columnLeftRW[c[0]]=='wm')}" layout="none">
                                  <div class="requiredInput"><div class="requiredBlock"></div><apex:inputField value="{!or.sobj[c[0]]}" onchange="setChangeFlg('{!or.lineNo}');if(typeof onFieldChanged == 'function') {onFieldChanged(this, {!or.lineNo});}"/></div>
        </apex:outputPanel>
                                </td>
        <apex:variable value="{!cnt_2 + 1}" var="cnt_2" />
    </apex:repeat>
                            </tr>
    <apex:variable value="{!cnt + 1}" var="cnt" />
</apex:repeat>
                        </table>
                    </div>
                    <!-- 右 データリスト -->
                    <div id="in_Div">
                        <!-- 20230512 ljh lightning add table-layout:fixed" -->
                        <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;table-layout:fixed;" border="" id="tableData">
                            <apex:variable value="{!1}" var="cnt" />
                            <apex:repeat value="{!pageController.viewList}" var="or" id="oppTable">
                                <tr class="dataRow {!IF(MOD(cnt, 2)==0, 'odd', 'even')} {!IF(cnt==1, 'first', '')}" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">
                                <apex:variable value="{!0}" var="cnt_3" />
                                <apex:repeat value="{!columnsRightApi}" var="c">
                                    <td class="dataCellBorder1 col_{!columnRightCss[cnt_3]}" style="height: 38px;">
                                    <apex:outputPanel rendered="{!(c.size==1 && columnRightRW[c[0]]=='r')}" layout="none">
                                        <apex:outputField value="{!or.sobj[c[0]]}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!(c.size==2 && or.sobj[c[0]] != null)}" layout="none" >
                                        <apex:outputField value="{!or.sobj[c[0]][c[1]]}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!(c.size==1 && columnRightRW[c[0]]=='w')}" layout="none">
                                        <apex:inputField value="{!or.sobj[c[0]]}" onchange="setChangeFlg('{!or.lineNo}');if(typeof onFieldChanged == 'function') {onFieldChanged(this, {!or.lineNo});}"/>
                                    </apex:outputPanel>
                                    <apex:outputPanel rendered="{!(c.size==1 && columnRightRW[c[0]]=='wm')}" layout="none">
                                        <div class="requiredInput"><div class="requiredBlock"></div><apex:inputField value="{!or.sobj[c[0]]}" onchange="setChangeFlg('{!or.lineNo}');if(typeof onFieldChanged == 'function') {onFieldChanged(this, {!or.lineNo});}"/></div>
                                    </apex:outputPanel>
                                    <apex:variable value="{!cnt_3 + 1}" var="cnt_3" />
                                    </td>
                                </apex:repeat>
                                <td class="dataRow col_Scroll">
                                    <apex:repeat value="{!columnsHiddenApi}" var="c">
                                        <input name="{!c}" value="{!or.additionalInfoMap[c]}" type="hidden" />
                                    </apex:repeat>
                                    <apex:inputHidden value="{!or.changeFlg}" id="changeFlg"/>
                                    <script type="text/javascript">
                                        if ("{!or.canEdit}" == "false") {
                                            var right = j$("#tableData").find("tr").eq({!cnt-1});
                                            var rightline = j$(right).find("td");
                                            for (var i=0; i<rightline.length; i++) {
                                                j$(rightline[i]).find("input").each(function(){
                                                    j$(this).attr("disabled",true);
                                                });
                                                j$(rightline[i]).find("select").each(function(){
                                                    j$(this).attr("disabled",true);
                                                });
                                                j$(rightline[i]).find("a").each(function(){
                                                    j$(this).attr("href","#");
                                                });
                                            }
                                        }
                                        if ("{!or.hasError}" == "true") {
                                            var left = j$("#tableData_L").find("tr").eq({!cnt-1});
                                            var leftFirst = j$(left).find("td").eq(1);
                                            j$(leftFirst).css("background-color", "gray");
                                        }
                                        if ("{!or.hasFieldError}" == "true") {
                                            var left = j$("#tableData_L").find("tr").eq({!cnt-1});
                                            var leftFirst = j$(left).find("td").eq(1);
                                            j$(leftFirst).css("background-color", "red");
                                        }
                                    </script>
                                </td>
                                </tr>
                                <apex:variable value="{!cnt + 1}" var="cnt" />
                            </apex:repeat>
                        </table>
                    </div><!-- /in_Div -->
                </apex:outputPanel>
                <!-- 20230523  ljh lightning 分页 代码换位置  start -->
                <!-- <apex:outputPanel layout="none" rendered="{!isDisplayPaging}">
                    <apex:outputPanel layout="none" rendered="{!hasPrevious}">
                        <button onclick="if('{!userCustomPaging}' == 'true') {searchPreviousCustom();} else {searchPreviousJs();}return false;" class="btn">前へ</button>
                    </apex:outputPanel>
                    <apex:outputPanel layout="none" rendered="{!!hasPrevious}">
                        <button class="btn" disabled="disabled"
                                style="cursor: default;border-color: #e5e5e5; background: #f0f0f0;color: #a8a8a8;">前へ</button>
                    </apex:outputPanel>
                    <span class="count">{!page}</span><span>|</span>
                    <span class="count">{!maxPage}</span>
                    <apex:outputPanel layout="none" rendered="{!hasNext}">
                        <button onclick="if('{!userCustomPaging}' == 'true') {searchNextCustom();} else {searchNextJs();}return false;" class="btn" >次へ</button>
                    </apex:outputPanel>
                    <apex:outputPanel layout="none" rendered="{!!hasNext}">
                        <button class="btn" disabled="disabled"
                        style="cursor: default;border-color: #e5e5e5; background: #f0f0f0;color: #a8a8a8;">次へ</button>
                    </apex:outputPanel>
    &nbsp;&nbsp;
                    <apex:outputPanel id="canGoPage" layout="none" rendered="{!canGoPage}">
                        <apex:selectList value="{!goPageInt}" size="1" style="width:50px" id="goPageInt"><apex:selectOptions value="{!pageNumList}" id="pageNumList"/></apex:selectList> 
                        <button onclick="if('{!userCustomPaging}' == 'true') {searchGoPageCustom();} else {searchGoPageJs();}return false;" class="btn">go</button>
                    </apex:outputPanel>
                </apex:outputPanel> -->
                <!-- 20230523  ljh lightning 分页 代码换位置  end -->
            </apex:pageBlock>
            <!-- 20230523  ljh lightning 分页 代码换位置  start -->
            <apex:outputPanel layout="none" rendered="{!isDisplayPaging}">
                <apex:outputPanel layout="none" rendered="{!hasPrevious}">
                    <button onclick="if('{!userCustomPaging}' == 'true') {searchPreviousCustom();} else {searchPreviousJs();}return false;" class="btn">前へ</button>
                </apex:outputPanel>
                <apex:outputPanel layout="none" rendered="{!!hasPrevious}">
                    <button class="btn" disabled="disabled"
                            style="cursor: default;border-color: #e5e5e5; background: #f0f0f0;color: #a8a8a8;">前へ</button>
                </apex:outputPanel>
                <span class="count">{!page}</span><span>|</span>
                <span class="count">{!maxPage}</span>
                <apex:outputPanel layout="none" rendered="{!hasNext}">
                    <button onclick="if('{!userCustomPaging}' == 'true') {searchNextCustom();} else {searchNextJs();}return false;" class="btn" >次へ</button>
                </apex:outputPanel>
                <apex:outputPanel layout="none" rendered="{!!hasNext}">
                    <button class="btn" disabled="disabled"
                    style="cursor: default;border-color: #e5e5e5; background: #f0f0f0;color: #a8a8a8;">次へ</button>
                </apex:outputPanel>
&nbsp;&nbsp;
                <apex:outputPanel id="canGoPage" layout="none" rendered="{!canGoPage}">
                    <apex:selectList value="{!goPageInt}" size="1" style="width:50px" id="goPageInt"><apex:selectOptions value="{!pageNumList}" id="pageNumList"/></apex:selectList> 
                    <button onclick="if('{!userCustomPaging}' == 'true') {searchGoPageCustom();} else {searchGoPageJs();}return false;" class="btn">go</button>
                </apex:outputPanel>
            </apex:outputPanel>
            <!-- 20230523  ljh lightning 分页 代码换位置  end -->
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
var bottomspace = '{!bottomSp}';
var i = 0;
j$(document).ready(function(){
    console.log({!isFirstRefresh});
    if({!isFirstRefresh}){
      blockme();
      init();
    }
    // 20230523  ljh lightning start
    if(i == 0){
        sbwidth = scrollbarWidth();
        i++;
        tableWidth = j$('body .pbBody table#tableHeader').width();
        // var widthTemp = 0;
        j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
            var colClass = getColClassName(this);
            if (colClass != 'col_Scroll') {
                var temp = j$('body .pbBody table.list tr.headerRow td.' + colClass).width();
                listColClassWidthMap[colClass] = temp;
                //widthTemp += temp;
            }
        });
        var blockWidthNew = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width()-sbwidth;
        // console.log(widthTemp+'~'+blockWidthNew+'~'+tableWidth);
        var tableHeader_L =  j$(escapeVfId('tableHeader_L')).width();
        j$('div#in_Div_L').css('width', tableHeader_L+ 'px');
        j$('table#tableData_L').css('width', tableHeader_L + 'px');
        // j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
        if(tableWidth > blockWidthNew){
            j$('div#in_Div').css('width', blockWidthNew + 'px'); // 20230519 ljh
            j$('div#out_Div').css('width', blockWidthNew + 'px'); // 20230519 ljh
        }
        j$('div#in_Div').scroll(function() {
            j$('div#out_Div').scrollLeft(j$(this).scrollLeft());
            j$('div#in_Div_L').scrollTop(j$(this).scrollTop());
        });
        j$('div#out_Div').scroll(function() {
            j$('div#in_Div').scrollLeft(j$(this).scrollLeft());
        });
        j$('div#in_Div_L').scroll(function() {
            j$('div#in_Div').scrollTop(j$(this).scrollTop());
        });
    }
    // windowResize();
    // スクロール連動
    // j$('div#in_Div').scroll(function() {
    //     j$('div#out_Div').scrollLeft(j$(this).scrollLeft());
    //     j$('div#in_Div_L').scrollTop(j$(this).scrollTop());
    // });
    // j$('div#out_Div').scroll(function() {
    //     j$('div#in_Div').scrollLeft(j$(this).scrollLeft());
    // });
    // j$('div#in_Div_L').scroll(function() {
    //     j$('div#in_Div').scrollTop(j$(this).scrollTop());
    // });
    // 20230523  ljh lightning end
});
function runSFDCAddRemote(MetadataConnectionWarning) {
    if (MetadataConnectionWarning) SFDCAddRemote('{!$Api.Session_ID}');
}
function sortTableJs(key) {
  // blockme();
  sortTablefunc(key);
}
// 20230523  ljh lightning start
// j$(function() {
//     var tableWidth = 0;
//     j$('body .pbBody table#tableHeader tr.headerRow td').each(function() {
//         var colClass = getColClassName(this);
//         if (colClass != 'col_Scroll') {
//             var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass);
//             tableWidth += headerCol.width();
//         }
//     });
//     j$('table#tableData').css('width', (tableWidth + 2) + 'px');
//     j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
//     // list の headerRow の tdに toggleWidth() を追加
//     bindTdToggleWidth();
// });
// 20230523  ljh lightning end
var elements = document.getElementsByTagName("select");
for (i = 0; i < elements.length; i++) {
    var id = elements[i].id;
    if (id.length > 5 && id.substring(id.length - 5, id.length) == 'mlktp') {
        elements[i].style.display = "none";
    }
}
var tbl_l = document.getElementById("tableData_L");
var input_l = tbl_l.getElementsByTagName("input");
for (i = 0; i < input_l.length; i++) {
    var id = input_l[i].id + '_lkid';
    if (document.getElementById(id) != null) {
        input_l[i].style.width = "75%";
    }
}
var tbl = document.getElementById("tableData");
var input = tbl.getElementsByTagName("input");
for (i = 0; i < input.length; i++) {
    var id = input[i].id + '_lkid';
    if (document.getElementById(id) != null) {
        input[i].style.width = "75%";
    }
}
//aをクリックする際に、tdイベントを実装しない
j$("a[name='out_Div_a']").bind("click",function(event){
    event.stopPropagation();
});
// windowResize(); // 20230523 ljh lightning
</script>
        </apex:outputPanel>
    <!-- </apex:form> -->
</apex:component>
force-app/main/default/pages/MainFixtureSelect.page
@@ -33,7 +33,7 @@
        right: 0;
        left: 0;
        margin: 0;
        z-index: 9999;
        z-index: 2;
        display: inline-block;
        background-color: white;
        border-radius: 0.25rem;/*20230607 ljh lightning*/
@@ -68,6 +68,10 @@
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* 20230628 ljh */
    .menu ul li:first-child{
        padding-left: 0.75rem;
    }
</style>
@@ -503,6 +507,7 @@
                        </td>
                        <td style="width:50%">
                            <div style="text-align: center;">
                                <input type="hidden" name="hidden" /> <!-- 20230706 ljh 为了按钮对齐 -->
                                <apex:commandButton action="{!save}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame" oncomplete="unblockUI();" />
                                <apex:commandButton style="margin-left:20px;" onclick="clickunassign(); return false;" value="取消分配" rerender="allForm,checEventFrame"/>
                                <apex:commandButton style="margin-left:20px;" value="取消" onclick="clickCancel(); return false;"/>
force-app/main/default/pages/MainFixtureSelect.page.bak
New file
@@ -0,0 +1,695 @@
<!-- 20230529 ljh lightning -->
<!-- <apex:page controller="MainFixtureSelectController" showHeader="false" sidebar="false" id="allPage" action="{!init}"> -->
<apex:page controller="MainFixtureSelectController" showHeader="false" sidebar="false" id="allPage" action="{!init}" lightningStylesheets="true">
<head>
<title>主体备品选择</title>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.MainFixtureSelectCss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230619 ljh lightning  -->
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
<style type="text/css">
    .hideDropdown select{
        display: none
    }
    /*以下是下拉复选框的样式  start*/
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    .nav {
        width: 170px;/*20230606 ljh*/
        line-height: 30px;/*20230606 ljh*/
        /* border: 1px solid #000; *//*20230610 ljh lightning*/
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        position: absolute;
        top: -15px;/*20230606 ljh*/
        right: 0;
        left: 0;
        margin: 0;
        z-index: 9999;
        display: inline-block;
        background-color: white;
        border-radius: 0.25rem;/*20230607 ljh lightning*/
        border: 1px solid rgb(201, 201, 201);/*20230610 ljh lightning*/
    }
    ul,
    li {
        list-style: none;
    }
    .nav li input {
        margin: 0px 3px 0px 3px;
    }
    .nav li p:hover {
        background: #1e90ff;
        color: #fff;
    }
    .nav_a li input {
        margin: 0px 3px 0px 3px;
    }
    .nav_a li p:hover {
        background: #1e90ff;
        color: #fff;
    }
    #classification {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #classification_a {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
</style>
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
function clickCancel(){
    if (confirm('是否操作取消?')) {
        blockme();
        cancel();
    }
}
function clickunassign(){
    if (confirm('是否操作取消分配?')) {
        blockme();
        unassign();
    }
}
//下拉多选框  strat
j$(document).bind("click",function(e){
    var e = e || window.event;    //事件对象,兼容IE
    var target = e.target || e.srcElement;  //源对象,兼容火狐和IE
    while(target){
        // console.log(target.id);
        if (target.id && (target.id == "nav" ||target.id == "nav_a")){
         //循环判断至根节点,防止点击的是#selected和它的子元素
            return;
        }
       target = target.parentNode;
    }
    j$("#selectCheckId").hide();   //点击的不是#selected和它的子元素,隐藏下拉菜单
    j$("#selectCheckId_a").hide();
})
//选择备品存放地 下拉框值有变动以后触发
function reloadBenBu(Obj){
    var selectId = Obj.value;
    //如果备品存放地选择无
    // console.log('00:'+selectId);
    //消除选择的其他选项
    if(j$("#classification").children().text() != "--无--"){
        j$("#classification").children().remove();
        j$("#classification").append("<span class='valClass_CF' id='initial'>--无--</span>");
    }
    var inputObj = j$(".li-input");
    if(inputObj != null){
        for(var i = 0; i < inputObj.length;i++){
            if(inputObj[i].checked){
                inputObj[i].checked = false;
            }
        }
    }
    j$("#selectCheckId").show();
    // j$("#selectCheckId_a").hide();
}
//点击 本部选择
function selectBenBu(obj,name){
    var checked1 = j$(obj).prop("checked");
    if (checked1 == true) {
        j$("#classification").children("#initial").remove();
        var idTemp = j$(obj).value().trim();
        idTemp = 'Id'+idTemp.split('.')[0];
        j$("#classification").append("<span class='valClass' id='" + (idTemp) + "'>" + (j$(obj)
            .value().trim() + ",") + "</span>");
    } else {
        var idTemp = 'Id'+name.split('.')[0];
        j$("#classification").children("#" + (idTemp)).remove();
        var length = j$("#classification").html().length;
        if (length === 0) {
            j$("#classification").append("<span class='valClass' id='initial'>--无--</span>");
        }
    }
    var optioncheck = j$(".valClass");
    var hint = '';
    for(var i = 0;i<optioncheck.length;i++){
        if(optioncheck[i].innerText != '--无--'){
            hint +=optioncheck[i].innerText;
        }
    }
    console.log(hint);
    // j$(escapeVfId('allPage:allForm:searchBlock:mainSection:ApplyBB:bieBenBu')).val(hint);
    j$(escapeVfId('allPage:allForm:searchBlock:bieBenBu')).val(hint);
}
function navClose(){
    j$("#selectCheckId").toggle();
}
// 备品分类点击选择
function selectAgency(obj,name){
    var checked1 = j$(obj).prop("checked");
    if (checked1 == true) {
        j$("#classification_a").children("#initial_a").remove();
        var idTemp = j$(obj).value().trim();
        idTemp = 'Id'+idTemp.split('.')[0];
        j$("#classification_a").append("<span class='valClass_a' id='" + (idTemp) + "'>" + (j$(obj)
            .value().trim() + ",") + "</span>");
    } else {
        var idTemp = 'Id'+name.split('.')[0];
        j$("#classification_a").children("#" + (idTemp)).remove();
        var length = j$("#classification_a").html().length;
        if (length === 0) {
            j$("#classification_a").append("<span class='valClass_a' id='initial_a'>--无--</span>");
        }
    }
    var optioncheck = j$(".valClass_a");
    var hint = '';
    for(var i = 0;i<optioncheck.length;i++){
        if(optioncheck[i].innerText != '--无--' ){
            hint +=optioncheck[i].innerText;
        }
    }
    // j$(escapeVfId('allPage:allForm:searchBlock:mainSection:ApplyAA:bieBeiPinFenLei')).val(hint);
    j$(escapeVfId('allPage:allForm:searchBlock:bieBeiPinFenLei')).val(hint);
}
function navClose_a(){
    j$("#selectCheckId_a").toggle();
}
function searchJs() {
    blockme();
    searchfunc();
}
function checkEventJs(obj){
    blockme();
    j$(escapeVfId('allPage:allForm:checkEventId')).val(obj);
    checkEvent();
}
</script>
</head>
    <apex:form id="allForm">
        <apex:inputHidden id="changeCampaignType" value="{!changeCampaignType}"/>
        <apex:actionFunction name="saveAndSearch" action="{!save}" rerender="allForm,checEventFrame" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="saveAndSort" action="{!save}" rerender="allForm,checEventFrame" oncomplete="unblockUI();">
            <apex:param name="firstParam" assignTo="{!saveType}" value="" />
            <apex:param name="secondParam" assignTo="{!sortKey}" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="searchOpp" action="{!searchOpp}" rerender="allForm,checEventFrame" oncomplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction action="{!cancel}" name="cancel" rerender="allForm,checEventFrame" oncomplete="unblockUI();"/>
        <apex:actionFunction action="{!unassign}" name="unassign" rerender="allForm,checEventFrame" oncomplete="unblockUI();"/>
        <apex:actionFunction name="changebenbu" rerender="S_bieBenBuApply" oncomplete="unblockUI();"/>
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <apex:pageBlockSection title="主体备品选择" id="mainSection">
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Name}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Demo_purpose1__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Owner.Name}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.demo_purpose2__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Salesdept__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Product_category__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.WorkPlace__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Equipment_Type_F__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Internal_asset_location_F__c}"/>
                    <apex:outputField value="{!parentObj.Irreplaceable_flag__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Request_shipping_day__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Apply__r.Request_return_day__c}"/>
                    <apex:outputField value="{!parentObj.Fixture_Set__r.Fixture_Set_Body_Model_No__c}"/>
                    <apex:outputField value="{!parentObj.Rental_End_Date__c}"/>
                    <apex:outputField value="{!parentObj.Fu_Shu_Pin_Fen_Pei_Jia__c}"/>
                    <apex:outputField value="{!parentObj.Rental_Start_Date__c}"/>
                    <!-- 20230605 ljh lightning start -->
                    <!-- <apex:pageBlockSectionItem >
                        <apex:outputLabel for="salesd" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="备品存放地" />
                        <apex:selectList value="{!bieCunFangDi}" onchange="blockme(); changebenbu(); reloadBenBu(this);return false" size="1" style="margin-left: 0px; width:110px" id="bieCunFangDi">
                            <apex:selectOptions value="{!bieCunFangDiOps}"/>
                        </apex:selectList>
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel for="salesd" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="产品分类(GI/SP)" />
                            <apex:selectList value="{!bieChanPinFenLei}" size="1" style="margin-left: 0px; width:60px" id="bieChanPinFenLei">
                                <apex:selectOptions value="{!bieChanPinFenLeiOps}"/>
                            </apex:selectList>
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSectionItem id="ApplyBB">
                        <apex:outputLabel for="S_bieBenBuApply" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="本部" />
                        <apex:outputPanel style="position: relative; " id="S_bieBenBuApply">
                            <apex:inputHidden id="bieBenBu" value="{!bieBenBu}" />
                            <ul class="nav" id="nav" style="left:0px;">
                                <li id="classification" class="transparent_class" style="margin-left:0px;height:20px;" onclick="navClose();return false;">
                                    <span id="initial">--无--</span>
                                </li>
                                <li id="selectCheckId" style="margin-left:0px;display: none;">
                                    <ul style="background-color: #FFFFFF;">
                                        <apex:repeat value="{!bieBenBuOps}" var="orr" id="selSD">
                                            <li class="sdclass" style="margin-left:0px">
                                                <p class="ul-nav" name="cate_id[]" >
                                                    <input type="checkbox" value="{!orr.label}" class="li-input" onclick="selectBenBu(this,'{!orr.label}');" style="display: inline-block;vertical-align: middle;" />
                                                    <font style="">{!orr.label}</font>
                                                </p>
                                            </li>
                                        </apex:repeat>
                                    </ul>
                                </li>
                            </ul>
                            <div class="nav_close"></div>
                            <script>
                                initShowBenbu();
                                function initShowBenbu() {
                                    var bieBenBuTemp = '{!bieBenBu}';
                                    if (bieBenBuTemp != null && bieBenBuTemp != undefined && bieBenBuTemp != "") {
                                        j$("#classification").children("#initial").remove();
                                        var bieBenBuList = bieBenBuTemp.split(',');
                                        for(var i=0; i< bieBenBuList.length; i++) {
                                            var idTemp = bieBenBuList[i].trim();
                                            idTemp = 'Id'+idTemp.split('.')[0];
                                            j$("#classification").append("<span class='valClass' id='" + (idTemp) + "'>" + (bieBenBuList[i].trim() + ",") + "</span>");
                                        }
                                        var inputObj = j$(".li-input");
                                        if(inputObj != null){
                                            for(var i = 0; i < inputObj.length;i++){
                                                if(bieBenBuTemp.includes(inputObj[i].value)){
                                                    inputObj[i].checked = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            </script>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSectionItem id="ApplyAA" >
                        <apex:outputLabel for="salesd" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="备品分类" />
                        <apex:outputPanel style="position: relative;" id="S_AgencyApply">
                            <apex:inputHidden id="bieBeiPinFenLei" value="{!bieBeiPinFenLei}" />
                            <ul class="nav" id="nav_a" style="left:0px;">
                                <li id="classification_a" class="transparent_class" style="margin-left:0px;height:20px;" onclick="navClose_a();return false;">
                                    <span id="initial_a">--无--</span>
                                </li>
                                <li id="selectCheckId_a" style="margin-left:0px;display: none;">
                                    <ul style="background-color: #FFFFFF;">
                                        <apex:repeat value="{!bieBeiPinFenLeiOps}" var="orr" id="selSD">
                                            <li class="sdclass" style="margin-left:0px">
                                                <p class="ul-nav" name="cate_id[]" >
                                                    <input type="checkbox" value="{!orr.label}" class="li-input_a" onclick="selectAgency(this,'{!orr.label}');" style="display: inline-block;vertical-align: middle;" />
                                                    <font style="">{!orr.label}</font>
                                                </p>
                                            </li>
                                        </apex:repeat>
                                    </ul>
                                </li>
                            </ul>
                            <script>
                                initShowFenlei();
                                function initShowFenlei() {
                                    var bieBeiPinFenLeiTemp = '{!bieBeiPinFenLei}';
                                    if (bieBeiPinFenLeiTemp != null && bieBeiPinFenLeiTemp != undefined && bieBeiPinFenLeiTemp != "") {
                                        j$("#classification_a").children("#initial_a").remove();
                                        var bieBeiPinFenLeiList = bieBeiPinFenLeiTemp.split(',');
                                        for(var i=0; i< bieBeiPinFenLeiList.length; i++) {
                                            var idTemp = bieBeiPinFenLeiList[i].trim();
                                            idTemp = 'Id'+idTemp.split('.')[0];
                                            j$("#classification_a").append("<span class='valClass_a' id='" + (idTemp) + "'>" + (bieBeiPinFenLeiList[i].trim() + ",") + "</span>");
                                        }
                                        var inputObj = j$(".li-input_a");
                                        if(inputObj != null){
                                            for(var i = 0; i < inputObj.length;i++){
                                                if(bieBeiPinFenLeiTemp.includes(inputObj[i].value)){
                                                    inputObj[i].checked = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            </script>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>-->
                </apex:pageBlockSection>
                <table style="width:100%;margin:10px 0;">
                    <!-- <tr/><tr/><tr/><tr/><tr/><tr/><tr/><tr/>
                    <tr>
                        <td width="50px">关键字</td>
                        <td><apex:inputText value="{!keyword}" style="width:200px"/></td>
                        <td width="20px"/>
                        <td><apex:commandButton value="検索" onclick=" searchOppJs(); return false;"/></td>
                    </tr>
                    <tr/><tr/><tr/><tr/><tr/><tr/> -->
                    <colgroup>
                        <col width="6%" />
                        <col width="12%" />
                        <col width="12%" />
                        <col width="6%" />
                        <col width="6%"/>
                        <col width="12%"/>
                        <col width="6%"/>
                        <col width="12%"/>
                        <col width="6%"/>
                        <col width="12%"/>
                        <col width="10%"/>
                    </colgroup>
                    <tr>
                        <td align="right" style="padding-right:5px;" >备品存放地</td>
                        <td align="left">
                            <apex:selectList value="{!bieCunFangDi}" onchange="blockme(); changebenbu(); reloadBenBu(this);return false" size="1" style="margin-left: 0px; width:110px" id="bieCunFangDi">
                                <apex:selectOptions value="{!bieCunFangDiOps}"/>
                            </apex:selectList>
                        </td>
                        <td align="right" style="padding-right:5px;">产品分类(GI/SP)</td>
                        <td align="left">
                            <apex:selectList value="{!bieChanPinFenLei}" size="1" style="margin-left: 0px; width:60px" id="bieChanPinFenLei">
                                <apex:selectOptions value="{!bieChanPinFenLeiOps}"/>
                            </apex:selectList>
                        </td>
                        <td align="right" style="padding-right:5px;" >本部</td>
                        <td align="left">
                            <apex:outputPanel style="position: absolute;" id="S_bieBenBuApply">
                            <apex:inputHidden id="bieBenBu" value="{!bieBenBu}" />
                            <ul class="nav" id="nav" style="left:0px;">
                                <li id="classification" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose();return false;">
                                    <span id="initial">--无--</span>
                                </li>
                                <li id="selectCheckId" style="margin-left:0px;display: none;">
                                    <ul style="background-color: #FFFFFF;margin-left: 0;">
                                        <apex:repeat value="{!bieBenBuOps}" var="orr" id="selSDBB">
                                            <li class="sdclass" style="margin-left:0px">
                                                <p class="ul-nav" name="cate_id[]" >
                                                    <input type="checkbox" value="{!orr.label}" class="li-input" onclick="selectBenBu(this,'{!orr.label}');" style="display: inline-block;vertical-align: middle;" />
                                                    <font style="">{!orr.label}</font>
                                                </p>
                                            </li>
                                        </apex:repeat>
                                    </ul>
                                </li>
                            </ul>
                            <script>
                                initShowBenbu();
                                function initShowBenbu() {
                                    var bieBenBuTemp = '{!bieBenBu}';
                                    if (bieBenBuTemp != null && bieBenBuTemp != undefined && bieBenBuTemp != "") {
                                        j$("#classification").children("#initial").remove();
                                        var bieBenBuList = bieBenBuTemp.split(',');
                                        for(var i=0; i< bieBenBuList.length; i++) {
                                            var idTemp = bieBenBuList[i].trim();
                                            idTemp = 'Id'+idTemp.split('.')[0];
                                            j$("#classification").append("<span class='valClass' id='" + (idTemp) + "'>" + (bieBenBuList[i].trim() + ",") + "</span>");
                                        }
                                        var inputObj = j$(".li-input");
                                        if(inputObj != null){
                                            for(var i = 0; i < inputObj.length;i++){
                                                if(bieBenBuTemp.includes(inputObj[i].value)){
                                                    inputObj[i].checked = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            </script>
                        </apex:outputPanel>
                        </td>
                        <td align="right" style="padding-right:5px;" >备品分类</td>
                        <td align="left" >
                            <apex:outputPanel style="position: absolute;" id="S_AgencyApply">
                            <apex:inputHidden id="bieBeiPinFenLei" value="{!bieBeiPinFenLei}" />
                            <ul class="nav" id="nav_a" style="left:0px;">
                                <li id="classification_a" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose_a();return false;">
                                    <span id="initial_a">--无--</span>
                                </li>
                                <li id="selectCheckId_a" style="margin-left:0px;display: none;">
                                    <ul style="background-color: #FFFFFF;margin-left: 0;">
                                        <apex:repeat value="{!bieBeiPinFenLeiOps}" var="orr" id="selSD">
                                            <li class="sdclass" style="margin-left:0px">
                                                <p class="ul-nav" name="cate_id[]" >
                                                    <input type="checkbox" value="{!orr.label}" class="li-input_a" onclick="selectAgency(this,'{!orr.label}');" style="display: inline-block;vertical-align: middle;" />
                                                    <font style="">{!orr.label}</font>
                                                </p>
                                            </li>
                                        </apex:repeat>
                                    </ul>
                                </li>
                            </ul>
                            <script>
                                initShowFenlei();
                                function initShowFenlei() {
                                    var bieBeiPinFenLeiTemp = '{!bieBeiPinFenLei}';
                                    if (bieBeiPinFenLeiTemp != null && bieBeiPinFenLeiTemp != undefined && bieBeiPinFenLeiTemp != "") {
                                        j$("#classification_a").children("#initial_a").remove();
                                        var bieBeiPinFenLeiList = bieBeiPinFenLeiTemp.split(',');
                                        for(var i=0; i< bieBeiPinFenLeiList.length; i++) {
                                            var idTemp = bieBeiPinFenLeiList[i].trim();
                                            idTemp = 'Id'+idTemp.split('.')[0];
                                            j$("#classification_a").append("<span class='valClass_a' id='" + (idTemp) + "'>" + (bieBeiPinFenLeiList[i].trim() + ",") + "</span>");
                                        }
                                        var inputObj = j$(".li-input_a");
                                        if(inputObj != null){
                                            for(var i = 0; i < inputObj.length;i++){
                                                if(bieBeiPinFenLeiTemp.includes(inputObj[i].value)){
                                                    inputObj[i].checked = true;
                                                }
                                            }
                                        }
                                    }
                                }
                            </script>
                        </apex:outputPanel>
                        </td>
                        <td  align="right" style="padding-right:5px;">关键字</td>
                        <td align="left" ><apex:inputText value="{!keyword}"/></td>
                        <td style="padding-left:20px;"><apex:commandButton value="検索" onclick=" searchOppJs(); return false;"/></td>
                    </tr>
                </table>
                <!-- 20230605 ljh lightning end -->
                <table style="width:100%">
                    <tr>
                        <td style="width:40%">
                            <apex:outputPanel rendered="{!parentObj.Rental_Apply__r.demo_purpose2__c=='学会展会'&&NOT((contains(parentObj.Rental_Apply__r.Salesdepartment__c,'MA本部')||contains(parentObj.Rental_Apply__r.Salesdepartment__c,'产品培训')))}">
                                <apex:outputLabel for="campaignType" value="学会类型" style="font-weight: bold;font-family: Arial,Helvetica,sans-serif;font-size: 91%;color: #4a4a56;" />
                                <apex:selectList value="{!campaignType}" size="1" style="margin-left: 20px; width:120px;" id="campaignType">
                                    <apex:selectOptions value="{!campaignTypeOps}"/>
                                </apex:selectList>
                            </apex:outputPanel>
                            <apex:commandButton style="margin-left:5px;" action="{!defaultScheduel}" disabled="{!parentObj.Rental_Apply__r.Demo_purpose1__c=='其他'||(sonObj.Asset__c!=''&&sonObj.Select_Time__c!=null)||(sonObj.Asset__c!=''&&sonObj.Queue_Number__c==0)}" onclick="if(!confirmDefualt()) return false;blockme();" oncomplete="unblockUI();" value="默认排队" rerender="allForm,checEventFrame"/>
                            <apex:commandButton style="margin-left:20px;" action="{!specialScheduel}" disabled="{!parentObj.Rental_Apply__r.Demo_purpose1__c=='维修代用'||parentObj.Rental_Apply__r.Demo_purpose1__c=='协议借用'||(sonObj.Asset__c!=''&&sonObj.Select_Time__c!=null)||(sonObj.Asset__c!=''&&sonObj.Queue_Number__c==0)}" onclick="if(!confirmSpecial()) return false;blockme();" oncomplete="unblockUI();" value="特殊排队" rerender="message,checEventFrame"/>
                            <apex:commandButton style="margin-left:20px;" action="{!topInLine}" disabled="{!(sonObj.Asset__c!=''&&sonObj.Select_Time__c!=null)||(sonObj.Asset__c!=''&&sonObj.Queue_Number__c==0)}" onclick="blockme();" oncomplete="unblockUI();" value="排队No.置顶" rerender="allForm,checEventFrame"/>
                        </td>
                        <td style="width:50%">
                            <div style="text-align: center;">
                                <apex:commandButton action="{!save}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame" oncomplete="unblockUI();" />
                                <apex:commandButton style="margin-left:20px;" onclick="clickunassign(); return false;" value="取消分配" rerender="allForm,checEventFrame"/>
                                <apex:commandButton style="margin-left:20px;" value="取消" onclick="clickCancel(); return false;"/>
                            </div>
                        </td>
                        <td>
                            <div style="text-align: right;">
                                <apex:commandButton action="{!turnback}" value="返回" rerender="allForm,checEventFrame"/>
                            </div>
                        </td>
                    </tr>
                </table>
                <div style="clear:both;"></div>
                <apex:outputPanel id="message">
                    <apex:pageMessages />
                </apex:outputPanel>
            </apex:pageBlock>
            <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true" isRadio="true"/>
        </apex:outputPanel>
    </apex:form>
    <apex:outputPanel id="checEventFrame">
        <apex:form >
            <!-- <apex:inputHidden id="assetId" value="{!assetId}" />
            <apex:inputHidden id="rentalId" value="{!rentalId}" /> -->
<!--             <apex:inputHidden id="modelNo" value="{!modelNo}" />
            <apex:inputHidden id="raesdId" value="{!raesdId}" /> -->
        </apex:form>
        <apex:iframe id="theIframe" rendered="{!IF(!ISBLANK(queueByAsset),true,false)}" title="排队一览" src="{!queueByAsset}"/>
        <!-- add by rentx 20210813 start SFDC-C448KZ -->
        <script>
            addlinkbutton();
            function addlinkbutton(){
              // 次の画面遷移click
              var ele = j$(".dataCellBorder1.col_Asset__r_Fixture_Status__c");
              var isShowButton = '{!(sonObj.Asset__c!=''&&sonObj.Select_Time__c!=null)||(sonObj.Asset__c!=''&&sonObj.Queue_Number__c==0)}';
              // alert(ele.length);
              if(ele.length) {
                var i = 0;
                ele.each(function () {
                    j$(this).css('align-items','center');
                    console.log(j$(this).children("span")[0].innerText);
                    var value = j$(this).children("span")[0].innerText;
                    if(value == '暂定分配'){
                        if (isShowButton=='false') {
                            j$(this).append('<input type="button" style="width: auto;" value="抢夺暂定分配" onclick="derectlyAssign('+i+');" />');
                        } else {
                            j$(this).append('<input type="button" style="width: auto;" value="抢夺暂定分配" onclick="derectlyAssign('+i+');" disabled="true" />');
                        }
                    }
                    i = i + 1;
                })
              }
            }
            function derectlyAssign(index) {
                // var viewList = JSONCODE(viewListStr);
                var viewList = eval("({!JSENCODE(WrapperJSON)})");
                var targetId = '{!parentId}';
                console.log(viewList[index]);
                var rasdId = viewList[index].sobj.Asset__r.Last_Reserve_RAES_Detail__r.Rental_Apply_Equipment_Set__c;
                window.location.href = '/apex/DirectAssign?oldquenId=' + rasdId + '&targetId=' + targetId;
            }
            function confirmDefualt() {
                var queenType = '{!sonObj.QuenType__c}';
                if (queenType=='特殊排队') {
                    if (confirm("已参与特殊排队,是否继续?")) {
                        var campaignTemp1 = '{!parentObj.Rental_Apply__r.CampaignType__c}';
                        var campaignTemp2 = j$(escapeVfId('allPage:allForm:searchBlock:campaignType')).value();
                        if (campaignTemp1 !="" && campaignTemp1 != undefined && campaignTemp1 != campaignTemp2) {
                            if(confirm("选择的学会类型与申请单中的学会类型不一致,请确认是否更新?")){
                                j$("[id*='changeCampaignType']").val(true);
                            } else {
                                j$("[id*='changeCampaignType']").val(false);
                            }
                        }
                        return true;
                    }
                } else {
                    if (confirm("是否默认排队?")) {
                        var campaignTemp1 = '{!parentObj.Rental_Apply__r.CampaignType__c}';
                        var campaignTemp2 = j$(escapeVfId('allPage:allForm:searchBlock:campaignType')).value();
                        if (campaignTemp1 !="" && campaignTemp1 != undefined && campaignTemp1 != campaignTemp2) {
                            if (confirm("选择的学会类型与申请单中的学会类型不一致,请确认是否更新?")) {
                                j$("[id*='changeCampaignType']").val(true);
                            } else {
                                j$("[id*='changeCampaignType']").val(false);
                            }
                        }
                        return true;
                    }
                }
                return false;
            }
            function confirmSpecial() {
                var queenType = '{!sonObj.QuenType__c}';
                if (queenType=='特殊排队') {
                    if(confirm("已参与特殊排队,是否继续?")){
                        return true;
                    }
                } else if (queenType=='默认排队') {
                    if(confirm("已参与默认排队,是否继续?")){
                        return true;
                    }
                } else {
                    if(confirm("是否特殊排队?")){
                        return true;
                    }
                }
                return false;
            }
            // 20210817 ljh add
            function changeCancleReasonJs(){
                var Cancel_Reason = j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Cancel_Reason')).value();
                if((Cancel_Reason != null && Cancel_Reason == '主动取消') || Cancel_Reason == ''){
                    j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_Remarks')).val('');
                    j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_Remarks')).attr('disabled',true);
                }else if(Cancel_Reason != null && Cancel_Reason == '重新分配'){
                    j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_Remarks')).attr('disabled',false);
                }
            }
            function changeReasonJs(){
                var reason = j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_reason')).value();
                if(reason != null && reason == '其他'){
                    j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_Remarks')).attr('disabled',false);
                }else{
                    j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_Remarks')).val('');
                    j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_Remarks')).attr('disabled',true);
                }
            }
            // 20210817 ljh add end
            //add by rentx 20210813 start SFDC-C448KZ
            //1.默认设置"取消备注理由"不可编辑
            j$(escapeVfId('allPage:allForm:searchBlock:mainSection:pbId:Loaner_cancel_Remarks')).attr('disabled',true);
            //设置明细行的不可编辑
            j$(".dataCellBorder1.col_Loaner_cancel_Remarks__c input").each(function () {
                //设置只读
                j$(this).prop('disabled', true)
            });
            //2.设置只有明细取消理由为 '其他' 时 取消理由备注 可编辑
            //设置当明细取消原因为 其他时可编辑
            j$(".dataCellBorder1.col_Loaner_cancel_reason__c span").each(function () {
                //判断当前标签下的select标签值是否为取消--
                // var aaa = j$(this);
                var Loaner_cancel_reason = j$(this).children()[0].value;
                if (Loaner_cancel_reason == '其他') {
                    //拿到输入框 设置可以编辑
                    j$(this).parent().parent().find("input[type=text]").prop("disabled",false);
                    j$(this).parent().parent().find("input[type=text]").prop("required","required");
                }
            });
            //为明细取消原因添加change时间 如果变为其他 则设置可编辑 反之设置不可编辑
            j$(".dataCellBorder1.col_Cancel_Reason__c").on("change", function () {
                //判断当前标签下的select标签值是否为取消--
                var Cancel_Reason = j$(this).children()[0].value;
                if((Cancel_Reason != null && Cancel_Reason == '主动取消') ||Cancel_Reason == ''){
                    //清空输入框 设置不可编辑
                    j$(this).parent().find("input[type=text]").val('');
                    j$(this).parent().find("input[type=text]").prop("disabled",true);
                }else if(Cancel_Reason != null && Cancel_Reason == '重新分配'){
                    j$(this).parent().find("input[type=text]").prop("disabled",false);
                }
            });
            j$(".dataCellBorder1.col_Loaner_cancel_reason__c span").on("change", function () {
                //判断当前标签下的select标签值是否为取消--
                var Loaner_cancel_reason = j$(this).children()[0].value;
                if (Loaner_cancel_reason == '其他') {
                    //拿到输入框 设置可以编辑
                    j$(this).parent().parent().find("input[type=text]").prop("disabled",false);
                }else{
                    //清空输入框 设置不可编辑
                    j$(this).parent().parent().find("input[type=text]").val('');
                    j$(this).parent().parent().find("input[type=text]").prop("disabled",true);
                }
            });
        </script>
        <!-- add by rentx 20210813 end SFDC-C448KZ -->
    </apex:outputPanel>
</apex:page>
force-app/main/default/pages/QueuePageByAssetId.page
@@ -61,6 +61,7 @@
            </apex:pageBlockSection>
            <!-- <apex:commandButton onclick="lineMoveUp();return false;" value="上"/> -->
            <!-- <apex:commandButton onclick="lineMoveDown();return false;" value="下"/> -->
            <input type="hidden" name="hidden" /> <!-- 20230610 ljh 为了按钮对齐 -->
            <apex:commandButton onclick="lineMoveTopUp();return false;" value="置顶"/>
            <apex:commandButton onclick="lineMoveTopDown();return false;" value="置底"/>
            <apex:commandButton value="申请单置顶" reRender="allForm,message" onclick="blockme();" action="{!upRentalApply}" oncomplete="unblockUI();" rendered="{!!isNotShow}" />
force-app/main/default/pages/QueuePageByAssetId.page.bak
New file
@@ -0,0 +1,184 @@
<!-- 20230526 ljh lightning -->
<!-- <apex:page controller="QueuePageByAssetIdController" showHeader="false" sidebar="false" id="allPage" action="{!init}" lightningStylesheets="true"> -->
<apex:page controller="QueuePageByAssetIdController" showHeader="false" sidebar="false" id="allPage" action="{!init}" lightningStylesheets="true">
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.QueuePageByAssetIdCss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
    <style>
        /* 20230526 ljh lightning start */
        /* table.list{
            width: 100%!important;
        } */
        body .detailList .dataCol input[type="text"]{min-width: 60px;width:60px;}
        /* 20230526 ljh lightning end */
    </style>
    <script type="text/javascript">
        var heightAjustment = 120;
        var widthAjustment = 30;
    </script>
    <apex:form id="allForm">
    <apex:outputPanel id="message">
        <apex:pageMessages />
    </apex:outputPanel>
    <!-- <apex:actionFunction action="{!saveQueue}" name="saveQueue();" oncomplete="unblockUI();"/> -->
    <apex:inputHidden value="{!inputUpDownFlag}" id="hiddenFlag"/>
    <apex:inputHidden value="{!inptNum}" id="hiddenNum"/>
    <apex:outputPanel id="pageallPanel">
        <apex:pageBlock id="searchBlock" tabStyle="Asset">
            <apex:pageBlockSection columns="3" id="aa">
                <apex:outputPanel >
                <apex:outputText value="队列信息:"/>
                </apex:outputPanel>
                <apex:outputPanel >
                </apex:outputPanel>
                <apex:outputPanel >
                </apex:outputPanel>
                <!-- ++++ -->
                <apex:outputPanel >
                    <!-- 20211104 ljh 排队 start-->
                    <!-- <apex:outputText value="{!$ObjectType.Asset.Fields.Fixture_Model_No_F__c.Label + ':'}"/><apex:outputField value="{!aset.Fixture_Model_No_F__c}"/> -->
                    <apex:outputText value="{!$ObjectType.Asset.Fields.Fixture_Model_No_F__c.Label + ':'}"/><apex:outputField value="{!raesd.Fixture_Model_No_F__c}"/>
                    <!-- 20211104 ljh 排队 end-->
                </apex:outputPanel>
                <apex:outputPanel >
                    <apex:outputText value="备品存放地:"/><apex:outputField value="{!raesd.Internal_asset_location_before__c}"/>
                </apex:outputPanel>
                <apex:outputPanel >
                    <apex:outputText value="产品分类(GI/SP):"/><apex:outputField value="{!raesd.Product_category_text__c}"/>
                </apex:outputPanel>
                <apex:outputPanel >
                    <apex:outputText value="所在地区(本部):"/><apex:outputField value="{!raesd.Salesdepartment_before__c}"/>
                </apex:outputPanel>
                <apex:outputPanel >
                    <apex:outputText value="备品分类:"/><apex:outputField value="{!raesd.Equipment_Type_text__c}"/>
                </apex:outputPanel>
                <apex:outputPanel >
                    <apex:outputText value="指定排队NO.:"/><apex:inputText id="strNum" value="{!inptNumStr}" onChange="changeNum();return false;"/>
                </apex:outputPanel>
                <!-- 20211104  排队 add end-->
            </apex:pageBlockSection>
            <!-- <apex:commandButton onclick="lineMoveUp();return false;" value="上"/> -->
            <!-- <apex:commandButton onclick="lineMoveDown();return false;" value="下"/> -->
            <apex:commandButton onclick="lineMoveTopUp();return false;" value="置顶"/>
            <apex:commandButton onclick="lineMoveTopDown();return false;" value="置底"/>
            <apex:commandButton value="申请单置顶" reRender="allForm,message" onclick="blockme();" action="{!upRentalApply}" oncomplete="unblockUI();" rendered="{!!isNotShow}" />
            <apex:commandButton value="保存排队" reRender="allForm,message" onclick="blockme();" style="margin-left:400px;" action="{!saveQueue}" oncomplete="unblockUI();"/>
        </apex:pageBlock>
        <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true" isRadio="true" tabStyle="Report" />
    </apex:outputPanel>
    </apex:form>
    <script type="text/javascript">
        /*function disableCheckboxJs(){
            var ele = j$(".dataCellBorder1.col_Allow_Adjust_Queue_Flag__c");
            if (ele.length) {
                var i = 0;
                ele.each(function () {
                    var value = j$(this).children("span")[0].innerText;
                    if(value == 'false'){
                        j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + i + ':rowRadioCheck')).disabled = true;
                    }
                    i = i + 1;
                })
            }
        }*/
        function lineMoveUp() {
            var i = 1;
            var line = 0;
            var nowitem;
            j$(".rowchkcls:checkbox").each(function() {
                nowitem = j$(this);
                if (this.checked == true) {
                    line = i;
                    //break;
                    return false
                }
                i++;
            });
            if (line > 0) {
                var hiddenFlag = document.getElementById('allPage:allForm:hiddenFlag');
                var hiddenNum = document.getElementById('allPage:allForm:hiddenNum');
                hiddenNum.value = i - 1;
                hiddenFlag.value = true;
                return resetOrderNoMoveUpDown(true, line);
            }
        }
        function lineMoveDown() {
            var i = 1;
            var line = 0;
            j$(".rowchkcls:checkbox").each(function() {
                nowitem = j$(this);
                if (this.checked == true) {
                    line = i;
                    //break;
                    return false
                }
                i++;
            });
            if (line > 0) {
                var hiddenFlag = document.getElementById('allPage:allForm:hiddenFlag');
                var hiddenNum = document.getElementById('allPage:allForm:hiddenNum');
                hiddenNum.value = i + 1;
                hiddenFlag.value = false;
                return resetOrderNoMoveUpDown(false, line);
            }
        }
        function lineMoveTopUp() {
            var i = 1;
            var line = 0;
            var nowitem;
            j$(".rowchkcls:checkbox").each(function() {
                nowitem = j$(this);
                if (this.checked == true) {
                    line = i;
                    //break;
                    return false
                }
                i++;
            });
            if (line > 0) {
                var hiddenFlag = document.getElementById('allPage:allForm:hiddenFlag');
                var hiddenNum = document.getElementById('allPage:allForm:hiddenNum');
                hiddenNum.value = 1;
                hiddenFlag.value = true;
                return resetOrderNoMoveTopUpDown(true, line);
            }
        }
        function lineMoveTopDown() {
            var i = 1;
            var line = 0;
            j$(".rowchkcls:checkbox").each(function() {
                nowitem = j$(this);
                if (this.checked == true) {
                    line = i;
                    //break;
                    return false
                }
                i++;
            });
            if (line > 0) {
                var hiddenFlag = document.getElementById('allPage:allForm:hiddenFlag');
                var hiddenNum = document.getElementById('allPage:allForm:hiddenNum');
                // 为了区分保存排队备注的情况,此处给排队No设置,但后台处理时不使用
                hiddenNum.value = 99;
                hiddenFlag.value = false;
                return resetOrderNoMoveTopUpDown(false, line);
            }
        }
        function changeNum() {
            var numStr = document.getElementById('allPage:allForm:searchBlock:aa:strNum').value;
            if (numStr === undefined || numStr === '') {
                return;
            } else {
                var hiddenFlag = document.getElementById('allPage:allForm:hiddenFlag');
                var hiddenNum = document.getElementById('allPage:allForm:hiddenNum');
                hiddenNum.value = numStr;
                hiddenFlag.value = true;
            }
        }
    </script>
</apex:page>
force-app/main/default/pages/ReantalApplySeriesNo.page
@@ -1,12 +1,11 @@
<!-- <apex:page controller="ReantalApplySeriesNoController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="序列查看"> -->
<apex:page controller="ReantalApplySeriesNoController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="序列查看" lightningStylesheets="true">
<!-- 20230525 ljh lightning -->
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.listTable)}"/><!-- 20230525 ljh lightning  -->
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.listTable)}"/>
    <!-- 20230525 ljh lightning  -->
    <style type="text/css">
    .bPageBlock .detailList .dataCol {
        width: auto;
@@ -26,6 +25,7 @@
        }
    </script>
    <apex:form id="allForm">
        <apex:outputPanel id="pageallPanel">
        <apex:pageBlock id="searchBlock" title="序列信息">
            <!-- 20230525 ljh lightning start -->
            <!-- <apex:pageBlockSection columns="3" id="mainSection">
@@ -54,26 +54,27 @@
                    <apex:outputText value="{!IF(Isadmix,'混合','单一')}"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection> -->
            <table style="width:100%;margin:10px 0;" >
            <table style="width:100%;margin:10px 0;" class="detailList" border="0" cellpadding="0" cellspacing="0" >
                <tr>
                    <td>型号:</td>
                    <td>{!raq.Fixture_Model_No__c}</td>
                    <td>备品存放地:</td>
                    <td>{!raq.Internal_asset_location__c}</td>
                    <td>本部:</td>
                    <td>{!raq.Salesdepartment__c}</td>
                    <td align="right" style="padding-right:5px;">型号:</td>
                    <td align="left" >{!raq.Fixture_Model_No__c}</td>
                    <td align="right" style="padding-right:5px;">备品存放地:</td>
                    <td align="left" >{!raq.Internal_asset_location__c}</td>
                    <td align="right" style="padding-right:5px;">本部:</td>
                    <td align="left" >{!raq.Salesdepartment__c}</td>
                </tr>
                <tr>
                    <td>备品分类:</td>
                    <td>{!raq.Equipment_Type__c}</td>
                    <td>产品分类:</td>
                    <td>{!raq.Product_category__c}</td>
                    <td>序列类型:</td>
                    <td>{!IF(Isadmix,'混合','单一')}</td>
                    <td align="right" style="padding-right:5px;">备品分类:</td>
                    <td align="left" >{!raq.Equipment_Type__c}</td>
                    <td align="right" style="padding-right:5px;">产品分类:</td>
                    <td align="left" >{!raq.Product_category__c}</td>
                    <td align="right" style="padding-right:5px;" >序列类型:</td>
                    <td align="left" >{!IF(Isadmix,'混合','单一')}</td>
                </tr>
            </table>
            <!-- 20230525 ljh lightning end -->
        </apex:pageBlock>
        </apex:outputPanel>
        <apex:outputPanel id="message">
            <apex:pageMessages />
        </apex:outputPanel>
force-app/main/default/pages/ReantalApplySeriesNo.page.bak
New file
@@ -0,0 +1,156 @@
<!-- <apex:page controller="ReantalApplySeriesNoController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="序列查看"> -->
<apex:page controller="ReantalApplySeriesNoController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="序列查看" lightningStylesheets="true">
<!-- 20230525 ljh lightning -->
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.listTable)}"/><!-- 20230525 ljh lightning  -->
    <style type="text/css">
    .bPageBlock .detailList .dataCol {
        width: auto;
    }
    .table-head{padding-right:17px;}
    .tablehead0{padding-right:0;}
    .table-body table tr:nth-child(2n){background-color:#f2f2f2;}
    </style>
    <script>
        // window.onload = () => {
        window.onload = function gunzhou(){
            if(j$('#tablebody').height() >= 270){
                j$('#table-head').addClass("table-head");
            }else{
                j$('#table-head').addClass("tablehead0");
            }
        }
    </script>
    <apex:form id="allForm">
        <apex:pageBlock id="searchBlock" title="序列信息">
            <!-- 20230525 ljh lightning start -->
            <!-- <apex:pageBlockSection columns="3" id="mainSection">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="型号:" />
                    <apex:outputField value="{!raq.Fixture_Model_No__c}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="备品存放地:"/>
                    <apex:outputField value="{!raq.Internal_asset_location__c}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="本部:"/>
                    <apex:outputField value="{!raq.Salesdepartment__c}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="备品分类:"/>
                    <apex:outputField value="{!raq.Equipment_Type__c}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="产品分类:"/>
                    <apex:outputField value="{!raq.Product_category__c}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="序列类型:"/>
                    <apex:outputText value="{!IF(Isadmix,'混合','单一')}"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection> -->
            <table style="width:100%;margin:10px 0;" >
                <tr>
                    <td>型号:</td>
                    <td>{!raq.Fixture_Model_No__c}</td>
                    <td>备品存放地:</td>
                    <td>{!raq.Internal_asset_location__c}</td>
                    <td>本部:</td>
                    <td>{!raq.Salesdepartment__c}</td>
                </tr>
                <tr>
                    <td>备品分类:</td>
                    <td>{!raq.Equipment_Type__c}</td>
                    <td>产品分类:</td>
                    <td>{!raq.Product_category__c}</td>
                    <td>序列类型:</td>
                    <td>{!IF(Isadmix,'混合','单一')}</td>
                </tr>
            </table>
            <!-- 20230525 ljh lightning end -->
        </apex:pageBlock>
        <apex:outputPanel id="message">
            <apex:pageMessages />
        </apex:outputPanel>
        <apex:pageBlock id="raqList" title="查看序列情况">
        <div class="" id="table-head">
            <table class="list" border="0" cellpadding="0" cellspacing="0" width="100%" >
                <colgroup>
                <col width="4%" />
                <col width="4%" />
                <col width="10%" />
                <col width="10%"/>
                <col width="8%"/>
                <col width="8%"/>
                <col width="7%"/>
                <col width="10%"/>
                <col width="8%"/>
                <col width="5%"/>
                <col width="13%"/>
                <col width="13%"/>
                </colgroup>
                <thead>
                <tr class="headerRow" >
                    <th style="padding-bottom: 6px;">序列号</th>
                    <th style="padding-bottom: 6px;">排队NO.</th>
                    <th style="padding-bottom: 6px;">申请单NO.</th>
                    <th style="padding-bottom: 6px;">排队时间</th>
                    <th style="padding-bottom: 6px;">申请者办事处</th>
                    <th style="padding-bottom: 6px;">备品出借担当</th>
                    <th style="padding-bottom: 6px;">希望到货日</th>
                    <th style="padding-bottom: 6px;">批准时间</th>
                    <th style="padding-bottom: 6px;">使用目的2</th>
                    <th style="padding-bottom: 6px;">负责人</th>
                    <th style="padding-bottom: 6px;">医院</th>
                    <th style="padding-bottom: 6px;">学会</th>
                </tr>
                </thead>
                </table>
            </div>
            <div class="table-body" id="table-body" style="height: 270px;overflow-y:auto;">
            <table class="list" border="0" cellpadding="0" cellspacing="0" id="tablebody">
                <colgroup>
                <col width="4%" />
                <col width="4%" />
                <col width="10%" />
                <col width="10%"/>
                <col width="8%"/>
                <col width="8%"/>
                <col width="7%"/>
                <col width="10%"/>
                <col width="8%"/>
                <col width="5%"/>
                <col width="13%"/>
                <col width="13%"/>
                </colgroup>
                <tbody>
                <apex:repeat value="{!raqList}" var="info"  id="info">
                <tr height="48px">
                <!-- <apex:outputLink value="/{!info.Id}">{!info.Series_No__c}</apex:outputLink>-->
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Series_No__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Apply_Set_Detail__r.Queue_Number__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Apply_Set_Detail__r.Queue_Time_F__c}"/></td>
                    <apex:outputPanel layout="none">
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__r.WorkPlace__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__r.Person_In_Charge__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__r.Request_shipping_day__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__r.Request_approval_time__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__r.demo_purpose2__c}"/></td>
                    </apex:outputPanel>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Apply_Set_Detail__r.Queue_User__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__r.Hospital__c}"/></td>
                    <td style="white-space: pre-wrap;"><apex:outputField value="{!info.Rental_Apply__r.Campaign__c}"/></td>
                </tr>
                </apex:repeat>
                </tbody>
            </table>
        </div>
        </apex:pageBlock>
    </apex:form>
</apex:page>
force-app/main/default/pages/RentalApplyExtensions.page
@@ -9,12 +9,12 @@
        <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230619 ljh lightning  -->
        <!-- 20230614 ljh lightning start -->
        <style type="text/css">
            table.list .col_Name  {width:150px;}
            table.list .col_First_RAESD_Model_No_F__c  {width:100px;}
            table.list .col_Name  {width:200px;}
            table.list .col_First_RAESD_Model_No_F__c  {width:140px;}
            table.list .col_Set_Managment_Code__c  {width:90px;}
            table.list .col_SerialNumber_F__c  {width:80px;}
            table.list .col_Loaner_Set_No__c  {width:90px;}
            table.list .col_RAES_Status__c  {width:90px;}
            table.list .col_RAES_Status__c  {width:150px;}
            body .pbSubsection{
                padding-bottom: 0;
                padding-top: 0;
force-app/main/default/pages/RentalApplyExtensions.page.bak
New file
@@ -0,0 +1,56 @@
<!--20230420 zq 加壳  <apex:page controller="RentalApplyExtensionsController" showHeader="false" sidebar="false" action="{!init}" id="allPage" > -->
<apex:page controller="RentalApplyExtensionsController" showHeader="false" sidebar="false" action="{!init}" id="allPage" lightningStylesheets="true">
    <head>
        <title>备品借出申请延期</title>
        <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
        <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
        <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
        <apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
        <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230619 ljh lightning  -->
        <!-- 20230614 ljh lightning start -->
        <style type="text/css">
            table.list .col_Name  {width:150px;}
            table.list .col_First_RAESD_Model_No_F__c  {width:100px;}
            table.list .col_Set_Managment_Code__c  {width:90px;}
            table.list .col_SerialNumber_F__c  {width:80px;}
            table.list .col_Loaner_Set_No__c  {width:90px;}
            table.list .col_RAES_Status__c  {width:90px;}
            body .pbSubsection{
                padding-bottom: 0;
                padding-top: 0;
            }
            body .pbSubsection > .detailList:first-child{
                margin-top: 0;
            }
        </style>
        <!-- 20230614 ljh lightning end -->
    </head>
    <apex:form id="allForm">
        <apex:outputPanel id="message">
            <apex:pageMessages />
        </apex:outputPanel>
        <apex:actionFunction name="submitExtensionRequest" action="{!submitExtensionRequest}" rerender="allForm" oncomplete="unblockUI();"/>
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <apex:pageBlockSection title="备品借出申请" id="mainSection">
                </apex:pageBlockSection>
                <table style="width:800px;float:right;margin-top: 8px" >
                    <tr>
                        <td style="width:450px;">
                            <apex:commandButton value="提交延期申请" onclick="if (window.confirm('是否提交延期申请?')) {blockme(); submitExtensionRequest();}return false;"/>
                        </td>
                        <td style="width:450px;">
                            <apex:outputPanel rendered="{!if( buttonFlag , 'true','false')}" >
                                <input type="submit" value="关闭" class="btn" onclick="window.close();"/>
                            </apex:outputPanel>
                            <apex:outputPanel rendered="{!if( buttonFlag , 'false','true')}" >
                                <apex:commandButton value="返回" action="{!comeBack}" />
                            </apex:outputPanel>
                        </td>
                    </tr>
                </table>
            </apex:pageBlock>
            <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true" isRadio="false"/>
        </apex:outputPanel>
    </apex:form>
</apex:page>
force-app/main/default/pages/RentalApplySequence.page
@@ -73,6 +73,10 @@
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* 20230802 ljh */
    body .bPageBlock .detailList .dataCol{
        width: 8%;
    }
</style>
<script>
    // 滚轴是否显示
force-app/main/default/pages/RentalApplySequence.page.bak
New file
@@ -0,0 +1,452 @@
<!--
 * @Description: 备品排队展示包含队列信息和序列信息
 * @Author: [lijinhuan]
 * @Date: 2021-10-26 14:15:03
 * @LastEditors: [lijinhuan]
 * @LastEditTime: 2023-06-06 13:04:33
-->
<!-- 20230522 ljh lightning  -->
<!-- <apex:page controller="RentalApplySequenceController"  showHeader="false" sidebar="false" id="allPage" action="{!init}" title="排队查看"> -->
<apex:page controller="RentalApplySequenceController"  showHeader="false" sidebar="false" id="allPage" action="{!init}" title="排队查看" lightningStylesheets="true">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230525 ljh lightning  -->
<style type="text/css">
    .hideDropdown select{
        display: none
    }
    .table-head{padding-right:17px;}
    .tablehead0{padding-right:0;}
    .table-body table tr:nth-child(2n){background-color:#f2f2f2;}
    /*以下是下拉复选框的样式  start*/
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    .nav {
        width: 180px;/*20230606 ljh*/
        line-height: 30px;/*20230606 ljh*/
        /* border: 1px solid #000; *//*20230610 ljh*/
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        margin: 0;
        z-index: 9999;
        display: inline-block;
        border-radius: 0.25rem;/*20230607 ljh*/
        border: 1px solid rgb(201, 201, 201);/*20230610 ljh lightning*/
    }
    ul,
    li {
        list-style: none;
    }
    .nav li input {
        margin: 0px 3px 0px 3px;
    }
    .nav li p:hover {
        background: #1e90ff;
        color: #fff;
    }
    .nav_a li input {
        margin: 0px 3px 0px 3px;
    }
    .nav_a li p:hover {
        background: #1e90ff;
        color: #fff;
    }
    #classification {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    #classification_a {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
</style>
<script>
    // 滚轴是否显示
    window.onload = function gunzhou(){
    // window.onload = () => {
        gzShow();
    }
    function gzShow(){
        // console.log(j$('#tablebody').height());
        if(j$('#tablebody').height() >= 270){
            j$('#table-head').addClass("table-head");
        }else{
            j$('#table-head').addClass("tablehead0");
        }
    }
    //下拉多选框  strat
    j$(document).bind("click",function(e){
        var e = e || window.event;    //事件对象,兼容IE
        var target = e.target || e.srcElement;  //源对象,兼容火狐和IE
        while(target){
            // console.log(target.id);
            if (target.id && (target.id == "nav" ||target.id == "nav_a")){
             //循环判断至根节点,防止点击的是#selected和它的子元素
                return;
            }
           target = target.parentNode;
        }
        j$("#selectCheckId").hide();   //点击的不是#selected和它的子元素,隐藏下拉菜单
        j$("#selectCheckId_a").hide();
    })
    //选择备品存放地 下拉框值有变动以后触发
    function selectCunFangDiJs(Obj){
        var selectId = Obj.value;
        //如果备品存放地选择无
        // console.log('00:'+selectId);
        //消除选择的其他选项
        if(j$("#classification").children().text() != "--无--"){
            j$("#classification").children().remove();
            j$("#classification").append("<span class='valClass_CF' id='initial'>--无--</span>");
        }
        var inputObj = j$(".li-input");
        if(inputObj != null){
            for(var i = 0; i < inputObj.length;i++){
                if(inputObj[i].checked){
                    inputObj[i].checked = false;
                }
            }
        }
        j$("#selectCheckId").show();
        // j$("#selectCheckId_a").hide();
    }
    //点击 本部选择
    function selectBenBu(obj,name){
        var checked1 = j$(obj).prop("checked");
        if (checked1 == true) {
            j$("#classification").children("#initial").remove();
            var idTemp = j$(obj).value().trim();
            idTemp = 'Id'+idTemp.split('.')[0];
            j$("#classification").append("<span class='valClass' id='" + (idTemp) + "'>" + (j$(obj)
                .value().trim() + ",") + "</span>");
        } else {
            var idTemp = 'Id'+name.split('.')[0];
            j$("#classification").children("#" + (idTemp)).remove();
            var length = j$("#classification").html().length;
            if (length === 0) {
                j$("#classification").append("<span class='valClass' id='initial'>--无--</span>");
            }
        }
        var optioncheck = j$(".valClass");
        var hint = '';
        for(var i = 0;i<optioncheck.length;i++){
            if(optioncheck[i].innerText != '--无--'){
                hint +=optioncheck[i].innerText;
            }
        }
        // console.log(hint);
        j$(escapeVfId('allPage:allForm:searchBlock:mainSection:ApplyBB:S_ApplyBenBu')).val(hint);
    }
    function navClose(){
        j$("#selectCheckId").toggle();
    }
    // 办事处点击选择
    function selectAgency(obj,name){
        var checked1 = j$(obj).prop("checked");
        if (checked1 == true) {
            j$("#classification_a").children("#initial_a").remove();
            var idTemp = j$(obj).value().trim();
            idTemp = 'Id'+idTemp.split('.')[0];
            j$("#classification_a").append("<span class='valClass_a' id='" + (idTemp) + "'>" + (j$(obj)
                .value().trim() + ",") + "</span>");
        } else {
            var idTemp = 'Id'+name.split('.')[0];
            j$("#classification_a").children("#" + (idTemp)).remove();
            var length = j$("#classification_a").html().length;
            if (length === 0) {
                j$("#classification_a").append("<span class='valClass_a' id='initial_a'>--无--</span>");
            }
        }
        var optioncheck = j$(".valClass_a");
        var hint = '';
        for(var i = 0;i<optioncheck.length;i++){
            if(optioncheck[i].innerText != '--无--' ){
                hint +=optioncheck[i].innerText;
            }
        }
        j$(escapeVfId('allPage:allForm:searchBlock:mainSection:ApplyAA:S_Agency')).val(hint);
    }
    function navClose_a(){
        j$("#selectCheckId_a").toggle();
    }
    function searchJs() {
        blockme();
        searchfunc();
    }
    function checkEventJs(obj){
        blockme();
        j$(escapeVfId('allPage:allForm:checkEventId')).val(obj);
        checkEvent();
    }
</script>
<apex:form id="allForm">
    <apex:actionFunction name="changeCunfangdi" rerender="S_bieBenBuApply" oncomplete="unblockUI();"/>
    <!-- <apex:actionFunction name="changebenbu" rerender="S_AgencyApply" oncomplete="unblockUI();"/> -->
    <apex:actionFunction name="searchfunc" action="{!searchBtn}" rerender="MySequence,checEventFrame" onComplete="gzShow();unblockUI();"/>
    <apex:actionFunction name="recordNumChangeAction" action="{!recordNumChange}" rerender="MySequence" oncomplete="unblockUI();">
    </apex:actionFunction>
    <apex:actionFunction name="checkEvent" action="{!checkEvent}" rerender="checEventFrame" oncomplete="window.scrollTo(0, 200);unblockUI();">
    </apex:actionFunction>
    <apex:inputHidden id="checkEventId" value="{!checkEventId}" />
    <apex:pageBlock id="searchBlock" title="查看排队情况">
        <apex:pageBlockSection title="检索" id="mainSection" columns="4"  >
             <apex:pageBlockSectionItem >
                <apex:outputLabel value="申请单号" />
                <apex:inputText id="S_raName" value="{!S_raName}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="型号" />
                <apex:inputText id="S_Fixture_Model_No" value="{!S_Fixture_Model_No}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="备品出借担当" />
                <apex:inputField id="S_Person_In_Charge" value="{!S_Ra_Person.Person_In_Charge__c}" styleClass="hideDropdown" />
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem rendered="{!isEquipmentCenter}">
                <apex:outputLabel for="S_bieBenBu" value="队列所在地区本部" />
                <apex:inputText id="S_bieBenBu" value="{!S_bieBenBu}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem rendered="{!isEquipmentCenter}">
                <apex:outputLabel for="S_bieCunFangDi" value="备品存放地" />
                <apex:selectList value="{!S_bieCunFangDi}"  onchange="blockme(); changeCunfangdi();selectCunFangDiJs(this);return false;" size="1" style="width:160px" id="S_bieCunFangDi">
                <apex:selectOptions value="{!bieCunFangDiOps}"/>
                </apex:selectList>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem rendered="{!!isEquipmentCenter}"></apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem id="ApplyBB">
                <apex:outputLabel for="S_bieBenBuApply" value="申请人所属本部" />
                <apex:outputPanel style="position: absolute; " id="S_bieBenBuApply">
                    <apex:inputHidden id="S_ApplyBenBu" value="{!S_ApplyBenBu}" />
                    <ul class="nav" id="nav" style="background-color: #FFFFFF;left:0px;">
                        <li id="classification" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose();return false;">
                            <span id="initial">--无--</span>
                        </li>
                        <li id="selectCheckId" style="margin-left:0px;display: none;">
                            <ul style="margin-left:0px;">
                            <apex:repeat value="{!SApplyBenBu}" var="orr" id="selSD">
                            <li class="sdclass" style="margin-left:0px">
                                <p class="ul-nav" name="cate_id[]" >
                                    <input type="checkbox" value="{!orr.parameterName}" class="li-input" onclick="selectBenBu(this,'{!orr.parameterName}');" style="display: inline-block;vertical-align: middle;" />
                                    <font style="">{!orr.parameterName}</font>
                                </p>
                            </li>
                            </apex:repeat>
                            </ul>
                        </li>
                    </ul>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem id="ApplyAA" >
                <apex:outputLabel for="S_AgencyApply" value="申请者办事处" />
                <apex:outputPanel style="position: absolute; " id="S_AgencyApply">
                <apex:inputHidden id="S_Agency" value="{!S_Agency}" />
                <ul class="nav" id="nav_a" style="background-color: #FFFFFF;left:0px;">
                    <li id="classification_a" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose_a();return false;">
                        <span id="initial_a">--无--</span>
                    </li>
                    <li id="selectCheckId_a" style="margin-left:0px;display: none;">
                        <ul style="margin-left:0px;">
                        <apex:repeat value="{!SApplyAgency}" var="orr" id="selSD">
                        <li class="sdclass" style="margin-left:0px">
                            <p class="ul-nav" name="cate_id[]" >
                                <input type="checkbox" value="{!orr.parameterName}" class="li-input" onclick="selectAgency(this,'{!orr.parameterName}');" style="display: inline-block;vertical-align: middle;" />
                                <font style="">{!orr.parameterName}</font>
                            </p>
                        </li>
                        </apex:repeat>
                        </ul>
                    </li>
                </ul>
            </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem rendered="{!isEquipmentCenter}" >
                <apex:outputLabel for="S_bieBeiPinFenLei" value="备品分类" />
                    <apex:selectList value="{!S_bieBeiPinFenLei}" size="1" id="bieBeiPinFenLei" style="width:180px">
                        <apex:selectOptions value="{!bieBeiPinFenLeiOps}"/>
                    </apex:selectList>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem rendered="{!isEquipmentCenter}" >
                <apex:outputLabel for="S_Product_category" value="产品分类(GI/SP)" />
                <apex:selectList value="{!S_Product_category}" size="1" style="width:60px" id="S_Product_category">
                <apex:selectOptions value="{!bieChanPinFenLeiOps}"/>
                </apex:selectList>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:commandButton style="" value="检索" onclick="searchJs(); return false;"/>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <!-- 数据 -->
    </apex:pageBlock>
    <apex:pageBlock id="MySequence">
    <apex:outputPanel id="message">
        <apex:pageMessages />
    </apex:outputPanel>
    <apex:pageBlockButtons location="top" id="pageBlockButton1">
    <table align="right" style="width: 700px;">
        <tr>
            <td>{!(currPage-1)*selctRecordNum}&nbsp;-&nbsp;{!IF(currPage*selctRecordNum > totalRecords, totalRecords, currPage*selctRecordNum)}</td>
            <td>&nbsp;&nbsp;共{!totalRecords}个</td>
            <td align="right" width="150px">显示
                <apex:selectList value="{!selRecordOption}" id="selRecordOption" size="1" onchange="blockme();recordNumChangeAction();" disabled="{!IF(totalRecords<20,true,false)}"><apex:selectOptions value="{!recordNum}"/></apex:selectList>条记录
            </td>
            <td align="right" width="55px">第{!currPage}页</td>
            <td align="right" width="45px">
                <apex:commandLink action="{!firstPage}" value="首页" id="firstPg" onclick="blockme();" oncomplete="unblockUI();" reRender="MySequence" style="{!IF(currPage==1,'display: none;','')}color: blue;"/>
                <apex:outputText value="首页" style="{!IF(currPage!=1,'display: none;','')}color: gray;"></apex:outputText>
            </td>
            <td align="right" width="55px">
                <apex:commandLink action="{!previousPage}" value="上一页" id="previous" onclick="blockme();" oncomplete="unblockUI();" reRender="MySequence" style="{!IF(currPage==1,'display: none;','')}color: blue;"/>
                <apex:outputText value="上一页" style="{!IF(currPage!=1,'display: none;','')}color: gray;"></apex:outputText>
            </td>
            <td width="3px"></td>
            <td align="left" width="55px">
                <apex:commandLink action="{!nextPage}" value="下一页" id="next" onclick="blockme();" oncomplete="gzShow();unblockUI();" reRender="MySequence" style="{!IF(totalPage==currPage ||totalPage == 0,'display: none;','')}color: blue;"/>
                <apex:outputText value="下一页" style="{!IF(totalPage!=currPage && totalPage != 0,'display: none;','')}color: gray;"></apex:outputText>
            </td>
            <td align="left" width="45px">
                <apex:commandLink action="{!endPage}" value="尾页" id="endPg" onclick="blockme();" oncomplete="gzShow();unblockUI();" reRender="MySequence" style="{!IF(totalPage==currPage||totalPage == 0,'display: none;','')}color: blue;"/>
                <apex:outputText value="尾页" style="{!IF(totalPage!=currPage
                    && totalPage != 0,'display: none;','')}color: gray;"></apex:outputText>
            </td>
            <!-- HWAG-B4R3SS  END 20181026-->
            <td align="left">共{!totalPage}页</td>
        </tr>
    </table>
    </apex:pageBlockButtons>
    <!-- <div  style="height: 270px;overflow-y:auto;"> -->
        <div class="" id="table-head">
        <table class="list" border="0" cellpadding="0" cellspacing="0" width="100%"  >
            <!-- style="table-layout: fixed;" -->
            <colgroup style="{!IF(isEquipmentCenter,'','display:none;')}" >
            <col width="10%" />
            <col width="10%" />
            <col width="8%" />
            <!-- 2022015 -->
            <col width="6%" />
            <col width="10%"/>
            <col width="4%"/>
            <col width="8%"/>
            <col width="6%"/>
            <col width="6%"/>
            <col width="6%"/>
            <col width="6%"/>
            <col width="4%"/>
            <col width="16%"/>
            </colgroup>
            <colgroup style="{!IF(isEquipmentCenter,'display:none;','')}" >
            <col width="16%" />
            <col width="16%" />
            <col width="16%" />
            <col width="12%" />
            <col width="10%"/>
            <col width="10%"/>
            <col width="10%"/>
            <col width="10%"/>
            </colgroup>
            <thead>
            <tr class="headerRow">
                <th style="padding-bottom: 6px;">申请单号No.</th>
                <th style="padding-bottom: 6px;">一览No.</th>
                <th style="padding-bottom: 6px;">型号</th>
                <th style="padding-bottom: 6px;">排队备品<br/>预计出库时间</th>
                <th style="padding-bottom: 6px; {!IF(isEquipmentCenter,'','display:none;')}">队列所在地区本部</th> <!-- 申请人看不到  -->
                <th style="padding-bottom: 6px;{!IF(isEquipmentCenter,'','display:none;')}">产品分类<br/>(GI/SP)</th> <!-- 申请人看不到 -->
                <th style="padding-bottom: 6px;{!IF(isEquipmentCenter,'','display:none;')}">备品分类</th> <!-- 申请人看不到 -->
                <th style="padding-bottom: 6px;{!IF(isEquipmentCenter,'','display:none;')}">备品存放地</th> <!-- 申请人看不到 -->
                <th style="padding-bottom: 6px;">申请者<br/>销售本部</th>
                <th style="padding-bottom: 6px;">申请者<br/>办事处</th>
                <th style="padding-bottom: 6px;">备品出借担当</th>
                <th style="padding-bottom: 6px;">排队NO.</th>
                <th style="padding-bottom: 6px;{!IF(isEquipmentCenter,'','display:none;')}">序列NO.</th> <!-- 申请人看不到 -->
            </tr>
            </thead>
        </table>
        </div>
        <div class="table-body" id="table-body" style="height: 270px;overflow-y:auto;">
        <table class="list" border="0" cellpadding="0" cellspacing="0" id="tablebody" style="table-layout:fixed;" >
            <colgroup style="{!IF(isEquipmentCenter,'','display:none;')}" >
            <col width="10%" />
            <col width="10%" />
            <col width="8%" />
            <!-- 2022015 -->
            <col width="6%" />
            <col width="10%"/>
            <col width="4%"/>
            <col width="8%"/>
            <col width="6%"/>
            <col width="6%"/>
            <col width="6%"/>
            <col width="6%"/>
            <col width="4%"/>
            <col width="16%"/>
            </colgroup>
            <colgroup style="{!IF(isEquipmentCenter,'display:none;','')}" >
            <col width="16%" />
            <col width="16%" />
            <col width="16%" />
            <col width="12%" />
            <col width="10%"/>
            <col width="10%"/>
            <col width="10%"/>
            <col width="10%"/>
            </colgroup>
            <tbody>
            <apex:repeat value="{!raesInfoListList[currPage-1]}" var="info"  id="Sequence" >
            <tr height="48px">
                <td><apex:outputField value="{!info.raesd.Rental_Apply__c}"/></td>
                <!-- <span><apex:outputLink value="/{!rased.Id}"> <apex:outputField value="{!rased.Rental_Apply__c}" id="opname"/></apex:outputLink></span> -->
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Rental_Apply_Equipment_Set__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Fixture_Model_No__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Rental_Apply_Equipment_Set__r.QueueShippmentDateNew__c}"/></td>
                <apex:outputPanel rendered="{!isEquipmentCenter}" layout="none">
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Salesdepartment_before__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Product_category_text__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Equipment_Type_text__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Internal_asset_location_before__c}"/></td>
                </apex:outputPanel>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Rental_Apply__r.Salesdepartment_text__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Rental_Apply__r.WorkPlace__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;"><apex:outputField value="{!info.raesd.Rental_Apply__r.Person_In_Charge__c}"/></td>
                <td style="white-space: pre-wrap;word-wrap:break-word;">
                    <apex:outputField value="{!info.raesd.Queue_Number__c}" rendered="{!!isEquipmentCenter}" />
                    <apex:outputLink value="" rendered="{!isEquipmentCenter}" onclick="checkEventJs('1;{!info.raesd.Rental_Apply_Equipment_Set__c}');return false;"> {!info.raesd.Queue_Number__c}</apex:outputLink>
                </td>
                <apex:outputPanel rendered="{!isEquipmentCenter}" layout="none">
                <td>
                    <apex:repeat value="{!info.raqList}" var="qL"  id="SeriesNo" >
                    <apex:outputLink value="" onclick="checkEventJs('2;{!qL.Id}');return false;">{!qL.Salesdepartment__c};{!qL.Equipment_Type__c};{!qL.Product_category__c};<font style="color: red;font-weight: 800;">{!qL.Series_No__c}</font>
                    </apex:outputLink><br/>
                    </apex:repeat>
                </td>
                </apex:outputPanel>
            </tr>
            </apex:repeat>
            </tbody>
        </table>
    </div>
    </apex:pageBlock>
</apex:form>
<apex:outputPanel id="checEventFrame">
    <apex:iframe id="theIframe" rendered="{!IF(!ISBLANK(frameUrl),true,false)}" title="排队一览" src="{!frameUrl}"/>
</apex:outputPanel>
</apex:page>
force-app/main/default/pages/RentalApplySplit.page
@@ -59,6 +59,14 @@
        body .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
            border-width: 1px;
        }*/
        /* 20230613 ljh lightning start */
        body .detailList .dataCol input[type="text"],body .detailList .dataCol select{
            min-width: 180px;
        }
        .pbBody{
            width:600px;
        }
        /* 20230613 ljh lightning start */
    </style>
    <apex:form id="allForm">
        <script type="text/javascript">
force-app/main/default/pages/RentalApplySplit.page.bak
New file
@@ -0,0 +1,176 @@
<apex:page controller="RentalApplySplitController" action="{!init}" showHeader="false" id="allPage" lightningStylesheets="true">
    <head>
      <title>备品借出申请分单</title>
      <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
      <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
      <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    </head>
    <style type="text/css">
        .hideDropdown select{
            display: none
        }
        .modal {
           display:none;
           position: fixed; /* Stay in place */
           z-index: 10; /* Sit on top */
           left: 0;
           top: 0;
           width: 100%; /* Full width */
           height: 100%; /* Full height */
           overflow: auto; /* Enable scroll if needed */
           background-color: rgb(0,0,0); /* Fallback color */
           background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
        }
        span.dateFormat {
            display: none;
        }
        /* Modal Content/Box */
        .modal-content {
           background-color: #fefefe;
           margin-left: 6px;
           margin-top: 100px;
           padding: 20px;
           border: 1px solid #888;
           right: 5%;
           position: absolute;
           width: 200px;
        }
        .modal-content-cancel {
           background-color: #fefefe;
           margin-left: -150px;
           margin-top: 100px;
           padding: 20px;
           border: 1px solid #888;
           left: 50%;
           position: absolute;
           width: 300px;
        }
        body .slds-vf-data-table thead th{
            background: none;
        }
        /*table.list td{
            width:100px;
            border-width: 1px;
        }
        table.list td.col_chk {
            width:30px;
        }
        body .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
            border-width: 1px;
        }*/
    </style>
    <apex:form id="allForm">
        <script type="text/javascript">
            function back() {
                window.opener.parent.location.href = "/{!ra.Id}";
                top.window.close();
            }
            function checkSaveStatus() {
                var saveStatus = document.getElementById('{!$Component.allForm.saveStatus}').value;
                if (saveStatus == 'ok') {
                    //20210609 ljh update 1732  start
                    var temp = '{!cloneRas.Id}';
                    console.log(temp);
                    if( temp == null || temp == '' ){
                        window.open("/{!ra.Id}");
                    }else{
                        window.open("/{!cloneRas.Id}");
                    }
                    //20210609 ljh update 1732 end
                    top.window.close();
                }
            }
            //现地管理分单 202100609 ljh update 1732
            function changeSplitApplyReason(){
                var reason = j$(escapeVfId('allPage:allForm:searchBlock:split:split0:Split_Apply_Reason')).value();
                console.log(reason);
                var RecordTypeIsAgency = j$(escapeVfId('allPage:allForm:RecordTypeIsAgency')).value();
                if(reason != null && (reason == '现地管理分单'
                    || (eval(RecordTypeIsAgency) && reason == '到货NG分单'))
                    ){
                    //办事处必须填写
                    j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).attr('disabled',false);
                    j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).attr('required',true);
                }else{
                    if(!(eval(RecordTypeIsAgency) && reason != null && reason == '到货NG分单')){
                        //办事处清空 只读
                        j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).val(null);
                        j$(escapeVfId('allPage:allForm:searchBlock:split:ToAgency0:ToAgency')).attr('disabled',true);
                    }
                }
            }
            function allSplitShow(){
                var allSplitShow = j$(escapeVfId('allPage:allForm:allSplitShow')).value();
                if(eval(allSplitShow)){
                    j$('#AllSplitModal').show();
                }
            }
        </script>
        <apex:pageMessages />
        <apex:inputHidden value="{!saveStatus}" id="saveStatus"/>
        <!-- 20210609 ljh add 1732  start-->
        <apex:inputHidden value="{!allSplitShow}" id="allSplitShow"/>
        <apex:inputHidden value="{!RecordTypeIsAgency}" id="RecordTypeIsAgency"/>
        <div id="AllSplitModal" class="modal">
            <div class="modal-content-cancel">
                <table>
                    <tr>
                        <td colspan="2">
                        是否要整单分{!IF(SplitNum == 1,'回备品中心?',IF(SplitNum == 2,'给其他办事处?',IF(SplitNum == 3,'给办事处?','')))}
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <apex:commandButton style="margin: 0 20px;" value="确定"  action="{!saveSplitAll}" oncomplete="checkSaveStatus();unblockUI();" onclick="j$('#AllSplitModal').hide();blockme();" rerender="allForm"
                            />
                            <apex:commandButton style="margin: 0 20px;" value="取消" onclick="j$('#AllSplitModal').hide();return false;"/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <!-- 20210609 ljh add 1732  end-->
        <apex:pageBlock id="searchBlock" tabStyle="Report">
            <apex:pageBlockSection title="备品借出申请分单" collapsible="false" id="split">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Name.label}" for="Name"/>
                    <apex:outputField value="{!ra.Name}" id="Name"/>
                </apex:pageBlockSectionItem>
                <!-- 20201119 ljh update start -->
                <apex:pageBlockSectionItem id="split0">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Split_Apply_Reason__c.label}" for="Split_Apply_Reason"/>
                    <apex:inputField value="{!cloneRas.Split_Apply_Reason__c}" id="Split_Apply_Reason" required="true"  onchange="changeSplitApplyReason();"/>
                </apex:pageBlockSectionItem>
                <!-- 20201117 ljh add start -->
                <apex:pageBlockSectionItem id="ToAgency0">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.ToAgency__c.label}" for="Name"/>
                    <apex:inputField value="{!cloneRas.ToAgency__c}" id="ToAgency"  />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem html-style="display: none;">
                <apex:inputField value="{!cloneRas.SalesdeptSelect__c}" id="SalesdeptSelect" style="display: none;" />
              </apex:pageBlockSectionItem>
                <!-- 20201117 ljh add end -->
            </apex:pageBlockSection>
            <apex:dataTable value="{!raesList}" var="raes" id="raesLists" border="allPage" cellpadding="5">
              <apex:column >
                <apex:facet name="header">借出备品配套一览No.</apex:facet>
                <apex:outputText value="{!raes.Name}" />
              </apex:column>
              <apex:column >
                <apex:facet name="header">借出配套型号</apex:facet>
                <apex:outputText value="{!raes.Loaner_code_F__c}" />
              </apex:column>
              <apex:column >
                <apex:facet name="header">借出备品配套一览状态</apex:facet>
                <apex:outputText value="{!raes.RAES_Status__c}" />
              </apex:column>
            </apex:dataTable>
            <div style="height: 15px"></div>
            <apex:commandButton value="确认分单" action="{!saveSplit}" oncomplete="allSplitShow();checkSaveStatus();unblockUI();" onclick="blockme();" rerender="allForm" />
            <apex:commandButton value="返回" onclick="back(); return false;" rerender="allForm" oncomplete="unblockUI();" />
          </apex:pageBlock>
        </apex:form>
</apex:page>
force-app/main/default/pages/RentalFixtureSetAssign.page
@@ -132,17 +132,17 @@
        j$("#classification_f").children("#initial_f").remove();
        var idTemp = j$(obj).value().trim();
        idTemp = 'Id'+idTemp.split('.')[0];
        j$("#classification_f").append("<span class='valClass' id='" + (idTemp) + "'>" + (j$(obj)
        j$("#classification_f").append("<span class='valClassf' id='" + (idTemp) + "'>" + (j$(obj)
            .value().trim() + ",") + "</span>");
    } else {
        var idTemp = 'Id'+name.split('.')[0];
        j$("#classification_f").children("#" + (idTemp)).remove();
        var length = j$("#classification_f").html().length;
        if (length === 0) {
            j$("#classification_f").append("<span class='valClass' id='initial_f'>--无--</span>");
            j$("#classification_f").append("<span class='valClassf' id='initial_f'>--无--</span>");
        }
    }
    var optioncheck = j$(".valClass");
    var optioncheck = j$(".valClassf");
    var hint = '';
    for(var i = 0;i<optioncheck.length;i++){
        if(optioncheck[i].innerText != '--无--'){
@@ -377,7 +377,8 @@
                    <apex:outputField value="{!parentObj.Product_category__c}"/>
                    <apex:pageBlockSectionItem id="SelectOP"  rendered="{!!(parentObj.Demo_purpose1__c=='维修代用'||parentObj.Demo_purpose1__c=='协议借用')}">
                    <!-- 20220106 ljh 放开 服务培训/学会 parentObj.CampaignType__c=='服务培训/学会'|| -->
                    <apex:outputLabel for="bieBeiPinFenLei" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="备品分类" />
                    <!-- <apex:outputLabel for="bieBeiPinFenLei" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="备品分类" /> -->
                    <apex:outputLabel for="bieBeiPinFenLei" value="备品分类" />
                    <apex:outputPanel style="position:absolute; " id="S_bieFenLei">
                        <ul class="nav" id="nav_f" style="background-color: #FFFFFF;left:0px;top:-5px;">
                            <li id="classification_f" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose_f();return false;">
@@ -400,7 +401,8 @@
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSectionItem id="Selectsalesd" rendered="{!!(parentObj.Demo_purpose1__c=='维修代用'||parentObj.Demo_purpose1__c=='协议借用')}">
                        <!-- 20220106 ljh 放开 服务培训/学会 parentObj.CampaignType__c=='服务培训/学会'|| -->
                        <apex:outputLabel for="salesd" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="本部" />
                        <!-- <apex:outputLabel for="salesd" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="本部" /> -->
                        <apex:outputLabel for="salesd"  value="本部" />
                        <apex:outputPanel style="position:absolute; " id="S_bieBenBu">
                            <ul class="nav" id="nav_b" style="background-color: #FFFFFF;left:0px;">
                                <li id="classification_b" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose_b();return false;">
@@ -426,7 +428,7 @@
                </apex:pageBlockSection>
                 <!-- 20230526 ljh lightning start-->
                <!-- <table style="width: 450px;margin: auto;float: left;margin-top: 1.5%;" > -->
                <table style="width: 450px;margin: auto;float: left;" >
                <table style="width: 550px;margin: auto;float: left;" >
                    <tr><td colspan="{!IF(parentObj.demo_purpose2__c == '学会展会'&&!(contains(parentObj.Salesdepartment__c,'MA本部')||contains(parentObj.Salesdepartment__c,'产品培训')),4,2)}">
                        &nbsp;</td>
                    </tr>
@@ -459,11 +461,10 @@
                        </td>
                    </tr>
                </table>
                <table style="width:800px;float:right;" >
                <table style="width:700px;float:right;" >
                  <tr>
                    
                      <td style="width:450px;">
                    </td>
                    <td style="width:350px;"></td>
                    <!-- <td style="width:180px;">
                    </td> -->
                    <th>{!$ObjectType.Rental_Apply__c.fields.Asset_loaner_start_day__c.label}</th>
@@ -471,7 +472,7 @@
                  </tr>
                  <tr>
                    
                    <td style="width:450px;">
                    <td style="width:350px;">
                      <apex:commandButton action="{!save}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame" oncomplete="unblockUI();"  />
                      <apex:commandButton style="margin-left:150px;" action="{!cancel}" value="返回" />
                    </td>
force-app/main/default/pages/RentalFixtureSetAssign.page.bak
New file
@@ -0,0 +1,642 @@
<apex:page lightningStylesheets="true" controller="RentalFixtureSetAssignController" showHeader="false" sidebar="false" id="allPage" action="{!init}" >
<head>
<title>备品出借分配设备</title>
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.RentalFixtureSetAssignCss)}"/>
<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230619 ljh lightning  -->
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<apex:includeScript value="{!URLFOR($Resource.RelationListPagingCmpJS)}"/>
<!-- <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
<apex:includeScript value="{!URLFOR($Resource.apex20)}"/> -->
<style type="text/css">
    .hideDropdown select{
        display: none
    }
    .modal {
        display:none;
        position: fixed; /* Stay in place */
        z-index: 10; /* Sit on top */
        left: 0;
        top: 0;
        width: 100%; /* Full width */
        height: 100%; /* Full height */
        overflow: auto; /* Enable scroll if needed */
        background-color: rgb(0,0,0); /* Fallback color */
        background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    }
    span.dateFormat {
        display: none;
    }
    /* Modal Content/Box */
    .modal-content {
        background-color: #fefefe;
        margin-left: 6px;
        margin-top: 100px;
        padding: 20px;
        border: 1px solid #888;
        right: 5%;
        position: absolute;
        width: 200px;
    }
    .modal-content-cancel {
        background-color: #fefefe;
        margin-left: -150px;
        margin-top: 100px;
        padding: 20px;
        border: 1px solid #888;
        left: 50%;
        position: absolute;
        width: 300px;
    }
    /* 20230606 ljh lightning start */
    body .detailList .dataCol input[type="text"],body .detailList .dataCol select{
        min-width: 180px;
    }
    /* body .bPageBlock .detailList .dataCol{
        width: 8%;
    } */
    body .bPageBlock .detailList .dataCol input[type="checkbox"]:first-child{
        margin-top: 0;
    }
    body .detailList td{
        position: static;
    }
    /*以下是下拉复选框的样式  start*/
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
    .nav {
        width: 180px;/*20230606 ljh*/
        line-height: 30px;/*20230606 ljh*/
        /* border: 1px solid #000; *//*20230610 ljh*/
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        margin: 0;
        /* z-index: 9999; */
        z-index: 2;
        display: inline-block;
        border-radius: 0.25rem;/*20230607 ljh lightning*/
        border: 1px solid rgb(201, 201, 201);/*20230610 ljh lightning*/
    }
    ul,li {
        list-style: none;
    }
    .nav li input {
        margin: 0px 3px 0px 3px;
    }
    .nav li p:hover {
        background: #1e90ff;
        color: #fff;
    }
    #classification_f,#classification_b {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
</style>
<script type="text/javascript">
var heightAjustment = 120;
var widthAjustment = 30;
var clickLineNo;
var iszhu;
// 20230607 ljh lightning start
j$(document).bind("click",function(e){
    var e = e || window.event;    //事件对象,兼容IE
    var target = e.target || e.srcElement;  //源对象,兼容火狐和IE
    while(target){
        // console.log(target.id);
        if (target.id && (target.id == "nav_f" ||target.id == "nav_b")){
            //循环判断至根节点,防止点击的是#selected和它的子元素
            return;
        }
        target = target.parentNode;
    }
    j$("#selectCheckId_f").hide();   //点击的不是#selected和它的子元素,隐藏下拉菜单
    j$("#selectCheckId_b").hide();
})
//点击 分类选择
function selectFenLei(obj,name){
    var checked1 = j$(obj).prop("checked");
    if (checked1 == true) {
        j$("#classification_f").children("#initial_f").remove();
        var idTemp = j$(obj).value().trim();
        idTemp = 'Id'+idTemp.split('.')[0];
        j$("#classification_f").append("<span class='valClass' id='" + (idTemp) + "'>" + (j$(obj)
            .value().trim() + ",") + "</span>");
    } else {
        var idTemp = 'Id'+name.split('.')[0];
        j$("#classification_f").children("#" + (idTemp)).remove();
        var length = j$("#classification_f").html().length;
        if (length === 0) {
            j$("#classification_f").append("<span class='valClass' id='initial_f'>--无--</span>");
        }
    }
    var optioncheck = j$(".valClass");
    var hint = '';
    for(var i = 0;i<optioncheck.length;i++){
        if(optioncheck[i].innerText != '--无--'){
            hint +=optioncheck[i].innerText;
        }
    }
    j$("[id*='equipmenttypes']").val(hint);
}
//点击 本部选择
function selectBenBu(obj,name){
    var checked1 = j$(obj).prop("checked");
    if (checked1 == true) {
        j$("#classification_b").children("#initial_b").remove();
        var idTemp = j$(obj).value().trim();
        idTemp = 'Id'+idTemp.split('.')[0];
        j$("#classification_b").append("<span class='valClass' id='" + (idTemp) + "'>" + (j$(obj)
            .value().trim() + ",") + "</span>");
    } else {
        var idTemp = 'Id'+name.split('.')[0];
        j$("#classification_b").children("#" + (idTemp)).remove();
        var length = j$("#classification_b").html().length;
        if (length === 0) {
            j$("#classification_b").append("<span class='valClass' id='initial_b'>--无--</span>");
        }
    }
    var optioncheck = j$(".valClass");
    var hint = '';
    for(var i = 0;i<optioncheck.length;i++){
        if(optioncheck[i].innerText != '--无--'){
            hint +=optioncheck[i].innerText;
        }
    }
    j$("[id*='salesdepartments']").val(hint);
}
// 分类
function navClose_f(){
    j$("#selectCheckId_f").toggle();
}
// 本部
function navClose_b(){
    j$("#selectCheckId_b").toggle();
}
// 20230607 ljh lightning end
function saveGoPageJs(clickLineNo1, iszhu1) {
    blockme();
    clickLineNo = clickLineNo1;
    iszhu = iszhu1;
    //如果当前操作的行没有选中,直接打勾选中
    var lock = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + clickLineNo + ':rowCheck'));
    lock.prop('checked', true);
    saveGoPageJs_save();
}
function saveGoPageJsComplete() {
    var errorFlag = j$(escapeVfId('allPage:allForm:hasError')).value();
    if(errorFlag == 'false'){
       // 跳转URL逻辑
       checkEvent(clickLineNo, iszhu);
    }
}
// 计算自然日
function getDays(date1,date2){
    var dayCount = 0;
    if(date1 && date2){
        //将时间字符串转化为距离1970年1月1日午夜零时的时间间隔的毫秒数
        var time1 = Date.parse(date1);
        var time2 = Date.parse(date2);
        //将两个时间相减,求出相隔的天数
        var dayCount = (Math.ceil(time2 - time1))/1000/60/60/24;
    }
    return dayCount;
}
function setAsset_loaner_closed_day(date1, daysId, demo_purpose2, Campaign_EndDate_F, dId) {
    var demo2 = j$(escapeVfId(demo_purpose2)).value();
    var days = 0;
    var date = date1;
    if (demo2 == '试用(无询价)'
            || demo2 == '试用(有询价)'
            || demo2 == '新产品评价'
            || demo2 == '其他'
            || demo2 == '协议借用') {
        days = j$(escapeVfId(daysId)).value();
        if (days != null && days != '' && days > 0) {
            days = days;
        }
    }
    else if (demo2 == '一般用户'
            || demo2 == '保修用户'
            || demo2 == '市场多年保修'
            || demo2 == '再修理'
            || demo2 == '索赔QIS'
            || demo2 == '已购待货'
            || demo2 == '故障排查') {
        days = 30;
    }
    else if (demo2 == '学会展会') {
        date = '{!parentObj.Campaign_EndDate_F__c}';
        days = 5;
    }
    j$(escapeVfId(dId)).val(dateAddDays(date, days));
}
function dateAddDays(dataStr,dayCount) {
    var strdate=dataStr;
    //日期字符串
    var isdate = new Date(strdate.replace(/-/g,"/"));
    //把日期字符串转换成日期格式
    isdate = new Date((isdate/1000+(86400*dayCount))*1000);
    //日期加1天
    var pdate = isdate.getFullYear()+"/"+(isdate.getMonth()+1)+"/"+(isdate.getDate());
    //把日期格式转换成字符串
    return pdate;
}
function confirmSpecial() {
    if(confirm("是否特殊排队?")){
        var needconfirm = false;
        var confirmMsg = '';
        var count = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:currentPageRecordCnt')).val();
        for(var i = 0;i < count;i ++){
            var lock = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + i + ':rowCheck')).prop('checked');
            if(lock){
                var QueueType = j$("input[name=QueueType__c][type=hidden]")[i].value;
                console.log(QueueType);
                // var type = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable:'+ i +':queueType')).val();
                if(QueueType != undefined && QueueType != '' ){
                    var model = j$("input[name=First_RAESD_Model_No_F__c][type=hidden]")[i].value;
                    confirmMsg +=   '第' + (i + 1) + '行 '+ model+' 已经' + QueueType + '; ' + '\n' ;
                    needconfirm = true;
                }
            }
        }
        console.log(needconfirm);
        if(needconfirm){
            return confirm(confirmMsg + '是否继续?');
        }else{
            return true;
        }
    }
    return false;
}
// 20220105 ljh update start
/*function defualtconfirm() {
    if(confirm("是否默认排队?")){
        var oldtype = j$("[id*='OldCampaignType']").val();
        var campaignType = j$("[id*='campaignType']").val();
        if(oldtype !="" && oldtype != undefined && oldtype != campaignType){
            if(confirm("您本次选择的学会类型与已排队的不一致,请确认是否更新")){
                j$("[id*='changeCampaignType']").val(true);
            }else{
                j$("[id*='changeCampaignType']").val(false);
            }
        }
        return true;
    }
    return false;
}*/
function defualtconfirm() {
    if(confirm("是否默认排队?")){
        var needconfirm = false;
        var confirmMsg = '';
        var count = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:currentPageRecordCnt')).val();
        for(var i = 0;i < count;i ++){
            var lock = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + i + ':rowCheck')).prop('checked');
            if(lock){
                var QueueType = j$("input[name=QueueType__c][type=hidden]")[i].value;
                console.log(QueueType);
                // var type = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable:'+ i +':queueType')).val();
                if(QueueType != undefined && QueueType != '' ){
                    var model = j$("input[name=First_RAESD_Model_No_F__c][type=hidden]")[i].value;
                    confirmMsg +=   '第' + (i + 1) + '行 '+ model+' 已经' + QueueType + '; ' + '\n' ;
                    needconfirm = true;
                }
            }
        }
        console.log(needconfirm);
        if(needconfirm){
            if(confirm(confirmMsg + '是否继续?')){
                var oldtype = j$("[id*='OldCampaignType']").val();
                var campaignType = j$("[id*='campaignType']").val();
                console.log(oldtype+campaignType);
                if(oldtype !="" && oldtype != undefined && oldtype != campaignType){
                    if(confirm("您本次选择的学会类型与已排队的不一致,请确认是否更新")){
                        j$("[id*='changeCampaignType']").val(true);
                    }else{
                        j$("[id*='changeCampaignType']").val(false);
                    }
                }
                return true;
            }
        }else{
            return true;
        }
    }
}
// 20220105 ljh update end
</script>
</head>
    <apex:form id="allForm">
        <apex:inputHidden id="salesdepartments" value="{!salesdepartments}" />
        <apex:inputHidden id="equipmenttypes" value="{!equipmenttypes}" />
        <apex:inputHidden id="changeCampaignType" value="{!changeCampaignType}"/>
        <apex:inputHidden id="OldCampaignType" value="{!oldCampaignType}"/>
        <apex:actionFunction name="save" action="{!save}" rerender="allForm,checEventFrame" onComplete="unblockUI();">
        </apex:actionFunction>
        <apex:actionFunction name="saveGoPageJs_save" action="{!save}" rerender="allForm,checEventFrame" onComplete="unblockUI();saveGoPageJsComplete();">
        </apex:actionFunction>
        <apex:actionFunction name="checkEvent" action="{!checkEvent}" rerender="allForm,checEventFrame" onComplete="unblockUI();window.open(j$(escapeVfId('{!$Component.checkEventUrl}')).value());">
            <apex:param name="firstParam" assignTo="{!clickLineNo}" value="" />
            <apex:param name="isZhu" value="" />
        </apex:actionFunction>
        <apex:inputHidden id="checkEventUrl" value="{!checkEventUrl}" />
        <apex:inputHidden id="Hope_Lonaer_date_Num" value="{!parentObj.Hope_Lonaer_date_Num__c}" />
        <apex:inputHidden id="demo_purpose2" value="{!parentObj.demo_purpose2__c}"/>
        <apex:outputText id="hasError" value="{!hasError}" style="display:none"/>
        <apex:outputPanel id="pageallPanel">
            <apex:pageBlock id="searchBlock" tabStyle="Report">
                <apex:pageBlockSection title="分配画面">
                    <apex:outputField value="{!parentObj.Name}"/>
                    <apex:outputField value="{!parentObj.Demo_purpose1__c}"/>
                    <apex:outputField value="{!parentObj.Salesdept__c}"/>
                    <apex:outputField value="{!parentObj.demo_purpose2__c}"/>
                    <apex:outputField value="{!parentObj.Internal_asset_location_F__c}"/>
                    <apex:outputField value="{!parentObj.Equipment_Type_F__c}"/>
                    <apex:outputField value="{!parentObj.Request_shipping_day__c}"/>
                    <apex:outputField value="{!parentObj.Request_return_day__c}"/>
                    <apex:outputField value="{!parentObj.Product_category__c}"/>
                    <apex:pageBlockSectionItem id="SelectOP"  rendered="{!!(parentObj.Demo_purpose1__c=='维修代用'||parentObj.Demo_purpose1__c=='协议借用')}">
                    <!-- 20220106 ljh 放开 服务培训/学会 parentObj.CampaignType__c=='服务培训/学会'|| -->
                    <apex:outputLabel for="bieBeiPinFenLei" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="备品分类" />
                    <apex:outputPanel style="position:absolute; " id="S_bieFenLei">
                        <ul class="nav" id="nav_f" style="background-color: #FFFFFF;left:0px;top:-5px;">
                            <li id="classification_f" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose_f();return false;">
                                <span id="initial_f">--无--</span>
                            </li>
                            <li id="selectCheckId_f" style="margin-left:0px;display: none;">
                                <ul style="margin-left:0px;">
                                <apex:repeat value="{!bieBeiPinFenLeiOps}" var="orr" id="selFL">
                                <li class="sdclass" style="margin-left:0px">
                                    <p class="ul-nav" name="cate_id[]" >
                                        <input type="checkbox" value="{!orr.value}" onclick="selectFenLei(this,'{!orr.value}');"  class="li-input" style="display: inline-block;vertical-align: middle;"/>
                                        <font style="">{!orr.label}</font>
                                    </p>
                                </li>
                                </apex:repeat>
                                </ul>
                            </li>
                        </ul>
                    </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                    <apex:pageBlockSectionItem id="Selectsalesd" rendered="{!!(parentObj.Demo_purpose1__c=='维修代用'||parentObj.Demo_purpose1__c=='协议借用')}">
                        <!-- 20220106 ljh 放开 服务培训/学会 parentObj.CampaignType__c=='服务培训/学会'|| -->
                        <apex:outputLabel for="salesd" style="font-weight: bold; font-family: Arial,Helvetica,sans-serif; font-size: 91%;color: #4a4a56;" value="本部" />
                        <apex:outputPanel style="position:absolute; " id="S_bieBenBu">
                            <ul class="nav" id="nav_b" style="background-color: #FFFFFF;left:0px;">
                                <li id="classification_b" class="transparent_class" style="margin-left:0px;height:30px;" onclick="navClose_b();return false;">
                                    <span id="initial_b">--无--</span>
                                </li>
                                <li id="selectCheckId_b" style="margin-left:0px;display: none;">
                                    <ul style="margin-left:0px;">
                                    <apex:repeat value="{!bieBenBuOps}" var="orr" id="selSD">
                                    <li class="sdclass" style="margin-left:0px">
                                        <p class="ul-nav" name="cate_id[]" >
                                            <input type="checkbox" value="{!orr.value}" onclick="selectBenBu(this,'{!orr.value}');"  class="li-input" style="display: inline-block;vertical-align: middle;"/>
                                            <font style="">{!orr.label}</font>
                                        </p>
                                    </li>
                                    </apex:repeat>
                                    </ul>
                                </li>
                            </ul>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                    <apex:inputField rendered="{!!(parentObj.Demo_purpose1__c=='维修代用'||parentObj.Demo_purpose1__c=='协议借用')}" id="product_category" value="{!parentObj.Product_category_Sys__c}" />
                    <!-- 20220106 ljh 放开 服务培训/学会 parentObj.CampaignType__c=='服务培训/学会'|| -->
                </apex:pageBlockSection>
                 <!-- 20230526 ljh lightning start-->
                <!-- <table style="width: 450px;margin: auto;float: left;margin-top: 1.5%;" > -->
                <table style="width: 450px;margin: auto;float: left;" >
                    <tr><td colspan="{!IF(parentObj.demo_purpose2__c == '学会展会'&&!(contains(parentObj.Salesdepartment__c,'MA本部')||contains(parentObj.Salesdepartment__c,'产品培训')),4,2)}">
                        &nbsp;</td>
                    </tr>
                    <tr>
                        <apex:outputPanel rendered="{!parentObj.demo_purpose2__c == '学会展会'&&!(contains(parentObj.Salesdepartment__c,'MA本部')||contains(parentObj.Salesdepartment__c,'产品培训'))}">
                            <td style="width:50px;font-weight: bold;font-family: Arial,Helvetica,sans-serif;font-size: 91%;color: #4a4a56;">
                                {!$ObjectType.Rental_Apply__c.fields.CampaignType__c.label}
                            </td>
                             <td style="width:80px;">
                                <apex:inputField id="campaignType" value="{!parentObj.CampaignType__c}" />
                            </td>
                        </apex:outputPanel>
                        <!-- 20230526 ljh lightning start-->
                        <!-- <td colspan="2" style="text-align:end;"> -->
                        <td style="text-align:end;">
                        <!-- 20230526 ljh lightning end-->
                            <apex:commandButton action="{!defaultScheduel}" disabled="{!parentObj.Demo_purpose1__c=='其他'||parentObj.Status__c!='已批准'}" onclick="if(!defualtconfirm()) return false;blockme();" oncomplete="unblockUI();"  value="默认排队" rerender="message,campaignType"/>
                            <!-- 20220105 ljh rerender add cmpid -->
                        </td>
                        <!-- 20230526 ljh lightning start-->
                        <!-- <td style="width:190px;"> -->
                        <td>
                        <!-- 20230526 ljh lightning end-->
                            <apex:outputPanel rendered="{!!(parentObj.Demo_purpose1__c=='维修代用'||parentObj.Demo_purpose1__c=='协议借用'||parentObj.Status__c!='已批准')}">
                                <apex:commandButton style="margin-left:20px;" onclick="if(!confirmSpecial()) return false;blockme();"  action="{!specialScheduel}" disabled="{parentObj.Demo_purpose1__c=='维修代用'||parentObj.Demo_purpose1__c=='协议借用'||parentObj.Status__c!='已批准'}" value="特殊排队" rerender="cmpid,checEventFrame,message,campaignType" oncomplete="unblockUI();"  />
                            </apex:outputPanel>
                            <!-- 20220106 ljh 放开 服务培训/学会 !parentObj.CampaignType__c=='服务培训/学会'|| -->
                            <!-- 20220105 ljh rerender add cmpid -->
                            <apex:commandButton style="margin-left:20px;" disabled="{!parentObj.Status__c!='已批准'}" action="{!topInLine}" value="排队NO.置顶" onclick="blockme();" oncomplete="unblockUI();" rerender="cmpid,checEventFrame,message"  />
                        </td>
                    </tr>
                </table>
                <table style="width:800px;float:right;" >
                  <tr>
                      <td style="width:450px;">
                    </td>
                    <!-- <td style="width:180px;">
                    </td> -->
                    <th>{!$ObjectType.Rental_Apply__c.fields.Asset_loaner_start_day__c.label}</th>
                    <th>{!$ObjectType.Rental_Apply__c.fields.Asset_loaner_closed_day__c.label}</th>
                  </tr>
                  <tr>
                    <td style="width:450px;">
                      <apex:commandButton action="{!save}" value="保存" onclick="blockme();" rerender="allForm,checEventFrame" oncomplete="unblockUI();"  />
                      <apex:commandButton style="margin-left:150px;" action="{!cancel}" value="返回" />
                    </td>
                    <td id="special"><apex:inputField id="rentalStartDate" value="{!parentObj.Asset_loaner_start_day__c}" onchange="setAsset_loaner_closed_day(this.value, '{!$Component.Hope_Lonaer_date_Num}', '{!$Component.demo_purpose2}', '{!$Component.Campaign_EndDate_F}', '{!$Component.rentalEndDate}'); return false"></apex:inputField></td>
                    <td id="special"><apex:inputField id="rentalEndDate" value="{!parentObj.Asset_loaner_closed_day__c}" html-disabled="true" ></apex:inputField></td>
                    <td><apex:commandButton action="{!checkDate}" reRender="allForm,checEventFrame" value="适用" oncomplete="applyJs()" />
                      <script type="text/javascript">
                        function applyJs() {
                          var errorFlag = j$(escapeVfId('{!$Component.hasError}')).value();
                          if(errorFlag == 'false'){
                            var cnt = document.getElementById('allPage:allForm:cmpid:cmpinnerid:dataBlock:currentPageRecordCnt').value;
                            var rentalStartDate = j$(escapeVfId('{!$Component.rentalStartDate}')).value();
                            var rentalEndDate = j$(escapeVfId('{!$Component.rentalEndDate}')).value();
                            //算出借出时间(天) = 备品预计回收日 - 备品预计出货日
                            var days = getDays(rentalStartDate, rentalEndDate);
                            var td_start = [];
                            j$("td.dataCellBorder1.col_Rental_Start_Date__c").each(function () {
                              td_start.push(j$(this))
                            });
                            var td_end = [];
                            j$("td.dataCellBorder1.col_Rental_End_Date__c").each(function () {
                              td_end.push(j$(this))
                            });
                            var td_days = [];
                            j$("td.dataCellBorder1.col_Jie_Chu_Shi_Jian_Jia__c").each(function () {
                              td_days.push(j$(this))
                            });
                            for (var i = 0; i < cnt; i++) {
                              var lock = j$(escapeVfId('allPage:allForm:cmpid:cmpinnerid:dataBlock:oppTable_L:' + i + ':rowCheck'));
                              if(lock.prop('checked') == true){
                                td_start[i].find("input").val(rentalStartDate);
                                td_end[i].find("input").val(rentalEndDate);
                                td_days[i].find("span").text(days);
                              }
                            }
                          }
                        }
                      </script>
                    </td>
                  </tr>
                </table>
                <div style="clear:both;"></div>
            <apex:outputPanel id="message">
                <apex:pageMessages />
            </apex:outputPanel>
        </apex:pageBlock>
        <c:RelationListPagingCmp id="cmpid" pgController="{!this}" hasCheckbox="true"/>
        </apex:outputPanel>
        <div id="AllSplitModal" class="modal">
            <div class="modal-content-cancel">
                <table>
                    <tr>
                        <td style="width:300px;text-align: center;" colspan="2">
                        是否特殊排队
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <apex:commandButton style="margin: 0 20px;" value="确定"   rerender="allForm"
                            />
                            <apex:commandButton style="margin: 0 20px;" value="取消" onclick="j$('#AllSplitModal').hide();return false;"/>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </apex:form>
    <apex:outputPanel id="checEventFrame">
        <script>
        addlinkbutton();
        function addlinkbutton(){
          // 次の画面遷移click
          var ele = j$(".dataCellBorder1.col_Zhu_Ti_Fen_Pei_Jia__c");
          var ele1 = j$(".dataCellBorder1.col_Fu_Shu_Pin_Fen_Pei_Jia__c");
          var showButton = eval("({!JSENCODE(bodyModelNoJson)})");
          // alert(ele.length);
          if(ele.length){
            var i = 0;
            ele.each(function () {
              var showmap = showButton[i];
              if (showmap['ZHU']) {
                j$(this).css('align-items','center');
                j$(this).append('<input type="button" style="width: auto;" value="分配" onclick="saveGoPageJs('+i+', true);"/>');
                console.log(j$(this).children("span")[0].innerText);
                var value = j$(this).children("span")[0].innerText;
                if(value == '暂定分配'){
                    j$(this).append('<input type="button" style="width: auto;" value="指定暂定分配" onclick="derectlyAssign('+i+');"/>');
                }
              }
              i = i + 1;
            })
          }
          if(ele1.length){
            var i = 0;
            ele1.each(function () {
              var showmap = showButton[i];
              if (showmap['FU']) {
                j$(this).css('align-items','center');
                // j$(this).css('display','inline-flex').css('align-items','center');
                j$(this).append('<input type="button" style="width: auto;" value="分配" onclick="saveGoPageJs('+i+', false);"/>');
              }
              i = i + 1;
            })
          }
          j$("td.dataCellBorder1.col_Rental_Start_Date__c").on("change", function() {
            var from = j$(this).find("input").val();
            var to = j$(this).next().find("input").val();
            //算出借出时间(天) = 备品预计回收日 - 备品预计出货日
            var days = getDays(from, to);
            j$(this).next().next().find("span").text(days);
          })
          j$("td.dataCellBorder1.col_Rental_End_Date__c").on("change", function() {
            var from = j$(this).prev().find("input").val();
            var to = j$(this).find("input").val();
            //算出借出时间(天) = 备品预计回收日 - 备品预计出货日
            var days = getDays(from, to);
            j$(this).next().find("span").text(days);
          })
        }
        showDate();
        function showDate() {
            var cnt = document.getElementById('allPage:allForm:cmpid:cmpinnerid:dataBlock:currentPageRecordCnt').value;
            var td_start = [];
            j$("td.dataCellBorder1.col_Rental_Start_Date__c").each(function () {
              td_start.push(j$(this))
            });
            var td_end = [];
            j$("td.dataCellBorder1.col_Rental_End_Date__c").each(function () {
              td_end.push(j$(this))
            });
            var td_days = [];
            j$("td.dataCellBorder1.col_Jie_Chu_Shi_Jian_Jia__c").each(function () {
              td_days.push(j$(this))
            });
            for (var i = 0; i < cnt; i++) {
                var days = getDays(td_start[i].find("input").val(), td_end[i].find("input").val());
                td_days[i].find("span").text(days);
            }
        }
        function derectlyAssign(index) {
            // var viewList = JSONCODE(viewListStr);
            var viewList = eval("({!JSENCODE(WrapperJSON)})");
            // console.log('{!wrapperStr}');
            console.log('index***',index);
            console.log(viewList);
            console.log(viewList[index].sobj.Id);
            var rasdId = viewList[index].sobj.Id;
            window.location.href = '/apex/DirectAssign?oldquenId='+ rasdId;
        }
        </script>
    </apex:outputPanel>
</apex:page>
force-app/main/default/pages/RentalFixtureSetAssignAgency.page
@@ -37,7 +37,9 @@
       border: 1px solid #888;
       right: 5%;
       position: absolute;
       width: 200px;
       /* 20230628 ljh */
       /* width: 200px; */
       width: 300px;
    }
    .modal-content-cancel {
       background-color: #fefefe;
force-app/main/default/pages/RentalFixtureSetAssignAgency.page.bak
New file
@@ -0,0 +1,558 @@
<!-- 20230524 ljh lightning  -->
<!-- <apex:page controller="RentalFixtureSetAssignAgencyController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="办事处分配/发货"> -->
<apex:page controller="RentalFixtureSetAssignAgencyController" showHeader="false" sidebar="false" id="allPage" action="{!init}" title="办事处分配/发货" lightningStylesheets="true">
<!-- 20210624 ljh update SFDC-C448GR --><!-- title="办事处分配/下架/发货" -->
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.instascan)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/><!-- 20230525 ljh lightning  -->
<style type="text/css">
    .hideDropdown select{
        display: none
    }
    .modal {
       display:none;
       position: fixed; /* Stay in place */
       z-index: 10; /* Sit on top */
       left: 0;
       top: 0;
       width: 100%; /* Full width */
       height: 100%; /* Full height */
       overflow: auto; /* Enable scroll if needed */
       background-color: rgb(0,0,0); /* Fallback color */
       background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    }
    span.dateFormat {
        display: none;
    }
    /* Modal Content/Box */
    .modal-content {
       background-color: #fefefe;
       margin-left: 6px;
       margin-top: 100px;
       padding: 20px;
       border: 1px solid #888;
       right: 5%;
       position: absolute;
       width: 200px;
    }
    .modal-content-cancel {
       background-color: #fefefe;
       margin-left: -150px;
       margin-top: 100px;
       padding: 20px;
       border: 1px solid #888;
       left: 50%;
       position: absolute;
       width: 300px;
    }
    table.list td{
        width:100px;
        border-width: 1px;
    }
    table.list td.col_chk {
        width:30px;
    }
    /* 20230524 ljh lightning start  */
    /* body .pbBody table.list tr.headerRow td, body .pbBody table.list tr.headerRow th {
        border-width: 1px;
    } */
    /* 20230524 ljh lightning end  */
</style>
<script type="text/javascript">
function checkMessage() {
    if (j$(escapeVfId('allPage:allForm:done_flg')).val() == 'true') {
        alert("保存成功");
    }
}
function filljsQR(qrcode) {
    if(!qrcode) return;
    blockme();
    if(scanType == '1'){
        j$("input[name$='SlipNo']").val(qrcode);
    }
    //20210513 ljh 1829 add start
    else if(scanType.indexOf('2;') != -1){
        scanAndMatch(qrcode+';'+scanType);
    }
    //20210513 ljh 1829 add end
    else{
        scanAndMatch(qrcode);
    }
    j$("#scanedqr").append("<li>"+qrcode+"</li>");
    j$("#scanedqr").animate({ scrollTop: j$("#scanedqr").prop("scrollHeight")}, 1000);
    unblockUI();
}
function checkAll() {
    j$("table td.dataCellBorder1.col_chk input").each(function(){
        if(!this.disabled) {
            this.checked = j$("input#checker").prop('checked');
        }
    })
}
var globalChecked = false;
function checkGlobal() {
    globalChecked = !globalChecked;
    j$("table td.col_chk input[type=checkbox]:enabled").each(function(){
        this.checked = globalChecked;
    })
}
/**
20210707 SFDC-C448KZ you start
function cancelModalConfirm() {
    //检查取消理由和取消理由备注
    var reason = j$.trim(j$("select[name$=cancelReason]").val());
    var remark = j$.trim(j$("input[name$=cancelReasonRemark]").val());
    //20210420 ljh 1711 update start
    //if(reason == "" || remark == "") {
    if(reason == "" && remark == "") {
        j$("#errormessage span").html('取消理由和取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(reason == "") {
        j$("#errormessage span").html('取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(remark == "") {
        j$("#errormessage span").html('取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    //20210420 ljh 1711 update end
    else {
        j$("#errormessage").css('display', 'none');
        blockme();
        cancelSet();
    }
}
**/
function cancelModalConfirm() {
   //检查取消理由和取消理由备注   cancle Reason Lcr
    var reason = j$(escapeVfId('allPage:allForm:Cancel_Reason')).value();
    var remark = j$(escapeVfId('allPage:allForm:Loaner_cancel_reason')).value();
    var Lcr = j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).value();
    if(reason == "" && remark == "") {
        j$("#errormessage span").html('取消理由和备品申请取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(reason == "") {
        j$("#errormessage span").html('取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }
    else if(remark == "") {
        j$("#errormessage span").html('一览取消理由不可为空!');
        j$("#errormessage").css('display', '');
    }else if(remark == "其他" && Lcr =="") {
        j$("#errormessage span").html('取消理由备注不可为空!');
        j$("#errormessage").css('display', '');
    }
    else {
        j$("#errormessage").css('display', 'none');
        blockme();
        cancelSet();
    }
}
/**20210707 SFDC-C448KZ you end**/
function showCancelModal() {
    var hasChecked = false;
    j$("table td.dataCellBorder1.col_chk input").each(function(){
        if(this.checked) {
            hasChecked = true;
        }
    })
    if(!hasChecked) {
        alert('未选择取消的一览!');
        return;
    }
    j$('#cancelModal').show();
    j$('#searchBlock1').show();
}
/** 20210707 SFDC-C448KZ you start**/
 function changeCancleReasonJs(){
    var Cancel_Reason = j$(escapeVfId('allPage:allForm:Cancel_Reason')).value();
    if(Cancel_Reason != '被动取消'){
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).val('');
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',true);
    }
}
function changeReasonJs(){
    var reason = j$(escapeVfId('allPage:allForm:Loaner_cancel_reason')).value();
    if(reason != null && reason == '其他'){
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',false);
    }else{
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).val('');
        j$(escapeVfId('allPage:allForm:Loaner_cancel_request')).attr('disabled',true);
    }
}
/** 20210707 SFDC-C448KZ you end**/
</script>
<div id="myModal" class="modal">
  <!-- Modal content -->
  <div class="modal-content">
    <span class="close" onclick="stopScan()">&times;</span>
    <p>扫描中</p>
        <p>Code:<input type="text" id="qrcode"/></p>
    <video playsinline="true" id="preview" style="width: 100%;z-index: 11;transform: scaleX(-1);margin-top: 10px;"></video>
    扫码履历:
    <ul id="scanedqr" style="list-style-type: none; text-align: center;padding: 0;width: 100%; height: 60px; overflow: auto">
    </ul>
  </div>
</div>
<apex:form id="allForm" styleclass="pbBody">
    <!-- 20210624 ljh update SFDC-C448GR -->
    <!-- <apex:actionFunction name="stockDown" action="{!stockDown}" rerender="detail,message,done_flg"  oncomplete="unblockUI();checkMessage();checEventFrame();"/> -->
    <apex:actionFunction name="scanAndMatch" action="{!scanAndMatch}" rerender="detail,message,done_flg"  oncomplete="unblockUI();checkMessage();checEventFrame();">
        <apex:param name="firstParam" assignTo="{!qrcode}" value="" />
    </apex:actionFunction>
    <apex:actionFunction name="cancelSet" action="{!cancelSet}" rerender="allForm"  oncomplete="unblockUI();checkMessage();checEventFrame();j$('#cancelModal').hide();"/>
    <apex:actionFunction name="changeStep" rerender="allForm"  oncomplete="unblockUI();"/>
    <apex:inputHidden value="{!done_flg}" id="done_flg"/>
    <apex:inputHidden value="{!readOnly}" id="readOnly"/>
    <div id="cancelModal" class="modal">
        <div class="modal-content-cancel">
            <table>
                <tr>
                    <td colspan="2" align="center">
                        <apex:commandButton style="margin: 0 20px;" value="确定" onclick="cancelModalConfirm(); return false;" />
                        <apex:commandButton style="margin: 0 20px;" value="取消" onclick="j$('#errormessage').css('display', 'none');j$('#cancelModal').hide();return false;"/>
                    </td>
                </tr>
                <tr style="display: none;" id="errormessage">
                    <td colspan="2">
                        <span style="color: #F00; font-weight:bold"></span>
                    </td>
                </tr>
                <!--
                <tr>
                    <td>
                        <apex:outputLabel value="取消理由"/>
                    </td>
                    <td>
                        <apex:selectList id="cancelReason" size="1" value="{!cancelReason}">
                            <apex:selectOption itemValue="" itemLabel="--无--"/>
                            <apex:selectOption itemValue="主动取消" itemLabel="主动取消"/>
                            <apex:selectOption itemValue="被动取消" itemLabel="被动取消"/>
                        </apex:selectList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <apex:outputLabel value="取消理由备注"/>
                    </td>
                    <td>
                        <apex:inputText id="cancelReasonRemark" value="{!cancelReasonRemark}"/>
                    </td>
                </tr>
            -->
            <!--  20210707 SFDC-C448KZ you start-->
            <tr>
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Cancel_Reason__c.label}" />
                </td>
                <td>
                <apex:inputField value="{!parentObj.Cancel_Reason__c}" id="Cancel_Reason" onchange="changeCancleReasonJs();"/>
                </td>
            </tr>
            <tr rendered="true">
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_reason__c.label}" for="Loaner_cancel_reason"/>
                </td>
                <td>
                    <apex:inputField value="{!parentObj.Loaner_cancel_reason__c}" id="Loaner_cancel_reason"  onchange="changeReasonJs();"/>
                </td>
            </tr>
            <tr>
                <td>
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_Remarks__c.label}" for="Loaner_cancel_request"/>
                </td>
                <td>
                 <apex:inputField value="{!parentObj.Loaner_cancel_request__c}" id="Loaner_cancel_request" html-disabled="true"/>
                </td>
            </tr>
            <!--  20210707 SFDC-C448KZ you end-->
            <!--<tr>  20210707 SFDC-C448KZ you start-->
            <!-- <apex:pageBlock id="searchBlock1" tabStyle="Report">
            <apex:pageBlockSection title="备品借出申请一览取消" collapsible="false" id="cancle">
               <apex:pageBlockSectionItem id="CR">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Cancel_Reason__c.label}" />
                    <apex:inputField value="{!parentObj.Cancel_Reason__c}" id="Cancel_Reason" onchange="changeCancleReasonJs();"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem rendered="true" id="Reason">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_reason__c.label}" for="Loaner_cancel_reason"/>
                    <apex:inputField value="{!parentObj.Loaner_cancel_reason__c}" id="Loaner_cancel_reason"  onchange="changeReasonJs();"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem ></apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem id="Lcr">
                    <apex:outputLabel value="{!$ObjectType.Rental_Apply_Equipment_Set__c.fields.Loaner_cancel_Remarks__c.label}" for="Loaner_cancel_request"/>
                    <apex:inputField value="{!parentObj.Loaner_cancel_request__c}" id="Loaner_cancel_request" html-disabled="true"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            </apex:pageBlock>   -->
            <!-- 20210707 SFDC-C448KZ you end
            </tr>-->
            </table>
        </div>
    </div>
    <apex:pageBlock id="searchBlock" tabStyle="Report">
        <apex:pageBlockButtons location="top">
            预计出货日
            <apex:inputField id="rentalStartDate" value="{!parentObj.Asset_loaner_start_day__c}"/>
            <apex:commandButton value="适用" action="{!applyDate}" onclick="blockme();" reRender="allForm" disabled="{!readOnly}" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
            &nbsp; &nbsp;
            出库
            <apex:selectList size="1" value="{!stepName}" onchange="blockme();changeStep();return false;">
                <apex:selectOption itemValue="无" itemLabel="无"/>
                <apex:selectOption itemValue="分配" itemLabel="分配"/>
                <!-- 20210624 ljh update SFDC-C448GR -->
                <!-- <apex:selectOption itemValue="下架" itemLabel="下架"/> -->
                <apex:selectOption itemValue="发货" itemLabel="发货"/>
            </apex:selectList>
            &nbsp; &nbsp;
            <!-- 20210517 ljh update 1829 start -->
            <!-- <apex:commandButton value="扫一扫" onclick="qrscan();return false;" disabled="{!readOnly || stepName!='分配'}"/> -->
            <apex:commandButton value="扫一扫" onclick="qrscan(0);return false;" disabled="{!readOnly || stepName!='分配'}"/>
            <!-- 20210517 ljh update 1829 end -->
            <apex:commandButton value="分配" action="{!assign}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='分配'}" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
            <!-- 20210624 ljh update SFDC-C448GR -->
            <!-- <apex:commandButton value="下架" action="{!stockdown}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='下架'}" oncomplete="unblockUI();checkMessage();checEventFrame();"/> -->
            <apex:commandButton value="发货" action="{!shipment}" onclick="blockme();" reRender="allForm" disabled="{!readOnly || stepName!='发货'}" oncomplete="unblockUI();checkMessage();checEventFrame();"/>
            &nbsp; &nbsp;
            <apex:commandButton value="全选/取消全选" onclick="checkGlobal(); return false;" disabled="{!readOnly}"/>
            <apex:commandButton value="取消" onclick="showCancelModal(); return false;" disabled="{!readOnly}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="办事处分配">
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Name.Label}"/>
                <apex:outputField value="{!parentObj.Name}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="主单预计出货日"/>
                <apex:outputText value="{0,date, yyyy/MM/dd}">
                    <apex:param value="{!masterDate}"/>
                </apex:outputText>
            </apex:pageBlockSectionItem>
            <!-- 20210508 ljh add 1672 start -->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.demo_purpose2__c.Label}"/>
                <apex:outputField value="{!parentObj.demo_purpose2__c}"/>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
            &nbsp;&nbsp;&nbsp;&nbsp;
            </apex:pageBlockSectionItem>
            <!-- 20210508 ljh add 1672 end -->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Name.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Name}" id="SlipNo" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Name}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                    <apex:commandButton value="扫运输单" onclick="qrscan(1);return false;" disabled="{!NOT(slipEnabled && stepName == '发货')}"/>
                    <apex:commandButton value="检索" action="{!searchSlip}" onclick="blockme();" reRender="allForm" disabled="{!NOT(slipEnabled && stepName == '发货')}" oncomplete="unblockUI();checEventFrame();"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryType__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.DeliveryType__c}" id="deliveryType" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.DeliveryType__c}"  rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Distributor_method__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Distributor_method__c}" id="distributorMethod" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Distributor_method__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.DeliveryCompany__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.DeliveryCompany__c}" id="deliveryCompany" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.DeliveryCompany__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="发货-{!$ObjectType.FixtureDeliverySlip__c.fields.Wh_Staff__c.Label}"/>
                <apex:outputPanel >
                    <apex:inputField value="{!slip.Wh_Staff__c}" styleClass="hideDropdown" rendered="{!slipEnabled && stepName == '发货'}"/>
                    <apex:outputField value="{!slip.Wh_Staff__c}" rendered="{!NOT(slipEnabled && stepName == '发货')}"/>
                </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <!-- 20201209 ljh add start-->
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="{!$ObjectType.Rental_Apply__c.fields.Delivery_Agency__c.Label}"/>
                <!-- 20210624 ljh update SFDC-C448GR start-->
                <!-- <apex:outputPanel >
                    <apex:inputField value="{!parentObj.Delivery_Agency__c}" styleClass="hideDropdown" rendered="{!parentObj.StockDown_ng_num__c == 0 && stepName == '发货'}" />
                    <apex:outputField value="{!parentObj.Delivery_Agency__c}" rendered="{!NOT(parentObj.StockDown_ng_num__c == 0 && stepName == '发货')}"/>
                </apex:outputPanel> -->
                <apex:outputPanel >
                    <apex:inputField value="{!parentObj.Delivery_Agency__c}" styleClass="hideDropdown" rendered="{!parentObj.Wei_Assigned_Cnt__c == 0 && stepName == '发货'}" />
                    <apex:outputField value="{!parentObj.Delivery_Agency__c}" rendered="{!NOT(parentObj.Wei_Assigned_Cnt__c == 0 && stepName == '发货')}"/>
                </apex:outputPanel>
                <!-- 20210624 ljh update SFDC-C448GR end-->
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem html-style="display: none;">
                <apex:inputField value="{!parentObj.SalesdeptSelect__c}"  style="display: none;" />
            </apex:pageBlockSectionItem>
            <!-- 20201209 ljh add end-->
        </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:outputPanel id="message">
        <apex:pageMessages />
    </apex:outputPanel>
    <apex:outputPanel id="detail">
    <div id="out_Div_L">
            <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableHeader_L">
                <tr class="headerRow" height="30px">
                    <td class="col_chk" align="center">
                        全选 <input type='checkbox' onClick='checkAll();' id="checker"/>
                    </td>
                    <td> 申请型号 </td>
                    <td> 存放地 </td>
                    <td> 固定资产编号(Key) </td>
                    <td> 机身编号 </td>
                    <td> 预计出货日 </td>
                    <td style="{!IF(stepName='分配','background-color: #cfeef9','')}"> 分配 </td>
                    <!-- 20210624 ljh update SFDC-C448GR -->
                    <!-- <td style="{!IF(stepName='下架','background-color: #cfeef9','')}"> 下架 </td> -->
                    <td> 借出备品一览明细状态 </td>
                    <td> 备品分类 </td><!-- 20210508 ljh add 1672  -->
                    <td> 操作 </td>
                    <!-- 20210510 ljh add 1829 -->
                </tr>
                <apex:variable value="{!0}" var="Cnt" />
                <apex:repeat id="dataline_L" value="{!esdList}" var="esdInfo">
                    <tr class="" id="tableData_L_{!Cnt}" style="{!IF(esdInfo.rec.AgencyTempCancel__c, 'display: none','')}">
                        <td class="dataCellBorder1 col_chk" align="center">
                            <apex:inputCheckbox styleClass="rowchkcls" rendered="{!esdInfo.rec.Is_Body__c}" value="{!esdInfo.checked}" id="rowCheck" disabled="{!!esdInfo.editable}" html-qrscan="{!esdInfo.rec.Rental_Apply_Equipment_Set__c}"/>
                            <!-- 20210514 ljh 1829 add html-qrscan -->
                        </td>
                        <td> <apex:outputText value="{!esdInfo.tempModel}"/> </td>
                        <td> {!esdInfo.tempLocation} </td>
                        <td> {!esdInfo.tempKey}</td>
                        <td> {!esdInfo.tempSerial} </td>
                        <td>
                            <apex:inputField value="{!esdInfo.rec.Rental_Apply_Equipment_Set__r.Rental_Start_Date__c}" rendered="{!esdInfo.editable && stepName=='分配'}"/>
                            <apex:outputText value="{0,date, yyyy/MM/dd}" rendered="{!NOT(esdInfo.editable && stepName=='分配')}">
                                <apex:param value="{!esdInfo.tempDate}"/>
                            </apex:outputText>
                        </td>
                        <td style="{!IF(stepName='分配','background-color: #cfeef9','')}">
                            {!esdInfo.tempStatus}
                        </td>
                        <!-- 20210624 ljh update SFDC-C448GR -->
                        <!-- <td style="{!IF(stepName='下架','background-color: #cfeef9','')}">
                            <apex:outputField value="{!esdInfo.rec.StockDown__c}"/>
                        </td> -->
                        <td> <apex:outputText value="{!esdInfo.tempDetailStatus}"/> </td>
                        <td> {!esdInfo.tempEquipmentType}</td>
                        <!-- 20210508 ljh add 1672  -->
                        <td>
                            <apex:commandButton rendered="{!esdInfo.rec.Is_Body__c}" value="分配代替品" onclick="qrscan('2;{!esdInfo.rec.Rental_Apply_Equipment_Set__c}');return false;" disabled="{!readOnly || esdInfo.IsCanSub || stepName != '分配'}"/>
                        </td>
                        <!-- 20210508 ljh add 1829  -->
                    </tr>
                    <apex:variable value="{!Cnt+1}" var="Cnt" />
                </apex:repeat>
            </table>
        </div>
    </apex:outputPanel>
    <apex:outputPanel id="checEventFrame">
        <script>
            checEventFrame();
        </script>
    </apex:outputPanel>
</apex:form>
<script type="text/javascript">
    var standalone = window.navigator.standalone,
        userAgent = window.navigator.userAgent.toLowerCase(),
        safari = /safari/.test( userAgent ),
        ios = /iphone|ipod|ipad/.test( userAgent ),
        ver = '';
        if (ios) {
            ver = (navigator.userAgent).match(/OS (\d)?\d_\d(_\d)?/i)[0].split('_')[0].replace("OS ","");
        }
    let scanner = new Instascan.Scanner({ video: document.getElementById('preview'), scanPeriod: 5 ,mirror: false});
    scanner.addListener('scan', function (content) {
      filljsQR(content);
    });
    function qrscan(stype) {
        scanType = stype.toString();//20210518 ljh update toString 1829
        //20210514 ljh add 1829 start
        //console.log(scanType+':~'+scanType.indexOf('2;'));
        if(scanType.indexOf('2;') != -1){
            j$("input[type=checkbox][qrscan='"+scanType.split('2;')[1]+"']").prop("checked", true);
        }
        //20210514 ljh add 1829 end
        if (!standalone && !safari && ios) {
            window.location.href="sfqr://scan";
        } else {
            j$("#myModal").show();
            Instascan.Camera.getCameras().then(function (cameras) {
              if (cameras.length > 0) {
                if (ver >= 13) {
                    scanner.start(cameras[1]);
                } else {
                    scanner.start(cameras[0]);
                }
              } else {
                console.error('No cameras found.');
              }
            }).catch(function (e) {
              console.error(e);
            });
        }
    }
    function stopScan() {
        scanner.stop().then(function () {
            j$("#myModal").hide();
        });
        j$("#scanedqr").children().remove();
    }
    j$(document).ready(function(){
        j$( '#qrcode' ).unbind();
        j$( '#qrcode' ).keypress( function ( e ) {
            if ( e.which == 13 ) {
                filljsQR(j$( '#qrcode' ).val());
                return false;
            }
        });
    });
    function checEventFrame() {
        j$('select[name$="deliveryType"]').val('发货');
        j$('select[name$="deliveryType"]').prop('disabled', true);
        j$("input[name=onetoone]").siblings("input[type=checkbox]").each(function(){
            this.disabled = true;
        })
        if (j$(escapeVfId('allPage:allForm:readOnly')).val() == 'true') {
            j$("input#checker").attr('disabled', 'disabled');
        }
        else {
            j$("input#checker").removeAttr('disabled');
        }
        setTimeout(function() {
            j$('select[name$="distributorMethod"]').children('option[value="空运"]').remove();
            j$('select[name$="deliveryCompany"]').children('option[value="莱比特"],option[value="嘉里大通"]').remove();
            if (j$(escapeVfId('allPage:allForm:readOnly')).val() == 'true') {
                j$("input[type=text],select").each(function(){
                    this.disabled = true;
                })
            }
        }, 500);
    }
    // checEventFrame();
</script>
</apex:page>
force-app/main/default/staticresources/EquipmentSetShippmentReceivedcss.css
@@ -1,109 +1,186 @@
@charset "utf-8";
.detail {
   margin-left:5px;
   width:310px;
    /* margin-left:5px;*/
    /*width:310px;*/
}
.menu {
   padding:0px;
   border-left:1px solid #D1D1D1;
   border-right:1px solid #D1D1D1;
    padding:0px;
    border-left:1px solid #D1D1D1;
    border-right:1px solid #D1D1D1;
}
.menu h2{
   margin:0;
   padding:0;
   font-size:14px;
    margin:0;
    padding:0;
    font-size:16px;
}
.menu h2 div {
    width: 308px;
    text-align: left;
    margin: 0;
    background:#DCDCDC;
    /*width: 308px;*//*20230615 ljh*/
    text-align: left;
    margin: 0;
    background:#DCDCDC;
}
.menu ul{
   margin:0;
   padding:1px;
   list-style: none;
   border-top:1px solid #ddd;
    margin:0;
    padding:1px;
    list-style: none;
    border-top:1px solid #ddd;
}
.menu li {
   padding:0;
   font-size:14px;
   line-height:1.0;
   /* 2023-04-23   zyh   lightning升级   start */
   height:33px;
   /* height:23px; */
   /* 2023-04-23   zyh   lightning升级   end */
   clear:both;
   /*border-bottom: 1px dotted #999;*/
    padding:0;
    font-size:16px;
    /* line-height:1.0; */
    /* 2023-04-23   zyh   lightning升级   start */
    /* height:33px; */
    /* height:23px; */
    /* 2023-04-23   zyh   lightning升级   end */
    clear:both;
    /*border-bottom: 1px dotted #999;*/
    border-bottom: var(--lwc-borderWidthThin,1px) solid var(--slds-g-color-border-base-1, var(--lwc-colorBorder,rgb(229, 229, 229)))
}
.menu li span {
    width: 140px;
    text-align: right;
    float: left;
    margin: 5px 0px 0px 0px;
}
/* .menu li span {
    width: 140px;
    text-align: right;
    float: left;
    margin: 5px 0px 0px 0px;
    height: 33px;
    line-height:33px;
} */
.menu li span span{
    text-align: left;
    margin-left: 3px;
    margin-top: 0px;
    text-align: left;
    margin-left: 3px;
    margin-top: 0px;
}
.commandbutton {
   font-size: 13px !important;
    font-size: 13px !important;
}
.tabsize {
   font-size: 14px !important;
    font-size: 14px !important;
}
.detailtab {
   font-size: 14px;
    font-size: 16px;
}
.detailhander {
   font-size: 16px;
    font-size: 16px;
}
.deliveryslip {
   font-size: 15px;
    font-size: 15px;
}
.modal {
   display:none;
   position: fixed; /* Stay in place */
   z-index: 10; /* Sit on top */
   left: 0;
   top: 0;
   width: 100%; /* Full width */
   height: 100%; /* Full height */
   overflow: auto; /* Enable scroll if needed */
   background-color: rgb(0,0,0); /* Fallback color */
   background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    display:none;
    position: fixed; /* Stay in place */
    z-index: 10; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content/Box */
.modal-content {
   background-color: #fefefe;
   margin-left: 6px;
   margin-top: 100px;
   padding: 20px;
   border: 1px solid #888;
   width: 265px; /* Could be more or less, depending on screen size */
    background-color: #fefefe;
    margin-left: 6px;
    margin-top: 100px;
    padding: 20px;
    border: 1px solid #888;
    width: 265px; /* Could be more or less, depending on screen size */
}
.freezehander {
   position: fixed;
   top: 0px;
   background-color:
   white;
   width: 320px;
   z-index: 1;
}
    /*20230615 ljh*/
    position: fixed;
    top: 0px;
    background-color:white;
    /*width: 320px;*/
    z-index: 1;
    /*20230615 ljh*/
}
/***********************/
.menu ul{
    /* display: flex; */
    list-style: none;
    margin-bottom: 5px;
}
.menu ul li{
   /*  flex: 1;
    height: 55px;
    max-width:200px;  */
    width: calc(50% - 30px);
    display: inline-block;
    margin-left: 0;
}
.menu ul li Span{
    /* display:inline-block; */
    height: 50px;
    line-height:50px;
}
.menu ul li input[type="checkbox"]{
    width:16px;
    height:16px;
}
.myBtn .btn{
    margin: 1px 20px;
}
body .btn{
    -webkit-appearance: none;
    position: relative;
    // margin: 1px 20px;
    display: inline-block;
    border: 1px solid transparent;
    font-size: .75rem;
    line-height: 1.875rem;
    text-decoration: none;
    white-space: normal;
    border-radius: 0.25rem;
    background: transparent;
    background-clip: border-box;
    color: rgba(1, 118, 211, 1);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-transition: color .05s linear,background-color .05s linear;
    transition: color .05s linear,background-color .05s linear;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: center;
    vertical-align: middle;
    border: 1px solid rgb(201, 201, 201);
    -webkit-transition: border 0.15s linear;
    transition: border 0.15s linear;
    border-color: rgb(201, 201, 201);
    background-color: rgb(255, 255, 255);
}
body input.btn{
    padding: 4px 1rem;
}
body input[type="text"],body select,span select{
    border: 1px solid rgb(201, 201, 201);
    border-radius: 0.25rem;
    display: inline-block;
    padding: 0 1rem 0 0.75rem;
    min-height: calc(1.875rem + (1px * 2)) !important;
    line-height: 1.875rem !important;
    /* background-color: rgb(255, 255, 255); */
    transition: border .1s linear,background-color .1s linear;
    max-width: 100%;
    color: rgb(24, 24, 24);
}
/***********************/
force-app/main/default/staticresources/EquipmentSetShippmentReceivedcss.css.bak
New file
@@ -0,0 +1,109 @@
@charset "utf-8";
.detail {
   margin-left:5px;
   width:310px;
}
.menu {
   padding:0px;
   border-left:1px solid #D1D1D1;
   border-right:1px solid #D1D1D1;
}
.menu h2{
   margin:0;
   padding:0;
   font-size:14px;
}
.menu h2 div {
    width: 308px;
    text-align: left;
    margin: 0;
    background:#DCDCDC;
}
.menu ul{
   margin:0;
   padding:1px;
   list-style: none;
   border-top:1px solid #ddd;
}
.menu li {
   padding:0;
   font-size:14px;
   line-height:1.0;
   /* 2023-04-23   zyh   lightning升级   start */
   height:33px;
   /* height:23px; */
   /* 2023-04-23   zyh   lightning升级   end */
   clear:both;
   /*border-bottom: 1px dotted #999;*/
}
.menu li span {
    width: 140px;
    text-align: right;
    float: left;
    margin: 5px 0px 0px 0px;
}
.menu li span span{
    text-align: left;
    margin-left: 3px;
    margin-top: 0px;
}
.commandbutton {
   font-size: 13px !important;
}
.tabsize {
   font-size: 14px !important;
}
.detailtab {
   font-size: 14px;
}
.detailhander {
   font-size: 16px;
}
.deliveryslip {
   font-size: 15px;
}
.modal {
   display:none;
   position: fixed; /* Stay in place */
   z-index: 10; /* Sit on top */
   left: 0;
   top: 0;
   width: 100%; /* Full width */
   height: 100%; /* Full height */
   overflow: auto; /* Enable scroll if needed */
   background-color: rgb(0,0,0); /* Fallback color */
   background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content/Box */
.modal-content {
   background-color: #fefefe;
   margin-left: 6px;
   margin-top: 100px;
   padding: 20px;
   border: 1px solid #888;
   width: 265px; /* Could be more or less, depending on screen size */
}
.freezehander {
   position: fixed;
   top: 0px;
   background-color:
   white;
   width: 320px;
   z-index: 1;
}
force-app/main/default/staticresources/ReceivingNotePageCss.css
@@ -11,7 +11,7 @@
  position:relative;
  overflow: hidden;
  float:left;
  width:32768px;
  /* width:32768px; *//*20230705 ljh*/
}
div#out_Div_L {
  position:relative;
@@ -22,7 +22,7 @@
  position:relative;
  overflow: auto;  /*スクロールバー*/
  float:left;
  width:32768px;
  /* width:32768px; *//*20230705 ljh*/
  height: 100px; /* tbodyを表示する高さ、後でjsにて調整 */
}
div#in_Div_L {
@@ -60,7 +60,7 @@
table.list td {width:100px;}
table.list td.col_noChk {width:0px;}
table.list td select {width:95%;}
table.list td input {width:95%;}
/* table.list td input {width:95%;} *//*20230705 ljh*/
table.list td.col_Fixture_Model_No__c {width:230px;}
table.list td.col_ProductName__c {width:230px;}
table.list td.col_Fixture_Model_No_F__c {width:230px;}
force-app/main/default/staticresources/ReceivingNotePageCss.css.bak
New file
@@ -0,0 +1,88 @@
td .dateFormat  {
    display: none;
}
div.inline { float:left; }
.clearBoth { clear:both; }
div.reportBlock table.list {
  width:auto;
}
div#out_Div { /* ここにヘッダを格納 */
  position:relative;
  overflow: hidden;
  float:left;
  /* width:32768px; *//*20230705 ljh*/
}
div#out_Div_L {
  position:relative;
  overflow: hidden;
  float:left;
}
div#in_Div {/* tbodyが入っている。ここがスクロール対象*/
  position:relative;
  overflow: auto;  /*スクロールバー*/
  float:left;
  /* width:32768px; *//*20230705 ljh*/
  height: 100px; /* tbodyを表示する高さ、後でjsにて調整 */
}
div#in_Div_L {
  position:relative;
  overflow: hidden;
  float:left;
  height: 100px;
}
body .pbBody table.list tr.headerRow td {
  box-sizing: border-box;
  text-align:center;font-weight:normal;
  padding:0px 0px 0px 1px;
}
body .pbBody table.list tr.headerRow td.header1 {
  text-align:center;font-weight:normal;
  padding:0px 0px 0px 0px;
}
body .pbBody table.list tr.dataRow td {
  box-sizing: border-box;
  padding:0px 0px 0px 1px; border-width: 0px 0px 1px 0px; vertical-align: middle; word-break:break-all;
}
body .pbBody table.list tr.dataRow td.dataCellBorder  {
  /* いらない、使っていない */
  padding:0px 0px 0px 1px; border-width: 0px 0px 1px 0px; vertical-align: middle; word-break:break-all;
}
body .pbBody table.list tr.dataRow td.dataCellBorder1 {
  padding:0px 0px 0px 1px;
  border-width: 0px 0px 1px 1px; vertical-align: middle; word-break:break-all;
}
@-moz-document url-prefix() {
body .pbBody table.list tr.dataRow td.dataCellBorder1 {padding:0px 0px 0px 0px; border-width: 0px 0px 1px 1px; vertical-align: middle; word-break:break-all;}
}
table.list td {width:100px;}
table.list td.col_noChk {width:0px;}
table.list td select {width:95%;}
table.list td input {width:95%;}
table.list td.col_Fixture_Model_No__c {width:230px;}
table.list td.col_ProductName__c {width:230px;}
table.list td.col_Fixture_Model_No_F__c {width:230px;}
table.list td.col_Fixture_Model_Name_F__c  {width:230px;}
table.list td textarea {
  height:50px;
  width:90%;
}
/*URLFOR($Resource なのでRelationListPagingCmpCssに入れません*/
/*
body .pbBody table.list tr.headerRow td.colViewing {
  // デフォルト値、最小化アイコンを表示
  background-image:url('{!URLFOR($Resource.IconResizeMinus_5)}') ;
  background-repeat:no-repeat;
}
body .pbBody table.list tr.headerRow td.colUnHideIcon {
  //最大化アイコンを表示
  background-image:url('{!URLFOR($Resource.IconResizePlus_5)}');
  background-repeat:no-repeat;
}
*/
body .pbBody table.list tr.headerRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
body .pbBody table.list tr.dataRow td.col_Scroll {width:0px; padding:0px; border-width:0px;}
force-app/main/default/staticresources/RelationListPagingCmpCss.css
@@ -12,7 +12,6 @@
  overflow: hidden;
  float:left;
  /* width:32768px; */ /* 20230523 ljh lightning */
  /* width: 1200px; */
}
div#out_Div_L {
  position:relative;
@@ -24,14 +23,13 @@
  overflow: auto;  /*スクロールバー*/
  float:left;
  /* width:32768px; */ /* 20230523 ljh lightning */
  height: 100px; /* tbodyを表示する高さ、後でjsにて調整 */
  /* width: 1200px; */
  /* height: 100px; *//* tbodyを表示する高さ、後でjsにて調整 */ /*20230607 ljh lightning*/
}
div#in_Div_L {
  position:relative;
  overflow: hidden;
  float:left;
  height: 100px;
  /* height: 100px; *//*20230607 ljh lightning*/
}
body .pbBody table.list tr.headerRow td {
@@ -110,10 +108,10 @@
  color: #000;
  white-space:normal;
}
table#tableData{
/* table#tableData{
  width: 1000px;
}
table#tableHeader{
  width: 1000px;
}
} */
/* 20230508 ljh lightning切换 start */
force-app/main/default/staticresources/RelationListPagingCmpJS.js
@@ -338,8 +338,9 @@
    sbwidth = scrollbarWidth();
    // 20230531 ljh start 
    // blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width() - widthAjustment - sbwidth - 20;
    blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width()- sbwidth;
    blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width() - widthAjustment - sbwidth - 20;
    // blockWidth = j$(escapeVfId('allPage:allForm:searchBlock')).width() - j$('div#out_Div_L').width()- sbwidth;
    var tableWidth = j$('table#tableData').width();
    // 20230531 ljh end 
    //コンポネートなのでIDを変更
    // 20230519 ljh start
@@ -377,7 +378,8 @@
        // j$('div#out_Div').css('width', (blockWidth + sbwidth) + 'px');
        // j$('div#in_Div').css('width', (blockWidth + sbwidth) + 'px');
        // 20230704 ljh start
        if(blockWidth > 1000){
        /*if(blockWidth > 1000){
            console.log('333');
            // j$('div#out_Div').css('width', (blockWidth) + 'px');
            // j$('div#in_Div').css('width', (blockWidth) + 'px');
            if (j$('table#tableData').width() > j$('div#in_Div').width()) {
@@ -385,18 +387,34 @@
                j$('div#in_Div').css('width', (blockWidth) + 'px');
            }
        }else{
            console.log('222');
            j$('table#tableData').css('width', (blockWidth) + 'px');
            j$('table#tableHeader').css('width', (blockWidth) + 'px');
            tableWidth = blockWidth; // 20230725 ljh
        }*/
        if (j$('table#tableData').width() > j$('div#in_Div').width()) {
            j$('div#out_Div').css('width', (blockWidth) + 'px');
            j$('div#in_Div').css('width', (blockWidth) + 'px');
            j$('table#tableData').css('width', (tableWidth) + 'px');
            j$('table#tableHeader').css('width', (tableWidth) + 'px');
        }
        // if (j$('table#tableData').width() > j$('div#in_Div').width()) {
        //     j$('div#out_Div').css('width', (blockWidth) + 'px');
        //     j$('div#in_Div').css('width', (blockWidth) + 'px');
        // }
        // 20230704 ljh end
    }
    if (j$('table#tableData').width() > j$('div#in_Div').width()) {
        j$('div#in_Div').css('height', (blockHeight + sbwidth) +'px');
    }
    j$('div#in_Div').scroll(function() {
        j$('div#out_Div').scrollLeft(j$(this).scrollLeft());
        j$('div#in_Div_L').scrollTop(j$(this).scrollTop());
    });
    j$('div#out_Div').scroll(function() {
        j$('div#in_Div').scrollLeft(j$(this).scrollLeft());
    });
    j$('div#in_Div_L').scroll(function() {
        j$('div#in_Div').scrollTop(j$(this).scrollTop());
    });
}
function expandAll(){
@@ -422,29 +440,40 @@
function rerenderColWidth(colClass, isFirst) {
    // tableWidth = j$('body .pbBody table#tableHeader').width();// 20230519 ljh lightning add
    console.log('555'+tableWidth);
    var headerCol = j$('body .pbBody table.list tr.headerRow td.' + colClass);
    if (headerCol.hasClass("colUnHideIcon")) {
        listColClassMap[colClass] = "colUnHideIcon";
        // 20230519 ljh lightning start
        // tableWidth -= headerCol.width();
        console.log('666'+listColClassWidthMap[colClass]);
        tableWidth -= listColClassWidthMap[colClass];
        // 20230519 ljh lightning end
        // 全部最小化する
        j$('body .pbBody table.list td.' + colClass).children().hide();
        j$('body .pbBody table.list td.' + colClass).width(7).css("font-size", "0");
        // 20230728 ljh 优化
        // j$('body .pbBody table.list td.' + colClass).width(7).css("font-size", "0");
        j$('body .pbBody table.list td.' + colClass).outerWidth(10).css("font-size", "0");
    } else {
        listColClassMap[colClass] = "colViewing";
        console.log('888'+tableWidth);
        // if (isFirst == false) { // 20230519 ljh lightning  去掉判断
            var hiddenWidth = headerCol.width();
            j$('body .pbBody table.list td.' + colClass).width("").css("font-size", "");
            j$('body .pbBody table.list td.' + colClass).children().show();
            tableWidth += listColClassWidthMap[colClass] + 2 - hiddenWidth;    // 2 is border
        // }
        console.log('777'+listColClassWidthMap[colClass]);
    }
    console.log('444'+tableWidth);
    // 20230725 ljh start
    // if(tableWidth < 1000){
    //     j$('div#in_Div').css('width', tableWidth + 'px');
    //     j$('div#out_Div').css('width', tableWidth + 'px');
    // }
    // 20230725 ljh start
    j$('table#tableData').css('width', (tableWidth + 2) + 'px');
    j$('table#tableHeader').css('width', (tableWidth + 2) + 'px');
}
function getColClassName(pObj) {
force-app/main/default/staticresources/RentalFixtureSetDetilSelectCss.css
@@ -16,4 +16,5 @@
/* 20230517 ljh lightning start */
table.list .col_IndexFromUniqueKey_Text__c {width:70px;}
table.list .col_Fixture_Set_Detail__r_Quantity__c {width:70px;}
table.list .col_Product_Status_Flag_F__c{width:100px;}
/* 20230517 ljh lightning end */
force-app/main/default/staticresources/StyleUtilCss.css
@@ -14,7 +14,7 @@
/*信息提示颜色*/
body .bPageBlock .pbSubheader, .slds-vf-scope .bPageBlock .pbSubheader{
    background-color: #08107b !important;;
    color: #FFF !important;;
    color: #FFF !important;
}
body .infoM2, body .infoM3, body .infoM4, .slds-vf-scope .infoM2, .slds-vf-scope .infoM3, .slds-vf-scope .infoM4 {
    background-color: #08107b !important;
@@ -25,14 +25,13 @@
body .pbButton{
    text-align: left;
}
.message .messageText{
    color: #FFF !important;
}
/*检索框不乱*/
body .detailList .dataCol input[type="text"],body .detailList .dataCol select{
    min-width: 180px;
    padding: 0;
}
body .bPageBlock .detailList .dataCol{
    width: 8%;
}
body .detailList td{
    position: static;
force-app/main/default/staticresources/StyleUtilCss.css.bak
New file
@@ -0,0 +1,39 @@
/* 20230616 ljh start lightning */
/* 表格表格和框*/
body .pbBody table.list tr th, body .pbBody table.list tr td {
    border: 1px solid #ededed;
    white-space: normal;
}
body .pbBody table.list tr.headerRow td,body .pbBody table.list tr.headerRow th {
    background: #f2f3f3;
    border-width: 0 0 1px 1px;
    border-color: #e0e3e5;
    font-size: .9em;
    font-weight: bold;
}
/*信息提示颜色*/
body .bPageBlock .pbSubheader, .slds-vf-scope .bPageBlock .pbSubheader{
    background-color: #08107b !important;;
    color: #FFF !important;;
}
body .infoM2, body .infoM3, body .infoM4, .slds-vf-scope .infoM2, .slds-vf-scope .infoM3, .slds-vf-scope .infoM4 {
    background-color: #08107b !important;
}
body .message, .slds-vf-scope .message{
    background-color: #08107b !important;
}
body .pbButton{
    text-align: left;
}
/*检索框不乱*/
body .detailList .dataCol input[type="text"],body .detailList .dataCol select{
    min-width: 180px;
    padding: 0;
}
body .bPageBlock .detailList .dataCol{
    width: 8%;
}
body .detailList td{
    position: static;
}
force-app/main/default/staticresources/TransferShippmentReceivedcss.css
@@ -1,53 +1,54 @@
@charset "utf-8";
.detail {
   margin-left:5px;
   width:310px;
    /* margin-left:5px;*/
    /*width:310px;*/
}
.menu {
   padding:0px;
   border-left:1px solid #D1D1D1;
   border-right:1px solid #D1D1D1;
    padding:0px;
    border-left:1px solid #D1D1D1;
    border-right:1px solid #D1D1D1;
}
.menu h2{
   margin:0;
   padding:0;
   font-size:14px;
    margin:0;
    padding:0;
    font-size:16px;
}
.menu h2 div {
    width: 308px;
    text-align: left;
    margin: 0;
    background:#DCDCDC;
    /*width: 308px;*//*20230615 ljh*/
    text-align: left;
    margin: 0;
    background:#DCDCDC;
}
    
.menu ul{
   margin:0;
   padding:1px;
   list-style: none;
   border-top:1px solid #ddd;
    margin:0;
    padding:1px;
    list-style: none;
    border-top:1px solid #ddd;
}
.menu li {
   padding:0;
   font-size:14px;
   line-height:1.0;
   /* 20230423 ljh lightning 升级 start */
   /* height:23px; */
   height:33px;
   /* 20230423 ljh lightning 升级 end */
   clear:both;
   /*border-bottom: 1px dotted #999;*/
    padding:0;
    font-size:16px;
    /*line-height:1.0;*/
    /* 20230423 ljh lightning 升级 start */
    /* height:23px; */
    /*height:33px;*/
    /* 20230423 ljh lightning 升级 end */
    clear:both;
    /*border-bottom: 1px dotted #999;*/
    border-bottom: var(--lwc-borderWidthThin,1px) solid var(--slds-g-color-border-base-1, var(--lwc-colorBorder,rgb(229, 229, 229)))
}
.menu li span {
    width: 140px;
    /*width: 140px;
    text-align: right;
    float: left;
    margin: 5px 0px 0px 0px;
    margin: 5px 0px 0px 0px;*/
}
.menu li span span{
@@ -65,7 +66,7 @@
}
.detailtab {
   font-size: 14px;
   font-size: 16px;
}
.detailhander {
@@ -104,6 +105,81 @@
   top: 0px;
   background-color:
   white;
   width: 320px;
   /*width: 320px;*/
   z-index: 1;
}
}
/***********************/
.menu ul{
    /* display: flex; */
    list-style: none;
    margin-bottom: 5px;
}
.menu ul li{
    /* flex: 1;
    height: 55px;
    max-width:200px;  */
    width: calc(50% - 30px);
    display: inline-block;
    margin-left: 0;
}
/* .menu ul li Span{ */
.menu ul li span{
    /* // display:inline-block; */
    /* // display:inline-block; */
    height: 50px;
    line-height:50px;
}
.menu ul li input[type="checkbox"]{
    width:16px;
    height:16px;
}
.myBtn .btn{
    margin: 1px 20px;
}
body .btn{
    -webkit-appearance: none;
    position: relative;
    // margin: 1px 20px;
    display: inline-block;
    border: 1px solid transparent;
    font-size: .75rem;
    line-height: 1.875rem;
    text-decoration: none;
    white-space: normal;
    border-radius: 0.25rem;
    background: transparent;
    background-clip: border-box;
    color: rgba(1, 118, 211, 1);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-transition: color .05s linear,background-color .05s linear;
    transition: color .05s linear,background-color .05s linear;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: center;
    vertical-align: middle;
    border: 1px solid rgb(201, 201, 201);
    -webkit-transition: border 0.15s linear;
    transition: border 0.15s linear;
    border-color: rgb(201, 201, 201);
    background-color: rgb(255, 255, 255);
}
body input.btn{
    padding: 4px 1rem;
}
body input[type="text"],body select,span select{
    border: 1px solid rgb(201, 201, 201);
    border-radius: 0.25rem;
    display: inline-block;
    padding: 0 1rem 0 0.75rem;
    min-height: calc(1.875rem + (1px * 2)) !important;
    line-height: 1.875rem !important;
    /* background-color: rgb(255, 255, 255); */
    transition: border .1s linear,background-color .1s linear;
    max-width: 100%;
    color: rgb(24, 24, 24);
}
/***********************/
force-app/main/default/staticresources/TransferShippmentReceivedcss.css.bak
New file
@@ -0,0 +1,109 @@
@charset "utf-8";
.detail {
   margin-left:5px;
   width:310px;
}
.menu {
   padding:0px;
   border-left:1px solid #D1D1D1;
   border-right:1px solid #D1D1D1;
}
.menu h2{
   margin:0;
   padding:0;
   font-size:14px;
}
.menu h2 div {
    width: 308px;
    text-align: left;
    margin: 0;
    background:#DCDCDC;
}
.menu ul{
   margin:0;
   padding:1px;
   list-style: none;
   border-top:1px solid #ddd;
}
.menu li {
   padding:0;
   font-size:14px;
   line-height:1.0;
   /* 20230423 ljh lightning 升级 start */
   /* height:23px; */
   height:33px;
   /* 20230423 ljh lightning 升级 end */
   clear:both;
   /*border-bottom: 1px dotted #999;*/
}
.menu li span {
    width: 140px;
    text-align: right;
    float: left;
    margin: 5px 0px 0px 0px;
}
.menu li span span{
    text-align: left;
    margin-left: 3px;
    margin-top: 0px;
}
.commandbutton {
   font-size: 13px !important;
}
.tabsize {
   font-size: 14px !important;
}
.detailtab {
   font-size: 14px;
}
.detailhander {
   font-size: 16px;
}
.deliveryslip {
   font-size: 15px;
}
.modal {
   display:none;
   position: fixed; /* Stay in place */
   z-index: 10; /* Sit on top */
   left: 0;
   top: 0;
   width: 100%; /* Full width */
   height: 100%; /* Full height */
   overflow: auto; /* Enable scroll if needed */
   background-color: rgb(0,0,0); /* Fallback color */
   background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content/Box */
.modal-content {
   background-color: #fefefe;
   margin-left: 6px;
   margin-top: 100px;
   padding: 20px;
   border: 1px solid #888;
   width: 265px; /* Could be more or less, depending on screen size */
}
.freezehander {
   position: fixed;
   top: 0px;
   background-color:
   white;
   width: 320px;
   z-index: 1;
}