buli
2023-07-14 36d15f189de2e83ce2576715dac30c3c260388dd
force-app/main/default/classes/LexSummonsCreatController.cls
@@ -245,265 +245,565 @@
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC) {
        // try {
        firstInit(ESetidJs);
        statusEdit = statusEdit;
        arriveorder = '';
        HospitalName = '';
        provinceOpts = new List<SelectOption>();
        provinceOptsMap = new Map<String, String>();
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        // public static Integer pagesize { get; set; }
        // public static Integer pageToken { get; set; }
        // public static String sortField { get; set; }
        // public static String sortOrder { get; set; }
        pagesize = pageSizeLWC;
        pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
<<<<<<< HEAD
    public static ResponseBodyLWC init(
        String ESetidJs,
        String statusEdit,
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String arriveorderLWC
    ) {
=======
    public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC,String arriveorderLWC) {
>>>>>>> LEXCommunityLiJun
        try {
            firstInit(ESetidJs);
            statusEdit = statusEdit;
            arriveorder = arriveorderLWC;
            HospitalName = '';
            provinceOpts = new List<SelectOption>();
            provinceOptsMap = new Map<String, String>();
            ResponseBodyLWC res = new ResponseBodyLWC();
            Map<String, object> data = new Map<String, object>();
            res.entity = data;
            // public static Integer pagesize { get; set; }
            // public static Integer pageToken { get; set; }
            // public static String sortField { get; set; }
            // public static String sortOrder { get; set; }
            pagesize = pageSizeLWC;
            pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
        // sortKey = '1';
        // preSortKey = '1';
        // sortOrderAsc = false;
        // sortOrder = new List<String>(8);
        // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' };
        //cate1ForSort = '';
        sumPrice = 0;
        IdCheck = EsetId;
        if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) {
            editAble = false;
        } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
            editAble = true;
        } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
            editAble = true;
        }
        userId = UserInfo.getUserId();
        localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()];
        //userId = '00510000005QO75';
        user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
        accountid = Useracc.accountid;
        userWorkLocation = Useracc.Work_Location__c;
        agencyProType = Useracc.UserPro_Type__c;
        if (String.isBlank(Useracc.UserPro_Type__c)) {
            agencyProType = 'ET';
        }
        Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
        accountName = accountInfo.Name;
        //coc.Order_date__c = Date.today();
        list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>();
        Dealerelationship = [
            SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
            FROM Dealer_elationship__c
            WHERE Dealer_principal__c = :accountid
        ];
        List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
        AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid];
        //add by rentx 2021-3-1 start
        //判断当前经销商下是否有特价医院
        List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid];
        if (hlist == null || hlist.size() == 0) {
            hasHos = false;
        } else {
            for (hospitalprice__c hp : hlist) {
                HosProMap.put(hp.product__c, '');
            // sortKey = '1';
            // preSortKey = '1';
            // sortOrderAsc = false;
            // sortOrder = new List<String>(8);
            // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '↓', '', '', '' };
            //cate1ForSort = '';
            sumPrice = 0;
            IdCheck = EsetId;
            if (ESetId != null && ESetId != '' && (statusEdit == '' || statusEdit == null)) {
                editAble = false;
            } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) {
                editAble = true;
            } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) {
                editAble = true;
            }
            hasHos = true;
        }
        //add by rentx 2021-3-1 end
            userId = UserInfo.getUserId();
<<<<<<< HEAD
            localuser = [
                SELECT id, State_Hospital__c
                FROM User
                WHERE id = :UserInfo.getUserId()
            ];
            //userId = '00510000005QO75';
            user Useracc = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                FROM user
                WHERE id = :userId
            ];
=======
            localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()];
            //userId = '00510000005QO75';
            user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
>>>>>>> LEXCommunityLiJun
            accountid = Useracc.accountid;
            userWorkLocation = Useracc.Work_Location__c;
            agencyProType = Useracc.UserPro_Type__c;
            if (String.isBlank(Useracc.UserPro_Type__c)) {
                agencyProType = 'ET';
            }
            Account accountInfo = [SELECT Name FROM account WHERE id = :accountid];
            accountName = accountInfo.Name;
            //coc.Order_date__c = Date.today();
            list<Dealer_elationship__c> Dealerelationship = new List<Dealer_elationship__c>();
            Dealerelationship = [
                SELECT Dealer_subordinate__c, Dealer_subordinate__r.Name
                FROM Dealer_elationship__c
                WHERE Dealer_principal__c = :accountid
            ];
        saveBtnDisabled = false;
        SorderBtnDisabled = false;
        String sqlagencyProType = '%' + agencyProType + '%';
        coc = new Consumable_order__c();
        consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
        Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
        //add by rentx 2021-01-29
        Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
        //add by rentx 2021-01-29
            List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
<<<<<<< HEAD
            AgencyHospitalLink = [
                SELECT Id, Hospital__c, Hospital__r.Name
                FROM Agency_Hospital_Link__c
                WHERE Agency__c = :accountid
            ];
        List<AggregateResult> orderdetailCount = [
            SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Isoverdue__c = 1
                AND Product_Type__c LIKE :sqlagencyProType
                AND Dealer_Info_text__c = :accountName
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            GROUP BY Consumable_Product__c, Box_Piece__c
        ];
        for (AggregateResult orderdetail : orderdetailCount) {
            zaikuId.add(String.valueOf(orderdetail.get('cpc')));
        }
        System.debug('sqlagencyProType = ' + sqlagencyProType);
        System.debug('userWorkLocation = ' + userWorkLocation);
        System.debug('accountName = ' + accountName);
        List<Consumable_order_details2__c> CountDel = [
            SELECT
                Id,
                Bar_Code__c,
                Name,
                Inventory_date__c,
                Consumable_Product__c,
                Consumable_Product__r.Asset_Model_No__c,
                Recordtypeid,
                Box_Piece__c,
                ProductPacking_list_manual__c,
                //add by rentx 2020-11-27 start
                hospitalSpecialOffer__c
            //add by rentx 2020-11-27 end
            FROM Consumable_order_details2__c
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Isoverdue__c = 1
                AND Product_Type__c LIKE :sqlagencyProType
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
                AND Dealer_Info_text__c = :accountName
        ];
        // 新規
        if (ESetId == null || ESetId == '') {
            SummonsFlag = 'hidden';
            String msoql = makeSoqlinventory();
            initStandardController(msoql);
            System.debug('msoql = ' + msoql);
            product2Selected = Database.query(msoql);
            if (String.isBlank(arriveorder)) {
                EditDelCommitBtnDisabled = true;
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
            //add by rentx 2021-3-1 start
            //判断当前经销商下是否有特价医院
            List<hospitalprice__c> hlist = [
                SELECT id, product__c
                FROM hospitalprice__c
                WHERE account__c = :accountid
            ];
=======
            AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid];
            //add by rentx 2021-3-1 start
            //判断当前经销商下是否有特价医院
            List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid];
>>>>>>> LEXCommunityLiJun
            if (hlist == null || hlist.size() == 0) {
                hasHos = false;
            } else {
                for (hospitalprice__c hp : hlist) {
                    HosProMap.put(hp.product__c, '');
                }
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                hasHos = true;
            }
            //add by rentx 2021-3-1 end
            saveBtnDisabled = false;
            SorderBtnDisabled = false;
            String sqlagencyProType = '%' + agencyProType + '%';
            coc = new Consumable_order__c();
            consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
            Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
            //add by rentx 2021-01-29
            Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
            //add by rentx 2021-01-29
            List<AggregateResult> orderdetailCount = [
                SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c != NULL
                    AND Isoverdue__c = 1
                    AND Product_Type__c LIKE :sqlagencyProType
                    AND Dealer_Info_text__c = :accountName
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                GROUP BY Consumable_Product__c, Box_Piece__c
            ];
            for (AggregateResult orderdetail : orderdetailCount) {
                zaikuId.add(String.valueOf(orderdetail.get('cpc')));
            }
<<<<<<< HEAD
=======
            System.debug('orderdetailCount = ' + orderdetailCount);
>>>>>>> LEXCommunityLiJun
            System.debug('sqlagencyProType = ' + sqlagencyProType);
            System.debug('userWorkLocation = ' + userWorkLocation);
            System.debug('accountName = ' + accountName);
            List<Consumable_order_details2__c> CountDel = [
                SELECT
                    Id,
                    Bar_Code__c,
                    Name,
                    Inventory_date__c,
                    Consumable_Product__c,
                    Consumable_Product__r.Asset_Model_No__c,
                    Recordtypeid,
                    Box_Piece__c,
                    ProductPacking_list_manual__c,
                    //add by rentx 2020-11-27 start
                    hospitalSpecialOffer__c
                //add by rentx 2020-11-27 end
                FROM Consumable_order_details2__c
                WHERE
                    Dealer_Arrive__c = TRUE
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Dealer_Returned__c = FALSE
                    AND Lose_Flag__c = FALSE
                    AND Cancellation_Flag__c = FALSE
                    AND Bar_Code__c != NULL
                    AND Isoverdue__c = 1
                    AND Product_Type__c LIKE :sqlagencyProType
                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
                    AND Dealer_Info_text__c = :accountName
            ];
            // 新規
            if (ESetId == null || ESetId == '') {
                SummonsFlag = 'hidden';
                String msoql = makeSoqlinventory();
                initStandardController(msoql);
                System.debug('msoql = ' + msoql);
                product2Selected = Database.query(msoql);
                if (String.isBlank(arriveorder)) {
                    EditDelCommitBtnDisabled = true;
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
<<<<<<< HEAD
=======
                    System.debug('MidMap = ' + MidMap);
>>>>>>> LEXCommunityLiJun
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            str = 'notHos';
                        }
<<<<<<< HEAD
=======
                        System.debug('CountDel[i].Consumable_Product__c= ' + CountDel[i].Consumable_Product__c);
                        System.debug('CountDel[i].Consumable_Product__c + str= ' + CountDel[i].Consumable_Product__c + str);
>>>>>>> LEXCommunityLiJun
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                        System.debug('MidMap2.size() = ' + MidMap2.size());
                        /*//然后循环CountDel去修改map里的allnumber
                            if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                                Jstage.allnumber = Jstage.allnumber+1 ;
                                if(CountDel[i].Box_Piece__c == '盒'){
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                }else if(CountDel[i].Box_Piece__c == '个'){
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                }else{
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage);
                            }*/
                    }
                    //update by rentx 2021-01-29 end
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                        //if(bss.allnumber>0){
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        consumableorderdetailsSelectRecords.add(bss);
                        //}
                    }
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        //ass.sortBy = sortOrderAsc;
                        //add by rentx 2021-3-10
                        if (ass.hospitalSpecialOffer) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    System.debug('MidMap2.size() = ' + MidMap2.size());
                    /*//然后循环CountDel去修改map里的allnumber
                        if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                            Jstage.allnumber = Jstage.allnumber+1 ;
                            if(CountDel[i].Box_Piece__c == '盒'){
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            }else if(CountDel[i].Box_Piece__c == '个'){
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            }else{
                                Jstage.hospitalSpecialOffer = false;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap.put(CountDel[i].Consumable_Product__c+str, Jstage);
                        }*/
                }
                //update by rentx 2021-01-29 end
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    consumableorderdetailsSelectRecords.sort();
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords1');
                    makepagerecords();
                    //listCut();
                } else {
                    if (statusEdit == '' || statusEdit == null) {
                        editAble = false;
                    } else if (statusEdit != '' && statusEdit != null) {
                        editAble = true;
                    }
                    // upadte start by vivek 2019-7-15
                    // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c,
                    //             Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c,
                    //             Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c,
                    //             Order_status__c,Shipment_total_amount__c,Offers_Price__c,
                    //             Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c
                    //         FROM Consumable_order__c
                    //         WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation
                    //         AND recordtypeid = :System.Label.RT_ConOrder_Arrive];
                    coc = [
                        SELECT
                            Id,
                            Name,
                            Summons_Order_type__c,
                            NoConfirmedPrice__c,
                            SummonsStatus_c__c,
                            Order_ForDealerText__c,
                            Dealer_Info__c,
                            Order_ForDealer__c,
                            Order_ForDealer__r.Name,
                            Order_ForDealerTextID__c,
                            Order_ForHospital__c,
                            SummonsForDirction__c,
                            Order_date__c,
                            Arrive_Order__c,
                            Order_status__c,
                            Shipment_total_amount__c,
                            Offers_Price__c,
                            Billed_Status__c,
                            ShipmentAccount__c,
                            Order_Dealer_Info__c,
                            Order_ForCustomerText__c,
                            ConInvoice_Code__c,
                            Onchange_order__c,
                            OutPattern__c
                        FROM Consumable_order__c
                        WHERE
                            Id = :arriveorder
                            AND Order_Owner_WorkLocal__c = :userWorkLocation
                            AND recordtypeid = :System.Label.RT_ConOrder_Arrive
                    ];
                    // update end by vivek 2019-7-15
                    //明细1获取
                    consumableorderdetailsSelected = [
                        SELECT
                            Id,
                            Dealer_Custom_Price__c,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Name,
                            Consumable_order__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Shipment_Count__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Sum_of_money__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            Consumable_Product__r.SFDA_Status__c,
                            Consumable_count__c,
                            Invoiced_Procount__c,
                            RrturnPro_count__c,
                            InvoiceProNot_count__c,
                            //Unitprice_To_agency__c,
                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
                        FROM Consumable_Orderdetails__c
                        WHERE Consumable_order__c = :coc.Arrive_Order__c
                        ORDER BY Name
                    ];
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        orderzaikuId.add(cdc1.Consumable_Product__c);
                    }
                    msoql = makeSoqlorderdet();
                    product2Selected = Database.query(msoql);
                    size = product2Selected.size();
                    initStandardController(msoql);
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    //update by rentx 2021-01-29
                    //if(bss.allnumber>0){
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    consumableorderdetailsSelectRecords.add(bss);
                    //}
                }
                    /*for(Integer i = 0 ; i< CountDel.size();i++){
                            //然后循环CountDel去修改map里的allnumber
                            if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                                Jstage.allnumber = Jstage.allnumber+1 ;
                                if(CountDel[i].Box_Piece__c == '盒'){
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                }else if(CountDel[i].Box_Piece__c == '个'){
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                            }
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    //ass.sortBy = sortOrderAsc;
                    //add by rentx 2021-3-10
                    if (ass.hospitalSpecialOffer) {
                        ishosnum = ishosnum + 1;
                        }*/
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            str = 'notHos';
                        }
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                        }
                    }
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        consumableorderdetailsSelectRecords.add(bss);
                    }
                    //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size()));
                    //return;
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        //ass.sortBy = sortOrderAsc;
                        for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                            cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
                            if (ass.prod.Id == cdc1.Consumable_Product__c) {
                                ass.check = true;
                                ass.orderdetails1 = cdc1;
                            }
                        }
                        if (ass.hospitalSpecialOffer == true) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    consumableorderdetailsSelectRecords.sort();
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords2');
                    makepagerecords();
                    consumablearriveproductdetailsSelected = [
                        SELECT
                            Id,
                            Name,
                            Intra_Trade_List_RMB__c,
                            Asset_Model_No__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Name__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Sterilization_limit__c,
                            Deliver_date__c,
                            Bar_Code__c,
                            Arrive_date__c,
                            Send_Date__c,
                            Consumable_order_minor__r.Name,
                            Consumable_order_minor__c,
                            Dealer_Arrive__c,
                            Delivery_List_RMB__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE
                            Consumable_order_minor__c = :coc.Arrive_Order__c
                            AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                            AND Dealer_Arrive__c = TRUE
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                        if (
                            consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c &&
                            HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c)
                        ) {
                            coc.OutPattern__c = true;
                        }
                        consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                consumableorderdetailsSelectRecords.sort();
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords1');
                makepagerecords();
                //listCut();
            } else {
                if (statusEdit == '' || statusEdit == null) {
                    editAble = false;
                } else if (statusEdit != '' && statusEdit != null) {
                    editAble = true;
                }
                // upadte start by vivek 2019-7-15
                // coc = [SELECT Id,Name,Summons_Order_type__c,SummonsStatus_c__c,Order_ForDealerText__c,
                //             Dealer_Info__c,Order_ForDealer__c,Order_ForDealer__r.Name,Order_ForDealerTextID__c,
                //             Order_ForHospital__c,SummonsForDirction__c,Order_date__c,Arrive_Order__c,
                //             Order_status__c,Shipment_total_amount__c,Offers_Price__c,
                //             Billed_Status__c,ShipmentAccount__c,Order_Dealer_Info__c,Order_ForCustomerText__c,ConInvoice_Code__c,Onchange_order__c
                //         FROM Consumable_order__c
                //         WHERE Id =:arriveorder AND Order_Owner_WorkLocal__c =: userWorkLocation
                //         AND recordtypeid = :System.Label.RT_ConOrder_Arrive];
                // 更新、
                SummonsFlag = 'visible';
                // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select
                consumableInvoiceRecords = [
                    SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c
                    FROM Consumable_order__c
                    WHERE
<<<<<<< HEAD
                        Id IN (
                            SELECT Invoice_Code_link__c
                            FROM Consumable_order_LinkTable__c
                            WHERE Outboundorder_Code_link__c = :ESetId
                        )
=======
                        Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId)
>>>>>>> LEXCommunityLiJun
                        AND Invoice_status__c != '草案中'
                ];
                System.debug('coc ESetId = ' + ESetId);
                System.debug('coc userWorkLocation = ' + userWorkLocation);
                coc = [
                    SELECT
                        Id,
@@ -531,871 +831,644 @@
                        Onchange_order__c,
                        OutPattern__c
                    FROM Consumable_order__c
                    WHERE
                        Id = :arriveorder
                        AND Order_Owner_WorkLocal__c = :userWorkLocation
                        AND recordtypeid = :System.Label.RT_ConOrder_Arrive
                    WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '传票'
                ];
                // update end by vivek 2019-7-15
                //明细1获取
                consumableorderdetailsSelected = [
                    SELECT
                        Id,
                        Dealer_Custom_Price__c,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Name,
                        Consumable_order__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Shipment_Count__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Sum_of_money__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        Consumable_Product__r.SFDA_Status__c,
                        Consumable_count__c,
                        Invoiced_Procount__c,
                        RrturnPro_count__c,
                        InvoiceProNot_count__c,
                        //Unitprice_To_agency__c,
                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c
                    FROM Consumable_Orderdetails__c
                    WHERE Consumable_order__c = :coc.Arrive_Order__c
                    ORDER BY Name
                ];
                for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                    orderzaikuId.add(cdc1.Consumable_Product__c);
                // update start by vivek 2019-7-15
                if (getExistarrive()) {
                    arriveorder = coc.Arrive_Order__c;
                }
                msoql = makeSoqlorderdet();
                product2Selected = Database.query(msoql);
                size = product2Selected.size();
                initStandardController(msoql);
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                }
                //update by rentx 2021-01-29
                /*for(Integer i = 0 ; i< CountDel.size();i++){
                        //然后循环CountDel去修改map里的allnumber
                        if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
                            Jstage.allnumber = Jstage.allnumber+1 ;
                            if(CountDel[i].Box_Piece__c == '盒'){
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            }else if(CountDel[i].Box_Piece__c == '个'){
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                        }
                    }*/
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                // 到货订单来的时候
                if (getExistarrive()) {
                    if (editAble) {
                        alertMessage = '到货订单直接出库,出库单明细不可编辑';
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                    if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                        system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                        saveBtnDisabled = true;
                        SorderBtnDisabled = true;
                        EditDelCommitBtnDisabled = false;
                    }
                }
                    //医院二级经销商分类
                    Integer io = 0;
                    while (io < Dealerelationship.size()) {
                        if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                            SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                            coc.Order_ForDealer__c = null;
                            io = io + Dealerelationship.size();
                        }
                        io++;
                    }
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    //update by rentx 2021-01-29
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    consumableorderdetailsSelectRecords.add(bss);
                }
                //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test11111' + consumableorderdetailsSelected.size()));
                //return;
                    Integer ik = 0;
                    while (ik < AgencyHospitalLink.size()) {
                        if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                            HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                            HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                            coc.Order_ForHospital__c = null;
                            ik = ik + AgencyHospitalLink.size();
                        }
                        ik++;
                    }
                    //出库单明细1取得
                    consumableorderdetailsSelected = [
                        SELECT
                            Id,
                            Dealer_Custom_Price__c,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Consumable_Product__r.SFDA_Status__c,
                            Name,
                            Consumable_order__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Shipment_Count__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Shipment_amount__c,
                            //Unitprice_To_agency__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            Invoiced_Procount__c,
                            RrturnPro_count__c,
                            InvoiceProNot_count__c,
                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                            isOutPattern__c
                        FROM Consumable_orderdetails__c
                        WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                        ORDER BY Name
                    ];
                    Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    //ass.sortBy = sortOrderAsc;
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
                        if (ass.prod.Id == cdc1.Consumable_Product__c) {
                            ass.check = true;
                            ass.orderdetails1 = cdc1;
                        sumPrice += cdc1.Shipment_amount__c;
                        orderzaikuId.add(cdc1.Consumable_Product__c);
                        //add by rentx 2021-2-26
                        String tempId = cdc1.Consumable_product__c;
                        if (cdc1.isOutPattern__c) {
                            cocMap.put(tempId + 'ishos', cdc1);
                        } else {
                            cocMap.put(tempId + 'nothos', cdc1);
                        }
                        //add by rentx 2021-2-26
                    }
                    String msoql = makeSoqlorderdet();
                    product2Selected = Database.query(msoql);
                    size = product2Selected.size();
                    initStandardController(msoql);
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    //update by rentx 2021-01-29
                    /*for(Integer i = 0 ; i< CountDel.size();i++){
                            //然后循环CountDel去修改map里的allnumber
                            if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                                ConsumableorderdetailsInfo Jstage =  MidMap.get(CountDel[i].Consumable_Product__c);
                                Jstage.allnumber = Jstage.allnumber+1 ;
                                if(CountDel[i].Box_Piece__c == '盒'){
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                }else if(CountDel[i].Box_Piece__c == '个'){
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                            }
                        }*/
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            str = 'notHos';
                        }
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                        }
                    }
                    if (ass.hospitalSpecialOffer == true) {
                        ishosnum = ishosnum + 1;
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                    //update by rentx 2021-01-29
                    consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                consumableorderdetailsSelectRecords.sort();
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords2');
                makepagerecords();
                consumablearriveproductdetailsSelected = [
                    SELECT
                        Id,
                        Name,
                        Intra_Trade_List_RMB__c,
                        Asset_Model_No__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Name__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Sterilization_limit__c,
                        Deliver_date__c,
                        Bar_Code__c,
                        Arrive_date__c,
                        Send_Date__c,
                        Consumable_order_minor__r.Name,
                        Consumable_order_minor__c,
                        Dealer_Arrive__c,
                        Delivery_List_RMB__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE
                        Consumable_order_minor__c = :coc.Arrive_Order__c
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                        AND Dealer_Arrive__c = TRUE
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                    if (
                        consumablearriveproductdetailsSelected[i].hospitalSpecialOffer__c &&
                        HosProMap.containsKey(consumablearriveproductdetailsSelected[i].Consumable_product__c)
                    ) {
                        coc.OutPattern__c = true;
                        //if(bss.allnumber > 0){
                        //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null  || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format();
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        //update by rentx 2021-2-26 start
                        if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                            consumableorderdetailsSelectRecords.add(bss);
                        } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                            consumableorderdetailsSelectRecords.add(bss);
                        }
                        //update by rentx 2021-2-26 end
                        // consumableorderdetailsSelectRecords.add(bss);
                        //}
                    }
                    consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                            //update by rentx 2012-3-1 start
                            // if(ass.prod.Id == cdc1.Consumable_Product__c){
                            //     ass.check = true;
                            //     ass.orderdetails1 = cdc1;
                            // }
                            if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                                ass.check = true;
                                ass.orderdetails1 = cdc1;
                            }
                            //update by rentx 2012-3-1 end
                        }
                        if (ass.hospitalSpecialOffer == true) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords3');
                    makepagerecords();
                    //listCut();
                    // 消耗品明细2を取得
                    consumableorderdetails2RecordsList = [
                        SELECT
                            Id,
                            Name,
                            SerialLotNo__c,
                            Consumable_Product__r.Name__c,
                            TracingCode__c,
                            Sterilization_limit__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Return_date__c,
                            Invoice_Date__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE Consumable_ZS_order__c = :ESetId
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                        consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                    }
                    //产品明细取得
                    consumablearriveproductdetailsSelected = [
                        SELECT
                            Id,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Name,
                            Consumable_Product__r.SFDA_Status__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Sterilization_limit__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE Consumable_ZS_order__c = :ESetId
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                        consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                    }
                } else {
                    // 不是到货订单来的时候
                    if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                        system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                        saveBtnDisabled = true;
                        SorderBtnDisabled = true;
                        EditDelCommitBtnDisabled = false;
                    }
                    //医院二级经销商分类
                    Integer io = 0;
                    while (io < Dealerelationship.size()) {
                        if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                            SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                            coc.Order_ForDealer__c = null;
                            io = io + Dealerelationship.size();
                        }
                        io++;
                    }
                    Integer ik = 0;
                    while (ik < AgencyHospitalLink.size()) {
                        if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                            HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                            HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                            coc.Order_ForHospital__c = null;
                            ik = ik + AgencyHospitalLink.size();
                        }
                        ik++;
                    }
                    // 消耗品明细1を取得
                    consumableorderdetailsSelected = [
                        SELECT
                            Id,
                            Dealer_Custom_Price__c,
                            Delivery_List_RMB__c,
                            Consumable_Product__r.Name__c,
                            Consumable_Product__r.SFDA_Status__c,
                            Name,
                            Consumable_order__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Shipment_Count__c,
                            Consumable_Product__r.Intra_Trade_List_RMB__c,
                            Consumable_Product__r.Asset_Model_No__c,
                            Shipment_amount__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            Invoiced_Procount__c,
                            RrturnPro_count__c,
                            //Unitprice_To_agency__c,
                            InvoiceProNot_count__c,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                            Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                            isOutPattern__c
                        FROM Consumable_orderdetails__c
                        WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                        ORDER BY Name
                    ];
                    //add by rentx 202-2-26
                    Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        sumPrice += cdc1.Shipment_amount__c;
                        orderzaikuId.add(cdc1.Consumable_Product__c);
                        //add by rentx 2021-2-26
                        String tempId = cdc1.Consumable_product__c;
                        if (cdc1.isOutPattern__c) {
                            cocMap.put(tempId + 'ishos', cdc1);
                        } else {
                            cocMap.put(tempId + 'nothos', cdc1);
                        }
                        //add by rentx 2021-2-26
                    }
                    String msoql = makeSoqlorderdet();
                    product2Selected = Database.query(msoql);
                    size = product2Selected.size();
                    initStandardController(msoql);
                    for (Integer i = 0; i < product2Selected.size(); i++) {
                        MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                    }
                    for (Integer i = 0; i < CountDel.size(); i++) {
                        String str = '';
                        if (CountDel[i].hospitalSpecialOffer__c) {
                            str = 'isHos';
                        } else {
                            str = 'notHos';
                        }
                        //明细2对应的产品存在于MidMap中
                        if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                            //设置map中key的后缀 用于区分医院特价和非医院特价
                            if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                                ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            } else {
                                //midmap2中没有对应的产品
                                ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                                Jstage.allnumber = Jstage.allnumber + 1;
                                if (CountDel[i].Box_Piece__c == '盒') {
                                    Jstage.Boxnumber = Jstage.Boxnumber + 1;
                                } else if (CountDel[i].Box_Piece__c == '个') {
                                    Jstage.Piecenumber = Jstage.Piecenumber + 1;
                                }
                                if (CountDel[i].hospitalSpecialOffer__c) {
                                    Jstage.hospitalSpecialOffer = true;
                                } else {
                                    Jstage.hospitalSpecialOffer = false;
                                }
                                if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                    Jstage.hosPro = true;
                                }
                                Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                                MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                            }
                        }
                    }
                    //再把map里的值从新赋给ConsumableorderdetailsRecords
                    //update by rentx 2021-01-29
                    // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                    for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                        //update by rentx 2021-01-29
                        //if(bss.allnumber>0){
                        bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                        bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                        bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                        //update by rentx 2021-2-26 start
                        if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                            consumableorderdetailsSelectRecords.add(bss);
                        } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                            consumableorderdetailsSelectRecords.add(bss);
                        }
                        // consumableorderdetailsSelectRecords.add(bss);
                        //}
                    }
                    // return null;
                    Integer ishosnum = 0;
                    for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                        //ass.sortBy = sortOrderAsc;
                        for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                            //update by rentx 2012-3-1 start
                            // if(ass.prod.Id == cdc1.Consumable_Product__c){
                            //     ass.check = true;
                            //     ass.orderdetails1 = cdc1;
                            // }
                            if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                                ass.check = true;
                                ass.orderdetails1 = cdc1;
                            }
                            //update by rentx 2012-3-1 end
                        }
                        if (ass.hospitalSpecialOffer == true) {
                            ishosnum = ishosnum + 1;
                        }
                    }
                    if (ishosnum > 0) {
                        hasHosPro = true;
                    } else {
                        hasHosPro = false;
                    }
                    consumableorderdetailsSelectRecords.sort();
                    //add by rentx
                    noOfRecords = consumableorderdetailsSelectRecords.size();
                    //add by rentx
                    System.debug('makepagerecords4');
                    makepagerecords();
                    // 消耗品明细2を取得
                    consumableorderdetails2RecordsList = [
                        SELECT
                            Id,
                            Name,
                            SerialLotNo__c,
                            Consumable_Product__r.Name__c,
                            TracingCode__c,
                            Sterilization_limit__c,
                            Consumable_Product__c,
                            Consumable_Product__r.Name,
                            Consumable_Product__r.Category3__c,
                            Consumable_Product__r.Category4__c,
                            Consumable_Product__r.Category5__c,
                            Return_date__c,
                            Invoice_Date__c,
                            Box_Piece__c,
                            ProductPacking_list_manual__c,
                            //add by rentx start
                            hospitalSpecialOffer__c
                        //add by rentx end
                        FROM Consumable_order_details2__c
                        WHERE Consumable_ZS_order__c = :ESetId
                        ORDER BY Name
                    ];
                    for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                        consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                    }
                }
            }
        } else {
            // 更新、
            SummonsFlag = 'visible';
            // update start by vivek 2019-7-15 add “NoConfirmedPrice__c” in select
            consumableInvoiceRecords = [
                SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c
                FROM Consumable_order__c
                WHERE
                    Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId)
                    AND Invoice_status__c != '草案中'
            ];
            System.debug('coc ESetId = ' + ESetId);
            System.debug('coc userWorkLocation = ' + userWorkLocation);
            coc = [
                SELECT
                    Id,
                    Name,
                    Summons_Order_type__c,
                    NoConfirmedPrice__c,
                    SummonsStatus_c__c,
                    Order_ForDealerText__c,
                    Dealer_Info__c,
                    Order_ForDealer__c,
                    Order_ForDealer__r.Name,
                    Order_ForDealerTextID__c,
                    Order_ForHospital__c,
                    SummonsForDirction__c,
                    Order_date__c,
                    Arrive_Order__c,
                    Order_status__c,
                    Shipment_total_amount__c,
                    Offers_Price__c,
                    Billed_Status__c,
                    ShipmentAccount__c,
                    Order_Dealer_Info__c,
                    Order_ForCustomerText__c,
                    ConInvoice_Code__c,
                    Onchange_order__c,
                    OutPattern__c
                FROM Consumable_order__c
                WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Order_type__c = '传票'
            ];
            // update start by vivek 2019-7-15
            if (getExistarrive()) {
                arriveorder = coc.Arrive_Order__c;
            }
            // 到货订单来的时候
            if (getExistarrive()) {
                if (editAble) {
                    alertMessage = '到货订单直接出库,出库单明细不可编辑';
                }
                if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                    system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                    saveBtnDisabled = true;
                    SorderBtnDisabled = true;
                    EditDelCommitBtnDisabled = false;
                }
                //医院二级经销商分类
                Integer io = 0;
                while (io < Dealerelationship.size()) {
                    if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                        SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                        coc.Order_ForDealer__c = null;
                        io = io + Dealerelationship.size();
                    }
                    io++;
                }
                Integer ik = 0;
                while (ik < AgencyHospitalLink.size()) {
                    if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                        HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                        HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                        coc.Order_ForHospital__c = null;
                        ik = ik + AgencyHospitalLink.size();
                    }
                    ik++;
                }
                //出库单明细1取得
                consumableorderdetailsSelected = [
                    SELECT
                        Id,
                        Dealer_Custom_Price__c,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Consumable_Product__r.SFDA_Status__c,
                        Name,
                        Consumable_order__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Shipment_Count__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Shipment_amount__c,
                        //Unitprice_To_agency__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        Invoiced_Procount__c,
                        RrturnPro_count__c,
                        InvoiceProNot_count__c,
                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                        isOutPattern__c
                    FROM Consumable_orderdetails__c
                    WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                    ORDER BY Name
                ];
                Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                    sumPrice += cdc1.Shipment_amount__c;
                    orderzaikuId.add(cdc1.Consumable_Product__c);
                    //add by rentx 2021-2-26
                    String tempId = cdc1.Consumable_product__c;
                    if (cdc1.isOutPattern__c) {
                        cocMap.put(tempId + 'ishos', cdc1);
                    } else {
                        cocMap.put(tempId + 'nothos', cdc1);
                    }
                    //add by rentx 2021-2-26
                }
                String msoql = makeSoqlorderdet();
                product2Selected = Database.query(msoql);
                size = product2Selected.size();
                initStandardController(msoql);
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                }
                //update by rentx 2021-01-29
                /*for(Integer i = 0 ; i< CountDel.size();i++){
                        //然后循环CountDel去修改map里的allnumber
                        if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                            ConsumableorderdetailsInfo Jstage =  MidMap.get(CountDel[i].Consumable_Product__c);
                            Jstage.allnumber = Jstage.allnumber+1 ;
                            if(CountDel[i].Box_Piece__c == '盒'){
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            }else if(CountDel[i].Box_Piece__c == '个'){
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap.put(CountDel[i].Consumable_Product__c, Jstage);
                        }
                    }*/
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                    }
                }
                //update by rentx 2021-01-29
                consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    //update by rentx 2021-01-29
                    //if(bss.allnumber > 0){
                    //bss.UnitpriceToagency = bss.orderdetails1.Unitprice_To_agency__c == null  || bss.orderdetails1.Unitprice_To_agency__c == 0 ? '' :bss.orderdetails1.Unitprice_To_agency__c.format();
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    //update by rentx 2021-2-26 start
                    if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                        consumableorderdetailsSelectRecords.add(bss);
                    } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                        consumableorderdetailsSelectRecords.add(bss);
                    }
                    //update by rentx 2021-2-26 end
                    // consumableorderdetailsSelectRecords.add(bss);
                    //}
                }
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        //update by rentx 2012-3-1 start
                        // if(ass.prod.Id == cdc1.Consumable_Product__c){
                        //     ass.check = true;
                        //     ass.orderdetails1 = cdc1;
                        // }
                        if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                            ass.check = true;
                            ass.orderdetails1 = cdc1;
                        }
                        //update by rentx 2012-3-1 end
                    }
                    if (ass.hospitalSpecialOffer == true) {
                        ishosnum = ishosnum + 1;
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords3');
                makepagerecords();
                //listCut();
                // 消耗品明细2を取得
                consumableorderdetails2RecordsList = [
                    SELECT
                        Id,
                        Name,
                        SerialLotNo__c,
                        Consumable_Product__r.Name__c,
                        TracingCode__c,
                        Sterilization_limit__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Return_date__c,
                        Invoice_Date__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE Consumable_ZS_order__c = :ESetId
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                    consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                }
                //产品明细取得
                consumablearriveproductdetailsSelected = [
                    SELECT
                        Id,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Name,
                        Consumable_Product__r.SFDA_Status__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Sterilization_limit__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE Consumable_ZS_order__c = :ESetId
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                    consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
            //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer));
            if (SecondDealer == null || SecondDealer == '') {
                provinceOpts.add(new SelectOption('', '-无-'));
                provinceOptsMap.put('', '-无-');
                for (Integer i = 0; i < Dealerelationship.size(); i++) {
                    provinceOpts.add(
                        new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                    );
                    provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                }
            } else {
                // 不是到货订单来的时候
                if (coc.SummonsStatus_c__c == '已提交' || coc.SummonsStatus_c__c == '批准') {
                    system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                    saveBtnDisabled = true;
                    SorderBtnDisabled = true;
                    EditDelCommitBtnDisabled = false;
                }
                //医院二级经销商分类
                Integer io = 0;
                while (io < Dealerelationship.size()) {
                    if (coc.Order_ForDealer__c == Dealerelationship[io].Dealer_subordinate__c) {
                        SecondDealer = Dealerelationship[io].Dealer_subordinate__c;
                        coc.Order_ForDealer__c = null;
                        io = io + Dealerelationship.size();
                    }
                    io++;
                }
                Integer ik = 0;
                while (ik < AgencyHospitalLink.size()) {
                    if (coc.Order_ForHospital__c == AgencyHospitalLink[ik].Hospital__c) {
                        HospitalInfo = AgencyHospitalLink[ik].Hospital__c;
                        HospitalName = AgencyHospitalLink[ik].Hospital__r.Name;
                        coc.Order_ForHospital__c = null;
                        ik = ik + AgencyHospitalLink.size();
                    }
                    ik++;
                }
                // 消耗品明细1を取得
                consumableorderdetailsSelected = [
                    SELECT
                        Id,
                        Dealer_Custom_Price__c,
                        Delivery_List_RMB__c,
                        Consumable_Product__r.Name__c,
                        Consumable_Product__r.SFDA_Status__c,
                        Name,
                        Consumable_order__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Shipment_Count__c,
                        Consumable_Product__r.Intra_Trade_List_RMB__c,
                        Consumable_Product__r.Asset_Model_No__c,
                        Shipment_amount__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        Invoiced_Procount__c,
                        RrturnPro_count__c,
                        //Unitprice_To_agency__c,
                        InvoiceProNot_count__c,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Consumable_Product__r.Product2__r.SFDA_Approbation_No__c,
                        Consumable_Product__r.Product2__r.SFDA_Expiration_Date__c,
                        isOutPattern__c
                    FROM Consumable_orderdetails__c
                    WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Order_Owner_WorkLocal__c = :userWorkLocation
                    ORDER BY Name
                ];
                //add by rentx 202-2-26
                Map<String, Consumable_Orderdetails__c> cocMap = new Map<String, Consumable_Orderdetails__c>();
                for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                    sumPrice += cdc1.Shipment_amount__c;
                    orderzaikuId.add(cdc1.Consumable_Product__c);
                    //add by rentx 2021-2-26
                    String tempId = cdc1.Consumable_product__c;
                    if (cdc1.isOutPattern__c) {
                        cocMap.put(tempId + 'ishos', cdc1);
                    } else {
                        cocMap.put(tempId + 'nothos', cdc1);
                    }
                    //add by rentx 2021-2-26
                }
                String msoql = makeSoqlorderdet();
                product2Selected = Database.query(msoql);
                size = product2Selected.size();
                initStandardController(msoql);
                for (Integer i = 0; i < product2Selected.size(); i++) {
                    MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                }
                for (Integer i = 0; i < CountDel.size(); i++) {
                    String str = '';
                    if (CountDel[i].hospitalSpecialOffer__c) {
                        str = 'isHos';
                    } else {
                        str = 'notHos';
                    }
                    //明细2对应的产品存在于MidMap中
                    if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                        //设置map中key的后缀 用于区分医院特价和非医院特价
                        if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
                            ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        } else {
                            //midmap2中没有对应的产品
                            ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
                            Jstage.allnumber = Jstage.allnumber + 1;
                            if (CountDel[i].Box_Piece__c == '盒') {
                                Jstage.Boxnumber = Jstage.Boxnumber + 1;
                            } else if (CountDel[i].Box_Piece__c == '个') {
                                Jstage.Piecenumber = Jstage.Piecenumber + 1;
                            }
                            if (CountDel[i].hospitalSpecialOffer__c) {
                                Jstage.hospitalSpecialOffer = true;
                            } else {
                                Jstage.hospitalSpecialOffer = false;
                            }
                            if (HosProMap.containsKey(Jstage.Prod.Id)) {
                                Jstage.hosPro = true;
                            }
                            Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                            MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                        }
                provinceOpts.add(new SelectOption('', '-无-'));
                provinceOptsMap.put('', '-无-');
                for (Integer i = 0; i < Dealerelationship.size(); i++) {
                    if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) {
                        provinceOpts.add(
                            new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                        );
                        provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                    }
                }
                //再把map里的值从新赋给ConsumableorderdetailsRecords
                //update by rentx 2021-01-29
                // for(ConsumableorderdetailsInfo bss : MidMap.values()){
                for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
                    //update by rentx 2021-01-29
                    //if(bss.allnumber>0){
                    bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                    bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                    bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                    //update by rentx 2021-2-26 start
                    if (cocMap.containsKey(bss.Prod.Id + 'ishos') && bss.hospitalSpecialOffer == true) {
                        consumableorderdetailsSelectRecords.add(bss);
                    } else if (cocMap.containsKey(bss.Prod.Id + 'nothos') && bss.hospitalSpecialOffer == false) {
                        consumableorderdetailsSelectRecords.add(bss);
                for (Integer i = 0; i < Dealerelationship.size(); i++) {
                    if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) {
                        provinceOpts.add(
                            new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                        );
                        provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                    }
                    // consumableorderdetailsSelectRecords.add(bss);
                    //}
                }
                // return null;
                Integer ishosnum = 0;
                for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
                    //ass.sortBy = sortOrderAsc;
                    for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                        //update by rentx 2012-3-1 start
                        // if(ass.prod.Id == cdc1.Consumable_Product__c){
                        //     ass.check = true;
                        //     ass.orderdetails1 = cdc1;
                        // }
                        if (ass.Prod.Id == cdc1.Consumable_Product__c && ass.hospitalSpecialOffer == cdc1.isOutPattern__c) {
                            ass.check = true;
                            ass.orderdetails1 = cdc1;
                        }
                        //update by rentx 2012-3-1 end
                    }
                    if (ass.hospitalSpecialOffer == true) {
                        ishosnum = ishosnum + 1;
                    }
                }
                if (ishosnum > 0) {
                    hasHosPro = true;
                } else {
                    hasHosPro = false;
                }
                consumableorderdetailsSelectRecords.sort();
                //add by rentx
                noOfRecords = consumableorderdetailsSelectRecords.size();
                //add by rentx
                System.debug('makepagerecords4');
                makepagerecords();
                // 消耗品明细2を取得
                consumableorderdetails2RecordsList = [
                    SELECT
                        Id,
                        Name,
                        SerialLotNo__c,
                        Consumable_Product__r.Name__c,
                        TracingCode__c,
                        Sterilization_limit__c,
                        Consumable_Product__c,
                        Consumable_Product__r.Name,
                        Consumable_Product__r.Category3__c,
                        Consumable_Product__r.Category4__c,
                        Consumable_Product__r.Category5__c,
                        Return_date__c,
                        Invoice_Date__c,
                        Box_Piece__c,
                        ProductPacking_list_manual__c,
                        //add by rentx start
                        hospitalSpecialOffer__c
                    //add by rentx end
                    FROM Consumable_order_details2__c
                    WHERE Consumable_ZS_order__c = :ESetId
                    ORDER BY Name
                ];
                for (Integer i = 0; i < consumableorderdetails2RecordsList.size(); i++) {
                    consumableorderdetails2Records.add(new ConsumableorderdetailsInfo(consumableorderdetails2RecordsList[i]));
                }
            }
        }
        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'test++++++' + SecondDealer));
        if (SecondDealer == null || SecondDealer == '') {
            provinceOpts.add(new SelectOption('', '-无-'));
            provinceOptsMap.put('', '-无-');
            for (Integer i = 0; i < Dealerelationship.size(); i++) {
                provinceOpts.add(
                    new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                );
                provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
            }
        } else {
            provinceOpts.add(new SelectOption('', '-无-'));
            provinceOptsMap.put('', '-无-');
            for (Integer i = 0; i < Dealerelationship.size(); i++) {
                if (Dealerelationship[i].Dealer_subordinate__c == SecondDealer) {
                    provinceOpts.add(
                        new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                    );
                    provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
            Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
            cansee = dfr.isAccessible();
            Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe();
            dealerPricesee = dealerPrice.isAccessible();
            // 显示数据条数信息
            //    makeMessage();
            //附件
<<<<<<< HEAD
            attachmentinfo = [
                SELECT Id, Name, OwnerId
                FROM Attachment
                WHERE parentid = :ESetId
            ];
=======
            attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId];
>>>>>>> LEXCommunityLiJun
            if (attachmentinfo.size() > 0) {
                for (Integer i = 0; i < attachmentinfo.size(); i++) {
                    attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
                }
            }
            for (Integer i = 0; i < Dealerelationship.size(); i++) {
                if (Dealerelationship[i].Dealer_subordinate__c != SecondDealer) {
                    provinceOpts.add(
                        new SelectOption(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name)
                    );
                    provinceOptsMap.put(Dealerelationship[i].Dealer_subordinate__c, Dealerelationship[i].Dealer_subordinate__r.Name);
                }
            AggregateResult[] categoryList = [
                SELECT Count(id), Category3_text__c c3c
                FROM Product2__c
                WHERE Category3_text__c != NULL
                GROUP BY Category3_text__c
            ];
            categoryOptionList = new List<SelectOption>();
            categoryOptionList.add(new SelectOption('', '-无-'));
            categoryOptionMap = new Map<String, String>();
            categoryOptionMap.put('', '-无-');
            for (AggregateResult category3Search : categoryList) {
                String deliverycnt = String.valueOf(category3Search.get('c3c'));
                categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
                categoryOptionMap.put(deliverycnt, deliverycnt);
            }
        }
        Schema.DescribeFieldResult dfr = Product2__c.Intra_Trade_List_RMB__c.getDescribe();
        cansee = dfr.isAccessible();
        Schema.DescribeFieldResult dealerPrice = Consumable_orderdetails__c.Dealer_Custom_Price__c.getDescribe();
        dealerPricesee = dealerPrice.isAccessible();
        // 显示数据条数信息
        //    makeMessage();
        //附件
        attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId];
        if (attachmentinfo.size() > 0) {
            for (Integer i = 0; i < attachmentinfo.size(); i++) {
                attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
            category4OptionList = new List<SelectOption>();
            category4OptionList.add(new SelectOption('', '-无-'));
            category4OptionMap = new Map<String, String>();
            category4OptionMap.put('', '-无-');
            /*for(AggregateResult category4Search : category4List) {
                    String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
                    category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
                }*/
            category5OptionList = new List<SelectOption>();
            category5OptionList.add(new SelectOption('', '-无-'));
            category5OptionMap = new Map<String, String>();
            category5OptionMap.put('', '-无-');
            //分页
            PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
            totalCount = pageRecords.size();
            System.debug('pageToken = ' + pageToken);
            System.debug('pageSize = ' + pageSize);
            System.debug('totalCount = ' + totalCount);
            paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
            System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken);
            paginatedAccounts.recordStart = pageToken + 1;
            paginatedAccounts.pageNumber = pageToken / pageSize + 1;
            Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
            paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
            paginatedAccounts.totalRecords = totalCount;
            Integer startIdx;
            Integer endIdx;
            startIdx = pageToken;
            endIdx = pageToken + pageSize;
            List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
            if (endIdx > pageRecords.size()) {
                endIdx = pageRecords.size();
            }
            for (Integer i = startIdx; i < endIdx; i++) {
                pageRecordsTemp.add(pageRecords.get(i));
            }
            Boolean Existarrive = (coc.Arrive_Order__c != null);
            String ConsumableOut_report = System.Label.ConsumableOut_report;
            System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
            data.put('paginatedAccounts', paginatedAccounts);
            data.put('ConsumableOut_report', ConsumableOut_report);
            data.put('accountid', accountid);
            data.put('consumableproductdetailsRecords', consumableproductdetailsRecords);
            data.put('agencyProType', agencyProType);
            data.put('accountName', accountName);
            data.put('userWorkLocation', userWorkLocation);
            data.put('categoryOptionMap', categoryOptionMap);
            data.put('category4OptionMap', category4OptionMap);
            data.put('category5OptionMap', category5OptionMap);
            data.put('outOutPatternOptionMap', outOutPatternOptionMap);
            data.put('hasHosPro', hasHosPro);
            data.put('Existarrive', Existarrive);
            data.put('sumPrice', sumPrice);
            data.put('HospitalName', HospitalName);
            data.put('provinceOptsMap', provinceOptsMap);
            data.put('SummonsFlag', SummonsFlag);
            data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
            data.put('EditAble', EditAble);
            data.put('coc', coc);
            data.put('pageRecords', pageRecordsTemp);
            data.put('arriveorder', arriveorder);
            data.put('consumableorderdetails2Count', consumableorderdetails2Count);
            data.put('consumableorderdetails2Records', consumableorderdetails2Records);
            data.put('HospitalInfo', HospitalInfo);
            res.status = 'Success';
            res.code = 200;
            System.debug('res = ' + res);
            return res;
        } catch (Exception e) {
<<<<<<< HEAD
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
=======
            return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
>>>>>>> LEXCommunityLiJun
        }
        AggregateResult[] categoryList = [
            SELECT Count(id), Category3_text__c c3c
            FROM Product2__c
            WHERE Category3_text__c != NULL
            GROUP BY Category3_text__c
        ];
        categoryOptionList = new List<SelectOption>();
        categoryOptionList.add(new SelectOption('', '-无-'));
        categoryOptionMap = new Map<String, String>();
        categoryOptionMap.put('', '-无-');
        for (AggregateResult category3Search : categoryList) {
            String deliverycnt = String.valueOf(category3Search.get('c3c'));
            categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
            categoryOptionMap.put(deliverycnt, deliverycnt);
        }
        category4OptionList = new List<SelectOption>();
        category4OptionList.add(new SelectOption('', '-无-'));
        category4OptionMap = new Map<String, String>();
        category4OptionMap.put('', '-无-');
        /*for(AggregateResult category4Search : category4List) {
                String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
                category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
            }*/
        category5OptionList = new List<SelectOption>();
        category5OptionList.add(new SelectOption('', '-无-'));
        category5OptionMap = new Map<String, String>();
        category5OptionMap.put('', '-无-');
        //分页
        PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
        totalCount = pageRecords.size();
        System.debug('pageToken = ' + pageToken);
        System.debug('pageSize = ' + pageSize);
        System.debug('totalCount = ' + totalCount);
        paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
        System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken);
        paginatedAccounts.recordStart = pageToken + 1;
        paginatedAccounts.pageNumber = pageToken / pageSize + 1;
        Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
        paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
        paginatedAccounts.totalRecords = totalCount;
        Integer startIdx;
        Integer endIdx;
        startIdx = pageToken;
        endIdx = pageToken + pageSize;
        List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
        if (endIdx > pageRecords.size()) {
            endIdx = pageRecords.size();
        }
        for (Integer i = startIdx; i < endIdx; i++) {
            pageRecordsTemp.add(pageRecords.get(i));
        }
        Boolean Existarrive = (coc.Arrive_Order__c != null);
        String ConsumableOut_report = System.Label.ConsumableOut_report;
        System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
        data.put('paginatedAccounts', paginatedAccounts);
        data.put('ConsumableOut_report', ConsumableOut_report);
        data.put('accountid', accountid);
        data.put('consumableproductdetailsRecords', consumableproductdetailsRecords);
        data.put('agencyProType', agencyProType);
        data.put('accountName', accountName);
        data.put('userWorkLocation', userWorkLocation);
        data.put('categoryOptionMap', categoryOptionMap);
        data.put('category4OptionMap', category4OptionMap);
        data.put('category5OptionMap', category5OptionMap);
        data.put('outOutPatternOptionMap', outOutPatternOptionMap);
        data.put('hasHosPro', hasHosPro);
        data.put('Existarrive', Existarrive);
        data.put('sumPrice', sumPrice);
        data.put('HospitalName', HospitalName);
        data.put('provinceOptsMap', provinceOptsMap);
        data.put('SummonsFlag', SummonsFlag);
        data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
        data.put('EditAble', EditAble);
        data.put('coc', coc);
        data.put('pageRecords', pageRecordsTemp);
        data.put('arriveorder', arriveorder);
        data.put('consumableorderdetails2Count', consumableorderdetails2Count);
        data.put('consumableorderdetails2Records', consumableorderdetails2Records);
        data.put('HospitalInfo', HospitalInfo);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
        // } catch (Exception e) {
        //     return new ResponseBodyLWC('Error',500, e.getMessage(), '');
        // }
    }
    @AuraEnabled
@@ -1411,6 +1484,10 @@
            WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
            GROUP BY Category4_text__c
        ];
<<<<<<< HEAD
=======
        System.debug('category4List ' + category4List);
>>>>>>> LEXCommunityLiJun
        category4OptionList = new List<SelectOption>();
        category4OptionList.add(new SelectOption('', '-无-'));
        category4OptionMap = new Map<String, String>();
@@ -1428,6 +1505,10 @@
            GROUP BY Category5_text__c
        ];
<<<<<<< HEAD
=======
        System.debug('category5List ' + category5List);
>>>>>>> LEXCommunityLiJun
        category5OptionList = new List<SelectOption>();
        category5OptionList.add(new SelectOption('', '-无-'));
        category5OptionMap = new Map<String, String>();
@@ -1459,6 +1540,10 @@
            WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
            GROUP BY Category4_text__c
        ];
<<<<<<< HEAD
=======
        System.debug('category4List ' + category4List);
>>>>>>> LEXCommunityLiJun
        category4OptionList = new List<SelectOption>();
        category4OptionList.add(new SelectOption('', '-无-'));
        category4OptionMap = new Map<String, String>();
@@ -1476,6 +1561,10 @@
            GROUP BY Category5_text__c
        ];
<<<<<<< HEAD
=======
        System.debug('category5List ' + category5List);
>>>>>>> LEXCommunityLiJun
        category5OptionList = new List<SelectOption>();
        category5OptionList.add(new SelectOption('', '-无-'));
        category5OptionMap = new Map<String, String>();
@@ -1543,6 +1632,11 @@
                AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc
            GROUP BY Consumable_Product__c, Box_Piece__c
        ];
<<<<<<< HEAD
=======
        System.debug('orderdetailCount = ' + orderdetailCount);
>>>>>>> LEXCommunityLiJun
        for (AggregateResult orderdetail : orderdetailCount) {
            zaikuId.add(String.valueOf(orderdetail.get('cpc')));
        }
@@ -1698,6 +1792,7 @@
        data.put('paginatedAccounts', paginatedAccounts);
        data.put('pageRecords', pageRecordsTemp);
        data.put('SearchDone', SearchDone);
        data.put('hasHosPro', hasHosPro);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -2054,7 +2149,15 @@
        //特价医院出库非本医院维护的特价商品时,报错 非特价医院出库维护在医院特价关系表的产品时 报错
        if (coc.SummonsForDirction__c != '互相调货') {
            //非特价医院出库特价产品时 报错(当前经销商下没有特价医院除外)
<<<<<<< HEAD
            List<hospitalprice__c> hopList = [
                SELECT id, hospital__c, product__c
                FROM hospitalprice__c
                WHERE account__c = :accountid
            ];
=======
            List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid];
>>>>>>> LEXCommunityLiJun
            //经销商对应医院下的所有特价产品
            Map<String, String> proMap = new Map<String, String>();
            //经销商下的所有特价产品
@@ -2121,11 +2224,15 @@
                    return new ResponseBodyLWC(
                        'Error',
                        500,
<<<<<<< HEAD
                        '经销商:' + coc.Order_ForDealerText__c + ' 没有消耗品:' + proStr.substring(0, proStr.length() - 1) + ' 的特价',
=======
                        '经销商:' +
                        coc.Order_ForDealerText__c +
                        ' 没有消耗品:' +
                        proStr.substring(0, proStr.length() - 1) +
                        ' 的特价',
>>>>>>> LEXCommunityLiJun
                        ''
                    );
                }
@@ -2177,22 +2284,26 @@
            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                if (ass.check == true) {
                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
<<<<<<< HEAD
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
=======
                    if ((ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) && coc.SummonsForDirction__c != '医院试用') {
>>>>>>> LEXCommunityLiJun
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
                        ass.orderdetails1.Delivery_List_RMB__c == 0 &&
                        (coc.SummonsForDirction__c == '销售给二级经销商' ||
                        coc.SummonsForDirction__c == '直接销售给医院')
                    ) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
@@ -2217,9 +2328,13 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
<<<<<<< HEAD
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
=======
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
>>>>>>> LEXCommunityLiJun
                                    ''
                                );
                            }
@@ -2235,9 +2350,13 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
<<<<<<< HEAD
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
=======
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
>>>>>>> LEXCommunityLiJun
                                    ''
                                );
                            }
@@ -2248,7 +2367,15 @@
            insert p;
            ESetId = p.id;
            List<Consumable_order__c> detailName = new List<Consumable_order__c>();
<<<<<<< HEAD
            detailName = [
                SELECT id, Name
                FROM Consumable_order__c
                WHERE id = :ESetId
            ];
=======
            detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId];
>>>>>>> LEXCommunityLiJun
            Integer i = 1;
            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                if (ass.check == true) {
@@ -2340,14 +2467,17 @@
            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                if (ass.check == true) {
                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
<<<<<<< HEAD
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
=======
                    if ((ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) && coc.SummonsForDirction__c != '医院试用') {
>>>>>>> LEXCommunityLiJun
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
@@ -2355,8 +2485,6 @@
                        (coc.SummonsForDirction__c == '销售给二级经销商' ||
                        coc.SummonsForDirction__c == '直接销售给医院')
                    ) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
@@ -2375,9 +2503,13 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
<<<<<<< HEAD
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
=======
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
>>>>>>> LEXCommunityLiJun
                                    ''
                                );
                            }
@@ -2392,9 +2524,13 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
<<<<<<< HEAD
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
=======
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
>>>>>>> LEXCommunityLiJun
                                    ''
                                );
                            }
@@ -2412,6 +2548,10 @@
                        InsAfterDel.Name = p.name + '-' + str;
                        InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
                        InsAfterDel.Consumable_order__c = ESetId;
<<<<<<< HEAD
=======
                        System.debug('ass.Prod.id:' + ass.Prod.id);
>>>>>>> LEXCommunityLiJun
                        InsAfterDel.Consumable_Product__c = ass.Prod.id;
                        InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
                        InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
@@ -2430,7 +2570,15 @@
            }
            update p;
            List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>();
<<<<<<< HEAD
            qs = [
                SELECT Id
                FROM Consumable_orderdetails__c
                WHERE Consumable_order__c = :ESetId
            ];
=======
            qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
>>>>>>> LEXCommunityLiJun
            if (qs.size() > 0) {
                delete qs;
            }
@@ -2542,7 +2690,11 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
<<<<<<< HEAD
        //             // AND
=======
        //             // AND 
>>>>>>> LEXCommunityLiJun
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2558,7 +2710,11 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
<<<<<<< HEAD
        //             // AND
=======
        //             // AND 
>>>>>>> LEXCommunityLiJun
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2569,7 +2725,10 @@
        //     ];
        // }
<<<<<<< HEAD
=======
>>>>>>> LEXCommunityLiJun
        Date today = Date.today();
        //Date today = Date.newInstance(2023, 3, 1);
        Integer thisMonth = today.month();
@@ -2578,7 +2737,11 @@
        Integer lastYear = today.year() - 1;
        Integer thisYear = today.year();
        Integer nextYear = today.year() + 1;
<<<<<<< HEAD
=======
        
>>>>>>> LEXCommunityLiJun
        Date lastDatetime = Date.newInstance(lastYear, 4, 1);
        Date thisDatetime = Date.newInstance(thisYear, 4, 1);
        Date thisDatetime2 = Date.newInstance(thisYear, 7, 1);
@@ -2588,6 +2751,20 @@
        System.debug('thisDatetime2 = ' + thisDatetime2);
        System.debug('nextDatetime = ' + nextDatetime);
        System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
<<<<<<< HEAD
        User UserProTypecTemp = [
            SELECT UserPro_Type__c
            FROM User
            WHERE id = :UserInfo.getUserId()
        ];
        String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
        if (thisMonth < 4) {
            sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 ';
        } else if (thisMonth >= 4 && thisMonth <= 6) {
            sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
        } else {
=======
        User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
        String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
@@ -2596,6 +2773,7 @@
        }else if(thisMonth >= 4 && thisMonth <= 6){
            sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
        }else{
>>>>>>> LEXCommunityLiJun
            sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
        }
        if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
@@ -2683,16 +2861,77 @@
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
<<<<<<< HEAD
        List<ContentVersion> cvList = [
            SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId
            FROM ContentVersion
            WHERE FirstPublishLocationId = :recordId
        ];
=======
        List<ContentVersion> cvList = new List<ContentVersion>();
        List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId];
        if (links != null && links.size() > 0) {
            List<String> documentIds = new List<String>();
            for (ContentDocumentLink link : links) {
                documentIds.add(link.ContentDocumentId);
            }
            List<ContentVersion> cvInfo = [
                SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
                FROM ContentVersion
                WHERE ContentDocumentId IN :documentIds
            ];
            if (cvInfo.size() > 0) {
                for (Integer i = 0; i < cvInfo.size(); i++) {
                    cvList.add(cvInfo[i]);
                }
            }
        }
        // List<ContentVersion> cvList = [
        //     SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId
        //     FROM ContentVersion
        //     WHERE FirstPublishLocationId = :recordId
        // ];
>>>>>>> LEXCommunityLiJun
        data.put('cvList', cvList);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    //删除附件
    @AuraEnabled
<<<<<<< HEAD
    public static ResponseBodyLWC deleteAtt(String contentVersionId) {
        try {
            ContentVersion conVersion = [
                SELECT ContentDocumentId
                FROM ContentVersion
                WHERE Id = :contentVersionId
            ];
            String contentDocumentId = conVersion.ContentDocumentId;
            ContentDocument conDocument = [
                SELECT Id
                FROM ContentDocument
                WHERE Id = :contentDocumentId
            ];
            delete conDocument;
            return new ResponseBodyLWC('Success', 200, '', '');
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
=======
    public static ResponseBodyLWC deleteAtt(String contentVersionId){
        try {
            ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
            String contentDocumentId = conVersion.ContentDocumentId;
            ContentDocument conDocument =  [SELECT Id FROM ContentDocument where Id = :contentDocumentId];
            delete conDocument;
            return new ResponseBodyLWC('Success',200,'','');
        } catch (Exception e) {
            return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
>>>>>>> LEXCommunityLiJun
        }
    }
    //跳转出货/销售
@@ -2752,7 +2991,15 @@
        try {
            List<Consumable_order__c> qs = new List<Consumable_order__c>();
            List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>();
<<<<<<< HEAD
            Dqs = [
                SELECT Id
                FROM Consumable_orderdetails__c
                WHERE Consumable_order__c = :ESetId
            ];
=======
            Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
>>>>>>> LEXCommunityLiJun
            qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId];
            if (Dqs.size() > 0 || qs.size() > 0) {
                delete Dqs;
@@ -2770,6 +3017,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -2857,8 +3105,14 @@
            hospitalSpecialOffer = false;
            hosPro = false;
        }
<<<<<<< HEAD
        //附件
=======
        //附件
        @TestVisible
>>>>>>> LEXCommunityLiJun
        public ConsumableorderdetailsInfo(Attachment e) {
            concc = e;
            hospitalSpecialOffer = false;
@@ -2909,7 +3163,7 @@
            }
        }
    }
    @TestVisible
    class ConsumableorderdetailsInfoLwc {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -2987,4 +3241,8 @@
        @AuraEnabled
        public Integer recordEnd { get; set; }
    }
}
<<<<<<< HEAD
}
=======
}
>>>>>>> LEXCommunityLiJun