From 9b197b7fac92278fb591ea8f4942c7d5687cb5ce Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期一, 28 三月 2022 18:01:22 +0800
Subject: [PATCH] LJPH-C8FB4P【委托】配合PBI设备覆盖率的数据准备0328

---
 force-app/main/default/pages/SelectAssetEstimateURF.page           |    5 ++++-
 force-app/main/default/classes/SelectAssetEstimateVMController.cls |   14 +++++---------
 force-app/main/default/pages/SelectAssetEstimateVM.page            |   25 ++++++++-----------------
 3 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/force-app/main/default/classes/SelectAssetEstimateVMController.cls b/force-app/main/default/classes/SelectAssetEstimateVMController.cls
index 3b9e7db..5b7e6ea 100644
--- a/force-app/main/default/classes/SelectAssetEstimateVMController.cls
+++ b/force-app/main/default/classes/SelectAssetEstimateVMController.cls
@@ -237,12 +237,11 @@
             }
         }
         //2021-11-30 fy add LJPH-C8W8FV 缃《 start OwnershipMachine_No__c Product2.ProductURF__c
-        //tcm 娣诲姞 Management_Code__c  20211201 start
-        //20220325 ljh LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 add CurrentContract_F__r.Is_Renewal__c  
+        //tcm 娣诲姞 Management_Code__c  20211201 start  
         String soql = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, '
                       + 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, InstallDate,isNewDate_use__c, '
                       + 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, '
-                      + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c,CurrentContract_F__r.Is_Renewal__c,CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,'
+                      + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c,CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,'
                       + 'CurrentContract_F_asset__c,CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,CurrentContract_F_asset__r.endDateGurantee_Text__c,CurrentContract_F__r.Gurantee_Estimate_startDate__c, '
                       + 'CurrentContract_F__r.First_Estimate_Date__c,CurrentContract_F__r.Estimate_Contract_endDate__c,'
                       + 'Product2.ProductURF__c,CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c,CurrentContract_F__r.Contract_Range__c,'
@@ -733,10 +732,9 @@
         if (!String.isBlank(this.targetHospitalId) && (this.targetHospitalId.length() == 15 || this.targetHospitalId.length() == 18)) {
             //2021-11-30 fy add LJPH-C8W8FV 缃《 start OwnershipMachine_No__c Product2.ProductURF__c
             //tcm 娣诲姞 Management_Code__c  20211201 start
-            //20220325 ljh LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 add CurrentContract_F__r.Is_Renewal__c
             assetRecords = [SELECT Id, Name,OwnershipMachine_No__c,Product2.ProductURF__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c, Management_Code__c, IF_Warranty__c, Reson_Can_not_Warranty__c,
                             InstallDate, isNewDate_use__c, Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, CurrentContract_End_Date__c, EquipmentGuaranteeFlg__c,
-                            CurrentContract_F__c, CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c, CurrentContract_F__r.RecordType_DeveloperName__c, CurrentContract_F__r.Is_Renewal__c, CurrentContract_F__r.Estimate_Num__c, CurrentContract_F__r.Contract_End_Date__c, CurrentContract_F__r.Estimate_Contract_endDate__c,
+                            CurrentContract_F__c, CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c, CurrentContract_F__r.RecordType_DeveloperName__c, CurrentContract_F__r.Estimate_Num__c, CurrentContract_F__r.Contract_End_Date__c, CurrentContract_F__r.Estimate_Contract_endDate__c,
                             CurrentContract_F_asset__c, CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c, CurrentContract_F_asset__r.endDateGurantee_Text__c, CurrentContract_F__r.Gurantee_Estimate_startDate__c,
                             CurrentContract_F__r.First_Estimate_Date__c,
                             CurrentContract_F__r.Contract_Consumption_rate__c, CurrentContract_F__r.First_contract_usage_Rate__c,
@@ -1086,12 +1084,11 @@
             notInId += '\')';
             //2021-11-30 fy add LJPH-C8W8FV 缃《 start OwnershipMachine_No__c Product2.ProductURF__c
             //tcm 娣诲姞 Management_Code__c  20211201 start
-            //20220325 ljh LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 add CurrentContract_F__r.Is_Renewal__c
             String sqlStr = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, '
                             + 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, InstallDate,isNewDate_use__c, '
                             + 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c, '
                             + 'CurrentContract_End_Date__c, Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c, '
-                            + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c,CurrentContract_F__r.Is_Renewal__c, CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,'
+                            + 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c, CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,'
                             + 'CurrentContract_F_asset__c,CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,CurrentContract_F_asset__r.endDateGurantee_Text__c,CurrentContract_F__r.Gurantee_Estimate_startDate__c, '
                             + 'CurrentContract_F__r.First_Estimate_Date__c,CurrentContract_F__r.Estimate_Contract_endDate__c,'
                             + 'CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c,'
@@ -1131,12 +1128,11 @@
             String sqlStr = '';
             //2021-11-30 fy add LJPH-C8W8FV 缃《 start OwnershipMachine_No__c Product2.ProductURF__c
             //tcm 娣诲姞 Management_Code__c  20211201 start
-            //20220325 ljh LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 add CurrentContract_F__r.Is_Renewal__c
             sqlStr  = 'SELECT Id, Name,OwnershipMachine_No__c, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c,';
             sqlStr += 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c,InstallDate,isNewDate_use__c,';
             sqlStr += 'Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c,';
             sqlStr += 'CurrentContract_End_Date__c,Extend_Gurantee_DateTo__c,EquipmentGuaranteeFlg__c,';
-            sqlStr += 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c,CurrentContract_F__r.Is_Renewal__c,CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,';
+            sqlStr += 'CurrentContract_F__c,CurrentContract_F__r.Maintenance_Contract_No_F__c,CurrentContract_F__r.Management_Code__c,CurrentContract_F__r.RecordType_DeveloperName__c,CurrentContract_F__r.Estimate_Num__c,CurrentContract_F__r.Contract_End_Date__c,';
             sqlStr += 'CurrentContract_F_asset__c,CurrentContract_F_asset__r.Estimate_Cost_Month_formula__c,CurrentContract_F_asset__r.endDateGurantee_Text__c,CurrentContract_F__r.Gurantee_Estimate_startDate__c,';
             sqlStr += 'CurrentContract_F__r.First_Estimate_Date__c,CurrentContract_F__r.Estimate_Contract_endDate__c,';
             sqlStr += 'Product2.ProductURF__c,CurrentContract_F__r.Contract_Consumption_rate__c,CurrentContract_F__r.First_contract_usage_Rate__c,';
diff --git a/force-app/main/default/pages/SelectAssetEstimateURF.page b/force-app/main/default/pages/SelectAssetEstimateURF.page
index 403df35..100444f 100644
--- a/force-app/main/default/pages/SelectAssetEstimateURF.page
+++ b/force-app/main/default/pages/SelectAssetEstimateURF.page
@@ -652,7 +652,10 @@
         result = '棣栫鍚堝悓';
     }else if(firstCCount > 0 && firstCCount == allcount){
         result = '棣栫鍚堝悓';
-    }else if(oyearCount > 0 && oyearCount == conCCount){
+    // 20220328 ljh update  LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start
+    // }else if(oyearCount > 0 && oyearCount == conCCount){
+    }else if(oyearCount > 0 && oyearCount == conCCount && allcount == oyearCount ){
+    // 20220328 ljh update  LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start
         result = '闈炵画绛惧悎鍚岋紙绌虹櫧鏈熶竴骞翠互涓婏級';
     }else{
         result = '缁鍚堝悓';
diff --git a/force-app/main/default/pages/SelectAssetEstimateVM.page b/force-app/main/default/pages/SelectAssetEstimateVM.page
index 6ddfe74..c8ed24e 100644
--- a/force-app/main/default/pages/SelectAssetEstimateVM.page
+++ b/force-app/main/default/pages/SelectAssetEstimateVM.page
@@ -411,8 +411,6 @@
                     strMoney = month * strMoney + month2 * strMoney;
                 }
                 var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
-                var IsRenewal = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsRenewal')).value();
-                // 20220325 ljh add  IsRenewal LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start
                 var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
                 if(b != ''){
                     conCCount ++;
@@ -431,10 +429,7 @@
                     }
                     //鏈�鍚庣粨鏉熸棩+1骞�
                     lastendDate.setMonth(lastendDate.getMonth() + 12);
-                    // 20220325 ljh update  IsRenewal 銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start
-                    // if (Date.parse(contractStartDate) > Date.parse(lastendDate) ) {
-                    if (Date.parse(contractStartDate) > Date.parse(lastendDate) && IsRenewal = true) {
-                    // 20220325 ljh update  IsRenewal 銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 end
+                    if (Date.parse(contractStartDate) > Date.parse(lastendDate) ) {
                         oyearCount ++;
                     }
                     // 鍙栬仈鍔ㄤ环鏍�
@@ -520,9 +515,7 @@
             } else {
                 strMoney = month * strMoney + month2 * strMoney;
             }
-            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value();
-            var IsRenewal = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':IsRenewal')).value();
-            // 20220325 ljh add  IsRenewal LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 
+            var b = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':Contract_No')).value(); 
             var LastMContractRecord = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':LastMContractRecord')).value();
             if(b != ''){
                 conCCount ++;
@@ -540,10 +533,7 @@
                 }
                 //鏈�鍚庣粨鏉熸棩+1骞�
                 lastendDate.setMonth(lastendDate.getMonth() + 12);
-                // 20220325 ljh update  IsRenewal LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start
-                // if (Date.parse(contractStartDate) > Date.parse(lastendDate)) 
-                if (Date.parse(contractStartDate) > Date.parse(lastendDate) && IsRenewal = true) {
-                // 20220325 ljh update  IsRenewal LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 end
+                if (Date.parse(contractStartDate) > Date.parse(lastendDate)) {
                     oyearCount ++;
                 }
                 // 鍙栬仈鍔ㄤ环鏍�
@@ -632,11 +622,15 @@
         result = '棣栫鍚堝悓';
     }else if(firstCCount > 0 && firstCCount == allcount){
         result = '棣栫鍚堝悓';
-    }else if(oyearCount > 0 && oyearCount == conCCount){
+    // 20220328 ljh update  LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start
+    // }else if(oyearCount > 0 && oyearCount == conCCount){
+    }else if(oyearCount > 0 && oyearCount == conCCount && allcount == oyearCount ){
+    // 20220328 ljh update  LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start
         result = '闈炵画绛惧悎鍚岋紙绌虹櫧鏈熶竴骞翠互涓婏級';
     }else{
         result = '缁鍚堝悓';
     }
+    console.log(result);
     document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXT").innerHTML = result;
     document.getElementById("allPage:allForm:allBlock:contractInfo:Contract_TypeTXTHidden").value = result;
     // 鍙栨秷閰稿寲姘�
@@ -1546,9 +1540,6 @@
                                
                                 <td class="dataCell" width="70px">
                                     <apex:outputField value="{!ar.rec.CurrentContract_F__r.Maintenance_Contract_No_F__c}" rendered="{!Not(ar.IsManual)}" id="Contract_No"/>
-                                    <!-- 20220325 ljh add  LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 start -->
-                                    <apex:inputHidden value="{!ar.rec.CurrentContract_F__r.Is_Renewal__c}" id="IsRenewal"/>
-                                    <!-- 20220325 ljh add start LJPH-C8FB4P銆愬鎵樸�戦厤鍚圥BI璁惧瑕嗙洊鐜囩殑鏁版嵁鍑嗗 end -->
                                     <apex:inputHidden value="{!ar.rec.CurrentContract_F__r.RecordType_DeveloperName__c}" id="LastMContractRecord"/>
                                     <apex:inputField value="{!ar.rec.CurrentContract_F_asset__r.endDateGurantee_Text__c}" id="endDateGurantee_Text" style="display: none" showDatePicker="false"/>
                                     <apex:inputHidden value="{!ar.rec.CurrentContract_F__c}" id="LastMContractID"/>

--
Gitblit v1.9.1