force-app/main/default/classes/ConsumDefaultSelectController.cls
@@ -272,7 +272,10 @@
                    Consum_Apply_Equipment_Set_Detail__c caesd = (Consum_Apply_Equipment_Set_Detail__c)info.sobj;
                    if (caesd.Qu_Xiao_Fen_Pei_Shu_Liang_Jia__c != null
                            && caesd.Qu_Xiao_Fen_Pei_Shu_Liang_Jia__c > 0) {
                        String key = caesd.GroupKey_F__c;
                        // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                        // String key = caesd.GroupKey_F__c;
                        String key = caesd.GroupKey_F__c+caesd.Fixture_Model_No__c;
                        // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
                        System.debug(caesd.Consumable_Guaranteen_end_F__c);
                        System.debug(key);
                        if(caesd.Qu_Xiao_Fen_Pei_Shu_Liang_Jia__c>caesd.Jie_Chu_Fen_Pei_Jia__c){
@@ -317,6 +320,7 @@
            carsdList = [SELECT Id
                        , Select_Time__c
                        , GroupKey_F__c
                        , Fixture_Model_No__c // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add
                     FROM Consum_Apply_Equipment_Set_Detail__c
                    WHERE Consum_Apply__c = :parentId
                      AND Cancel_Select__c = False
@@ -324,11 +328,22 @@
                    ORDER BY Degree_Of_Importance__c DESC];
            Map<String, List<Consum_Apply_Equipment_Set_Detail__c>> caesdListMap = new Map<String, List<Consum_Apply_Equipment_Set_Detail__c>>();
            for (Consum_Apply_Equipment_Set_Detail__c caesd : carsdList) {
                if (caesdListMap.containsKey(caesd.GroupKey_F__c) == false) {
                    caesdListMap.put(caesd.GroupKey_F__c, new List<Consum_Apply_Equipment_Set_Detail__c>());
                // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                String key = caesd.GroupKey_F__c+caesd.Fixture_Model_No__c;
                // if (caesdListMap.containsKey(caesd.GroupKey_F__c) == false) {
                //     caesdListMap.put(caesd.GroupKey_F__c, new List<Consum_Apply_Equipment_Set_Detail__c>());
                // }
                // System.debug(caesd.GroupKey_F__c);
                // caesdListMap.get(caesd.GroupKey_F__c).add(caesd);
                List<Consum_Apply_Equipment_Set_Detail__c> tempCaesdL;
                if(caesdListMap.containsKey(key)){
                    tempCaesdL = caesdListMap.get(key);
                }else{
                    tempCaesdL = new List<Consum_Apply_Equipment_Set_Detail__c>();
                }
                System.debug(caesd.GroupKey_F__c);
                caesdListMap.get(caesd.GroupKey_F__c).add(caesd);
                tempCaesdL.add(caesd);
                caesdListMap.put(key,tempCaesdL);
                // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
            }
            System.debug(caesdListMap);
            List<Consum_Apply_Equipment_Set_Detail__c> caesdList = new List<Consum_Apply_Equipment_Set_Detail__c>();
@@ -572,7 +587,7 @@
                final String soqlStr = 'Select {0} {1} ';
                String soql1 = String.format(soqlStr, new String[] {myComponentController.strColumus , selectedDataSql1});
                selectedData = Consum_ApplyUtil.withoutQueryList(soql1);
                System.debug('zheli:'+selectedData.size());
                if (String.isNotBlank(wherStr1) && String.isBlank(wherStr)) {
                    wherStr = wherStr1;
                }
@@ -595,18 +610,23 @@
                Map<String, Consum_Apply_Equipment_Set_Detail__c> keyMap = new Map<String, Consum_Apply_Equipment_Set_Detail__c>();
                Boolean haveChange = false;
                Set<String> modelKeySet = new Set<String>();
                System.debug('zheli598:'+selectedData.size());
                for (SObject sobj : selectedData) {
                    Consum_Apply_Equipment_Set_Detail__c caesdobj = (Consum_Apply_Equipment_Set_Detail__c) sobj;
                    if (caesdobj.Asset__c == null) {
                        continue;
                    }
                    String key = caesdobj.GroupKey_F__c;
                    // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add start
                    // String key = caesdobj.GroupKey_F__c;
                    String key = caesdobj.GroupKey_F__c+caesdobj.Fixture_Model_No__c;
                    // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 add end
                    if (keyMap.containsKey(key)) {
                        Consum_Apply_Equipment_Set_Detail__c caesd = keyMap.get(key);
                        keyMap.get(key).Request_Num_Jia__c ++;
                        if (caesdobj.Select_Time__c != null) {
                            keyMap.get(key).Jie_Chu_Fen_Pei_Jia__c += 1;
                        }
                        System.debug('zheli598:'+selectedData.size());
                        continue;
                    }
                    keyMap.put(key, caesdobj);
@@ -631,6 +651,7 @@
                    //viewList[viewList.size() - 1].additionalInfoMap.put('Substitute_Select_Again__c', String.valueOf(caesdobj.Substitute_Select_Again__c));
                }
            }
            System.debug('zheli634:'+viewList.size());
            if (savetype == '1') {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存成功'));
            }
@@ -670,7 +691,7 @@
                if (parentObj.demo_purpose2__c != '动物实验' 
                    //2021-04-30  mzy 备品课题-1577 start
                    &&parentObj.demo_purpose2__c != 'ET展箱') {
                    //2021-04-30  mzy 备品课题-1577 end
                    //2021-04-30  mzy 备品课题-1577 end
                    // Date d1 = caesdobj.Consum_Start_Date_After_15_Day__c == null ? td : caesdobj.Consum_Start_Date_After_15_Day__c;
                    // wherStr += ' AND Consumable_Guaranteen_end__c >= ' + d1.year() + '-' + String.valueOf(d1.month()).leftPad(2,'0') + '-' + String.valueOf(d1.day()).leftPad(2,'0') + ' )';
                    wherStr2 += ' AND (Consumable_Guaranteen_end__c >= ' + td.year() + '-' + String.valueOf(td.month()).leftPad(2,'0') + '-' + String.valueOf(td.day()).leftPad(2,'0');
@@ -693,7 +714,7 @@
        // if (String.isNotBlank(parentObj.Internal_asset_location_F__c)) {
            wherStr += ' AND Internal_asset_location__c = \'上海 备品中心\'';
            wherStr2 += ' AND Internal_asset_location__c = \'上海 备品中心\'';
        // }
        // }
        if (String.isNotBlank(parentObj.Salesdepartment__c)) {
            wherStr += ' AND (Salesdepartment__c = \'' + parentObj.Salesdepartment__c + '\' OR Salesdepartment__c = \'0.备品中心\')';
            wherStr2 += ' AND (Salesdepartment__c = \'' + parentObj.Salesdepartment__c + '\' OR Salesdepartment__c = \'0.备品中心\')';