From d79fcb2a960e8b0e18fe039d892f98187b08866d Mon Sep 17 00:00:00 2001
From: 李彤 <litong@prec-tech.com>
Date: 星期五, 23 九月 2022 18:24:58 +0800
Subject: [PATCH] 招标项目失单报告
---
force-app/main/default/classes/OpportunityTrigger.cls | 407 +++++++++++++++
force-app/main/default/aura/TenderLostApp/TenderLostApp.app | 3
force-app/main/default/classes/TenderResultConfirmTaskBatch.cls | 165 ++++++
force-app/main/default/classes/TenderResultConfirmTaskBatchTest.cls | 170 ++++++
force-app/main/default/classes/CommonUtilsTest.cls | 7
force-app/main/default/classes/OpportunityTriggerTest.cls | 160 +++++-
force-app/main/default/aura/TenderLostApp/TenderLostAppRenderer.js | 5
force-app/main/default/aura/TenderLostApp/TenderLostAppController.js | 5
force-app/main/default/classes/CommonUtils.cls | 46
force-app/main/default/aura/TenderLostApp/TenderLostApp.app-meta.xml | 5
force-app/main/default/aura/TenderLostApp/TenderLostApp.auradoc | 6
force-app/main/default/aura/TenderLostApp/TenderLostAppHelper.js | 5
force-app/main/default/lwc/tenderLost/tenderLost.js | 169 ++++++
force-app/main/default/classes/TenderLostController.cls | 150 +++++
force-app/main/default/aura/TenderLostApp/TenderLostApp.svg | 7
force-app/main/default/lwc/tenderLost/__tests__/tenderLost.test.js | 25
force-app/main/default/aura/TenderLostApp/TenderLostApp.css | 2
force-app/main/default/lwc/tenderLost/tenderLost.js-meta.xml | 5
force-app/main/default/lwc/tenderLost/tenderLost.html | 75 ++
force-app/main/default/pages/TenderLostPage.page | 26 +
force-app/main/default/classes/TenderLostControllerTest.cls | 65 ++
21 files changed, 1,453 insertions(+), 55 deletions(-)
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostApp.app b/force-app/main/default/aura/TenderLostApp/TenderLostApp.app
new file mode 100644
index 0000000..1080c02
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostApp.app
@@ -0,0 +1,3 @@
+<aura:application access="public" extends="ltng:outApp">
+ <aura:dependency resource="c:TenderLostApp"/>
+</aura:application>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostApp.app-meta.xml b/force-app/main/default/aura/TenderLostApp/TenderLostApp.app-meta.xml
new file mode 100644
index 0000000..b497bd6
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostApp.app-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>55.0</apiVersion>
+ <description>A Lightning Application Bundle</description>
+</AuraDefinitionBundle>
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostApp.auradoc b/force-app/main/default/aura/TenderLostApp/TenderLostApp.auradoc
new file mode 100644
index 0000000..d0d6eb5
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostApp.auradoc
@@ -0,0 +1,6 @@
+<aura:documentation>
+ <aura:description>Documentation</aura:description>
+ <aura:example name="ExampleName" ref="exampleComponentName" label="Label">
+ Example Description
+ </aura:example>
+</aura:documentation>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostApp.css b/force-app/main/default/aura/TenderLostApp/TenderLostApp.css
new file mode 100644
index 0000000..a5839d4
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostApp.css
@@ -0,0 +1,2 @@
+.THIS {
+}
\ No newline at end of file
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostApp.svg b/force-app/main/default/aura/TenderLostApp/TenderLostApp.svg
new file mode 100644
index 0000000..791b3c7
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostApp.svg
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg width="120px" height="120px" viewBox="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+ <path d="M120,108 C120,114.6 114.6,120 108,120 L12,120 C5.4,120 0,114.6 0,108 L0,12 C0,5.4 5.4,0 12,0 L108,0 C114.6,0 120,5.4 120,12 L120,108 L120,108 Z" id="Shape" fill="#2A739E"/>
+ <path d="M77.7383308,20 L61.1640113,20 L44.7300055,63.2000173 L56.0543288,63.2000173 L40,99.623291 L72.7458388,54.5871812 L60.907727,54.5871812 L77.7383308,20 Z" id="Path-1" fill="#FFFFFF"/>
+ </g>
+</svg>
\ No newline at end of file
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostAppController.js b/force-app/main/default/aura/TenderLostApp/TenderLostAppController.js
new file mode 100644
index 0000000..77e406b
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostAppController.js
@@ -0,0 +1,5 @@
+({
+ myAction : function(component, event, helper) {
+
+ }
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostAppHelper.js b/force-app/main/default/aura/TenderLostApp/TenderLostAppHelper.js
new file mode 100644
index 0000000..ba7f386
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostAppHelper.js
@@ -0,0 +1,5 @@
+({
+ helperMethod : function() {
+
+ }
+})
\ No newline at end of file
diff --git a/force-app/main/default/aura/TenderLostApp/TenderLostAppRenderer.js b/force-app/main/default/aura/TenderLostApp/TenderLostAppRenderer.js
new file mode 100644
index 0000000..f1f0c75
--- /dev/null
+++ b/force-app/main/default/aura/TenderLostApp/TenderLostAppRenderer.js
@@ -0,0 +1,5 @@
+({
+
+// Your renderer method overrides go here
+
+})
\ No newline at end of file
diff --git a/force-app/main/default/classes/CommonUtils.cls b/force-app/main/default/classes/CommonUtils.cls
index 8e650a6..cdb584a 100644
--- a/force-app/main/default/classes/CommonUtils.cls
+++ b/force-app/main/default/classes/CommonUtils.cls
@@ -28,27 +28,31 @@
//鏌ヨ 鏅�氱瀹�
- // public static string GetPTKS(String content,String ParentId)
- // {
- // String paramYy = 'HP';
- // String sql = 'select ';
- // String props = GetSqlToPorps(account.SObjectType);
- // sql += props;
- // sql += ' from account';
- // sql += ' where Parent.Parent.RecordType_DeveloperName__c = :paramYy';
- // if(content != null && content != '')
- // {
- // content = '%'+content+'%';
- // sql += ' and Name like :content ';
- // }
- // if(ParentId != null && ParentId != '')
- // {
- // sql += ' and Parentid = :ParentId ';
- // }
- // sql += ' limit 5 ';
- // List<account> arrays = Database.query(sql);
- // return JSON.serialize(arrays);
- // }
+ public static string GetPTKS(String content, List<String> ParentIds, Boolean checkOwner)
+ {
+ String paramYy = 'HP';
+ String sql = 'select ';
+ String props = GetSqlToPorps(account.SObjectType);
+ sql += props;
+ sql += ' from account';
+ sql += ' where Parent.Parent.RecordType_DeveloperName__c = :paramYy';
+ if(content != null && content != '')
+ {
+ content = '%'+content+'%';
+ sql += ' and Name like :content ';
+ }
+ if(ParentIds != null && ParentIds.size() > 0)
+ {
+ sql += ' and Parent.Parentid in :ParentIds ';
+ }
+ if (checkOwner) {
+ String userId = UserInfo.getUserId();
+ sql += ' and OwnerId = :userId';
+ }
+ sql += ' limit 5 ';
+ List<account> arrays = Database.query(sql);
+ return JSON.serialize(arrays);
+ }
//鏌ヨ 鏅�氱瀹�
diff --git a/force-app/main/default/classes/CommonUtilsTest.cls b/force-app/main/default/classes/CommonUtilsTest.cls
index 58c12b0..1b03e82 100644
--- a/force-app/main/default/classes/CommonUtilsTest.cls
+++ b/force-app/main/default/classes/CommonUtilsTest.cls
@@ -56,7 +56,9 @@
//鏌ヨ 鍖婚櫌涓嬬殑绉戝 鍖呮嫭鎴樼暐鍜屾櫘閫氱瀹�
CommonUtils.GetYYChilders('test',hospital.Id);
//鏌ヨ 鏅�氱瀹�
- // CommonUtils.GetPTKS('test',hospital.Id);
+ List<String> hospitals = new List<String>();
+ hospitals.add(hospital.Id);
+ CommonUtils.GetPTKS('test',hospitals,false);
//鏌ヨ 鏅�氱瀹�
// CommonUtils.GetPTKSByYYParent('test',hospital.Id);
//鏌ヨ 鎴樼暐绉戝
@@ -76,7 +78,8 @@
//鑾峰彇閫夐」鍒楄〃鍊�
CommonUtils.GetSelectedValues( Tender_information__c.irrelevantReasons__c.getDescribe());
- CommonUtils.getPicklistValues( 'PCLLostBrand__c','ProductClass__c','ProductCategory__c');
+ // CommonUtils.getPicklistValues( 'PCLLostBrand__c','ProductClass__c','ProductCategory__c');
+ CommonUtils.getPicklistValues( 'Tender_information__c','InfoType__c','subInfoType__c');
}
diff --git a/force-app/main/default/classes/OpportunityTrigger.cls b/force-app/main/default/classes/OpportunityTrigger.cls
index 15de464..3cfea75 100644
--- a/force-app/main/default/classes/OpportunityTrigger.cls
+++ b/force-app/main/default/classes/OpportunityTrigger.cls
@@ -1,5 +1,7 @@
public without sharing class OpportunityTrigger {
+ public static Boolean isFirst = true;
+
public static void lockOpportunityFile(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap) {
List<String> targetIds = new List<String>();
@@ -20,6 +22,7 @@
update ofileList;
}
+
//CHAN-AZJ6JS 杩芥函绯荤粺鏉ョ殑璇环锛屽彇娑圵IN鏃讹紝缁忛攢鍟嗚鍗曡嚜鍔ㄦ敼鍒扳�滈┏鍥炩��
public static void changeConsumableOrderStatus(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap) {
@@ -163,10 +166,14 @@
// temptender.IsReactionOpp__c = true;
// tenderMap.put(temptender.id ,temptender );
// }
- // 鍚堝苟鍒ゆ柇鏉′欢
+ // 鍚堝苟鍒ゆ柇鏉′欢
+ //20220803 you 鎷涙爣椤圭洰澧炲姞 鍙栨秷锛屼腑鏍囩粨鏋滄洿鏂扮‘璁ゆ潯浠�
if((op.SAP_Send_OK__c != oldopp.SAP_Send_OK__c) ||
((op.StageName__c.equals('澶卞崟') && !oldopp.StageName__c.equals('澶卞崟')) ||
- (!op.StageName__c.equals('澶卞崟') && oldopp.StageName__c.equals('澶卞崟')))) {
+ (!op.StageName__c.equals('澶卞崟') && oldopp.StageName__c.equals('澶卞崟'))) ||
+ ((op.StageName__c.equals('鍙栨秷') && !oldopp.StageName__c.equals('鍙栨秷')) ||
+ (!op.StageName__c.equals('鍙栨秷') && oldopp.StageName__c.equals('鍙栨秷'))) ||
+ (String.isNotBlank(op.ConfirmationofAward__c) && op.ConfirmationofAward__c!=oldopp.ConfirmationofAward__c)) {
for (Tender_Opportunity_Link__c link : links) {
if (link.Opportunity__c == op.Id) {
Tender_information__c temptender = new Tender_information__c();
@@ -293,5 +300,401 @@
}
}
//LastBuy 棰勭暀浜у搧 lt 20220315 end
+//SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy start
+// public static void UpdateBidNumber(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap){
+// List<Id> OpportunityIdList = new List<Id>();
+// Boolean flag = true;
+// for (Opportunity opp : newList) {
+// OpportunityIdList.add(opp.Id);
+// Opportunity oldopp = oldMap == null? null : oldMap.get(opp.Id);
+// if(oldopp==null){
+// if(opp.NumberOfBids__c!=null||opp.BidWinningNumber__c!=null){
+// flag = true;
+// }
+// }else{
+// if(opp.NumberOfBids__c!=oldopp.NumberOfBids__c||opp.NumberOfBids__c!=oldopp.NumberOfBids__c){
+// flag = true;
+// }
+// }
+// }
+// system.debug('newList+++'+newList);
+// system.debug('oldList+++'+oldList);
+// if(flag){
+// List<Tender_Opportunity_Link__c> TenderOpportunityLinkList = [select Tender_information__c from Tender_Opportunity_Link__c where Opportunity__c in:OpportunityIdList];
+// Set<Id> enderOpportunityId = new Set<Id>();
+// if(TenderOpportunityLinkList.size()>0){
+// for (Tender_Opportunity_Link__c TenderOpportunity : TenderOpportunityLinkList) {
+// enderOpportunityId.add(TenderOpportunity.Tender_information__c);
+// }
+// }
+// system.debug('TenderOpportunityLinkList+++'+TenderOpportunityLinkList);
+// List<Tender_Opportunity_Link__c> TenderOpportunityLinkList2 = [select Tender_information__c,Opportunity__r.NumberOfBids__c,Opportunity__r.BidWinningNumber__c from Tender_Opportunity_Link__c where Tender_information__c in:enderOpportunityId];
+// Map<String,Tender_information__c> TenderinformationMap = new Map<String,Tender_information__c>();
+// system.debug('TenderOpportunityLinkList2+++'+TenderOpportunityLinkList2);
+// if(TenderOpportunityLinkList2.size()>0){
+// for(Tender_Opportunity_Link__c TenderOpportunity2 :TenderOpportunityLinkList2){
+// if(TenderinformationMap.containsKey(TenderOpportunity2.Tender_information__c)){
+// Tender_information__c Tender_informationvalue = new Tender_information__c();
+// Tender_informationvalue = TenderinformationMap.get(TenderOpportunity2.Tender_information__c);
+// Tender_informationvalue.NumberOfBids__c=Tender_informationvalue.NumberOfBids__c+TenderOpportunity2.Opportunity__r.NumberOfBids__c;
+// Tender_informationvalue.BidWinningNumber__c=Tender_informationvalue.BidWinningNumber__c+TenderOpportunity2.Opportunity__r.BidWinningNumber__c;
+// TenderinformationMap.put(TenderOpportunity2.Tender_information__c, Tender_informationvalue);
+// }else{
+// Tender_information__c Tender_informationvalue = new Tender_information__c();
+// Tender_informationvalue.Id=TenderOpportunity2.Tender_information__c;
+// Tender_informationvalue.NumberOfBids__c=TenderOpportunity2.Opportunity__r.NumberOfBids__c;
+// Tender_informationvalue.BidWinningNumber__c=TenderOpportunity2.Opportunity__r.BidWinningNumber__c;
+// TenderinformationMap.put(TenderOpportunity2.Tender_information__c, Tender_informationvalue);
+// }
+// }
+// }
+// List<Tender_information__c> Tender_informationList = new List<Tender_information__c>();
+// for (Tender_information__c value : TenderinformationMap.values()) {
+// Tender_informationList.add(value);
+// }
+// system.debug('Tender_informationList+++'+Tender_informationList);
+// update Tender_informationList;
+// }
+// }
+//SWAG-CHL67J 銆愬鎵樸�戙�怓Y23璇环鏀瑰杽銆�-璇环椤甸潰/鎷涙爣椤圭洰澧炲姞缁熻瀛楁 fy end
+ //add 璇环璺熻繘浠诲姟寮�鍙� - 3.鍒涘缓澶卞崟浠诲姟 sx 20220617 start
+ //璇环涓爣缁撴灉纭绔炰簤瀵规墜涓爣鏃跺疄鏃跺垱寤哄け鍗曚换鍔�
+ public static void createTaskByOppConfirmationofAward(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap){
+ if (!isFirst) {
+ return;
+ }
+
+ Set<Id> oppoIds = new Set<Id>();
+ for(Opportunity op : newList){
+ Opportunity oldopp = oldMap.get(op.Id);
+ //璇环涓爣缁撴灉纭绔炰簤瀵规墜涓爣鏃跺疄鏃跺垱寤哄け鍗曚换鍔� 涓� 璇环鐘舵��1绛変簬璇环
+ if (oldopp.ConfirmationofAward__c != '绔炰簤瀵规墜涓爣' && op.ConfirmationofAward__c == '绔炰簤瀵规墜涓爣' && op.StageName__c == '璇环' && op.LeakageNumber__c !=1){
+ oppoIds.add(op.Id);
+ }
+ }
+
+ if (!oppoIds.isEmpty()) {
+ // 鏈夋晥澶卞崟鐘舵�佷竴瑙�
+ List<String> validStatus = new List<String>{'鐢宠涓�', '鎻愪氦', '鎵瑰噯'};
+ // 璇环澶卞崟/鍙栨秷鎶ュ憡鏌ヨ
+ List<Lost_cancel_report__c> lostCancelReportList = [SELECT Id, Opportunity__c from Lost_cancel_report__c WHERE Opportunity__c in :oppoIds and Report_Status__c in: validStatus];
+
+ //<璇环Id, 澶卞崟鎶ュ憡>
+ Map<String, Lost_cancel_report__c> lostCancelReportMap = new Map<String, Lost_cancel_report__c>();
+ for(Lost_cancel_report__c lcr : lostCancelReportList){
+ if (!lostCancelReportMap.isEmpty() && lostCancelReportMap.containsKey(lcr.Opportunity__c)) {
+ // no action
+ } else {
+ lostCancelReportMap.put(lcr.Opportunity__c, lcr);
+ }
+ }
+
+ List<Task__c> insTaskList = new List<Task__c>();
+
+ // 瀹氫箟闇�瑕佹洿鏂扮殑璇环浠诲姟
+ List<Opportunity> updateOpportunity = new List<Opportunity>();
+
+ // 璁板綍绫诲瀷锛氬け鍗曟姤鍛婁换鍔�
+ List<RecordType> recordTypes = [select Id from RecordType where IsActive = true and SobjectType = 'task__c' and DeveloperName = 'LoseListTask'];
+ Id loseListTask_TaskId = recordTypes.get(0).Id;
+ //String taskName = '';
+
+ for(Opportunity opp : newList) {
+ //娌℃湁宸叉彁浜ょ殑澶卞崟鎶ュ憡
+ if(!lostCancelReportMap.containsKey(opp.Id) && oppoIds.contains(opp.Id)) {
+
+ //鍒涘缓澶卞崟浠诲姟鎻愰啋
+ Task__c tempTask = new Task__c();
+ tempTask.RecordTypeId = loseListTask_TaskId;
+ tempTask.taskDifferent__c = '琚姩浠诲姟';
+ tempTask.taskStatus__c = '02 鎺ュ彈'; //浠诲姟鐘舵��2
+ tempTask.assignee__c = opp.OwnerId; //琚垎閰嶈��
+ tempTask.account__c = opp.AccountId;
+ tempTask.Name = '澶卞崟缁撴灉纭锛�' + opp.Opportunity_No__c;
+ tempTask.OwnerId = opp.OwnerId; //鎵�鏈変汉
+ tempTask.OpportunityId__c = opp.Id;
+ tempTask.ConfirmDate__c = Date.today();
+ insTaskList.add(tempTask);
+
+ //鏇存柊璇环 Task_createTime__c
+ Opportunity uopp = new Opportunity();
+ uopp.Id = opp.Id;
+ uopp.LostTask_createTime__c = Date.today();
+ updateOpportunity.add(uopp);
+ }
+ }
+
+ if (!insTaskList.isEmpty()) {
+ insert insTaskList;
+ }
+ if (!updateOpportunity.isEmpty()) {
+ update updateOpportunity;
+ }
+ }
+ isFirst = false;
+ }
+ //add 璇环璺熻繘浠诲姟寮�鍙� - 3.鍒涘缓澶卞崟浠诲姟 sx 20220617 end
+
+
+ //璇环璺熻繘浠诲姟寮�鍙�
+ public static void opportunityTasks(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap){
+ Set<Id> oppoIds = new Set<Id>();
+
+ for(Opportunity op : newList){
+ Opportunity oldopp = oldMap.get(op.Id);
+
+ //璇环涓爣缁撴灉纭绔炰簤瀵规墜涓爣鏃跺疄鏃跺垱寤哄け鍗曚换鍔� 涓� 璇环鐘舵��1绛変簬璇环
+ if (oldopp.ConfirmationofAward__c != 'OLY涓爣' && op.ConfirmationofAward__c == 'OLY涓爣' && op.StageName__c == '璇环'){
+ oppoIds.add(op.Id);
+ //纭涓爣缁撴灉鏃堕棿 鍒涘缓浠诲姟鏃堕棿 20220629 sx
+ op.ConfirmationofAward_createTime__c = Date.today();
+ if(op.Task_createTime__c!=null){
+
+ //鏄惁鎸夋椂纭锛�3涓伐浣滄棩鍐呮寜鏃�1锛屼笉鎸夋椂0
+ String inttemp = CalendarUtil.getWorkDayNum(String.valueOf(op.Task_createTime__c), String.valueOf(op.ConfirmationofAward_createTime__c));
+ op.Is_ConfirmationofAward__c = Integer.valueOf(inttemp) > 3 ? 0 : 1;
+ }
+ }
+
+ //20220628浼氳鏂伴渶姹� 瀵规墜涓爣 7.涓爣鏃ユ竻绌�
+ if(oldopp.ConfirmationofAward__c != '绔炰簤瀵规墜涓爣' && op.ConfirmationofAward__c == '绔炰簤瀵规墜涓爣'){
+ op.Closing_Bid_Date__c = null;
+ op.ConfirmationofAward_createTime__c = Date.today();
+ if(op.Task_createTime__c!=null){
+
+ //鏄惁鎸夋椂纭锛�3涓伐浣滄棩鍐呮寜鏃�1锛屼笉鎸夋椂0
+ String inttemp = CalendarUtil.getWorkDayNum(String.valueOf(op.Task_createTime__c), String.valueOf(op.ConfirmationofAward_createTime__c));
+ op.Is_ConfirmationofAward__c = Integer.valueOf(inttemp) > 3 ? 0 : 1;
+ }
+ }
+ }
+
+ if(!oppoIds.isEmpty()){
+
+ list<Tender_Opportunity_Link__c> toppLinkList = [Select Id, Opportunity__c, Tender_information__c,Tender_information__r.ResultDate__c FROM Tender_Opportunity_Link__c WHERE Opportunity__c in :oppoIds];
+ Map<String, Tender_Opportunity_Link__c> toopLinkMap = new Map<String, Tender_Opportunity_Link__c>();
+
+ for(Tender_Opportunity_Link__c tol : toppLinkList){
+ toopLinkMap.put(tol.Opportunity__c, tol);
+ }
+
+ for (String key : toopLinkMap.keySet()) {
+ Opportunity oppoTemp = newMap.get(key);
+
+ //20220628浼氳鏂伴渶姹� OLY涓爣 7.涓爣鏃ワ紙缁撴灉璁板綍鏃ワ級= 鎷涙爣椤圭洰.缁撴灉璁板綍鏃�
+ oppoTemp.Closing_Bid_Date__c = toopLinkMap.get(key).Tender_information__r.ResultDate__c;
+ System.debug('============'+toopLinkMap.get(key).Tender_information__r.ResultDate__c);
+
+
+ //鏄惁鎸夋椂纭锛�3涓伐浣滄棩鍐呮寜鏃�1锛屼笉鎸夋椂0
+ //String inttemp = CalendarUtil.getWorkDayNum(String.valueOf(oppoTemp.Task_createTime__c), String.valueOf(oppoTemp.ConfirmationofAward_createTime__c));
+ //oppoTemp.Is_ConfirmationofAward__c = Integer.valueOf(inttemp) > 3 ? 0 : 1;
+ }
+
+ }
+ Integer i = 0;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+ i++;
+
+ }
}
\ No newline at end of file
diff --git a/force-app/main/default/classes/OpportunityTriggerTest.cls b/force-app/main/default/classes/OpportunityTriggerTest.cls
index 0131d31..f3f0d17 100644
--- a/force-app/main/default/classes/OpportunityTriggerTest.cls
+++ b/force-app/main/default/classes/OpportunityTriggerTest.cls
@@ -121,7 +121,7 @@
Body = EncodingUtil.base64Decode('test')
);
insert att3;
- delete att3;
+ //delete att3;
Rental_Apply__c rentalApply = new Rental_Apply__c();
// '寮曞綋瀹屼簡' -> 宸叉壒鍑�
@@ -139,26 +139,27 @@
rentalApply.Hope_Lonaer_date_Num__c = 6;
insert rentalApply;
- Attachment att4 = new Attachment(
- Name = 'ORDER-123456.pdf',
- parentId = rentalApply.Id,
- Body = EncodingUtil.base64Decode('test')
- );
- insert att4;
- delete att4;
+ // Attachment att4 = new Attachment(
+ // Name = 'ORDER-123456.pdf',
+ // parentId = rentalApply.Id,
+ // Body = EncodingUtil.base64Decode('test')
+ // );
+ // insert att4;
+ // delete att4;
- Consumable_order__c co = new Consumable_order__c();
- insert co;
+ // Consumable_order__c co = new Consumable_order__c();
+ // insert co;
- Attachment att5 = new Attachment(
- Name = 'ORDER-123456.pdf',
- parentId = co.Id,
- Body = EncodingUtil.base64Decode('test')
- );
- insert att5;
+ // Attachment att5 = new Attachment(
+ // Name = 'ORDER-123456.pdf',
+ // parentId = co.Id,
+ // Body = EncodingUtil.base64Decode('test')
+ // );
+ // insert att5;
//delete att5;
System.Test.stopTest();
+ // OpportunityTrigger.intI();
}
}
@@ -322,9 +323,16 @@
opp1.Authorized_DB_No__c = '123';
opp1.Contract_DB_SalesDept_complite_day__c = Date.today();
opp1.NotesApprovedNo__c = '123';
+
update opp1;
-
-
+ LastbuyProduct__c wqe = new LastbuyProduct__c();
+ wqe.InquiryCode__c=opp1.Id;
+ wqe.LastbuyQuantity__c=1;
+ wqe.ActualQuantity__c=1;
+ insert wqe;
+ opp1.SAP_Send_OK__c = false;
+ opp1.Reason_Cancel_WIN__c = '1.缁堟鍚堝悓';
+ update opp1;
//lt 娉ㄩ噴鎺� te1
// //鎷涙爣椤圭洰
// Tender_information__c te1 = new Tender_information__c();
@@ -341,18 +349,18 @@
//鏂板缓璇环鏃�,璧嬪�兼嫑鎶曟爣椤圭洰,鎵撲笂鏍囪瘑
- Opportunity opp2 = new Opportunity(
- Name = 'test opp1',
- StageName = '寮曞悎',
- CurrencyIsoCode = 'USD',
- CloseDate = Date.today(),
- AccountId = depart.Id,
- Closing_Bid_Date__c = Date.today().addDays(-5),
- Hospital__c = company.Id,
- Competitor__c = 'A'
- //,Bidding_Project_Name_Bid__c = te1.Id //lt 20220316
- );
- insert opp2;
+ // Opportunity opp2 = new Opportunity(
+ // Name = 'test opp1',
+ // StageName = '寮曞悎',
+ // CurrencyIsoCode = 'USD',
+ // CloseDate = Date.today(),
+ // AccountId = depart.Id,
+ // Closing_Bid_Date__c = Date.today().addDays(-5),
+ // Hospital__c = company.Id
+ // // ,Competitor__c = 'A'
+ // //,Bidding_Project_Name_Bid__c = te1.Id //lt 20220316
+ // );
+ // insert opp2;
System.Test.stopTest();
@@ -389,4 +397,96 @@
}
//LastBuy 棰勭暀浜у搧 lt 20220315 end
+
+ //add start 20220623
+ @isTest
+ static void test_createTaskByOppConfirmationofAward() {
+ User user = new User(Test_staff__c = true);
+ user.LastName = '_銈点兂銉栥儶銉冦偢';
+ user.FirstName = '銇�';
+ user.Alias = '銇�';
+ user.Email = 'olympusTest03@sunbridge.com';
+ user.Username = 'olympusTest03@sunbridge.com';
+ user.CommunityNickname = '銇�';
+ user.IsActive = true;
+ user.EmailEncodingKey = 'ISO-2022-JP';
+ user.TimeZoneSidKey = 'Asia/Tokyo';
+ user.LocaleSidKey = 'ja_JP';
+ user.LanguageLocaleKey = 'ja';
+ user.ProfileId = System.Label.ProfileId_SystemAdmin;
+ user.Job_Category__c = '閿�鍞帹骞�';
+ user.Province__c = '涓婃捣甯�';
+ user.Use_Start_Date__c = Date.today().addMonths(-6);
+ user.SalesManager__c = UserInfo.getUserId();
+ user.BuchangApprovalManagerSales__c = UserInfo.getUserId();
+ user.JingliApprovalManager__c = UserInfo.getUserId();
+ user.BuchangApprovalManager__c = UserInfo.getUserId();
+ user.ZongjianApprovalManager__c = UserInfo.getUserId();
+
+ List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+ if (rectCo.size() == 0) {
+ return;
+ }
+ List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+ if (rectSct.size() == 0) {
+ return;
+ }
+ List<RecordType> rectDpt = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '瑷虹檪绉� 娑堝寲绉�'];
+ if (rectDpt.size() == 0) {
+ return;
+ }
+
+
+ StaticParameter.EscapeOpportunityBefUpdTrigger = true;
+ StaticParameter.EscapeSyncOpportunityTrigger = true;
+ StaticParameter.EscapeNFM007Trigger = true;
+ StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
+ StaticParameter.EscapeSyncOpportunityTrigger = true;
+
+ System.runAs(new User(Id = Userinfo.getUserId())) {
+ insert user;
+ // 銉嗐偣銉堛儑銉笺偪
+ Account company = new Account();
+ company.RecordTypeId = rectCo[0].Id;
+ company.Name = 'NFM007TestCompany';
+ upsert company;
+ Account section = new Account();
+ section.RecordTypeId = rectSct[0].Id;
+ section.Name = '*';
+ section.Department_Class_Label__c = '娑堝寲绉�';
+ section.ParentId = company.Id;
+ section.Hospital_Department_Class__c = company.Id;
+ upsert section;
+ Account depart = new Account();
+ depart.RecordTypeId = rectDpt[0].Id;
+ depart.Name = '*';
+ depart.Department_Name__c = 'NFM007TestDepart';
+ depart.ParentId = section.Id;
+ depart.Department_Class__c = section.Id;
+ depart.Hospital__c = company.Id;
+ upsert depart;
+
+ Opportunity opp = new Opportunity();
+ opp.AccountId = depart.Id;
+ opp.Department_Class__c = section.Id;
+ opp.Hospital__c = company.Id;
+ opp.SAP_Send_OK__c = false;
+ opp.Name = 'GZ-SP-NFM007_1';
+ opp.Trade__c = '鍐呰部';
+ opp.StageName = '璇环';
+ opp.ConfirmationofAward__c='OLY涓爣';
+ opp.CloseDate = date.newinstance(2022, 11, 30);
+ insert opp;
+
+ System.Test.startTest();
+ opp.ConfirmationofAward__c='绔炰簤瀵规墜涓爣';
+ update opp;
+
+
+ System.Test.stopTest();
+
+ }
+}
+//end start 20220623
+
}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TenderLostController.cls b/force-app/main/default/classes/TenderLostController.cls
new file mode 100644
index 0000000..c3dc626
--- /dev/null
+++ b/force-app/main/default/classes/TenderLostController.cls
@@ -0,0 +1,150 @@
+public without sharing class TenderLostController {
+
+ //鍒濆鍖�
+ @AuraEnabled
+ public static String InitData(String ParamIdStr) {
+ //鏍规嵁鎷涙爣椤圭洰Id 鏌� 鎷涙爣椤圭洰鍚嶇О 浣滀负 璇环鍚嶇О
+ List<Tender_information__c> tenList = Database.query('Select Id, Name From Tender_information__c Where Id = : ParamIdStr ');
+ Opportunity opp = new Opportunity();
+ if(tenList.size() > 0){
+ opp.Name = tenList[0].Name;
+ opp.Bidding_Project_Name_Bid__c = ParamIdStr;
+ }
+ return JSON.serialize(opp);
+ }
+
+ // 宸插叧鑱旂殑鍖婚櫌
+ @AuraEnabled
+ public static List<String> LinkedHospitals(String ParamIdStr) {
+ List<Tender_information__c> tenList = Database.query('Select Id, Hospital__c, Hospital1__c, Hospital2__c, Hospital3__c, Hospital4__c From Tender_information__c Where Id = : ParamIdStr ');
+ List<String> hospitals = new List<String>();
+ if(tenList.size() > 0){
+ if (String.isNotBlank(tenList[0].Hospital__c)) {
+ hospitals.add(tenList[0].Hospital__c);
+ }
+ if (String.isNotBlank(tenList[0].Hospital1__c)) {
+ hospitals.add(tenList[0].Hospital1__c);
+ }
+ if (String.isNotBlank(tenList[0].Hospital2__c)) {
+ hospitals.add(tenList[0].Hospital2__c);
+ }
+ if (String.isNotBlank(tenList[0].Hospital3__c)) {
+ hospitals.add(tenList[0].Hospital3__c);
+ }
+ if (String.isNotBlank(tenList[0].Hospital4__c)) {
+ hospitals.add(tenList[0].Hospital4__c);
+ }
+ }
+ return hospitals;
+ }
+
+ //鎶婇〉闈笂鐨勬暟鎹祴鍊煎埌璇环瀵硅薄涓�
+ private static Opportunity mergeInfo(Map<String, Object> oppMap){
+ Opportunity opp = new Opportunity();
+
+ // 鍚嶇О
+ opp.Name = String.valueOf(oppMap.get('Name'));
+ //璇环 鍏宠仈 鎷涙爣椤圭洰
+ opp.Bidding_Project_Name_Bid__c = String.valueOf(oppMap.get('Bidding_Project_Name_Bid__c'));
+ //椤甸潰涓婅幏鍙� 璧勯噾鏉ユ簮
+ opp.Fund_Basis__c = String.valueOf(oppMap.get('Fund_Basis__c'));
+ //椤甸潰涓婅幏鍙� 鎷涙爣鏂瑰紡
+ opp.Sales_Method__c = String.valueOf(oppMap.get('Sales_Method__c'));
+ // 绉戝
+ opp.AccountId = String.valueOf(oppMap.get('AccountId'));
+
+ System.debug('lt123test01榛樿璇环鍐呭'+opp);
+
+ // 鏌ユ壘绉戝鐩稿叧淇℃伅
+ Account acc = [select Id, Name, Parent.Parent.State_Master__r.Name, Parent.Department_Class_Label__c from Account where Id = :opp.AccountId];
+
+ System.debug('lt123test02榛樿璇环鍐呭'+opp);
+
+ opp.SAP_Province__c = acc.Parent.Parent.State_Master__r.Name; // SAP涓婁紶鐪�
+ switch on acc.Parent.Department_Class_Label__c { // 璇环绉戝鍒嗙被 璇环缂栫爜鑷姩鐢熸垚瑕佺敤鍒�
+ when '娑堝寲绉�' {
+ opp.Opportunity_Category__c = 'GI';
+ }
+ when '鍛煎惛绉�' {
+ opp.Opportunity_Category__c = 'BF';
+ }
+ when '鏅绉�' {
+ opp.Opportunity_Category__c = 'GS';
+ }
+ when '娉屽翱绉�' {
+ opp.Opportunity_Category__c = 'URO';
+ }
+ when '濡囩' {
+ opp.Opportunity_Category__c = 'GYO';
+ }
+ when '鑰抽蓟鍠夌' {
+ opp.Opportunity_Category__c = 'ENT';
+ }
+ when 'ET' {
+ opp.Opportunity_Category__c = 'ET';
+ }
+ when '鍏朵粬' {
+ opp.Opportunity_Category__c = 'OTH';
+ }
+ when else {
+ opp.Opportunity_Category__c = 'OTH';
+ }
+ }
+
+ opp.StageName = '寮曞悎'; // 鐘舵��
+ opp.Purchase_Reason__c = '鏂版湡'; // 璐拱鍘熷洜
+ opp.Trade__c = '鍐呰部'; // 鍐呰锤澶栬锤
+ opp.Close_Forecasted_Date__c = Date.today().addDays(90); // 棰勬祴OCSM绛剧害鏃�
+ opp.CloseDate = Date.today().addDays(120); // 棰勬祴鍙戣揣鏃�
+ opp.Purchase_Type__c = '涓�鑸紩鍚�'; // 璁㈣揣鏂瑰紡
+ opp.Sales_Root__c = '璨╁2搴�'; // 娓犻亾涓�"缁忛攢鍟�"
+ opp.ifOpenBid__c = '鍏紑鎷涙爣'; // 鏄惁鍏紑鎷涙爣
+ opp.LeadSource = '鎷涙爣缃�'; // 娼滃湪瀹㈡埛鏉ユ簮
+ opp.LeakageNumber__c = 1; //婕忓崟鏁�
+ opp.Tender_Number__c = 1; //鎷涙爣鏁�
+ //搴旀爣鏁颁负0 Authorized_DB_No__c涓虹┖鏃朵负0
+ //涓爣鏁颁负0
+ opp.ConfirmationofAward_createTime__c = Date.today(); //涓爣缁撴灉纭鏃�
+ opp.ConfirmationofAward__c = '绔炰簤瀵规墜涓爣'; //涓爣纭缁撴灉
+
+ System.debug('lt123opp榛樿璇环鍐呭'+opp);
+
+ return opp;
+ }
+
+ //淇濆瓨鏁版嵁 JSONData 鏄� json鏍煎紡鐨勫��
+ @AuraEnabled
+ public static string SaveData(String JsonData){
+ Opportunity opp = new Opportunity();
+ try{
+ Map<String, Object> oppMap = (Map<String, Object>)JSON.deserializeUntyped(JsonData);
+ System.debug('lt123JsonData'+JsonData);
+ opp = mergeInfo(oppMap);
+ insert opp;
+ System.debug('lt123opp.Id'+opp.Id);
+ return opp.Id;
+ }catch(Exception ex)
+ {
+ return '閿欒锛�' + ex.getLineNumber()+' 琛岄敊璇� : '+ex.getMessage();
+ }
+ }
+
+ //鏌ヨ鏅�氱瀹�
+ @AuraEnabled
+ public static String SearchPTKS(String content, List<String> hospitals){
+ String profile_2S1 = System.Label.ProfileId2S1HP;
+ Boolean is_2S1 = profile_2S1.contains(UserInfo.getProfileId()) ? true : false;
+ String jsonData = CommonUtils.GetPTKS(content, hospitals, is_2S1);
+ System.debug('hospitals: ' + hospitals);
+ System.debug('offices: ' + jsonData);
+ return jsonData;
+ }
+
+ //鏌ヨ鐖剁被
+ // @AuraEnabled
+ // public static String SearchParent(String Id){
+ // String jsonData = CommonUtils.GetParent(Id);
+ // return jsonData;
+ // }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TenderLostControllerTest.cls b/force-app/main/default/classes/TenderLostControllerTest.cls
new file mode 100644
index 0000000..28ec2c8
--- /dev/null
+++ b/force-app/main/default/classes/TenderLostControllerTest.cls
@@ -0,0 +1,65 @@
+@isTest
+private class TenderLostControllerTest {
+
+ @isTest
+ static void TestMethod1() {
+ //鍒涘缓瀹㈡埛
+ Account hospital = new Account();
+ hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
+ hospital.Name = 'test hospital';
+ hospital.Is_Active__c = '鏈夊姽';
+ hospital.Attribute_Type__c = '鍗敓閮�';
+ hospital.Speciality_Type__c = '缁煎悎鍖婚櫌';
+ hospital.Grade__c = '涓�绾�';
+ hospital.OCM_Category__c = 'SLTV';
+ hospital.Is_Medical__c = '鍖荤枟鏈烘瀯';
+ hospital.Town__c = '涓滀含';
+ hospital.Department_Name__c = 'testKS';
+ insert hospital;
+
+ //鍒涘缓鎷涙爣椤圭洰
+ Tender_information__c Ten = new Tender_information__c();
+ Ten.Name = '123456';
+ Ten.ProjectId__c = '38_99df2844cf784982acdc61d00d7a7dbb';
+ ten.Hospital__c = hospital.Id;
+ ten.Hospital1__c = hospital.Id;
+ ten.Hospital2__c = hospital.Id;
+ ten.Hospital3__c = hospital.Id;
+ ten.Hospital4__c = hospital.Id;
+ insert Ten;
+
+ //璇环
+ Opportunity opp = new Opportunity();
+ opp.Name = 'Testname0922';
+ opp.Fund_Basis__c = '鏀垮簻璩囬噾';
+ opp.Sales_Method__c = '鏀垮簻鎷涙爣';
+ opp.StageName = '寮曞悎';
+ opp.Opportunity_No__c = '0801';
+ opp.Purchase_Reason__c = '鏂版湡';
+ opp.Trade__c = '鍐呰部';
+ opp.Close_Forecasted_Date__c = Date.today().addDays(90);
+ opp.CloseDate = Date.today().addDays(120);
+ opp.Purchase_Type__c = '涓�鑸紩鍚�';
+ opp.Sales_Root__c = '璨╁2搴�';
+ opp.ifOpenBid__c = '鍏紑鎷涙爣';
+ opp.LeadSource = '鎷涙爣缃�';
+ opp.LeakageNumber__c = 1;
+ opp.Tender_Number__c = 1;
+ opp.ConfirmationofAward_createTime__c = Date.today();
+ opp.ConfirmationofAward__c = '绔炰簤瀵规墜涓爣';
+ insert opp;
+
+ Map<String, Object> oppMap = new Map<String, Object>();
+ oppMap.put('AccountId',hospital.Id);
+
+ String str1 = JSON.serialize(opp);
+ String str2 = JSON.serialize(oppMap);
+
+ TenderLostController.InitData(String.valueOf(Ten.Id));
+ TenderLostController.LinkedHospitals(String.valueOf(Ten.Id));
+ TenderLostController.SaveData(str1);
+ TenderLostController.SaveData(str2);
+
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TenderResultConfirmTaskBatch.cls b/force-app/main/default/classes/TenderResultConfirmTaskBatch.cls
new file mode 100644
index 0000000..98a9e41
--- /dev/null
+++ b/force-app/main/default/classes/TenderResultConfirmTaskBatch.cls
@@ -0,0 +1,165 @@
+/**
+ * 2022-06-15 sx 璇环璺熻繘浠诲姟
+ */
+
+global class TenderResultConfirmTaskBatch implements Database.Batchable<sObject> {
+
+ Integer opporTotal = 0;
+ Integer taskTotal = 0;
+
+ BatchIF_Log__c log = new BatchIF_Log__c();
+
+ public TenderResultConfirmTaskBatch() {
+ }
+ //20220715 you 鎷涙爣浠诲姟 start
+ List<String> TenderIds = new List<String>();
+ global TenderResultConfirmTaskBatch(List<String> tenIds){
+ this.TenderIds = tenIds;
+ }
+ //20220715 you 鎷涙爣浠诲姟 end
+ global Database.QueryLocator start(Database.BatchableContext bc){
+ String query = 'Select Id, Opportunity__c, Tender_information__c, '
+ + 'Tender_information__r.status__c, Tender_information__r.TenderManageCode__c,Tender_information__r.RecordTypeId, Tender_information__r.CreatedDate,'
+ + 'Opportunity__r.OwnerId, Opportunity__r.AccountId, Opportunity__r.StageName__c, '
+ + 'Opportunity__r.Assistant_Applied_Date__c, Opportunity__r.Cnt_Lost_cancel_Draft__c, Opportunity__r.ConfirmationofAward__c, '
+ + 'Opportunity__r.Contract_DB_complite_day__c, Opportunity__r.Contract_Authorize_Lock__c, Opportunity__r.LeakageNumber__c, '
+ + 'Opportunity__r.ConfirmationofAward_createTime__c '
+ + 'FROM Tender_Opportunity_Link__c '
+ + 'WHERE Tender_information__r.InfoType__c = \'3锛氱粨鏋淺' '
+ + 'AND (Tender_information__r.subInfoType__c = \'3-5锛氫腑鏍囬�氱煡\' OR Tender_information__r.subInfoType__c = \'3-6锛氬悎鍚屽叕鍛奬') '
+ + 'AND Tender_information__r.RecordTypeId = \'01210000000VLUI\' ';
+
+ //20220715 you 鎷涙爣浠诲姟 start
+ if(TenderIds !=null && TenderIds.size() > 0){
+ query += 'AND Opportunity__c in :TenderIds';
+ //query += 'AND Tender_information__c in :TenderIds ';
+ }else{
+ query += 'AND Tender_information__r.LastModifiedDate = LAST_N_DAYS:2';
+ }
+ query += ' ORDER BY Opportunity__c, Tender_information__r.CreatedDate';
+ //20220715 you 鎷涙爣浠诲姟 end
+ return Database.getQueryLocator(query);
+ }
+
+ global void execute(Database.BatchableContext BC, list<Tender_Opportunity_Link__c> toppLinkList){
+ log.Type__c='TenderResultConfirm_Task';
+ String logstr = 'Batch execute start' + '\r\n 鏌ヨ缁撴灉 :' + toppLinkList;
+
+ Set<Id> oppIds = new Set<Id>();
+ for (Tender_Opportunity_Link__c tol : toppLinkList) {
+ oppIds.add(tol.Opportunity__c);
+ }
+
+ //20220718 绛涢�変竴涓嬫湁鏃犱换鍔$殑璇环锛屽彇娑堜篃闇�瑕佹柊寤�
+ List<Task__c> taskList = [
+ SELECT Id,OpportunityId__c,taskStatus__c
+ FROM task__c
+ WHERE OpportunityId__c in :oppIds
+ AND (RecordType.Name = '涓爣缁撴灉纭' OR RecordType.Name = '澶卞崟鎶ュ憡浠诲姟')
+ AND (taskStatus__c = '02 鎺ュ彈' OR taskStatus__c = '03 瀹屾垚')];
+ system.debug('test1-----'+taskList);
+ Map<String,Task__c> mapTask = new Map<String,Task__c>();
+ for(Task__c t: taskList){
+ mapTask.put(t.OpportunityId__c, t);
+ }
+
+ // 璁板綍绫诲瀷锛氫腑鏍囩粨鏋滅‘璁�
+ Id winBiddingTask_TaskId = Schema.SObjectType.task__c.getRecordTypeInfosByDeveloperName().get('winBiddingTask').getRecordTypeId();
+
+ Map<Id, Opportunity> oppMap = new Map<Id, Opportunity>();
+ Map<Id, Task__c> taskMap = new Map<Id, Task__c>();
+
+ for(Tender_Opportunity_Link__c topp : toppLinkList){
+ system.debug('test3'+topp.Opportunity__c);
+ logstr += 'Batch execute ' + '\r\n 璇环杩涘叆for----- :'+ topp;
+ // 宸插瓨鍦ㄦ湁鏁堢姸鎬佷换鍔$殑璇环锛屼笉鐢ㄥ啀娆′骇鐢熶换鍔�
+ if (mapTask.isEmpty()
+ || (!mapTask.isEmpty() && !mapTask.containsKey(topp.Opportunity__c))){
+
+ //1.鍐呴儴纭鐘舵�佷负05.璇环涓笖鍏宠仈璇环鐨勭姸鎬�1涓鸿浠� 涓� 浠锋牸鐢宠 涓嶇瓑浜� 鐪� -- > 鍒涘缓骞舵淳鍙戜换鍔�
+ if (topp.Tender_information__r.status__c == '05.璇环涓�' && topp.Opportunity__r.StageName__c == '璇环' && topp.Opportunity__r.Assistant_Applied_Date__c == null && topp.Opportunity__r.LeakageNumber__c !=1){
+ logstr += 'Batch execute ' + '\r\n 璇环杩涘叆绗竴涓垽鏂潯浠�----- :'+ topp.Opportunity__c ;
+ Task__c tempTask = new Task__c();
+ tempTask.RecordTypeId = winBiddingTask_TaskId;
+ tempTask.taskDifferent__c = '琚姩浠诲姟';
+ tempTask.taskStatus__c = '02 鎺ュ彈'; //浠诲姟鐘舵��2
+ tempTask.assignee__c = topp.Opportunity__r.OwnerId; //琚垎閰嶈��
+ tempTask.account__c = topp.Opportunity__r.AccountId;
+ tempTask.Name = '涓爣缁撴灉纭锛�' + topp.Tender_information__r.TenderManageCode__c; //鎷涙爣椤圭洰.SFDC缂栫爜
+ tempTask.OwnerId = topp.Opportunity__r.OwnerId; //鎵�鏈変汉
+ tempTask.OpportunityId__c = topp.Opportunity__c;
+ tempTask.Tender_information_Task__c = topp.Tender_information__c; //鎷涙爣椤圭洰
+ tempTask.ConfirmDate__c = Date.today();
+
+ if (taskMap.isEmpty() || !taskMap.containsKey(topp.Opportunity__c)) {
+ taskMap.put(topp.Opportunity__c, tempTask);
+ }
+
+ //鏇存柊璇环 Task_createTime__c
+ if(oppMap.isEmpty() || !oppMap.containsKey(topp.Opportunity__c)){
+ Opportunity tempOpp = new Opportunity();
+ tempOpp.Id = topp.Opportunity__c;
+ tempOpp.Task_createTime__c = Date.today();
+ oppMap.put(topp.Opportunity__c, tempOpp);
+ }
+ }
+ }
+
+ //2. 瀛樺湪宸叉彁浜ょ殑澶卞崟鎶ュ憡鎴栬�呰浠风姸鎬�1=澶卞崟 -- >涓爣纭锛氱珵浜夊鎵嬩腑鏍�
+ // 鎷涙爣椤圭洰涓殑涓爣纭鏇存敼鍦˙atch涓洿鏂�
+ if (topp.Opportunity__r.Cnt_Lost_cancel_Draft__c > 0 || topp.Opportunity__r.StageName__c == '澶卞崟'){
+ logstr += 'Batch execute ' + '\r\n 璇环杩涘叆绗簩涓垽鏂潯浠�----- :'+ topp.Opportunity__c ;
+ //涓爣纭瀛楁璧嬪�肩珵浜夊鎵嬩腑鏍�
+ if(oppMap.isEmpty() || !oppMap.containsKey(topp.Opportunity__c)){
+ Opportunity tempOpp = new Opportunity();
+ tempOpp.Id = topp.Opportunity__c;
+ tempOpp.ConfirmationofAward__c = '绔炰簤瀵规墜涓爣';
+ oppMap.put(topp.Opportunity__c, tempOpp);
+ }
+ }
+
+ //3.宸插畬鎴愬悎鍚岀敵璇� --> 涓爣纭锛歄LY涓爣
+ // 鎷涙爣椤圭洰涓殑涓爣纭鏇存敼鍦˙atch涓洿鏂�
+ if (topp.Opportunity__r.Contract_DB_complite_day__c != null && topp.Opportunity__r.Contract_Authorize_Lock__c){
+ logstr += 'Batch execute ' + '\r\n 璇环杩涘叆绗笁涓垽鏂潯浠�----- :'+ topp.Opportunity__c ;
+ //涓爣纭瀛楁璧嬪�肩珵浜夊鎵嬩腑鏍�
+ if(oppMap.isEmpty() || !oppMap.containsKey(topp.Opportunity__c)){
+ Opportunity tempOpp = new Opportunity();
+ tempOpp.Id = topp.Opportunity__c;
+ tempOpp.ConfirmationofAward__c = 'OLY涓爣';
+ oppMap.put(topp.Opportunity__c, tempOpp);
+ }
+ }
+ }
+
+ try {
+ if (!taskMap.isEmpty()) {
+ insert taskMap.values();
+ logstr += 'Batch execute ' + '\r\n 浠诲姟鏁版嵁 :'+ taskMap.size() + taskMap.values() ;
+ }
+
+ if (!oppMap.isEmpty()) {
+ update oppMap.values();
+ logstr += 'Batch execute ' + '\r\n 璇环鏁版嵁 :'+ oppMap.size() + oppMap.values() ;
+ }
+
+
+ logstr += '\nend';
+ } catch(Exception ex) {
+ //鍙戠敓閿欒鐨勬儏鍐�
+ System.debug(Logginglevel.ERROR, 'NFM112_' + ':' + ex.getMessage());
+ System.debug(Logginglevel.ERROR, 'NFM112_' + ':' + ex.getStackTraceString());
+ logstr += ex.getMessage();
+ log.ErrorLog__c += ex.getMessage() + '\n';
+ log.ErrorLog__c += ex.getStackTraceString() + '\n';
+ }
+
+ log.Log__c = logstr;
+ insert log;
+ }
+
+ global void finish(Database.BatchableContext BC) {
+ system.debug('opporTotal======'+opporTotal);
+ system.debug('taskTotal======'+taskTotal);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/TenderResultConfirmTaskBatchTest.cls b/force-app/main/default/classes/TenderResultConfirmTaskBatchTest.cls
new file mode 100644
index 0000000..9901737
--- /dev/null
+++ b/force-app/main/default/classes/TenderResultConfirmTaskBatchTest.cls
@@ -0,0 +1,170 @@
+@isTest
+private class TenderResultConfirmTaskBatchTest {
+
+ @IsTest
+ static void myTest1() {
+
+ StaticParameter.EscapeTOLinkTrigger = true;
+ ControllerUtil.EscapeNFM001Trigger = true;
+ ControllerUtil.EscapeMaintenanceContractAfterUpdateTrigger = true;
+ StaticParameter.EscapeNFM001Trigger = true;
+ StaticParameter.EscapeNFM001AgencyContractTrigger = true;
+ StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
+ StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
+ Oly_TriggerHandler.bypass('TenderInformationHandler');
+
+
+ Profile p = [select id from Profile where id =:System.Label.ProfileId_SystemAdmin];
+ String loginId = UserInfo.getUserId();
+ User sys = [select id from User where Id = :loginId];
+ User u1 = new User(Test_staff__c = true);
+ u1.LastName = '123';
+ u1.FirstName = '2';
+ u1.Batch_User__c = true;
+ u1.Alias = '2';
+ u1.Email = 'shashiming@prec-tech.com';
+ u1.Username = 'test_user1@olympus.com.cn.tenopplink';
+ u1.CommunityNickname = '銇�1';
+ u1.IsActive = true;
+ u1.EmailEncodingKey = 'ISO-2022-JP';
+ u1.TimeZoneSidKey = 'Asia/Tokyo';
+ u1.LocaleSidKey = 'ja_JP';
+ u1.LanguageLocaleKey = 'ja';
+ u1.ProfileId = p.id;
+ u1.Job_Category__c = '閿�鍞湇鍔�';
+ u1.Province__c = '鏉变含';
+ insert u1;
+
+ User u2 = new User(Test_staff__c = true);
+ u2.LastName = '_銈点兂銉栥儶銉冦偢';
+ u2.FirstName = '銇�';
+ u2.Batch_User__c = true;
+ u2.Alias = '銇�';
+ u2.Email = 'shashiming@prec-tech.com';
+ u2.Username = 'test_user2@olympus.com.cn.tenopplink';
+ u2.CommunityNickname = '銇�';
+ u2.IsActive = true;
+ u2.EmailEncodingKey = 'ISO-2022-JP';
+ u2.TimeZoneSidKey = 'Asia/Tokyo';
+ u2.LocaleSidKey = 'ja_JP';
+ u2.LanguageLocaleKey = 'ja';
+ u2.ProfileId = p.id;
+ u2.Job_Category__c = '閿�鍞帹骞�';
+ u2.Province__c = '鏉变含';
+ u2.IsActive = true;
+ insert u2;
+
+ //鍒涘缓鎷涙爣椤圭洰1
+ Tender_information__c info1 = new Tender_information__c();
+ info1.Name = 'TEST001';
+ info1.OpportunityStatus__c = '璺熻繘涓�';
+ info1.InfoType__c = '3锛氱粨鏋�';
+ info1.subInfoType__c = '3-5锛氫腑鏍囬�氱煡';
+ info1.OwnerId = u1.Id;
+ info1.OpportunityNum__c = 1;
+ info1.ResultDate__c = Date.today();
+ insert info1;
+
+ //璇环1
+ Opportunity opp1 = new Opportunity(
+ StageName = '寮曞悎',
+ Name = 'tenderTest璇环1',
+ ETPromoteSale__c = true,
+ Close_Forecasted_Date__c = Date.today().addDays(-5),
+ // Bidding_Project_Name_Bid__c = info1.Id,
+ CloseDate = Date.today()
+ );
+ insert opp1;
+
+ Test.StartTest();
+
+ System.runAs(u1){
+ // 鎻掑叆鍏宠仈鍏崇郴
+ Tender_Opportunity_Link__c link1 = new Tender_Opportunity_Link__c();
+ link1.Tender_information__c = info1.Id;
+ link1.Opportunity__c = opp1.Id;
+ insert link1;
+ }
+
+ System.runAs(u2){
+ //鏂板缓鎷涙爣椤圭洰2
+ Tender_information__c info2 = new Tender_information__c();
+ info2.Name = 'TEST002';
+ info2.InfoType__c = '3锛氱粨鏋�';
+ info2.subInfoType__c = '3-5锛氫腑鏍囬�氱煡';
+ info2.ResultDate__c = Date.today();
+ insert info2;
+
+ //鏂板缓璇环2
+ Opportunity opp2 = new Opportunity(
+ StageName = '寮曞悎',
+ Name = 'tenderTest璇环2',
+ Contract_DB_complite_day__c = Date.today(),
+ Close_Forecasted_Date__c = Date.today().addDays(-5),
+ CloseDate = Date.today(),
+ Contract_Authorize_Lock__c = true
+ );
+ insert opp2;
+
+ // 鎻掑叆鍏宠仈鍏崇郴
+ Tender_Opportunity_Link__c link2 = new Tender_Opportunity_Link__c();
+ link2.Tender_information__c = info2.Id;
+ link2.Opportunity__c = opp2.Id;
+ insert link2;
+ }
+
+
+ //鏂板缓璇环3
+ Opportunity opp3 = new Opportunity(
+ StageName = '鏁楁垿',
+ Name = 'tenderTest璇环3',
+ Close_Forecasted_Date__c = Date.today().addDays(-5),
+ CloseDate = Date.today()
+ );
+ insert opp3;
+
+ //鏂板缓 璇环澶卞崟/鍙栨秷鎶ュ憡
+ Lost_cancel_report__c lcr = new Lost_cancel_report__c(
+ Opportunity__c = opp3.Id
+ );
+ insert lcr;
+
+ opp3.Lost_Cancel_Report__c = lcr.Id;
+ update opp3;
+
+
+ // //鏂板缓璇环4
+ // Opportunity opp4 = new Opportunity(
+ // StageName = '鏁楁垿',
+ // Name = 'tenderTest璇环4',
+ // Close_Forecasted_Date__c = Date.today().addDays(-5),
+ // CloseDate = Date.today(),
+ // ConfirmationofAward__c = '绔炰簤瀵规墜涓爣'
+ // );
+ // insert opp4;
+ // //鏂板缓 璇环澶卞崟/鍙栨秷鎶ュ憡
+ // Lost_cancel_report__c lcr1 = new Lost_cancel_report__c(
+ // Opportunity__c = opp4.Id
+ // );
+ // insert lcr1;
+
+ // opp4.Lost_Cancel_Report__c = lcr.Id;
+ // // update opp4;
+
+ List<Tender_Opportunity_Link__c> slist = [select id,name,Tender_information__r.InfoType__c,Tender_information__r.subInfoType__c,Tender_information__r.status__c,Tender_information__r.LastModifiedDate,Tender_information__r.OpportunityStatus__c,Tender_information__r.OpportunityNum__c,
+ Opportunity__r.StageName__c,Opportunity__r.If_Need_PriceApply__c,Opportunity__r.Contract_DB_complite_day__c,Opportunity__r.Contract_Authorize_Lock__c
+ from Tender_Opportunity_Link__c];
+
+ System.assertEquals(2, slist.size());
+ System.assertEquals('3锛氱粨鏋�', slist[1].Tender_information__r.InfoType__c);
+ System.assertEquals('3-5锛氫腑鏍囬�氱煡', slist[1].Tender_information__r.subInfoType__c);
+ // System.assertEquals('璺熻繘涓�',slist[0].Tender_information__r.OpportunityStatus__c);
+ // System.assertEquals(1,slist[0].Tender_information__r.OpportunityNum__c);
+ // System.assertEquals('05.璇环涓�',slist[0].Tender_information__r.status__c);
+ // System.assertEquals('璇环',slist[0].Opportunity__r.StageName__c);
+ System.assertEquals(Date.today(),slist[1].Opportunity__r.Contract_DB_complite_day__c);
+ System.assertEquals(true,slist[1].Opportunity__r.Contract_Authorize_Lock__c);
+ Database.executeBatch(new TenderResultConfirmTaskBatch());
+ Test.stopTest();
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/tenderLost/__tests__/tenderLost.test.js b/force-app/main/default/lwc/tenderLost/__tests__/tenderLost.test.js
new file mode 100644
index 0000000..39aef5e
--- /dev/null
+++ b/force-app/main/default/lwc/tenderLost/__tests__/tenderLost.test.js
@@ -0,0 +1,25 @@
+import { createElement } from 'lwc';
+import TenderLost from 'c/tenderLost';
+
+describe('c-tender-lost', () => {
+ afterEach(() => {
+ // The jsdom instance is shared across test cases in a single file so reset the DOM
+ while (document.body.firstChild) {
+ document.body.removeChild(document.body.firstChild);
+ }
+ });
+
+ it('TODO: test case generated by CLI command, please fill in test logic', () => {
+ // Arrange
+ const element = createElement('c-tender-lost', {
+ is: TenderLost
+ });
+
+ // Act
+ document.body.appendChild(element);
+
+ // Assert
+ // const div = element.shadowRoot.querySelector('div');
+ expect(1).toBe(1);
+ });
+});
\ No newline at end of file
diff --git a/force-app/main/default/lwc/tenderLost/tenderLost.html b/force-app/main/default/lwc/tenderLost/tenderLost.html
new file mode 100644
index 0000000..0cb5d38
--- /dev/null
+++ b/force-app/main/default/lwc/tenderLost/tenderLost.html
@@ -0,0 +1,75 @@
+<template>
+ <div class="exampleHolder" if:true={IsLoading} >
+ <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
+ </div>
+ <div style="padding:30px">
+ <div style="float:right" >
+ <div class="demo-only demo-only_viewport" style="height:4.5rem;" if:true = {Tongzhishow}>
+ <div class="slds-notification-container" style={IsLeftStyle}>
+ <div aria-live="assertive" aria-atomic="true" class="slds-assistive-text">鎻愮ず</div>
+ <section class="slds-notification" role="dialog" aria-labelledby="noti77" aria-describedby="dialog-body-id-43" >
+ <div class="slds-notification__body" id="dialog-body-id-43" >
+ <a class="slds-notification__target slds-media" href="#" style={BgColorStyle}>
+ <span class="slds-icon_container slds-icon-standard-task slds-media__figure" title="task">
+ <lightning-icon icon-name={TongzhiIcon} alternative-text="Account" title="Account"></lightning-icon>
+ </span>
+ <div class="slds-media__body">
+ <h2 class="slds-text-heading_small slds-m-bottom_xx-small" id="noti77">
+ <span class="slds-assistive-text">task notification:</span>鎻愮ず</h2>
+ <p>{SaveShowText}</p>
+ </div>
+ </a>
+ <button class="slds-button slds-button_icon slds-button_icon-container slds-notification__close" title="close">
+ <lightning-icon icon-name="utility:close" alternative-text="close" title="close" size="x-small" onclick={CloseAlert}></lightning-icon>
+ </button>
+ </div>
+ </section>
+ </div>
+ </div>
+ </div>
+
+ <!-- 椤甸潰涓讳綋 -->
+
+ <div style="width: 495px;padding:1px">
+ <lightning-combobox
+ name="fundBasic"
+ label="璧勯噾鏉ユ簮:"
+ placeholder="璇烽�夋嫨"
+ value={opp.Fund_Basis__c}
+ options={RelateOption}
+ onchange={handleRelationFn}
+ style="width: 495px;padding:1px"
+ >
+ </lightning-combobox>
+ </div>
+
+ <div style="width: 495px;padding:1px">
+ <lightning-combobox
+ name="salesMethod"
+ label="鎷涙爣鏂瑰紡:"
+ placeholder="璇烽�夋嫨"
+ value={opp.Sales_Method__c}
+ options={RelateOption1}
+ onchange={handleRelationFn1}
+ style="width: 495px;padding:1px"
+ >
+ </lightning-combobox>
+ </div>
+
+ <div style="width: 495px;padding:1px">
+ <!-- <c-jzlookup if:true={isShi} data-parent-id="lookup3" label="鍏宠仈鏅�氱瀹�" placeholder="璇烽�夋嫨鏅�氱瀹�.." onsearchchange={onsearchchangePTKS} searchdata={searchdataPTKS} option={optionPTKS} onselected={selectedPTKS}> </c-jzlookup> -->
+ <c-jzlookup data-parent-id="lookup3" label="绉戝:" placeholder="璇烽�夋嫨绉戝.." onsearchchange={onsearchchangePTKS} searchdata={searchdataPTKS} option={optionPTKS} onselected={selectedPTKS} > </c-jzlookup>
+ <!-- <c-jzlookuplightning ata-parent-id="lookup1" onsearchchange={onsearchchangePTKS} objectname="Opportunity" fieldname="AccountId" > </c-jzlookuplightning> -->
+ </div>
+
+ <button
+ class="slds-button slds-button_brand"
+ onclick={saveFn}
+ style="margin-top: 10px">
+ 淇濆瓨
+ </button>
+
+ <!-- 椤甸潰涓讳綋 -->
+
+ </div>
+ </template>
\ No newline at end of file
diff --git a/force-app/main/default/lwc/tenderLost/tenderLost.js b/force-app/main/default/lwc/tenderLost/tenderLost.js
new file mode 100644
index 0000000..135adca
--- /dev/null
+++ b/force-app/main/default/lwc/tenderLost/tenderLost.js
@@ -0,0 +1,169 @@
+import { LightningElement, api, track } from 'lwc';
+import SaveData from '@salesforce/apex/TenderLostController.SaveData';
+import SearchPTKS from '@salesforce/apex/TenderLostController.SearchPTKS';
+// import SearchParent from '@salesforce/apex/TenderLostController.SearchParent';
+import InitData from '@salesforce/apex/TenderLostController.InitData';
+import LinkedHospitals from '@salesforce/apex/TenderLostController.LinkedHospitals';
+
+export default class TenderLost extends LightningElement {
+
+ //璧勯噾鏉ユ簮閫夐」
+ RelateOption=[
+ {label:"鏀垮簻鎷ㄦ",value:"鏀垮簻璩囬噾"},
+ {label:"鍖婚櫌璧勯噾",value:"鐥呴櫌璩囬噾"},
+ {label:"鍥介檯璧勯噾",value:"鍥介殯璩囬噾"},
+ {label:"閾惰璧勯噾",value:"閵�琛岃硣閲�"},
+ {label:"鍏徃/涓汉鎶曡祫",value:"浼氱ぞ/鍊嬩汉璩囬噾"},
+ {label:"铻嶈祫绉熻祦",value:"铻嶈祫绉熻祦锛堛儶銉笺偣锛�"},
+ {label:"鍏朵粬",value:"銇濄伄浠�"},
+ ];
+
+ //鎷涙爣鏂瑰紡閫夐」
+ RelateOption1=[
+ {label:"鏀垮簻鎷涙爣",value:"鏀垮簻鎷涙爣"},
+ {label:"闄㈠唴鎷涙爣",value:"闄㈠唴鎷涙爣"},
+ {label:"绔熶簤鎬ц皥鍒�",value:"绔熶簤鎬ц皥鍒�(闈炴嫑鏍�)"},
+ {label:"鍗曚竴鏉ユ簮閲囪喘",value:"鍗曚竴鏉ユ簮閲囪喘"},
+ {label:"绉佺珛鍖婚櫌閲囪喘",value:"绉佺珛鍖婚櫌閲囪喘"},
+ {label:"鑰楁潗閲囪喘",value:"鑰楁潗閲囪喘"},
+ ];
+
+ // 椤甸潰瀵硅薄
+ opp = {};
+ hospitals = [];
+
+ //璧勯噾鏉ユ簮
+ handleRelationFn(event){
+ var value = event.target.value;
+ this.opp.Fund_Basis__c = value;
+ }
+
+ //鎷涙爣鏂瑰紡
+ handleRelationFn1(event){
+ var value = event.target.value;
+ this.opp.Sales_Method__c = value;
+ }
+
+ //浠巙rl涓婂彇寰桰D
+ getQueryVariable(variable)
+ {
+ var query = window.location.search.substring(1);
+ var vars = query.split("&");
+ for (var i=0;i<vars.length;i++) {
+ var pair = vars[i].split("=");
+ if(pair[0] == variable){return pair[1];}
+ }
+ return(false);
+ }
+
+ //鍒濆鍖�
+ connectedCallback(){
+ this.tenId = this.getQueryVariable('id');
+
+ InitData({ParamIdStr:this.tenId}).then(response=>{
+ this.opp=JSON.parse(response);
+ });
+ LinkedHospitals({ParamIdStr:this.tenId}).then(response=>{
+ this.hospitals = response;
+ console.log('get linked hospital:' + this.hospitals);
+ });
+ }
+
+ //鍏宠仈鏅�氱瀹�
+ optionPTKS = [{lableOne:"Name",lableTwo:"Acc_Record_Type__c"}];
+ searchdataPTKS=[];
+
+ onsearchchangePTKS(event){
+ var searchContentStr = event.detail.searchContent;
+ console.log('hospitals: ' + this.hospitals);
+ SearchPTKS({content:searchContentStr, hospitals:this.hospitals}).then(response=>{
+ var datas = JSON.parse(response);
+ this.searchdataPTKS = datas;
+ this.template.querySelector('[data-parent-id="lookup3"]').refreshdata(this.searchdataPTKS);
+ })
+ }
+ PTKSId = '';
+ selectedPTKS(event)
+ {
+ console.warn(event.detail.selectdata.Id);
+ this.opp.AccountId = event.detail.selectdata.Id;
+ }
+
+ // InitPTKS()
+ // {
+ // SearchPTKS({content:undefined}).then(response=>{
+ // var datas = JSON.parse(response);
+ // this.searchdataPTKS = datas;
+ // this.template.querySelector('[data-parent-id="lookup3"]').refreshdata(this.searchdataPTKS);
+ // })
+ // }
+ //鍏宠仈鏅�氱瀹�
+
+ //淇濆瓨鏁版嵁閫昏緫
+ saveFn(){
+ if(this.opp.Fund_Basis__c == undefined || this.opp.Sales_Method__c == undefined || this.opp.AccountId == undefined){
+ this.Alert("璇蜂笉瑕佽緭鍏ョ┖鍝︺��",false,true);
+ }else{
+ this.OnLoading(true);
+ SaveData({JsonData:JSON.stringify(this.opp)}).then((response)=>{
+ if (response != '' && response.indexOf('閿欒') < 0) {
+ this.OnLoading(false);
+ console.log(response);
+ this.Alert("淇濆瓨鎴愬姛",false,true);
+ window.open('/apex/PCLLostReportPage?pageStatus=Create&oppId=' + response + '&lostType=澶卞崟');
+ // window.location.hash = "Refresh"+"=="+response;
+ top.window.close();
+ }else{
+ this.Alert(response,true);
+ }
+ });
+ }
+ }
+
+
+ //-------- 淇濆瓨鎻愮ず妗� --------
+ //鎻愮ず
+ SaveShowText="淇濆瓨鎴愬姛";//鎻愮ず妗嗙殑鏂囨湰
+ Tongzhishow=false; //鎻愮ず鏄剧ず鐨勬爣璇�
+ TongzhiIcon = 'standard:account' //鎻愮ず妗嗙殑鍥炬爣
+ IsLeftStyle = "" //鎻愮ず妗嗙殑鏍峰紡
+ BgColorStyle = ""
+
+ //寮规鎻愮ず content 鍐呭 error 鏄惁鏄敊璇彁绀烘 left 鏄惁灞呭乏
+ Alert(content,error = false,left = false){
+ this.SaveShowText = content;
+ this.Tongzhishow = true;
+
+ if (error) {
+ this.TongzhiIcon = "standard:first_non_empty";
+ this.BgColorStyle = "background-color:#f88568";
+ }else{
+ this.TongzhiIcon = "standard:account";
+ this.BgColorStyle = "background-color:#69e669";
+ }
+ if (left) {
+ this.IsLeftStyle = "left: 0.25rem"
+ }else{
+ this.IsLeftStyle = ""
+ }
+ }
+
+ //鍏抽棴鎻愮ず妗�
+ CloseAlert(){
+ this.closeOffRefresh();
+ }
+ closeOffRefresh(){
+ if (this.Tongzhishow == true) {
+ this.Tongzhishow = false;
+ }
+ if (this.SaveShowText != "") {
+ this.SaveShowText = "";
+ }
+ }
+ //鍔犺浇
+ IsLoading = false;
+ OnLoading(flag) {
+ this.IsLoading = flag;
+ }
+ //-------- 淇濆瓨鎻愮ず妗� --------
+}
\ No newline at end of file
diff --git a/force-app/main/default/lwc/tenderLost/tenderLost.js-meta.xml b/force-app/main/default/lwc/tenderLost/tenderLost.js-meta.xml
new file mode 100644
index 0000000..eac275d
--- /dev/null
+++ b/force-app/main/default/lwc/tenderLost/tenderLost.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>55.0</apiVersion>
+ <isExposed>false</isExposed>
+</LightningComponentBundle>
\ No newline at end of file
diff --git a/force-app/main/default/pages/TenderLostPage.page b/force-app/main/default/pages/TenderLostPage.page
new file mode 100644
index 0000000..110317d
--- /dev/null
+++ b/force-app/main/default/pages/TenderLostPage.page
@@ -0,0 +1,26 @@
+<apex:page showHeader="false" sidebar="false" id="TenderLostApp" title="鎷涙爣椤圭洰澶卞崟">
+ <apex:includeLightning />
+ <div style="width:100%;height:100%;" id="TenderLostApp" />
+
+ <script>
+ $Lightning.use("c:TenderLostApp", function () {
+ $Lightning.createComponent("c:tenderLost",
+ {},
+ "TenderLostApp",
+ function (cmp) {
+ console.log('Component created, do something cool here');
+ });
+ });
+
+ // var interval = setInterval(()=>{
+ // var hrefStr = window.location.href;
+ // if (hrefStr.indexOf("Refresh") != -1) {
+ // // var arr = hrefStr.split("==");
+ // // window.open('/a1U/e?retURL=%2F' + arr[1] + '&RecordType=01210000000R4hM');
+ // top.window.close();
+ // clearInterval(interval);
+ // }
+ // },1000);
+ </script>
+
+</apex:page>
\ No newline at end of file
--
Gitblit v1.9.1