From 56cab641be7c6c0aaab0ae2ca7eeaee9be6d5a69 Mon Sep 17 00:00:00 2001 From: LiJinHuan <lijinhuan@prec-tech.com> Date: 星期五, 11 三月 2022 18:52:54 +0800 Subject: [PATCH] 【委托】【phase5上线课题132】-紧急-耗材ET展箱借用目的没有锁定已过期库存 --- force-app/main/default/classes/ConsumDefaultSelectController.cls | 39 ++++++++++++++++++++++++++++++--------- 1 files changed, 30 insertions(+), 9 deletions(-) diff --git a/force-app/main/default/classes/ConsumDefaultSelectController.cls b/force-app/main/default/classes/ConsumDefaultSelectController.cls index 88495aa..dd9f053 100644 --- a/force-app/main/default/classes/ConsumDefaultSelectController.cls +++ b/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.澶囧搧涓績\')'; -- Gitblit v1.9.1