From ca1c0956ec5d16a44bd0a2c10e0e49db37c0fb32 Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期三, 08 三月 2023 09:35:52 +0800
Subject: [PATCH] 20230307询价2期Batch增加入Schedule

---
 force-app/main/default/objects/Rental_Apply__c/webLinks/submit_approval_process.webLink-meta.xml |   65 ++++++++++++++++++++++++++++++--
 1 files changed, 60 insertions(+), 5 deletions(-)

diff --git a/force-app/main/default/objects/Rental_Apply__c/webLinks/submit_approval_process.webLink-meta.xml b/force-app/main/default/objects/Rental_Apply__c/webLinks/submit_approval_process.webLink-meta.xml
index ecf6ce4..ebca9f3 100644
--- a/force-app/main/default/objects/Rental_Apply__c/webLinks/submit_approval_process.webLink-meta.xml
+++ b/force-app/main/default/objects/Rental_Apply__c/webLinks/submit_approval_process.webLink-meta.xml
@@ -59,6 +59,15 @@
 	   alert(&apos;璇曠敤锛堟棤璇环锛夌洰鐨勭殑澶囧搧鐢宠鍗曪紝涓嶈兘鍏宠仈璇环淇℃伅锛�&apos;);
        return;
 	}
+    // 宸茶喘寰呰揣鐨勭敵璇峰崟瀹℃壒鏃讹紝闇�瑕乧heck娉ㄦ畫鐨勭姸鎬�
+    if (&apos;{!Rental_Apply__c.Statu_Achievements__c}&apos;!=&apos;&apos;) {
+        var SaID=&apos;{!Rental_Apply__c.Statu_Achievements_ID__c}&apos;;
+        var rtn = sforce.apex.execute(&quot;RentalApplyWebService&quot;,&quot;RentalApplyCheckForSAoneEle&quot;,{SaID:SaID});
+        if(rtn!=&apos;Fin&apos;){
+            alert(rtn);
+            return;
+        }
+    }
     // 甯屾湜鍒拌揣鏃ヤ笉鑳芥棭浜庣敵璇锋彁浜ゆ棩-0418杩藉姞
     if (&apos;{!Rental_Apply__c.Request_shipping_day__c}&apos;  &lt; &apos;{!TODAY()}&apos; ) {
         alert(&apos;甯屾湜鍒拌揣鏃ヤ笉鑳芥棭浜庣敵璇锋彁浜ゆ棩&apos;);
@@ -216,8 +225,13 @@
 
     if(&apos;{!Rental_Apply__c.Campaign__c}&apos; != null &amp;&amp; &apos;{!Rental_Apply__c.Campaign__c}&apos; != &apos;&apos;){
         var DeliveryGood = new Array();
-        DeliveryGood = sforce.connection.query(&quot;select Status, Rental_Apply_Flag__c from Campaign where id =&apos;{!Rental_Apply__c.CampaignId__c}&apos;&quot;);
-        var records= DeliveryGood.getArray(&quot;records&quot;);
+		// 20220324 ljh obpm update start
+		var statusSting = &quot;{!$Label.StatusProcessState}&quot;; 
+		var statusList = statusSting.split(&apos;,&apos;);
+        // DeliveryGood = sforce.connection.query(&quot;select Status, Rental_Apply_Flag__c from Campaign where id =&apos;{!Rental_Apply__c.CampaignId__c}&apos;&quot;);
+		DeliveryGood = sforce.connection.query(&quot;select Status, Rental_Apply_Flag__c ,IF_Approved__c,Meeting_Approved_No__c,Approved_Status__c from Campaign where id =&apos;{!Rental_Apply__c.CampaignId__c}&apos;&quot;);
+		// 20220324 ljh obpm update start
+		var records= DeliveryGood.getArray(&quot;records&quot;);
 
         var interval = records[0].Status;
         var records_Date =  records[0].Rental_Apply_Flag__c;
@@ -249,6 +263,16 @@
              alert(&quot;蹇呴』鎻愬墠浜庡笇鏈涘埌璐ф棩7澶╀互涓婃彁浜ょ敵璇�&quot;);
              return;
         }
+		// 20220324 ljh obpm add start
+		if (records != null &amp;&amp; records[0].IF_Approved__c == &quot;true&quot; &amp;&amp; (records[0].Meeting_Approved_No__c == null || records[0].Meeting_Approved_No__c == &quot;&quot;) ) {
+			 alert(&quot;娌℃湁鍐宠鍙风殑锛屾殏涓嶈兘鍑哄��,璇锋洿鏂拌鍐充俊鎭��&quot;);
+			 return;
+		} 
+		if (records != null &amp;&amp; records[0].IF_Approved__c == &quot;true&quot; &amp;&amp; records[0].Meeting_Approved_No__c != &quot;&quot; &amp;&amp; statusList.indexOf(records[0].Approved_Status__c) != -1 &amp;&amp; records[0].Approved_Status__c != &apos;鑽夌&apos; ) {
+			 alert(&quot;宸茬敵璇峰喅瑁佷絾鍐宠鐘舵�佷笉绗﹀悎鏉′欢銆�&quot;);
+			 return;
+		}
+		// 20220324 ljh obpm add end
     }
     if(&apos;{!Rental_Apply__c.QIS_number__c}&apos; != null &amp;&amp; &apos;{!Rental_Apply__c.QIS_number__c}&apos; != &apos;&apos;){
         var DeliveryGood = new Array();
@@ -301,15 +325,46 @@
         alert(&apos;鏈夋病鏈夋槑缁嗙殑鍊熷嚭澶囧搧閰嶅涓�瑙堬紝涓嶈兘鎻愪氦&apos;);
         return;
     }
-    //2022-2-23 yjk 鏌ヨRental_Apply__c 瀵硅薄浠ヨ幏寰桽alesManager__c 鐨勫�� start
+	// 20220704 ljh update  SFDC-CFWBBU start
+    /*
+	//2022-2-23 yjk 鏌ヨRental_Apply__c 瀵硅薄浠ヨ幏寰桽alesManager__c 鐨勫�� start
     var racs = sforce.connection.query(&quot;select id,Status__c, SalesManager__c from Rental_Apply__c where id = &apos;{!Rental_Apply__c.Id}&apos;&quot;);
     var rac = racs.getArray(&quot;records&quot;)[0];
     //2022-2-23 yjk 鏌ヨRental_Apply__c 瀵硅薄浠ヨ幏寰桽alesManager__c 鐨勫�� end
     rac.Status__c = &quot;濉啓瀹屾瘯&quot;;
     //2022-2-23 yjk 鎻愪氦鏃跺皢缁忕悊鐨凬ame瀛楁璧嬬粰澶囧搧鎻愪氦鏃剁粡鐞嗭紙鏂囨湰锛夊瓧娈� start
-    var manageUsers = sforce.connection.query(&quot;select id,name from User where id = &apos;&quot;+rac.SalesManager__c +&quot;&apos;&quot;);
-    rac.SalesManagerSubmit__c = manageUsers.getArray(&quot;records&quot;)[0].Name; 
+	if(rac.SalesManager__c != null){
+		var manageUsers = sforce.connection.query(&quot;select id,name from User where id = &apos;&quot;+rac.SalesManager__c +&quot;&apos;&quot;);
+		rac.SalesManagerSubmit__c = manageUsers.getArray(&quot;records&quot;)[0].Name;
+	} 
     //2022-2-23 yjk 鎻愪氦鏃跺皢缁忕悊鐨凬ame瀛楁璧嬬粰澶囧搧鎻愪氦鏃剁粡鐞嗭紙鏂囨湰锛夊瓧娈� end
+	*/
+	// 20220930 ljh SWAG-CJR8S7 start
+	var racs = sforce.connection.query(&quot;select id,OPDPlan__c,OPDPlan__r.SalesManager_Txt__c,OPDPlan__r.BuchangApprovalManagerSales_Txt__c from Rental_Apply__c where id = &apos;{!Rental_Apply__c.Id}&apos;&quot;);
+    var racNew = racs.getArray(&quot;records&quot;)[0];
+	// 20220930 ljh SWAG-CJR8S7 end
+	var rac = new sforce.SObject(&quot;Rental_Apply__c&quot;);
+	rac.Id = &quot;{!Rental_Apply__c.Id}&quot;;
+	rac.Status__c = &quot;濉啓瀹屾瘯&quot;;
+	var userId = &quot;{!$User.Id}&quot;;
+	var manageUsers = sforce.connection.query(&quot;select id ,JingliEquipmentManager__c,JingliEquipmentManager__r.Name,Buzhang_Equipment_Manager__c,Buzhang_Equipment_Manager__r.Name from User where id = &apos;&quot;+userId+&quot;&apos;&quot;);
+	if(manageUsers.getArray(&quot;records&quot;)[0].JingliEquipmentManager__c != null){
+		rac.SalesManagerSubmit__c = manageUsers.getArray(&quot;records&quot;)[0].JingliEquipmentManager__r.Name;
+	    // 20220930 ljh SWAG-CJR8S7 start
+	    if(racNew.OPDPlan__c != null){
+			rac.OPDManagerApprover__c =  rac.SalesManagerSubmit__c == racNew.OPDPlan__r.SalesManager_Txt__c?rac.SalesManagerSubmit__c:&apos; &apos;;
+	    } 
+		// 20220930 ljh SWAG-CJR8S7 end
+	}
+	if(manageUsers.getArray(&quot;records&quot;)[0].Buzhang_Equipment_Manager__c != null){
+		rac.BuchangApprovalManagerSalesSubmit__c = manageUsers.getArray(&quot;records&quot;)[0].Buzhang_Equipment_Manager__r.Name;  //2022-07-22   zyh
+		// 20220930 ljh SWAG-CJR8S7 start
+	    if(racNew.OPDPlan__c != null){
+			rac.OPDBuchangApprover__c = rac.BuchangApprovalManagerSalesSubmit__c == racNew.OPDPlan__r.BuchangApprovalManagerSales_Txt__c?rac.BuchangApprovalManagerSalesSubmit__c:&apos; &apos;; // 20220930 ljh SWAG-CJR8S7
+		}
+		// 20220930 ljh SWAG-CJR8S7 end
+	}
+	// 20220704 ljh update  SFDC-CFWBBU end
     var result = sforce.connection.update([rac]);
     var messages = getConnectDMLErrorMessages(result);
     if (messages.length &gt; 0) {

--
Gitblit v1.9.1