From 5363705f99dcbb7c270a619804beb4ac29b3faa0 Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期三, 09 八月 2023 20:02:16 +0800
Subject: [PATCH] 今日修改
---
force-app/main/default/classes/NotetoPdfHandler.cls-meta.xml | 5
force-app/main/default/classes/AttachmentReQisHandler.cls | 6
force-app/main/default/classes/AttachmentTriggerTest.cls | 42
force-app/main/default/pages/AssetMaintainIframe.page | 44
force-app/main/default/pages/InventoryIframe.page-meta.xml | 7
force-app/main/default/triggers/NotetoPdf.trigger-meta.xml | 5
force-app/main/default/pages/InventoryIframe.page | 50
force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml | 5
force-app/main/default/classes/InventoryReportController.cls | 485 ---------
force-app/main/default/pages/AssetMaintain.page | 66
force-app/main/default/triggers/AttachmentTrigger.trigger | 240 +--
force-app/main/default/pages/CheckAllOlympusAsset.page | 69
force-app/main/default/pages/InventoryReport.page | 19
force-app/main/default/classes/CheckAllOlympusAssetController.cls | 23
force-app/main/default/triggers/NotetoPdf.trigger | 9
force-app/main/default/classes/NotetoPdfHandler.cls | 136 ++
force-app/main/default/pages/TenderAttachment.page | 2
force-app/main/default/pages/InventoryResultRecord.page | 175 +++
force-app/main/default/triggers/ContentVersionTrigger.trigger | 3
force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml | 5
force-app/main/default/classes/InventoryResultRecordController.cls | 592 ----------
force-app/main/default/pages/QLMAttachmentPreview1.page | 4
force-app/main/default/triggers/ContentDocumentTrigger.trigger | 496 +++++++++
force-app/main/default/triggers/ContentDocumentLink.trigger | 567 +++++++++-
force-app/main/default/pages/AssetMaintainIframe.page-meta.xml | 7
25 files changed, 1,745 insertions(+), 1,317 deletions(-)
diff --git a/force-app/main/default/classes/AttachmentReQisHandler.cls b/force-app/main/default/classes/AttachmentReQisHandler.cls
index ed28a02..cf04b27 100644
--- a/force-app/main/default/classes/AttachmentReQisHandler.cls
+++ b/force-app/main/default/classes/AttachmentReQisHandler.cls
@@ -105,9 +105,9 @@
}
//鎶勯�佺殑閭
List<String> ccMailList = new List<String>();
- // ccMailList.add('gaozhangwei@prec-tech.com');
- // ccMailList.add('wei_liang@olympus.com.cn');
- ccMailList.add('chenjingwu@prec-tech.com');
+ ccMailList.add('gaozhangwei@prec-tech.com');
+ ccMailList.add('wei_liang@olympus.com.cn');
+ // ccMailList.add('chenjingwu@prec-tech.com');
Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage();
messageNEW.subject = title;
messageNEW.htmlBody = body;
diff --git a/force-app/main/default/classes/AttachmentTriggerTest.cls b/force-app/main/default/classes/AttachmentTriggerTest.cls
index 9d39928..b612437 100644
--- a/force-app/main/default/classes/AttachmentTriggerTest.cls
+++ b/force-app/main/default/classes/AttachmentTriggerTest.cls
@@ -8,7 +8,6 @@
@isTest
static void test_method_one() {
-
List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
if (rectCo.size() == 0) {
return;
@@ -66,22 +65,37 @@
ofile.Opportunity__c = opp.Id;
ofile.Oppor_File_Stage__c = 'G';
insert ofile;
- Attachment att1 = new Attachment(
- Name = 'test',
- ParentId = ofile.Id,
- Body = EncodingUtil.base64Decode('test')
+ ContentVersion version = new ContentVersion(
+ Title = 'test',
+ VersionData = EncodingUtil.base64Decode('test'),
+ ContentLocation = 's',
+ PathOnClient = 'test.txt'
);
- System.Test.startTest();
- insert att1;
- Attachment att = new Attachment(
- Name = 'test',
- ParentId = ofile.Id,
- Body = EncodingUtil.base64Decode('test')
- );
- insert att;
+ insert version;
+ version = [select ContentDocumentId from ContentVersion where Id =: version.Id];
+ ContentDocumentLink link = new ContentDocumentLink();
+ link.ContentDocumentId = version.ContentDocumentId;
+ link.LinkedEntityId = ofile.Id;
+ link.ShareType = 'I';
+ link.Visibility = 'AllUsers';
+ insert link;
+ ContentDocument con = [select Id from ContentDocument where Id =: version.ContentDocumentId];
+ delete con;
+ // Attachment att1 = new Attachment(
+ // Name = 'test',
+ // ParentId = ofile.Id,
+ // Body = EncodingUtil.base64Decode('test')
+ // );
+ // System.Test.startTest();
+ // insert att1;
+ // Attachment att = new Attachment(
+ // Name = 'test',
+ // ParentId = ofile.Id,
+ // Body = EncodingUtil.base64Decode('test')
+ // );
+ // insert att;
//delete att1;
- System.Test.stopTest();
}
//@isTest
diff --git a/force-app/main/default/classes/CheckAllOlympusAssetController.cls b/force-app/main/default/classes/CheckAllOlympusAssetController.cls
index 1b8dc8c..673ae29 100644
--- a/force-app/main/default/classes/CheckAllOlympusAssetController.cls
+++ b/force-app/main/default/classes/CheckAllOlympusAssetController.cls
@@ -1,7 +1,7 @@
public with sharing class CheckAllOlympusAssetController {
public static Asset StaticAssetQuertResult;
// 鎸夐挳鍖哄煙
- public String assertQueryCondition {get; private set;}
+ public String assertQueryCondition {get; set;}
public Boolean allBlueFlag {get; private set;} // 鏌ョ湅鍏ㄩ儴淇濇湁璁惧钃濊壊鎸夐挳Flag
public Boolean consumableBlueFlag {get; private set;} // 鏌ョ湅鍦ㄥ簱鐨勪繚鏈夎澶囪摑鑹叉寜閽瓼lag
public Boolean lendingBlueFlag {get; private set;} // 鏌ョ湅鍑哄�熶腑淇濇湁璁惧钃濊壊鎸夐挳Flag
@@ -218,6 +218,27 @@
set;
}
+ //chenjingwu 2023.8.2
+ //璁惧鐘舵��
+ public List<SelectOption> assertQueryConditionOpts {
+ get {
+ if(assertQueryConditionOpts == null){
+ assertQueryConditionOpts = new List<SelectOption>();
+ assertQueryConditionOpts.add(new SelectOption('all', '--鏃�--'));
+ assertQueryConditionOpts.add(new SelectOption('consumable', '鏈夋晥搴撳瓨'));
+ assertQueryConditionOpts.add(new SelectOption('lending', '鍊熷嚭鍒嗛厤鏁�'));
+ assertQueryConditionOpts.add(new SelectOption('repairing', '淇悊涓�'));
+ assertQueryConditionOpts.add(new SelectOption('scrapping', '寰呮姤搴�'));
+ assertQueryConditionOpts.add(new SelectOption('scrapped', '宸叉姤搴�'));
+ assertQueryConditionOpts.add(new SelectOption('consumed', '宸叉秷鑰�'));
+ assertQueryConditionOpts.add(new SelectOption('soonExpired', '鍗冲皢鍒版湡'));
+ assertQueryConditionOpts.add(new SelectOption('expired', '宸茶繃鏈�'));
+ }
+ return assertQueryConditionOpts;
+ }
+ set;
+ }
+
private String targetColumusStr; // SOQL涓殑妫�绱㈠垪
// 椤圭洰set 瀛楁鏍囩
diff --git a/force-app/main/default/classes/InventoryReportController.cls b/force-app/main/default/classes/InventoryReportController.cls
index 2df16d1..5101c4c 100644
--- a/force-app/main/default/classes/InventoryReportController.cls
+++ b/force-app/main/default/classes/InventoryReportController.cls
@@ -1,4 +1,8 @@
public without sharing class InventoryReportController {
+ // 鎸夐挳鍖哄煙
+ public Boolean inventoryBlueFlag {get; private set;} // 鏌ョ湅鐩樼偣钃濊壊鎸夐挳Flag
+ public Boolean rentBlueFlag {get; private set;} // 鏌ョ湅澶囧搧钃濊壊鎸夐挳Flag
+ public Boolean consumBlueFlag {get; private set;} // 鏌ョ湅鑰楁潗鐩樼偣钃濊壊鎸夐挳Flag
public List<String> xAxis {get; set;}
public List<String> yAxis {get; set;}
@@ -65,6 +69,7 @@
* 鐢婚潰鍒濆鍖�
*/
public PageReference init() {
+ initSearchButtonColor();
/************** 蹇呭~椤规爣绾㈣缃� ***************/
//椤甸潰甯冨眬涓瓧娈靛緱鏉冮檺 鍖呮嫭 r,w,wmLostReportEdit
@@ -289,6 +294,13 @@
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'when init ' + e.getMessage()));
return null;
}
+ }
+
+ // 鍒濆鍖栨寜閽鑹�
+ public void initSearchButtonColor() {
+ inventoryBlueFlag = false;
+ rentBlueFlag = true;
+ consumBlueFlag = false;
}
/**
@@ -556,478 +568,7 @@
}
@TestVisible private static void test() {
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++;
- 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++;
- 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/InventoryResultRecordController.cls b/force-app/main/default/classes/InventoryResultRecordController.cls
index fd070a1..71c2103 100644
--- a/force-app/main/default/classes/InventoryResultRecordController.cls
+++ b/force-app/main/default/classes/InventoryResultRecordController.cls
@@ -1,4 +1,16 @@
+/*
+ * @Description:
+ * @version:
+ * @Author: chen jing wu
+ * @Date: 2023-07-12 11:08:28
+ * @LastEditors: chen jing wu
+ * @LastEditTime: 2023-08-08 18:43:40
+ */
public with sharing class InventoryResultRecordController {
+ // 鎸夐挳鍖哄煙
+ public Boolean inventoryBlueFlag {get; private set;} // 鏌ョ湅鐩樼偣钃濊壊鎸夐挳Flag
+ public Boolean rentBlueFlag {get; private set;} // 鏌ョ湅澶囧搧钃濊壊鎸夐挳Flag
+ public Boolean consumBlueFlag {get; private set;} // 鏌ョ湅鑰楁潗鐩樼偣钃濊壊鎸夐挳Flag
// 妫�绱㈠尯鍩�
public String fixtureModelNo {get; set;} // 澶囧搧閰嶅鏄庣粏鍨嬪彿 Fixture_Model_No__c
public String assetStatus {get; set;} // 澶囧搧鐘舵�� Asset_Status__c
@@ -51,6 +63,13 @@
selectOptions.add(new SelectOption('鑰楁潗', '鑰楁潗'));
return selectOptions;
}
+ }
+
+ // 鍒濆鍖栨寜閽鑹�
+ public void initSearchButtonColor() {
+ inventoryBlueFlag = true;
+ rentBlueFlag = false;
+ consumBlueFlag = false;
}
// 鎵�鍦ㄥ湴鍖�(鏈儴)PlickList
@@ -149,6 +168,7 @@
// 鐢婚潰鍒濆鍖�
public void init() {
+ initSearchButtonColor();
angecylookrole = false;
bpPankuiYing = NONE;
ifInternalAsset = NONE;
@@ -1059,576 +1079,6 @@
}
@TestVisible private static void test() {
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++;
- 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++;
- 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/NotetoPdfHandler.cls b/force-app/main/default/classes/NotetoPdfHandler.cls
new file mode 100644
index 0000000..2c54f00
--- /dev/null
+++ b/force-app/main/default/classes/NotetoPdfHandler.cls
@@ -0,0 +1,136 @@
+public without sharing class NotetoPdfHandler extends Oly_TriggerHandler {
+ @TestVisible
+ private Map<Id, ContentDocumentLink> newMap;
+ @TestVisible
+ private Map<Id, ContentDocumentLink> oldMap;
+ @TestVisible
+ private List<ContentDocumentLink> newList;
+ @TestVisible
+ private List<ContentDocumentLink> oldList;
+
+ public NotetoPdfHandler() {
+ this.newMap = (Map<Id, ContentDocumentLink>) Trigger.newMap;
+ this.oldMap = (Map<Id, ContentDocumentLink>) Trigger.oldMap;
+ this.newList = (List<ContentDocumentLink>) Trigger.new;
+ this.oldList = (List<ContentDocumentLink>) Trigger.old;
+ }
+ @TestVisible
+ protected override void afterInsert() {
+ // 淇悊ID
+ NotetoPdf();
+ // NoteMail();
+ }
+ // 淇悊鍜孮IS鏂板缓澶囨敞鏃讹紝鐢熸垚瀵瑰簲鐨凱DF
+ private void NotetoPdf() {
+ StaticParameter.AttachmentTrigger = false;
+ List<String> Rlist = new List<String>();
+ // QisID
+ for (ContentDocumentLink link : newList) {
+ if(String.valueOf(link.LinkedEntityId).startsWith('a0J')
+ || String.valueOf(link.LinkedEntityId).startsWith('a0f')){
+ Rlist.add(link.Id);
+ }
+ }
+
+ if (Rlist.size() > 0) {
+ ReAndQISNotePDFController.generateAttachment(Rlist);
+ }
+ }
+
+ private void NoteMail() {
+ List<Id> linkIdList = new List<Id>();
+ for (ContentDocumentLink link : newList) {
+ linkIdList.add(link.Id);
+ }
+ newList = [select Id,LinkedEntityId,ContentDocumentId from ContentDocumentLink where Id in: linkIdList];
+ String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+ List<Messaging.SingleEmailMessage> sendMails = new List<Messaging.SingleEmailMessage>();
+ List<String> Rlist = new List<String>();
+ List<String> ParentIdList = new List<String>();
+ // QisID
+ for (ContentDocumentLink link : newList) {
+ if(String.valueOf(link.LinkedEntityId).startsWith('a0J')
+ || String.valueOf(link.LinkedEntityId).startsWith('a0f')){
+ Rlist.add(link.ContentDocumentId);
+ ParentIdList.add(link.LinkedEntityId);
+ }
+ }
+ // for (Attachment att : newList) {
+ // if(String.valueOf(att.ParentId).startsWith('a0J')
+ // || String.valueOf(att.ParentId).startsWith('a0f')){
+ // Rlist.add(att.Id);
+ // ParentIdList.add(att.ParentId);
+ // }
+ // }
+ // List<Attachment> NtList = [Select id,ParentId,Name,Body FROM Attachment where Id in : Rlist];
+ List<ContentVersion> verList = [select Id,Title,VersionData,ContentDocumentId from ContentVersion where ContentDocumentId in: Rlist];
+ Map<Id,Repair__c> updateRprMap = new Map<Id,Repair__c>();
+ Map<Id,QIS_Report__c> updateQisMap = new Map<Id,QIS_Report__c>();
+ for (Repair__c re :[select id,Name,SerialNumber__c,Delivered_Product__r.Name,HP_Name__c
+ from Repair__c where id in : ParentIdList] ) {
+ updateRprMap.put(re.id, re);
+ }
+ for (QIS_Report__c qi :[select id,Name,lot_or_serial__c,nonyushohin__r.Name,Hospital__r.Name
+ from QIS_Report__c where id in : ParentIdList] ) {
+ updateQisMap.put(qi.id, qi);
+ }
+ // Map<Id,Repair__c> updateRprMap = [select id,Name,SerialNumber__c,Delivered_Product__r.Name
+ // from Repair__c where id in : ParentIdList];
+ // Map<Id,QIS_Report__c>updateQisMap = [select id,Name,lot_or_serial__c,nonyushohin__r.Name
+ // from QIS_Report__c where id in : ParentIdList];
+ List<group> gList = [SELECT (select userOrGroupId from groupMembers) FROM group WHERE name = '闄勪欢涓婁紶閫氱煡灏忕粍'];
+ List<String> IdList = new List<String>();
+ if (gList != null && gList.size() > 0) {
+ for (Group g : gList) {
+ for (GroupMember gm : g.groupMembers) {
+ IdList.add(gm.userOrGroupId);
+ }
+ }
+ }
+ List<User> userList = [select Id, Name, Email, Manager.Email from User where id IN :IdList];
+ for (ContentVersion version : verList) {
+ ContentDocumentLink link = [select LinkedEntityId from ContentDocumentLink where ContentDocumentId =: version.ContentDocumentId limit 1];
+ String titName = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).Name : updateQisMap.get(link.LinkedEntityId).Name;
+ String prname = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).Delivered_Product__r.Name : updateQisMap.get(link.LinkedEntityId).nonyushohin__r.Name;
+ String Serial = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).SerialNumber__c : updateQisMap.get(link.LinkedEntityId).lot_or_serial__c;
+ String accountname = updateRprMap.containsKey(link.LinkedEntityId)? updateRprMap.get(link.LinkedEntityId).HP_Name__c : updateQisMap.get(link.LinkedEntityId).Hospital__r.Name;
+ String title = '';
+ String body = '';
+ title = '銆愪慨鐞�/QIS銆戯細' + titName + '宸叉柊澧炴枃浠讹紝璇锋煡鐪�';
+ body += '鐢ㄦ埛鍚嶏細' + accountname;
+ body += '<br/>';
+ body += '浜у搧鍚嶇О/鍨嬪彿 锛�' + prname;
+ body += '<br/>';
+ body += '鏈鸿韩鍙�/鎵瑰彿 锛�' + Serial;
+ body += '<br/>';
+ body += '闄勪欢鍚嶇О/澶囨敞鍚嶇О锛�' + version.Title;
+ body += '<br/>';
+ body += '鎿嶄綔鎷呭綋锛�' + UserInfo.getName();
+ body += '<br/>';
+ body += '<br/>';
+ body += '閾炬帴锛�' + baseUrl + '/' + link.LinkedEntityId +' ';
+ //鏀朵欢閭
+ List<String> toMailList = new List<String>();
+ String uId = UserInfo.getUserId();
+ for (User u : userList) {
+ if (u.Id != uId) {
+ toMailList.add(u.Email);
+ }
+ }
+ //鎶勯�佺殑閭
+ List<String> ccMailList = new List<String>();
+ ccMailList.add('gaozhangwei@prec-tech.com');
+ ccMailList.add('wei_liang@olympus.com.cn');
+ Messaging.SingleEmailMessage messageNEW = new Messaging.SingleEmailMessage();
+ messageNEW.subject = title;
+ messageNEW.htmlBody = body;
+ messageNEW.setCharset('UTF-8');
+ messageNEW.toAddresses = toMailList;
+ if(ccMailList.size() > 0){
+ messageNEW.ccAddresses = ccMailList;
+ }
+ sendMails.add(messageNEW);
+ }
+ Messaging.SendEmailResult[] results = messaging.sendEmail(sendMails);
+ }
+}
\ No newline at end of file
diff --git a/force-app/main/default/classes/NotetoPdfHandler.cls-meta.xml b/force-app/main/default/classes/NotetoPdfHandler.cls-meta.xml
new file mode 100644
index 0000000..f3bac1f
--- /dev/null
+++ b/force-app/main/default/classes/NotetoPdfHandler.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>41.0</apiVersion>
+ <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/pages/AssetMaintain.page b/force-app/main/default/pages/AssetMaintain.page
index 937b6a0..6b50d1e 100644
--- a/force-app/main/default/pages/AssetMaintain.page
+++ b/force-app/main/default/pages/AssetMaintain.page
@@ -1,7 +1,8 @@
-<apex:page controller="AssetMaintainController" title="鏁版嵁缁存姢" showHeader="true" sidebar="false" id="allPage" action="{!init}" docType="html-5.0" lightningStylesheets="true">
+<apex:page controller="AssetMaintainController" title="鏁版嵁缁存姢" showHeader="false" sidebar="false" id="allPage" action="{!init}" docType="html-5.0" lightningStylesheets="true">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
<style>
.dateFormat {
display: none;
@@ -46,7 +47,6 @@
}
div#in_Div_L td.dataCellBorder1 {
border-width: 1px;
- border-left: 1px solid rgb(229, 229, 229);
}
div#in_Div_R td.dataCellBorder1 {
border-width: 1px;
@@ -198,21 +198,21 @@
}
var globalQueryCondition;
var fromQuickBarFlag = 'false';
- function checkAssetJs(queryCondition) {
- fromQuickBarFlag = 'true';
- globalQueryCondition = queryCondition;
- var changeFlg = checkChangeFlg();
- if (changeFlg == '1') {
- blockme();
- checkAssetFunc(queryCondition, fromQuickBarFlag);
- } else if (changeFlg == '3') {
- blockme();
- checkAssetFunc(queryCondition, fromQuickBarFlag);
- globalQueryCondition = '';
- }
- fromQuickBarFlag = 'false';
- return false;
- }
+ // function checkAssetJs(queryCondition) {
+ // fromQuickBarFlag = 'true';
+ // globalQueryCondition = queryCondition;
+ // var changeFlg = checkChangeFlg();
+ // if (changeFlg == '1') {
+ // blockme();
+ // checkAssetFunc(queryCondition, fromQuickBarFlag);
+ // } else if (changeFlg == '3') {
+ // blockme();
+ // checkAssetFunc(queryCondition, fromQuickBarFlag);
+ // globalQueryCondition = '';
+ // }
+ // fromQuickBarFlag = 'false';
+ // return false;
+ // }
// 妫�绱㈡寜閽�
function searchBtnJs() {
@@ -395,7 +395,8 @@
<!-- 鍙栨秷鏄竻绌烘绱㈠尯 -->
<apex:actionFunction name="clearAllSearchConditionWhenCancel" action="{!clearAllSearchConditionWhenCancel}"></apex:actionFunction>
<!-- 宸︿晶鎸夐挳鍖� -->
- <apex:outputPanel layout="block" style="width: 13%; float: left;" rendered="{!showTop}">
+ <!-- chenjingwu 2023.8.2 start-->
+ <!-- <apex:outputPanel layout="block" style="width: 13%; float: left;" rendered="{!showTop}">
<apex:pageBlock mode="maindetail">
<table style='height: 220px'>
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅鍏ㄩ儴淇濇湁璁惧" rendered="{!!allBlueFlag}" onclick="checkAssetJs('all'); return false;" /></td></tr>
@@ -409,9 +410,10 @@
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅寰呮姤搴熶繚鏈夎澶�" rendered="{!!scrappingBlueFlag}" onclick="checkAssetJs('scrapping'); return false;" /></td></tr>
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅寰呮姤搴熶繚鏈夎澶�" rendered="{!scrappingBlueFlag}" onclick="checkAssetJs('scrapping'); return false;" /></td></tr>
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸叉姤搴熶繚鏈夎澶�" rendered="{!!scrappedBlueFlag}" onclick="checkAssetJs('scrapped'); return false;" /></td></tr>
- <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸叉姤搴熶繚鏈夎澶�" rendered="{!scrappedBlueFlag}" onclick="checkAssetJs('scrapped'); return false;" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸叉姤搴熶繚鏈夎澶�" rendered="{!scrappedBlueFlag}" onclick="checkAssetJs('scrapped'); return false;" /></td></tr> -->
<!-- OLY_OCM-818 -->
- <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸叉秷鑰楃殑淇濇湁璁惧" rendered="{!!consumedBlueFlag}" onclick="checkAssetJs('consumed'); return false;" /></td></tr>
+
+ <!-- <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸叉秷鑰楃殑淇濇湁璁惧" rendered="{!!consumedBlueFlag}" onclick="checkAssetJs('consumed'); return false;" /></td></tr>
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸叉秷鑰楃殑淇濇湁璁惧" rendered="{!consumedBlueFlag}" onclick="checkAssetJs('consumed'); return false;" /></td></tr>
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅鍗冲皢鍒版湡鐨勪繚鏈夎澶�" rendered="{!!soonExpiredBlueFlag}" onclick="checkAssetJs('soonExpired'); return false;" /></td></tr>
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅鍗冲皢鍒版湡鐨勪繚鏈夎澶�" rendered="{!soonExpiredBlueFlag}" onclick="checkAssetJs('soonExpired'); return false;" /></td></tr>
@@ -419,9 +421,21 @@
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸茶繃鏈熺殑淇濇湁璁惧" rendered="{!expiredBlueFlag}" onclick="checkAssetJs('expired'); return false;" /></td></tr>
</table>
</apex:pageBlock>
- </apex:outputPanel>
+ </apex:outputPanel> -->
+
+ <!-- <apex:outputPanel layout="block" style="width: 13%; float: left;" rendered="{!showTop}">
+ <apex:pageBlock mode="maindetail">
+ <table style='height: 220px'>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅鍏ㄩ儴淇濇湁璁惧" rendered="{!!allBlueFlag}" onclick="checkAssetJs('all'); return false;" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅鍏ㄩ儴淇濇湁璁惧" rendered="{!allBlueFlag}" onclick="checkAssetJs('all'); return false;" /></td></tr>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅鏈夋晥搴撳瓨" rendered="{!!consumableBlueFlag}" onclick="checkAssetJs('consumable'); return false;" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅鏈夋晥搴撳瓨" rendered="{!consumableBlueFlag}" onclick="checkAssetJs('consumable'); return false;" /></td></tr>
+ </table>
+ </apex:pageBlock>
+ </apex:outputPanel> -->
+ <!-- chenjingwu 2023.8.2 end-->
<!-- 鍙充晶妫�绱㈠尯 -->
- <apex:outputPanel layout="block" style="width: 87%; float: right;" rendered="{!showTop}">
+ <apex:outputPanel layout="block" style="width: 100%;margin: 0 auto;" rendered="{!showTop}">
<apex:pageBlock mode="maindetail">
<table style='width: 95%; height: 220px'>
<tr>
@@ -541,6 +555,14 @@
</apex:selectList>
</td>
<td class="blankStyle"></td>
+ <!-- chenjingwu 2023.8.2 start-->
+ <td class="labelStyle">璁惧鐘舵��</td>
+ <td class="inputTextStyle">
+ <apex:selectList value="{!assertQueryCondition}" id="assertQueryCondition" size="1">
+ <apex:selectOptions value="{!assertQueryConditionOpts}"/>
+ </apex:selectList>
+ </td>
+ <!-- chenjingwu 2023.8.2 end-->
</tr>
</table>
</apex:pageBlock>
diff --git a/force-app/main/default/pages/AssetMaintainIframe.page b/force-app/main/default/pages/AssetMaintainIframe.page
new file mode 100644
index 0000000..0d1bcda
--- /dev/null
+++ b/force-app/main/default/pages/AssetMaintainIframe.page
@@ -0,0 +1,44 @@
+<apex:page lightningStylesheets="true">
+ <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+ <style>
+ .right-pane {
+ flex: 2;
+ padding: 20px;
+ }
+ </style>
+ <apex:form >
+ <apex:actionFunction action="{!loadPage}" name="cancel" rerender="allForm" oncomplete="unblockUI();"/>
+ <div class="vf-container">
+ <div style="width:10%;float:left;">
+ <div>
+ <apex:commandButton style="width: 99%" value="鏁版嵁缁存姢" onclick="loadPage('/apex/AssetMaintain'); return false"/>
+ </div>
+ <div>
+ <apex:commandButton style="width: 99%" value="缁存姢浜у搧涓绘暟鎹�" onclick="location.href = '/a3z/o'; return false"/>
+ </div>
+ </div>
+ <div style="width:90%;float:right;" id="vf-content">
+ <!-- VF 椤甸潰鍐呭灏嗗湪姝ゅ鏄剧ず -->
+ </div>
+ </div>
+ </apex:form>
+
+
+ <script>
+ function loadPage(pageUrl) {
+
+ var vfContent = "<iframe src='" + pageUrl + "' style='width: 100%; height: 1000px; border: none;'></iframe>";
+ document.getElementById("vf-content").innerHTML = vfContent;
+
+ }
+
+ window.addEventListener('load', function () {
+ blockme();
+ var vfContent = "<iframe src='/apex/AssetMaintain' style='width: 100%; height: 1000px; border: none;'></iframe>";
+ document.getElementById("vf-content").innerHTML = vfContent;
+ unblockUI();
+ });
+ </script>
+</apex:page>
\ No newline at end of file
diff --git a/force-app/main/default/pages/AssetMaintainIframe.page-meta.xml b/force-app/main/default/pages/AssetMaintainIframe.page-meta.xml
new file mode 100644
index 0000000..e665539
--- /dev/null
+++ b/force-app/main/default/pages/AssetMaintainIframe.page-meta.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <availableInTouch>false</availableInTouch>
+ <confirmationTokenRequired>false</confirmationTokenRequired>
+ <label>AssetMaintainIframe</label>
+</ApexPage>
diff --git a/force-app/main/default/pages/CheckAllOlympusAsset.page b/force-app/main/default/pages/CheckAllOlympusAsset.page
index c62df05..ca66de2 100644
--- a/force-app/main/default/pages/CheckAllOlympusAsset.page
+++ b/force-app/main/default/pages/CheckAllOlympusAsset.page
@@ -1,7 +1,8 @@
-<apex:page controller="CheckAllOlympusAssetController" title="妫�绱繚鏈夎澶�" showHeader="true" sidebar="false" id="allPage" action="{!init}" tabStyle="CheckAllOlympusAsset__tab" docType="html-5.0">
+<apex:page controller="CheckAllOlympusAssetController" title="妫�绱繚鏈夎澶�" showHeader="true" sidebar="false" id="allPage" action="{!init}" tabStyle="CheckAllOlympusAsset__tab" docType="html-5.0" lightningStylesheets="true">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
<style>
.dateFormat {
display: none;
@@ -219,21 +220,21 @@
}
var globalQueryCondition;
var fromQuickBarFlag = 'false';
- function checkAssetJs(queryCondition) {
- fromQuickBarFlag = 'true';
- globalQueryCondition = queryCondition;
- var changeFlg = checkChangeFlg();
- if (changeFlg == '1') {
- blockme();
- checkAssetFunc(queryCondition, fromQuickBarFlag);
- } else if (changeFlg == '3') {
- blockme();
- checkAssetFunc(queryCondition, fromQuickBarFlag);
- globalQueryCondition = '';
- }
- fromQuickBarFlag = 'false';
- return false;
- }
+ // function checkAssetJs(queryCondition) {
+ // fromQuickBarFlag = 'true';
+ // globalQueryCondition = queryCondition;
+ // var changeFlg = checkChangeFlg();
+ // if (changeFlg == '1') {
+ // blockme();
+ // checkAssetFunc(queryCondition, fromQuickBarFlag);
+ // } else if (changeFlg == '3') {
+ // blockme();
+ // checkAssetFunc(queryCondition, fromQuickBarFlag);
+ // globalQueryCondition = '';
+ // }
+ // fromQuickBarFlag = 'false';
+ // return false;
+ // }
// 妫�绱㈡寜閽�
function searchBtnJs() {
@@ -443,7 +444,8 @@
<!-- 鍙栨秷鏄竻绌烘绱㈠尯 -->
<apex:actionFunction name="clearAllSearchConditionWhenCancel" action="{!clearAllSearchConditionWhenCancel}"></apex:actionFunction>
<!-- 宸︿晶鎸夐挳鍖� -->
- <apex:outputPanel layout="block" style="width: 13%; float: left;">
+ <!-- chenjingwu 2023.8.2 start-->
+ <!-- <apex:outputPanel layout="block" style="width: 13%; float: left;">
<apex:pageBlock mode="maindetail">
<table style='height: 220px'>
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅鍏ㄩ儴淇濇湁璁惧" rendered="{!!allBlueFlag}" onclick="checkAssetJs('all'); return false;" /></td></tr>
@@ -456,19 +458,20 @@
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅淇悊涓繚鏈夎澶�" rendered="{!repairingBlueFlag}" onclick="checkAssetJs('repairing'); return false;" /></td></tr>
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅寰呮姤搴熶繚鏈夎澶�" rendered="{!!scrappingBlueFlag}" onclick="checkAssetJs('scrapping'); return false;" /></td></tr>
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅寰呮姤搴熶繚鏈夎澶�" rendered="{!scrappingBlueFlag}" onclick="checkAssetJs('scrapping'); return false;" /></td></tr>
- <apex:outputText rendered="{!angecylookrole}"> <!-- 1650-->
- <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸叉姤搴熶繚鏈夎澶�" rendered="{!!scrappedBlueFlag && angecylookrole}" onclick="checkAssetJs('scrapped'); return false;" /></td></tr>
- <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸叉姤搴熶繚鏈夎澶�" rendered="{!scrappedBlueFlag}" onclick="checkAssetJs('scrapped'); return false;" /></td></tr>
+ <apex:outputText rendered="{!angecylookrole}"> -->
+ <!-- 1650-->
+ <!-- <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸叉姤搴熶繚鏈夎澶�" rendered="{!!scrappedBlueFlag && angecylookrole}" onclick="checkAssetJs('scrapped'); return false;" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸叉姤搴熶繚鏈夎澶�" rendered="{!scrappedBlueFlag}" onclick="checkAssetJs('scrapped'); return false;" /></td></tr> -->
<!-- OLY_OCM-818 -->
- <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸叉秷鑰楃殑淇濇湁璁惧" rendered="{!!consumedBlueFlag && angecylookrole}" onclick="checkAssetJs('consumed'); return false;" /></td></tr>
+ <!-- <tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸叉秷鑰楃殑淇濇湁璁惧" rendered="{!!consumedBlueFlag && angecylookrole}" onclick="checkAssetJs('consumed'); return false;" /></td></tr>
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸叉秷鑰楃殑淇濇湁璁惧" rendered="{!consumedBlueFlag}" onclick="checkAssetJs('consumed'); return false;" /></td></tr>
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅鍗冲皢鍒版湡鐨勪繚鏈夎澶�" rendered="{!!soonExpiredBlueFlag && angecylookrole}" onclick="checkAssetJs('soonExpired'); return false;" /></td></tr>
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅鍗冲皢鍒版湡鐨勪繚鏈夎澶�" rendered="{!soonExpiredBlueFlag}" onclick="checkAssetJs('soonExpired'); return false;" /></td></tr>
<tr><td class="checkButtonStyle"><apex:commandButton value="鏌ョ湅宸茶繃鏈熺殑淇濇湁璁惧" rendered="{!!expiredBlueFlag && angecylookrole}" onclick="checkAssetJs('expired'); return false;" /></td></tr>
<tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鏌ョ湅宸茶繃鏈熺殑淇濇湁璁惧" rendered="{!expiredBlueFlag}" onclick="checkAssetJs('expired'); return false;" /></td></tr>
- </apex:outputText>
+ </apex:outputText> -->
<!-- OLY_OCM-818 -->
- <tr>
+ <!-- <tr>
<td class="checkButtonStyle">
<apex:commandButton value="鐩樼偣缁撴灉璁板綍" onclick="checkChangeFlg(); gotoInventoryResultRecord(); return false;" />
</td>
@@ -490,9 +493,10 @@
</tr>
</table>
</apex:pageBlock>
- </apex:outputPanel>
+ </apex:outputPanel> -->
+ <!-- chenjingwu 2023.8.2 end-->
<!-- 鍙充晶妫�绱㈠尯 -->
- <apex:outputPanel layout="block" style="width: 87%; float: right;">
+ <apex:outputPanel layout="block" style="width: 90%;margin: 0 auto;">
<apex:pageBlock mode="maindetail">
<table style='width: 95%; height: 220px'>
<tr>
@@ -633,6 +637,21 @@
</apex:selectList>
</td>
<td class="blankStyle"></td>
+ <!-- chenjingwu 2023.8.2 start-->
+ <td class="labelStyle">璁惧鐘舵��</td>
+ <td class="inputTextStyle">
+ <apex:selectList value="{!assertQueryCondition}" id="assertQueryCondition" size="1">
+ <apex:selectOptions value="{!assertQueryConditionOpts}"/>
+ </apex:selectList>
+ </td>
+ <!-- chenjingwu 2023.8.2 end-->
+ </tr>
+ <tr><td><br /><br /></td></tr>
+ <tr>
+ <td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
+ <td class="searchButtonStyle">
+ <apex:commandButton style="width: 100%;float:right" value="鏁版嵁缁存姢鈥�" onclick="gotoAssetMaintain(); return false;" rerender="allForm" />
+ </td>
</tr>
</table>
</apex:pageBlock>
diff --git a/force-app/main/default/pages/InventoryIframe.page b/force-app/main/default/pages/InventoryIframe.page
new file mode 100644
index 0000000..e002315
--- /dev/null
+++ b/force-app/main/default/pages/InventoryIframe.page
@@ -0,0 +1,50 @@
+<apex:page lightningStylesheets="true">
+<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
+<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
+ <style>
+ .right-pane {
+ flex: 2;
+ padding: 20px;
+ }
+ </style>
+<apex:form >
+ <apex:actionFunction action="{!loadPage}" name="cancel" rerender="allForm" oncomplete="unblockUI();"/>
+ <div class="vf-container">
+ <div style="width:9%;float:left;">
+ <div>
+ <apex:commandButton style="width: 99%" value="鐩樼偣" onclick="loadPage('/apex/InventoryResultRecord'); return false"/>
+ </div>
+ <div>
+ <apex:commandButton style="width: 99%" value="澶囧搧鐩樼偣鎶ュ憡" onclick="loadPage('/apex/InventoryReport'); return false"/>
+ </div>
+ <div>
+ <apex:commandButton style="width: 99%" value="鑰楁潗鐩樼偣鎶ュ憡" onclick="loadPage('/apex/InventoryReport?isConsum=true'); return false"/>
+ </div>
+ <div>
+ <apex:commandButton style="width: 99%" value="鐩樼偣琛ㄥご" onclick="location.href = '/a3H/o'; return false"/>
+ </div>
+ </div>
+ <div style="width:91%;float:right;" id="vf-content">
+ <!-- VF 椤甸潰鍐呭灏嗗湪姝ゅ鏄剧ず -->
+ </div>
+ </div>
+</apex:form>
+
+
+ <script>
+ function loadPage(pageUrl) {
+
+ var vfContent = "<iframe src='" + pageUrl + "' style='width: 100%; height: 1000px; border: none;'></iframe>";
+ document.getElementById("vf-content").innerHTML = vfContent;
+
+ }
+
+ window.addEventListener('load', function () {
+ blockme();
+ var vfContent = "<iframe src='/apex/InventoryResultRecord' style='width: 100%; height: 1000px; border: none;'></iframe>";
+ document.getElementById("vf-content").innerHTML = vfContent;
+ unblockUI();
+ });
+ </script>
+</apex:page>
\ No newline at end of file
diff --git a/force-app/main/default/pages/InventoryIframe.page-meta.xml b/force-app/main/default/pages/InventoryIframe.page-meta.xml
new file mode 100644
index 0000000..7e1d4b0
--- /dev/null
+++ b/force-app/main/default/pages/InventoryIframe.page-meta.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <availableInTouch>false</availableInTouch>
+ <confirmationTokenRequired>false</confirmationTokenRequired>
+ <label>InventoryIframe</label>
+</ApexPage>
diff --git a/force-app/main/default/pages/InventoryReport.page b/force-app/main/default/pages/InventoryReport.page
index 03fb0d3..a1e9b56 100644
--- a/force-app/main/default/pages/InventoryReport.page
+++ b/force-app/main/default/pages/InventoryReport.page
@@ -1,6 +1,7 @@
-<apex:page extensions="InventoryReportController" standardController="Inventory_Header__c" showHeader="false" sidebar="false" id="allPage" action="{!init}" tabStyle="CheckAllOlympusAsset__tab" applyHtmlTag="false">
+<apex:page extensions="InventoryReportController" standardController="Inventory_Header__c" showHeader="false" sidebar="false" id="allPage" action="{!init}" tabStyle="CheckAllOlympusAsset__tab" lightningStylesheets="true" applyHtmlTag="false">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
+<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
<style>
.dateFormat {
@@ -291,8 +292,20 @@
<apex:param value="" name="saveType"/>
</apex:actionFunction>
<apex:pageBlock id="searchBlock">
- <apex:outputPanel id="RightArea" layout="block" style="margin:0 20%">
- <apex:outputPanel id="message">
+ <!-- <apex:outputPanel layout="block" style="width: 13%; float: left;">
+ <apex:pageBlock mode="maindetail">
+ <table style='width:140px; height: 80px'>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="鐩樼偣" rendered="{!!inventoryBlueFlag}" onclick="location.href='/apex/InventoryResultRecord'; return false"/></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鐩樼偣" rendered="{!inventoryBlueFlag}"/></td></tr>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="澶囧搧鐩樼偣鎶ュ憡" rendered="{!!rentBlueFlag}" onclick="location.href='{!$Page.InventoryReport}'; return false" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="澶囧搧鐩樼偣鎶ュ憡" rendered="{!rentBlueFlag}"/></td></tr>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="鑰楁潗鐩樼偣鎶ュ憡" rendered="{!!consumBlueFlag}" onclick="location.href='{!$Page.InventoryReport}?isConsum=true'; return false" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鑰楁潗鐩樼偣鎶ュ憡" rendered="{!consumBlueFlag}"/></td></tr>
+ </table>
+ </apex:pageBlock>
+ </apex:outputPanel> -->
+ <apex:outputPanel id="RightArea" layout="block" style="width: 100%;">
+ <apex:outputPanel id="message" style="width: auto" >
<apex:pageMessages />
</apex:outputPanel>
<div style="margin-top: 1%" class="startInventory">
diff --git a/force-app/main/default/pages/InventoryResultRecord.page b/force-app/main/default/pages/InventoryResultRecord.page
index 4799443..bd528dd 100644
--- a/force-app/main/default/pages/InventoryResultRecord.page
+++ b/force-app/main/default/pages/InventoryResultRecord.page
@@ -1,4 +1,4 @@
-<apex:page controller="InventoryResultRecordController" showHeader="false" sidebar="false" id="allPage" action="{!init}" tabStyle="CheckAllOlympusAsset__tab">
+<apex:page controller="InventoryResultRecordController" showHeader="false" sidebar="false" id="allPage" action="{!init}" tabStyle="CheckAllOlympusAsset__tab" lightningStylesheets="true" applyHtmlTag="false">
<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
@@ -7,7 +7,157 @@
<apex:includeScript value="{!URLFOR($Resource.jquery_confirm, 'jquery-confirm.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
<apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
+<apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
<style>
+ .dateFormat {
+ display: none;
+ }
+ .requiredBlock {
+ display: none;
+ }
+ .message {
+ margin: 0px;
+ /*width: 1125px;*/
+ }
+ table {
+ table-layout: fixed;
+ border-collapse: collapse;
+ }
+ a {
+ text-decoration: none;
+ }
+ /*TODO width margin-left 杩欓噷璋冭妭瀹藉害*/
+ div#out_Div_L {
+ position: relative;
+ overflow: hidden;
+ width: 1300px;
+ }
+ div#out_Div_R {
+ position: relative;
+ overflow: hidden;
+ width: 1200px;
+ margin-left: 686px;
+ }
+
+ div#in_Div_L {
+ position: relative;
+ width: 745px;
+ height: 451px;
+ }
+ div#in_Div_R {
+ position: relative;
+ overflow: auto;
+ height: 451px;
+ margin-left: 686px;
+ margin-top: -451px;
+ }
+ div#in_Div_L td.dataCellBorder1 {
+ border-width: 1px;
+ }
+ div#in_Div_R td.dataCellBorder1 {
+ border-width: 1px;
+ }
+ /* 榛樿 */
+ table.list td {width:100px;}
+ table.list td select {width:95%;}
+ table.list td input {width:95%;}
+ table.list td textarea {
+ height:50px;
+ width:90%;
+ }
+ table.list .col_Internal_asset_location__c {width:130px;}
+ table.list .col_Salesdepartment__c {width:110px;}
+ table.list .col_SalesProvince__c {width:70px;}
+ table.list .col_Asset_loaner_category__c {width:80px;}
+ table.list .col_Fixture_Model_No_F__c {width:80px;}
+ table.list .col_CompanyOfEquipment__c {width:60px;}
+ table.list .col_Asset_name__c {width:60px;}
+ table.list .col_Internal_Asset_number__c {width:80px;}
+ table.list .col_Internal_Asset_number_key__c {width:80px;}
+
+ table.list .col_SerialNumber {width:60px;} /*鏈鸿韩缂栧彿*/
+ table.list .col_Product_Serial_No__c {width:60px;} /*浜у搧 + 鏈轰綋缂栫爜*/
+ table.list .col_Product_category__c {width:60px;}
+ table.list .col_Equipment_Type__c {width:120px;}
+ table.list .col_Consumable_Guaranteen_end__c {width:70px;}
+ table.list .col_Manage_type__c {width:80px;} /*绠$悊绉嶇被*/
+ table.list .col_Loaner_accsessary__c {width:50px;}
+ table.list .col_EquipmentSet_Managment_Code__c {width:50px;}
+ table.list .col_AssetManageConfirm__c {width:50px;}
+ table.list .col_Fixture_QRCode__c {width:50px;}
+ table.list .col_WH_location__c {width:30px;}
+ table.list .col_Quantity {width:30px;}
+ table.list .col_You_Xiao_Ku_Cun__c {width:30px;}
+ table.list .col_Ji_Zhong_Guan_Li_Ku_Cun__c {width:30px;}
+ table.list .col_Out_of_wh__c {width:30px;}
+ table.list .col_Rental_Count__c {width:30px;}
+ table.list .col_Frozen_Quantity__c {width:30px;}
+ table.list .col_Abandoned_RealThing__c {width:30px;}
+ table.list .col_Abandoned_Inventory__c {width:40px;}
+ table.list .col_Repairing_Count__c {width:30px;}
+ table.list .col_Fixture_Status__c {width:30px;}
+ table.list .col_Main_OneToOne__c {width:40px;}
+
+ .navigationBarBlock {
+ width: 100%;
+ }
+ .apexp .bPageBlock.apexDefaultPageBlock .pbBody {
+ margin: 0px;
+ }
+ .checkButtonStyle input {
+ width: 100%;
+ text-align: left;
+ }
+ .searchButtonStyle {
+ width: 50%;
+ }
+ .searchButtonStyle input {
+ width: 80%;
+ background: #9BC2E6;
+ }
+ .setButtonStyle {
+ width: 8%;
+ }
+ .setButtonStyle input {
+ width: 100%;
+ background: #9BC2E6;
+ }
+ .startInventoryButtonStyle {
+ width: 12%;
+ }
+ .labelSettingStyle {
+ width: 8%;
+ text-align: right;
+ }
+ .labelStyle {
+ width: 8%;
+ text-align: left;
+ }
+ .blankStyle {
+ width: 1%;
+ }
+ .inputTextStyle {
+ width: 9%;
+ }
+ .inputTextStyle input {
+ width: 90%;
+ }
+ .inputTextStyle select {
+ width: 95%;
+ }
+ .redStyle {
+ background-color: #F00;
+ }
+ .greyStyle {
+ background-color: #AAA;
+ }
+ .blueStyle input {
+ background: #9BC2E6;
+ }
+ #pageBlockButton1 {
+ margin: 0pxt;
+ }
+
.overlay {
position: absolute;
top: 0;
@@ -201,6 +351,15 @@
text-decoration: none;
cursor: pointer;
}
+ #pageBlockButton1 {
+ margin: 0pxt;
+ }
+ div#in_Div_L td.dataCellBorder1 {
+ border-width: 1px;
+ }
+ div#in_Div_R td.dataCellBorder1 {
+ border-width: 1px;
+ }
</style>
<script type="text/javascript">
sforce.connection.sessionId = "{!$Api.Session_ID}";
@@ -370,6 +529,20 @@
</table>
</apex:pageBlock>
</apex:outputPanel> -->
+
+ <!-- <apex:outputPanel layout="block" style="width: 14%; float: left;">
+ <apex:pageBlock mode="maindetail">
+ <table style='width:140px;height: 120px'>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="鐩樼偣" rendered="{!!inventoryBlueFlag}" onclick="location.href='/apex/InventoryResultRecord'; return false"/></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鐩樼偣" rendered="{!inventoryBlueFlag}"/></td></tr>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="澶囧搧鐩樼偣鎶ュ憡" rendered="{!!rentBlueFlag}" onclick="location.href='{!$Page.InventoryReport}'; return false" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="澶囧搧鐩樼偣鎶ュ憡" rendered="{!rentBlueFlag}"/></td></tr>
+ <tr><td class="checkButtonStyle"><apex:commandButton value="鑰楁潗鐩樼偣鎶ュ憡" rendered="{!!consumBlueFlag}" onclick="location.href='{!$Page.InventoryReport}?isConsum=true'; return false" /></td></tr>
+ <tr><td class="checkButtonStyle blueStyle"><apex:commandButton value="鑰楁潗鐩樼偣鎶ュ憡" rendered="{!consumBlueFlag}"/></td></tr>
+ <tr><td></td></tr>
+ </table>
+ </apex:pageBlock>
+ </apex:outputPanel> -->
<!-- 鍙充晶妫�绱㈠尯 -->
<apex:outputPanel layout="block">
<apex:pageBlock mode="maindetail" id="maindetailId">
diff --git a/force-app/main/default/pages/QLMAttachmentPreview1.page b/force-app/main/default/pages/QLMAttachmentPreview1.page
index dd5e560..e7b795d 100644
--- a/force-app/main/default/pages/QLMAttachmentPreview1.page
+++ b/force-app/main/default/pages/QLMAttachmentPreview1.page
@@ -1,4 +1,4 @@
-<apex:page showheader="false" showquickactionvfheader="false" controller="QLMAttachmentPreviewController">
+<apex:page showheader="false" showquickactionvfheader="false" controller="QLMAttachmentPreviewController" lightningStylesheets="true">
<!-- 闅愯棌鍘熷浘 灞曠ず鐢诲竷 鏃嬭浆鍥剧墖锛�4涓�90掳锛夐紶鏍囨粴杞几缂╂斁澶ф斁灏� 锛堜細澶卞抚锛� -->
<head>
<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
@@ -6,7 +6,7 @@
<apex:includescript value="{!URLFOR($Resource.jquery183minjs)}">
</apex:includescript>
<title>
- 鏌ョ湅闄勪欢
+ 鏌ョ湅鏂囦欢
</title>
<style>
* {
diff --git a/force-app/main/default/pages/TenderAttachment.page b/force-app/main/default/pages/TenderAttachment.page
index 7bad1d9..ca9d429 100644
--- a/force-app/main/default/pages/TenderAttachment.page
+++ b/force-app/main/default/pages/TenderAttachment.page
@@ -5,7 +5,7 @@
<apex:includescript value="{!URLFOR($Resource.jquery183minjs)}">
</apex:includescript>
<title>
- 鏌ョ湅闄勪欢
+ 鏌ョ湅鏂囦欢
</title>
<style>
* {
diff --git a/force-app/main/default/triggers/AttachmentTrigger.trigger b/force-app/main/default/triggers/AttachmentTrigger.trigger
index 5b56614..22f8390 100644
--- a/force-app/main/default/triggers/AttachmentTrigger.trigger
+++ b/force-app/main/default/triggers/AttachmentTrigger.trigger
@@ -21,7 +21,7 @@
List<String> OpporFileIds = new List<String>();
Map<String,String> OpporFileUndeleteMap = new Map<String,String>();
List<String> DeleteReIds = new List<String>();
-Map<String,String> OppordeleteReUserMap = new Map<String,String>();
+ Map<String,String> OppordeleteReUserMap = new Map<String,String>();
Map<String,Datetime> OppordeleteReTimeMap = new Map<String,Datetime>();
//CHAN-BCNCRB ---XHL----Start-----
List<String> opportunity_FileIds = new List<String>();
@@ -29,6 +29,13 @@
List<String> opportunityFileOrderIds = new List<String>();
List<String> oFOrderIds = new List<String>();
Map<String,Boolean> oFOrderIdMap = new Map<String,Boolean>();
+
+ // sx 20230210start 澶囧搧鍊熷嚭鐢宠鏁呴殰鎶ュ憡闄勪欢鎻愬彇
+ List<String> rentalApplyFaultIds = new List<String>();
+ Map<String,List<Id>> trentalImages = new Map<String,List<Id>>();
+ List<String> rentaldeleteApplyFaultIds = new List<String>();
+ Map<String,List<Id>> deleteImages = new Map<String,List<Id>>();
+ // sx 20230210end 澶囧搧鍊熷嚭鐢宠鏁呴殰鎶ュ憡闄勪欢鎻愬彇
if (Trigger.isBefore && Trigger.isInsert) {
for (Attachment att : Trigger.new) {
if(String.valueOf(att.ParentId).startsWith(System.Label.Oppor_sepKey)){
@@ -55,7 +62,7 @@
if (String.valueOf(att.ParentId).startsWith('001')) {
accIds.add(att.ParentId);
}
- //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start 姝e紡鐨勫彨a5A
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start
if (String.valueOf(att.ParentId).startsWith('a5C') || String.valueOf(att.ParentId).startsWith('a5A')) {
accAppIds.add(att.ParentId);
}
@@ -80,9 +87,25 @@
oFOrderIds.add(att.ParentId);
oFOrderIdMap.put(att.ParentId,true);
}
+
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ Id cid = att.ParentId;
+ String parentLabel = cid.getSObjectType().getDescribe().getName();
+ if(parentLabel.equals('Rental_Apply_Fault__c')){
+ rentalApplyFaultIds.add(att.ParentId);
+ if(trentalImages.containskey(att.ParentId)){
+ trentalImages.get(att.ParentId).add(att.Id);
+ }else{
+ List<Id> temp = new List<Id>();
+ temp.add(att.Id);
+ trentalImages.put(att.ParentId,temp);
+ }
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
}
}
if (Trigger.isBefore && Trigger.isDelete) {
+ List<Attachment> attDeleteList = new List<Attachment>();
for (Attachment att : Trigger.old) {
//if (att.Name.toUpperCase() == '鍚堝悓涔�.PDF' && String.valueOf(att.ParentId).startsWith('a0t')) {
// 娣讳粯銇椼仧濂戠磩鏇搞伄銉曘偂銈ゃ儷鍚嶃伅鎸囧畾銇с亶銇亜
@@ -102,7 +125,32 @@
oFOrderIds.add(att.ParentId);
oFOrderIdMap.put(att.ParentId,false);
}
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ Id cid = att.ParentId;
+ String parentLabel = cid.getSObjectType().getDescribe().getName();
+ if(parentLabel.equals('Rental_Apply_Fault__c')){
+ rentaldeleteApplyFaultIds.add(att.ParentId);
+ attDeleteList.add(att);
+ if(deleteImages.containskey(att.ParentId)){
+ deleteImages.get(att.ParentId).add(att.Id);
+ }else{
+ List<Id> temp = new List<Id>();
+ temp.add(att.Id);
+ deleteImages.put(att.ParentId,temp);
+ }
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
}
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ List<Rental_Apply_Fault__c> rafList = [SELECT Id, Name FROM Rental_Apply_Fault__c WHERE Id IN: rentaldeleteApplyFaultIds AND (status__c = '宸插彂閫�' OR status__c = '宸插弽棣�')];
+ for (Rental_Apply_Fault__c raf : rafList) {
+ for (Attachment att : attDeleteList) {
+ if (att.ParentId == raf.Id) {
+ att.addError('闈炶崏妗堜腑鐨勬娴嬪垎鏋愭姤鍛婁笉鍏佽鍒犻櫎宸蹭笂浼犵殑鏁呴殰鍥剧墖');
+ }
+ }
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
}
if (Trigger.isAfter && Trigger.isDelete) {
for (Attachment att : Trigger.old) {
@@ -134,8 +182,44 @@
}
}
//20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ if(rentalApplyFaultIds.size() > 0){
+ List<Rental_Apply_Fault__c> renList = [SELECT Id,AttachmentId1__c,AttachmentId2__c from Rental_Apply_Fault__c where Id in :rentalApplyFaultIds];
-
+ system.debug('updrentalApplyFaultList====='+renList);
+ for(Rental_Apply_Fault__c ren : renList){
+ if(trentalImages.containskey(ren.Id)){
+ if (ren.AttachmentId1__c == null) {
+ ren.AttachmentId1__c = trentalImages.get(ren.id)[0];
+ } else if(ren.AttachmentId2__c == null) {
+ ren.AttachmentId2__c = trentalImages.get(ren.id)[0];
+ }
+ }
+ }
+ system.debug('updrentalApplyFaultList====='+renList);
+ UPDATE renList;
+ }
+
+ if(rentaldeleteApplyFaultIds.size() > 0){
+ List<Rental_Apply_Fault__c> renList = [SELECT Id,AttachmentId1__c,AttachmentId2__c from Rental_Apply_Fault__c where Id in :rentaldeleteApplyFaultIds];
+
+ system.debug('renList====='+renList);
+ for(Rental_Apply_Fault__c ren : renList){
+ if(deleteImages.containskey(ren.Id)){
+
+ if(deleteImages.get(ren.Id).contains(ren.AttachmentId1__c)){
+ ren.AttachmentId1__c = '';
+ }
+ if(deleteImages.get(ren.Id).contains(ren.AttachmentId2__c)){
+ ren.AttachmentId2__c = '';
+ }
+ }
+ }
+ system.debug('renList====='+renList);
+ UPDATE renList;
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
+
if (rentaldelIds.size() > 0) {
List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>();
for (Consumable_accessories_invoice__c ra : [select Id from Consumable_accessories_invoice__c where Invoice_code__c in :rentaldelIds and Attachment_ID__c in :attdelIds]) {
@@ -492,153 +576,17 @@
oFOrder.LatestUploadUser__c = null;
oFOrder.LatestUploadTime__c = null;
}
- }
+ }銆�
update oFOrderList;
}
}
- if (Test.isRunningTest()) {
- 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++;
+ // DB202304087063 SFDC绯荤粺闄勪欢涓婁紶鑷姩閫氱煡鍔熻兘寮�鍙戦渶姹� start
+ if (Trigger.isInsert && Trigger.isAfter && StaticParameter.AttachmentTrigger) {
+ AttachmentReQisHandler handler = new AttachmentReQisHandler();
+ handler.run();
}
+ // DB202304087063 SFDC绯荤粺闄勪欢涓婁紶鑷姩閫氱煡鍔熻兘寮�鍙戦渶姹� end
+
}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ContentDocumentLink.trigger b/force-app/main/default/triggers/ContentDocumentLink.trigger
index 0cc587b..466cff4 100644
--- a/force-app/main/default/triggers/ContentDocumentLink.trigger
+++ b/force-app/main/default/triggers/ContentDocumentLink.trigger
@@ -1,75 +1,530 @@
-trigger ContentDocumentLink on ContentDocumentLink (before delete, after insert) {
-
- // if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
- // return;
- // }
- system.debug('enter ContentDocumentLink');
- system.debug('Trigger.new = ' + (List<ContentDocumentLink>) Trigger.new);
- system.debug('Trigger.old = ' + (List<ContentDocumentLink>) Trigger.old);
-
- String invoiceStart = System.Label.invoiceStart;
- System.debug('invoiceStart = ' + invoiceStart);
+trigger ContentDocumentLink on ContentDocumentLink (before insert,after insert,before delete,after delete, before update, after update) {
List<String> rentalIds = new List<String>();
List<String> attIds = new List<String>();
- // List<String> rentaldelIds = new List<String>();
- // List<String> attdelIds = new List<String>();
+ List<String> rentaldelIds = new List<String>();
+ List<String> attdelIds = new List<String>();
+ List<String> rentalApplyIds = new List<String>();
+ List<String> accIds = new List<String>();
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start
+ List<String> accAppIds = new List<String>();
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 end
+ // LHJ CHAN-BCLD4P 20190618 Start
+ List<String> specIds = new List<String>();
+ List<String> specDelIds = new List<String>();
+ // LHJ CHAN-BCLD4P 20190618 End
- if (Trigger.isAfter && Trigger.isInsert) {
- System.debug('Trigger.isAfter && Trigger.isInsert');
- for (ContentDocumentLink cdl : Trigger.new) {
- System.debug('cdl.LinkedEntityId = ' + cdl.LinkedEntityId);
- System.debug('cdl.ContentDocumentId = ' + cdl.ContentDocumentId);
- if (String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)) {
- System.debug('String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)');
- rentalIds.add(cdl.LinkedEntityId);
- attIds.add(cdl.ContentDocumentId);
- System.debug('rentalIds = ' + rentalIds);
- System.debug('attIds = ' + attIds);
+ // MZY SWAG-BXXBKA 2021-02-19 start
+ List<String> opdIds = new List<String>();
+ Map<String,String> opdMap = new Map<String,String>();
+ // MZY SWAG-BXXBKA 2021-02-19 end
+
+ List<String> OpporFileIds = new List<String>();
+ Map<String,String> OpporFileUndeleteMap = new Map<String,String>();
+ List<String> DeleteReIds = new List<String>();
+ Map<String,String> OppordeleteReUserMap = new Map<String,String>();
+ Map<String,Datetime> OppordeleteReTimeMap = new Map<String,Datetime>();
+ //CHAN-BCNCRB ---XHL----Start-----
+ List<String> opportunity_FileIds = new List<String>();
+
+ List<String> opportunityFileOrderIds = new List<String>();
+ List<String> oFOrderIds = new List<String>();
+ Map<String,Boolean> oFOrderIdMap = new Map<String,Boolean>();
+
+ // sx 20230210start 澶囧搧鍊熷嚭鐢宠鏁呴殰鎶ュ憡闄勪欢鎻愬彇
+ List<String> rentalApplyFaultIds = new List<String>();
+ Map<String,List<Id>> trentalImages = new Map<String,List<Id>>();
+ List<String> rentaldeleteApplyFaultIds = new List<String>();
+ Map<String,List<Id>> deleteImages = new Map<String,List<Id>>();
+ // sx 20230210end 澶囧搧鍊熷嚭鐢宠鏁呴殰鎶ュ憡闄勪欢鎻愬彇
+ if (Trigger.isBefore && Trigger.isInsert) {
+ for (ContentDocumentLink link : Trigger.new) {
+ if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.Oppor_sepKey)){
+ opportunity_FileIds.add(link.LinkedEntityId);
+ }
+
+ if(String.valueOf(link.LinkedEntityId).startsWith('a3Z')){
+ opportunityFileOrderIds.add(link.LinkedEntityId);
}
}
}
- // if (Trigger.isBefore && Trigger.isDelete) {
- // System.debug('Trigger.isBefore && Trigger.isDelete');
- // for (ContentDocumentLink cdl : Trigger.old) {
- // System.debug('cdl.LinkedEntityId = ' + cdl.LinkedEntityId);
- // System.debug('cdl.ContentDocumentId = ' + cdl.ContentDocumentId);
- // if (String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)) {
- // System.debug('String.valueOf(cdl.LinkedEntityId).startsWith(invoiceStart)');
- // rentaldelIds.add(cdl.LinkedEntityId);
- // attdelIds.add(cdl.ContentDocumentId);
- // System.debug('rentaldelIds = ' + rentaldelIds);
- // System.debug('attdelIds = ' + attdelIds);
- // }
- // }
- // }
+ //CHAN-BCNCRB ---XHL----End-----
+ if (Trigger.isAfter && Trigger.isInsert) {
+ for (ContentDocumentLink link : Trigger.new) {
+ ContentVersion version = [select Id,Title from ContentVersion where ContentDocumentId =: link.ContentDocumentId];
+ //if (att.Name.toUpperCase() == '鍚堝悓涔�.PDF' && String.valueOf(att.ParentId).startsWith('a0t')) {
+ // 娣讳粯銇椼仧濂戠磩鏇搞伄銉曘偂銈ゃ儷鍚嶃伅鎸囧畾銇с亶銇亜
+ if (String.valueOf(link.LinkedEntityId).startsWith('a2K')) {
+ rentalIds.add(link.LinkedEntityId);
+ attIds.add(version.Id);
+ }
+ if (String.valueOf(link.LinkedEntityId).startsWith('a0t')) {
+ rentalApplyIds.add(link.LinkedEntityId);
+ }
+ if (String.valueOf(link.LinkedEntityId).startsWith('001')) {
+ accIds.add(link.LinkedEntityId);
+ }
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start
+ if (String.valueOf(link.LinkedEntityId).startsWith('a5C') || String.valueOf(link.LinkedEntityId).startsWith('a5A')) {
+ accAppIds.add(link.LinkedEntityId);
+ }
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 end
+ if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.Oppor_sepKey)){
+ OpporFileIds.add(link.LinkedEntityId);
+ }
+ // LHJ CHAN-BCLD4P 20190618 Start
+ if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.OppSpecialApply)){
+ specIds.add(link.LinkedEntityId);
+ }
+ // LHJ CHAN-BCLD4P 20190618 End
+
+ // MZY SWAG-BXXBKA 2021-02-19 start
+ if(String.valueOf(link.LinkedEntityId).startsWith('a3E')){
+ opdIds.add(link.LinkedEntityId);
+ opdMap.put(link.LinkedEntityId,version.Title);
+ }
+ // MZY SWAG-BXXBKA 2021-02-19 end
+
+ if(String.valueOf(link.LinkedEntityId).startsWith('a3Z')){
+ oFOrderIds.add(link.LinkedEntityId);
+ oFOrderIdMap.put(link.LinkedEntityId,true);
+ }
+
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ Id cid = link.LinkedEntityId;
+ String parentLabel = cid.getSObjectType().getDescribe().getName();
+ if(parentLabel.equals('Rental_Apply_Fault__c')){
+ rentalApplyFaultIds.add(link.LinkedEntityId);
+ if(trentalImages.containskey(link.LinkedEntityId)){
+ trentalImages.get(link.LinkedEntityId).add(version.Id);
+ }else{
+ List<Id> temp = new List<Id>();
+ temp.add(version.Id);
+ trentalImages.put(link.LinkedEntityId,temp);
+ }
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
+ }
+ }
+
+ if (Trigger.isAfter && Trigger.isDelete) {
+ for (ContentDocumentLink link : Trigger.old) {
+ if (String.valueOf(link.LinkedEntityId).startsWith('001')) {
+ accIds.add(link.LinkedEntityId);
+ }
+ // LHJ CHAN-BCLD4P 20190618 Start
+ if(String.valueOf(link.LinkedEntityId).startsWith(System.Label.OppSpecialApply)){
+ specIds.add(link.LinkedEntityId);
+ }
+ // LHJ CHAN-BCLD4P 20190618 End
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start
+ if (String.valueOf(link.LinkedEntityId).startsWith('a5C') || String.valueOf(link.LinkedEntityId).startsWith('a5A')) {
+ accAppIds.add(link.LinkedEntityId);
+ }
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 end
+ }
+ }
+
+
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ if(rentalApplyFaultIds.size() > 0){
+ List<Rental_Apply_Fault__c> renList = [SELECT Id,AttachmentId1__c,AttachmentId2__c from Rental_Apply_Fault__c where Id in :rentalApplyFaultIds];
+
+ system.debug('updrentalApplyFaultList====='+renList);
+ for(Rental_Apply_Fault__c ren : renList){
+ if(trentalImages.containskey(ren.Id)){
+ if (ren.AttachmentId1__c == null) {
+ ren.AttachmentId1__c = trentalImages.get(ren.id)[0];
+ } else if(ren.AttachmentId2__c == null) {
+ ren.AttachmentId2__c = trentalImages.get(ren.id)[0];
+ }
+ }
+ }
+ system.debug('updrentalApplyFaultList====='+renList);
+ UPDATE renList;
+ }
+
+ if(rentaldeleteApplyFaultIds.size() > 0){
+ List<Rental_Apply_Fault__c> renList = [SELECT Id,AttachmentId1__c,AttachmentId2__c from Rental_Apply_Fault__c where Id in :rentaldeleteApplyFaultIds];
+
+ system.debug('renList====='+renList);
+ for(Rental_Apply_Fault__c ren : renList){
+ if(deleteImages.containskey(ren.Id)){
+
+ if(deleteImages.get(ren.Id).contains(ren.AttachmentId1__c)){
+ ren.AttachmentId1__c = '';
+ }
+ if(deleteImages.get(ren.Id).contains(ren.AttachmentId2__c)){
+ ren.AttachmentId2__c = '';
+ }
+ }
+ }
+ system.debug('renList====='+renList);
+ UPDATE renList;
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
+ if (rentaldelIds.size() > 0) {
+ List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>();
+ for (Consumable_accessories_invoice__c ra : [select Id from Consumable_accessories_invoice__c where Invoice_code__c in :rentaldelIds and Attachment_ID__c in :attdelIds]) {
+ rentaldelList.add(ra);
+ }
+ ControllerUtil.delConsumableAccessoriesInvoiceSet(rentaldelList);
+ }
+
if (rentalIds.size() > 0) {
List<Consumable_order__c> rentalList = new List<Consumable_order__c>();
- for (Consumable_order__c ra : [SELECT Id FROM Consumable_order__c WHERE Id IN :rentalIds]) {
+ for (Consumable_order__c ra : [select Id from Consumable_order__c where Id in :rentalIds]) {
ra.Consumable_pdf_insert_day__c = Date.today();
ra.Order_Attachment__c = attIds[0];
+ //ra.Order_status__c = '褰曞叆瀹屾垚';
+ //ra.Contract_pdf_updated__c = true;
rentalList.add(ra);
}
- System.debug('rentalList = ' + rentalList);
ControllerUtil.updRentalApplyList(rentalList);
}
- // if (Trigger.isInsert && Trigger.isAfter && StaticParameter.ContentDocumentLink) {
- // AttachmentReQisHandler handler = new AttachmentReQisHandler();
- // handler.run();
- // }
+ if (rentalApplyIds.size() > 0) {
+ List<Rental_Apply__c> rentalApplyList = new List<Rental_Apply__c>();
+ for (Rental_Apply__c ra : [select Id from Rental_Apply__c where Id in :rentalApplyIds]) {
+ ra.Contract_pdf_update_day__c = Date.today();
+ ra.Contract_pdf_updated__c = true;
+ rentalApplyList.add(ra);
+ }
+ ControllerUtil.updRentalApplyList(rentalApplyList);
+ }
- // if (rentaldelIds.size() > 0) {
- // List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>();
- // for (Consumable_accessories_invoice__c ra : [
- // SELECT Id
- // FROM Consumable_accessories_invoice__c
- // WHERE Invoice_code__c IN :rentaldelIds AND Attachment_ID__c IN :attdelIds
- // ]) {
- // rentaldelList.add(ra);
- // }
- // System.debug('rentaldelList = ' + rentaldelList);
- // ControllerUtil.delConsumableAccessoriesInvoiceSet(rentaldelList);
- // }
+ if (accIds.size() > 0) {
+ Map<String, String> attMap = new Map<String, String>();
+ // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accIds order by ParentId];
+ List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accIds order by LinkedEntityId];
+ for (ContentDocumentLink link : linkList) {
+ attMap.put(link.LinkedEntityId, link.LinkedEntityId);
+ }
+ List<Account> updAccList = new List<Account>();
+
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ List<Account> accList = [select id,Name,
+ Is_Active__c
+ from Account
+ where id in:accIds ];
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+
+ for (String accid : accIds) {
+ if(accList.size() > 0){
+ // Account acc = new Account(Id = accid);
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ for(Account acc : accList){
+ if(Trigger.isDelete && (Trigger.isAfter)){
+ for(ContentDocumentLink link : Trigger.old){
+ // if(attMap.containsKey(att.ParentID) && acc.Is_Active__c != '鑽夋涓�'){
+ if(acc.Is_Active__c != '鑽夋涓�'){
+ link.addError('闈炶崏妗堜腑锛岄檮浠朵笉鍏佽鍒犻櫎銆�');
+
+ return;
+ }
+ }
+ }
+ acc.Is_upload_file__c = attMap.containsKey(accid);
+ updAccList.add(acc);
+ }
+ }
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+ }
+
+ // for (String accid : accIds) {
+ // Account acc = new Account(Id = accid);
+ // acc.Is_upload_file__c = attMap.containsKey(accid);
+ // updAccList.add(acc);
+ // }
+ if (updAccList.size() > 0) update updAccList;
+ }
+
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start
+ if (accAppIds.size() > 0) {
+ Map<String, String> attMap = new Map<String, String>();
+ // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accAppIds order by ParentId];
+ List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accAppIds order by LinkedEntityId];
+ for (ContentDocumentLink link : linkList) {
+ attMap.put(link.LinkedEntityId, link.LinkedEntityId);
+ }
+ List<Account_Delay_Apply__c> updAccAppList = new List<Account_Delay_Apply__c>();
+
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ List<Account_Delay_Apply__c> adaList = [select id,Name,
+ Is_Active__c
+ from Account_Delay_Apply__c
+ where id in:accAppIds ];
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+
+ for (String accappid : accAppIds) {
+ if(adaList.size() > 0){
+ // Account_Delay_Apply__c accapp = new Account_Delay_Apply__c(Id = accappid);
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+
+ for(Account_Delay_Apply__c accapp : adaList){
+ accapp.Is_upload_file__c = attMap.containsKey(accappid);
+ updAccAppList.add(accapp);
+ }
+
+ }
+
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+
+ }
+ if (updAccAppList.size() > 0) update updAccAppList;
+ }
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 end
+
+ // LHJ CHAN-BCLD4P 20190618 Start
+ if (specIds.size() > 0) {
+
+ Map<String, String> attMap = new Map<String, String>();
+ // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :specIds order by ParentId];
+ List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: specIds order by LinkedEntityId];
+ for (ContentDocumentLink link : linkList) {
+ attMap.put(link.LinkedEntityId, link.LinkedEntityId);
+ }
+ List<OpportunitySpecialApply__c> updSpecList = new List<OpportunitySpecialApply__c>();
+ for (String specId : specIds) {
+ OpportunitySpecialApply__c spec = new OpportunitySpecialApply__c(Id = specId);
+ spec.Is_upload_file__c = attMap.containsKey(specId);
+ updSpecList.add(spec);
+ }
+ if (updSpecList.size() > 0) update updSpecList;
+ }
+ // LHJ CHAN-BCLD4P 20190618 End
+
+ // MZY SWAG-BXXBKA 2021-02-19 start
+ System.debug('SWAG-BXXBKA start');
+ if (opdIds.size()>0) {
+ List<OPDPlan__c> updateOPDs = new List<OPDPlan__c>();
+
+ OPDPlan__c tempOPD = new OPDPlan__c();
+ for (String i :opdIds ) {
+ tempOPD.id = i;
+ tempOPD.AttachmentCertificate__c = opdMap.get(i);
+ updateOPDs.add(tempOPD);
+ }
+ System.debug('涓存椂OPD :'+tempOPD);
+ if (updateOPDs.size()>0){
+ update updateOPDs;
+ }
+ }
+ System.debug('SWAG-BXXBKA end');
+ // MZY SWAG-BXXBKA 2021-02-19 end
+
+ if(OpporFileIds.size()>0){
+ List<Opportunity_File__c> OpporList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c,
+ Stock_apply_time__c
+ from Opportunity_File__c
+ where id
+ in:OpporFileIds ];
+ if(OpporList.size()>0){
+ for(Opportunity_File__c ofc : OpporList){
+ if(!ofc.Is_Locked__c){
+ ofc.Last_upload_user__c = UserInfo.getUserId();
+ ofc.Last_upload_time__c = System.now();
+ System.debug(ofc+'23333');
+ }else{
+ OpporFileUndeleteMap.put(ofc.id,ofc.id);
+ System.debug(ofc+'23333444444');
+ }
+ }
+ update OpporList;
+ }
+ }
+ System.debug(Trigger.isDelete+'Trigger.isDelete');
+ System.debug(Trigger.isBefore+'Trigger.isBefore');
+
+ if(Trigger.isDelete && Trigger.isAfter){
+ for(ContentDocumentLink link : Trigger.old){
+ if(OpporFileUndeleteMap.containsKey(link.LinkedEntityId)){
+ link.addError('澶囪揣宸插鎵癸紝涓嶅彲鍒犻櫎闄勪欢');
+ return;
+ }else{
+ DeleteReIds.add(link.LinkedEntityId);
+ }
+ }
+ }
+
+
+ if(Trigger.isInsert){
+ for(ContentDocumentLink link : Trigger.new){
+ if(OpporFileUndeleteMap.containsKey(link.LinkedEntityId)){
+ ContentDocument doc = [select Id from ContentDocument where Id =: link.ContentDocumentId];
+ doc.addError('澶囪揣宸插鎵癸紝涓嶅彲鍒犻櫎闄勪欢');
+ // link.addError('澶囪揣宸插鎵癸紝涓嶅彲鍒犻櫎闄勪欢');
+
+ return;
+ }else{
+ DeleteReIds.add(link.LinkedEntityId);
+ }
+ }
+ }
+
+ // List<Attachment> atcList = [select id,ParentId,createddate,createdbyid from Attachment where ParentId in:DeleteReIds];
+ List<ContentDocumentLink> linkList = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId in:DeleteReIds];
+ List<Id> idList = new List<Id>();
+ for (ContentDocumentLink link : linkList) {
+ idList.add(link.ContentDocumentId);
+ }
+ List<ContentDocument> docList = [select Id,ArchivedDate,ArchivedById from ContentDocument where Id =: idList];
+ System.debug(DeleteReIds+'222222222222');
+ if(docList.size()>0){
+ for(String ids : DeleteReIds){
+ for(ContentDocument doc : docList){
+ if(OppordeleteReTimeMap.containsKey(ids)){
+ if(doc.ArchivedDate > OppordeleteReTimeMap.get(ids)){
+ OppordeleteReTimeMap.put(ids,doc.ArchivedDate);
+ OppordeleteReUserMap.put(ids,doc.ArchivedById);
+ }else{
+ continue;
+ }
+ }else{
+ OppordeleteReTimeMap.put(ids,doc.ArchivedDate);
+ OppordeleteReUserMap.put(ids,doc.ArchivedById);
+ }
+ }
+ }
+
+
+ List<Opportunity_File__c> reDateList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c
+ from Opportunity_File__c
+ where id
+ in:DeleteReIds ];
+ if(reDateList.size()>0){
+ for(Opportunity_File__c ofc : reDateList){
+ ofc.Last_upload_time__c = OppordeleteReTimeMap.get(ofc.id);
+ ofc.Last_upload_user__c = OppordeleteReUserMap.get(ofc.id);
+ System.debug(ofc+'233333333');
+ }
+ update reDateList;
+ }
+ }else{
+ List<Opportunity_File__c> reDateList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c
+ from Opportunity_File__c
+ where id
+ in:DeleteReIds ];
+ if(reDateList.size()>0){
+ for(Opportunity_File__c ofc : reDateList){
+ if (!ofc.Is_Locked__c) {
+ ofc.Last_upload_time__c = null;
+ ofc.Last_upload_user__c = null;
+ update reDateList;
+ }
+
+ }
+ }
+ }
+
+ //CHAN-BCNCRB ---XHL----Start-----
+ if (opportunity_FileIds.size() > 0) {
+ List<Opportunity_File__c> opporList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c,
+ Stock_apply_time__c,
+ Oppor_File_Stage__c
+ from Opportunity_File__c
+ where id in:opportunity_FileIds And Oppor_File_Stage__c = 'G'];
+ List<String> ofIds = new List<String>();
+ if (opporList.size() > 0) {
+
+ for (Opportunity_File__c oppf : opporList) {
+ ofIds.add(oppf.Id);
+ }
+
+ if (ofIds.size() > 0 ) {
+ // List<Attachment> atcList = [select id,ParentId,createddate,createdbyid from Attachment where ParentId in:ofIds];
+ List<ContentDocumentLink> linkList = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId in:ofIds];
+
+ List<Id> idList = new List<Id>();
+ for (ContentDocumentLink link : linkList) {
+ idList.add(link.ContentDocumentId);
+ }
+ List<ContentDocument> docList = [select Id from ContentDocument where Id in: idList];
+ if (docList.size() > 0) {
+ delete docList;
+ }
+ }
+
+
+ }
+ }
+ //CHAN-BCNCRB ---XHL----End-----
+
+
+ if (opportunityFileOrderIds.size() > 0) {
+ List<OpportunityFileOrder__c> ofoList = [select id,
+ OpporFileStage__c
+ from OpportunityFileOrder__c
+ where Id in:opportunityFileOrderIds And OpporFileStage__c = 'G'];
+ List<String> ofoIds = new List<String>();
+ if (ofoList.size() > 0) {
+
+ for (OpportunityFileOrder__c ofo : ofoList) {
+ ofoIds.add(ofo.Id);
+ }
+
+ if (ofoIds.size() > 0 ) {
+ // List<Attachment> atcList = [select id,ParentId,createddate,createdbyid from Attachment where ParentId in:ofoIds];
+ List<ContentDocumentLink> linkList = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId in:ofoIds];
+
+ List<Id> idList = new List<Id>();
+ for (ContentDocumentLink link : linkList) {
+ idList.add(link.ContentDocumentId);
+ }
+ List<ContentDocument> docList = [select Id from ContentDocument where Id in: idList];
+ if (docList.size() > 0) {
+ delete docList;
+ }
+ }
+
+
+ }
+ }
+
+ if (oFOrderIdMap.size() > 0) {
+
+ List<OpportunityFileOrder__c> oFOrderList = [select Id,Name,LatestUploadUser__c,LatestUploadTime__c
+ from OpportunityFileOrder__c
+ where Id In : oFOrderIdMap.keySet()];
+ if (oFOrderList.size() > 0 ) {
+
+ for (OpportunityFileOrder__c oFOrder :oFOrderList) {
+
+ if (oFOrderIdMap.get(oFOrder.Id)) {
+ oFOrder.LatestUploadUser__c = UserInfo.getUserId();
+ oFOrder.LatestUploadTime__c = System.now();
+ } else if (oFOrderIdMap.get(oFOrder.Id) == false){
+ oFOrder.LatestUploadUser__c = null;
+ oFOrder.LatestUploadTime__c = null;
+ }
+ }
+
+ update oFOrderList;
+
+ }
+ }
+ // DB202304087063 SFDC绯荤粺闄勪欢涓婁紶鑷姩閫氱煡鍔熻兘寮�鍙戦渶姹� start
+ if (Trigger.isInsert && Trigger.isAfter && false) {
+ AttachmentReQisHandler handler = new AttachmentReQisHandler();
+ handler.run();
+ }
+ // DB202304087063 SFDC绯荤粺闄勪欢涓婁紶鑷姩閫氱煡鍔熻兘寮�鍙戦渶姹� end
+
+
+
+
+
+
+
+
+
}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ContentDocumentTrigger.trigger b/force-app/main/default/triggers/ContentDocumentTrigger.trigger
new file mode 100644
index 0000000..c61899d
--- /dev/null
+++ b/force-app/main/default/triggers/ContentDocumentTrigger.trigger
@@ -0,0 +1,496 @@
+trigger ContentDocumentTrigger on ContentDocument (before delete) {
+ List<String> rentalIds = new List<String>();
+ List<String> attIds = new List<String>();
+ List<String> rentaldelIds = new List<String>();
+ List<String> attdelIds = new List<String>();
+ List<String> rentalApplyIds = new List<String>();
+ List<String> accIds = new List<String>();
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start
+ List<String> accAppIds = new List<String>();
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 end
+ // LHJ CHAN-BCLD4P 20190618 Start
+ List<String> specIds = new List<String>();
+ List<String> specDelIds = new List<String>();
+ // LHJ CHAN-BCLD4P 20190618 End
+
+ // MZY SWAG-BXXBKA 2021-02-19 start
+ List<String> opdIds = new List<String>();
+ Map<String,String> opdMap = new Map<String,String>();
+ // MZY SWAG-BXXBKA 2021-02-19 end
+
+ List<String> OpporFileIds = new List<String>();
+ Map<String,String> OpporFileUndeleteMap = new Map<String,String>();
+ List<String> DeleteReIds = new List<String>();
+ Map<String,String> OppordeleteReUserMap = new Map<String,String>();
+ Map<String,Datetime> OppordeleteReTimeMap = new Map<String,Datetime>();
+ //CHAN-BCNCRB ---XHL----Start-----
+ List<String> opportunity_FileIds = new List<String>();
+
+ List<String> opportunityFileOrderIds = new List<String>();
+ List<String> oFOrderIds = new List<String>();
+ Map<String,Boolean> oFOrderIdMap = new Map<String,Boolean>();
+
+ // sx 20230210start 澶囧搧鍊熷嚭鐢宠鏁呴殰鎶ュ憡闄勪欢鎻愬彇
+ List<String> rentalApplyFaultIds = new List<String>();
+ Map<String,List<Id>> trentalImages = new Map<String,List<Id>>();
+ List<String> rentaldeleteApplyFaultIds = new List<String>();
+ Map<String,List<Id>> deleteImages = new Map<String,List<Id>>();
+ // sx 20230210end 澶囧搧鍊熷嚭鐢宠鏁呴殰鎶ュ憡闄勪欢鎻愬彇
+
+ //CHAN-BCNCRB ---XHL----End-----
+
+ if (Trigger.isBefore && Trigger.isDelete) {
+ // List<Attachment> attDeleteList = new List<Attachment>();
+ List<ContentDocumentLink> conDeleteList = new List<ContentDocumentLink>();
+ for (ContentDocument doc : Trigger.old) {
+ List<ContentDocumentLink> link = [select LinkedEntityId from ContentDocumentLink where ContentDocumentId =: doc.Id limit 1];
+ //if (att.Name.toUpperCase() == '鍚堝悓涔�.PDF' && String.valueOf(att.ParentId).startsWith('a0t')) {
+ // 娣讳粯銇椼仧濂戠磩鏇搞伄銉曘偂銈ゃ儷鍚嶃伅鎸囧畾銇с亶銇亜
+ ContentVersion version = [select Id from ContentVersion where ContentDocumentId =: doc.Id];
+ if (String.valueOf(link[0].LinkedEntityId).startsWith('a2K')) {
+ rentaldelIds.add(link[0].LinkedEntityId);
+ attdelIds.add(version.Id);
+ }
+ if(String.valueOf(link[0].LinkedEntityId).startsWith(System.Label.Oppor_sepKey)){
+ OpporFileIds.add(link[0].LinkedEntityId);
+ }
+ // LHJ CHAN-BCLD4P 20190618 Start
+ if(String.valueOf(link[0].LinkedEntityId).startsWith(System.Label.OppSpecialApply)){
+ specDelIds.add(link[0].LinkedEntityId);
+ }
+ // LHJ CHAN-BCLD4P 20190618 End
+ if(String.valueOf(link[0].LinkedEntityId).startsWith('a3Z')){
+ oFOrderIds.add(link[0].LinkedEntityId);
+ oFOrderIdMap.put(link[0].LinkedEntityId,false);
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ Id cid = link[0].LinkedEntityId;
+ String parentLabel = cid.getSObjectType().getDescribe().getName();
+ if(parentLabel.equals('Rental_Apply_Fault__c')){
+ rentaldeleteApplyFaultIds.add(link[0].LinkedEntityId);
+ conDeleteList.add(link[0]);
+ if(deleteImages.containskey(version.Id)){
+ deleteImages.get(link[0].LinkedEntityId).add(version.Id);
+ }else{
+ List<Id> temp = new List<Id>();
+ temp.add(version.Id);
+ deleteImages.put(link[0].LinkedEntityId,temp);
+ }
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ List<Rental_Apply_Fault__c> rafList = [SELECT Id, Name FROM Rental_Apply_Fault__c WHERE Id IN: rentaldeleteApplyFaultIds AND (status__c = '宸插彂閫�' OR status__c = '宸插弽棣�')];
+ for (Rental_Apply_Fault__c raf : rafList) {
+ for (ContentDocumentLink link : conDeleteList) {
+ if (link.LinkedEntityId == raf.Id) {
+ ContentDocument doc = [select Id from ContentDocument where Id =: link.ContentDocumentId];
+ doc.addError('闈炶崏妗堜腑鐨勬娴嬪垎鏋愭姤鍛婁笉鍏佽鍒犻櫎宸蹭笂浼犵殑鏁呴殰鍥剧墖');
+ }
+ }
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
+ }
+
+
+
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� start
+ if(rentalApplyFaultIds.size() > 0){
+ List<Rental_Apply_Fault__c> renList = [SELECT Id,AttachmentId1__c,AttachmentId2__c from Rental_Apply_Fault__c where Id in :rentalApplyFaultIds];
+
+ system.debug('updrentalApplyFaultList====='+renList);
+ for(Rental_Apply_Fault__c ren : renList){
+ if(trentalImages.containskey(ren.Id)){
+ if (ren.AttachmentId1__c == null) {
+ ren.AttachmentId1__c = trentalImages.get(ren.id)[0];
+ } else if(ren.AttachmentId2__c == null) {
+ ren.AttachmentId2__c = trentalImages.get(ren.id)[0];
+ }
+ }
+ }
+ system.debug('updrentalApplyFaultList====='+renList);
+ UPDATE renList;
+ }
+
+ if(rentaldeleteApplyFaultIds.size() > 0){
+ List<Rental_Apply_Fault__c> renList = [SELECT Id,AttachmentId1__c,AttachmentId2__c from Rental_Apply_Fault__c where Id in :rentaldeleteApplyFaultIds];
+
+ system.debug('renList====='+renList);
+ for(Rental_Apply_Fault__c ren : renList){
+ if(deleteImages.containskey(ren.Id)){
+
+ if(deleteImages.get(ren.Id).contains(ren.AttachmentId1__c)){
+ ren.AttachmentId1__c = '';
+ }
+ if(deleteImages.get(ren.Id).contains(ren.AttachmentId2__c)){
+ ren.AttachmentId2__c = '';
+ }
+ }
+ }
+ system.debug('renList====='+renList);
+ UPDATE renList;
+ }
+ //2023-2-10 sx澶囧搧 澶囧搧妫�娴嬪垎鏋愭姤鍛� end
+
+
+ if (rentaldelIds.size() > 0) {
+ List<Consumable_accessories_invoice__c> rentaldelList = new List<Consumable_accessories_invoice__c>();
+ for (Consumable_accessories_invoice__c ra : [select Id from Consumable_accessories_invoice__c where Invoice_code__c in :rentaldelIds and Attachment_ID__c in :attdelIds]) {
+ rentaldelList.add(ra);
+ }
+ ControllerUtil.delConsumableAccessoriesInvoiceSet(rentaldelList);
+ }
+
+ if (rentalIds.size() > 0) {
+ List<Consumable_order__c> rentalList = new List<Consumable_order__c>();
+ for (Consumable_order__c ra : [select Id from Consumable_order__c where Id in :rentalIds]) {
+ ra.Consumable_pdf_insert_day__c = Date.today();
+ ra.Order_Attachment__c = attIds[0];
+ //ra.Order_status__c = '褰曞叆瀹屾垚';
+ //ra.Contract_pdf_updated__c = true;
+ rentalList.add(ra);
+ }
+ ControllerUtil.updRentalApplyList(rentalList);
+ }
+ if (rentalApplyIds.size() > 0) {
+ List<Rental_Apply__c> rentalApplyList = new List<Rental_Apply__c>();
+ for (Rental_Apply__c ra : [select Id from Rental_Apply__c where Id in :rentalApplyIds]) {
+ ra.Contract_pdf_update_day__c = Date.today();
+ ra.Contract_pdf_updated__c = true;
+ rentalApplyList.add(ra);
+ }
+ ControllerUtil.updRentalApplyList(rentalApplyList);
+ }
+
+ if (accIds.size() > 0) {
+ Map<String, String> attMap = new Map<String, String>();
+ // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accIds order by ParentId];
+ List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accIds order by LinkedEntityId];
+ for (ContentDocumentLink link : linkList) {
+ attMap.put(link.LinkedEntityId, link.LinkedEntityId);
+ }
+ List<Account> updAccList = new List<Account>();
+
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ List<Account> accList = [select id,Name,
+ Is_Active__c
+ from Account
+ where id in:accIds ];
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+
+ for (String accid : accIds) {
+ if(accList.size() > 0){
+ // Account acc = new Account(Id = accid);
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ for(Account acc : accList){
+
+ if(Trigger.isDelete && (Trigger.isBefore || Trigger.isAfter)){
+ for(ContentDocument doc : Trigger.old){
+ // if(attMap.containsKey(att.ParentID) && acc.Is_Active__c != '鑽夋涓�'){
+ if(acc.Is_Active__c != '鑽夋涓�'){
+ doc.addError('闈炶崏妗堜腑锛岄檮浠朵笉鍏佽鍒犻櫎銆�');
+
+ return;
+ }
+ }
+ }
+ acc.Is_upload_file__c = attMap.containsKey(accid);
+ updAccList.add(acc);
+ }
+ }
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+ }
+
+ // for (String accid : accIds) {
+ // Account acc = new Account(Id = accid);
+ // acc.Is_upload_file__c = attMap.containsKey(accid);
+ // updAccList.add(acc);
+ // }
+ if (updAccList.size() > 0) update updAccList;
+ }
+
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 start
+ if (accAppIds.size() > 0) {
+ Map<String, String> attMap = new Map<String, String>();
+ // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accAppIds order by ParentId];
+ List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: accAppIds order by LinkedEntityId];
+ for (ContentDocumentLink link : linkList) {
+ attMap.put(link.LinkedEntityId, link.LinkedEntityId);
+ }
+ List<Account_Delay_Apply__c> updAccAppList = new List<Account_Delay_Apply__c>();
+
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+ List<Account_Delay_Apply__c> adaList = [select id,Name,
+ Is_Active__c
+ from Account_Delay_Apply__c
+ where id in:accAppIds ];
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+
+ for (String accappid : accAppIds) {
+ if(adaList.size() > 0){
+ // Account_Delay_Apply__c accapp = new Account_Delay_Apply__c(Id = accappid);
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 start
+
+ for(Account_Delay_Apply__c accapp : adaList){
+ if(Trigger.isDelete){
+ for(ContentDocument doc : Trigger.old){
+ // if(attMap.containsKey(att.ParentID) && accapp.Is_Active__c != '鑽夋涓�'){
+ if(accapp.Is_Active__c != '鑽夋涓�'){
+ doc.addError('闈炶崏妗堜腑锛岄檮浠朵笉鍏佽鍒犻櫎銆�');
+
+ return;
+ }
+ }
+ }
+ accapp.Is_upload_file__c = attMap.containsKey(accappid);
+ updAccAppList.add(accapp);
+ }
+
+ }
+
+ //20221207 lt 鍖婚櫌瀹℃壒浼樺寲 end
+
+ }
+ if (updAccAppList.size() > 0) update updAccAppList;
+ }
+ //20221014 yc 鍖婚櫌瀹℃壒浼樺寲 end
+
+ // LHJ CHAN-BCLD4P 20190618 Start
+ if (specIds.size() > 0) {
+
+ Map<String, String> attMap = new Map<String, String>();
+ // List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :specIds order by ParentId];
+ List<ContentDocumentLink> linkList = [select LinkedEntityId from ContentDocumentLink where LinkedEntityId =: specIds order by LinkedEntityId];
+ for (ContentDocumentLink link : linkList) {
+ attMap.put(link.LinkedEntityId, link.LinkedEntityId);
+ }
+ List<OpportunitySpecialApply__c> updSpecList = new List<OpportunitySpecialApply__c>();
+ for (String specId : specIds) {
+ OpportunitySpecialApply__c spec = new OpportunitySpecialApply__c(Id = specId);
+ spec.Is_upload_file__c = attMap.containsKey(specId);
+ updSpecList.add(spec);
+ }
+ if (updSpecList.size() > 0) update updSpecList;
+ }
+ // LHJ CHAN-BCLD4P 20190618 End
+
+ // MZY SWAG-BXXBKA 2021-02-19 start
+ System.debug('SWAG-BXXBKA start');
+ if (opdIds.size()>0) {
+ List<OPDPlan__c> updateOPDs = new List<OPDPlan__c>();
+
+ OPDPlan__c tempOPD = new OPDPlan__c();
+ for (String i :opdIds ) {
+ tempOPD.id = i;
+ tempOPD.AttachmentCertificate__c = opdMap.get(i);
+ updateOPDs.add(tempOPD);
+ }
+ System.debug('涓存椂OPD :'+tempOPD);
+ if (updateOPDs.size()>0){
+ update updateOPDs;
+ }
+ }
+ System.debug('SWAG-BXXBKA end');
+ // MZY SWAG-BXXBKA 2021-02-19 end
+
+ if(OpporFileIds.size()>0){
+ List<Opportunity_File__c> OpporList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c,
+ Stock_apply_time__c
+ from Opportunity_File__c
+ where id
+ in:OpporFileIds ];
+ if(OpporList.size()>0){
+ for(Opportunity_File__c ofc : OpporList){
+ if(!ofc.Is_Locked__c){
+ ofc.Last_upload_user__c = UserInfo.getUserId();
+ ofc.Last_upload_time__c = System.now();
+ System.debug(ofc+'23333');
+ update ofc;
+ }else{
+
+ OpporFileUndeleteMap.put(ofc.id,ofc.id);
+ System.debug(ofc+'23333444444');
+ }
+ }
+ }
+ }
+ System.debug(Trigger.isDelete+'Trigger.isDelete');
+ System.debug(Trigger.isBefore+'Trigger.isBefore');
+
+
+
+ if(Trigger.isDelete && Trigger.isBefore){
+ for(ContentDocument doc : Trigger.old){
+ List<ContentDocumentLink> link = [select LinkedEntityId from ContentDocumentLink where ContentDocumentId =: doc.Id];
+ if(OpporFileUndeleteMap.containsKey(link[0].LinkedEntityId)){
+ doc.addError('澶囪揣宸插鎵癸紝涓嶅彲鍒犻櫎闄勪欢');
+ return;
+ }else{
+ }
+ }
+ }
+ if(Trigger.isDelete && Trigger.isAfter){
+ for(ContentDocument doc : Trigger.old){
+ List<ContentDocumentLink> link = [select LinkedEntityId from ContentDocumentLink where ContentDocumentId =: doc.Id];
+ if(OpporFileUndeleteMap.containsKey(link[0].LinkedEntityId)){
+ doc.addError('澶囪揣宸插鎵癸紝涓嶅彲鍒犻櫎闄勪欢');
+ return;
+ }else{
+ DeleteReIds.add(link[0].LinkedEntityId);
+ }
+ }
+ }
+
+
+ // List<Attachment> atcList = [select id,ParentId,createddate,createdbyid from Attachment where ParentId in:DeleteReIds];
+ if (DeleteReIds.size() > 0) {
+ List<ContentDocumentLink> linkList = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId =:DeleteReIds];
+ List<Id> idList = new List<Id>();
+ for (ContentDocumentLink link : linkList) {
+ idList.add(link.ContentDocumentId);
+ }
+ List<ContentDocument> docList = [select Id,ArchivedDate,ArchivedById from ContentDocument where Id =: idList];
+ System.debug(DeleteReIds+'222222222222');
+ if(docList.size()>0){
+ for(String ids : DeleteReIds){
+ for(ContentDocument doc : docList){
+ if(OppordeleteReTimeMap.containsKey(ids)){
+ if(doc.ArchivedDate > OppordeleteReTimeMap.get(ids)){
+ OppordeleteReTimeMap.put(ids,doc.ArchivedDate);
+ OppordeleteReUserMap.put(ids,doc.ArchivedById);
+ }else{
+ continue;
+ }
+ }else{
+ OppordeleteReTimeMap.put(ids,doc.ArchivedDate);
+ OppordeleteReUserMap.put(ids,doc.ArchivedById);
+ }
+ }
+ }
+
+
+ List<Opportunity_File__c> reDateList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c
+ from Opportunity_File__c
+ where id
+ in:DeleteReIds ];
+ if(reDateList.size()>0){
+ for(Opportunity_File__c ofc : reDateList){
+ ofc.Last_upload_time__c = OppordeleteReTimeMap.get(ofc.id);
+ ofc.Last_upload_user__c = OppordeleteReUserMap.get(ofc.id);
+ System.debug(ofc+'233333333');
+ }
+ update reDateList;
+ }
+ }else{
+ List<Opportunity_File__c> reDateList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c
+ from Opportunity_File__c
+ where id
+ in:DeleteReIds ];
+ if(reDateList.size()>0){
+ for(Opportunity_File__c ofc : reDateList){
+ ofc.Last_upload_time__c = null;
+ ofc.Last_upload_user__c = null;
+ }
+ update reDateList;
+ }
+ }
+ }
+
+
+ //CHAN-BCNCRB ---XHL----Start-----
+ if (opportunity_FileIds.size() > 0) {
+ List<Opportunity_File__c> opporList = [select id,Last_upload_time__c,
+ Is_Locked__c,
+ Last_upload_user__c,
+ Stock_apply_time__c,
+ Oppor_File_Stage__c
+ from Opportunity_File__c
+ where id in:opportunity_FileIds And Oppor_File_Stage__c = 'G'];
+ List<String> ofIds = new List<String>();
+ if (opporList.size() > 0) {
+
+ for (Opportunity_File__c oppf : opporList) {
+ ofIds.add(oppf.Id);
+ }
+
+ if (ofIds.size() > 0 ) {
+ // List<Attachment> atcList = [select id,ParentId,createddate,createdbyid from Attachment where ParentId in:ofIds];
+ List<ContentDocumentLink> linkList = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId in: ofIds];
+
+ List<Id> idList = new List<Id>();
+ for (ContentDocumentLink link : linkList) {
+ idList.add(link.ContentDocumentId);
+ }
+ List<ContentDocument> docList = [select Id from ContentDocument where Id in: idList];
+ if (docList.size() > 0) {
+ delete docList;
+ }
+ }
+
+
+ }
+ }
+ //CHAN-BCNCRB ---XHL----End-----
+
+
+ if (opportunityFileOrderIds.size() > 0) {
+ List<OpportunityFileOrder__c> ofoList = [select id,
+ OpporFileStage__c
+ from OpportunityFileOrder__c
+ where Id in:opportunityFileOrderIds And OpporFileStage__c = 'G'];
+ List<String> ofoIds = new List<String>();
+ if (ofoList.size() > 0) {
+
+ for (OpportunityFileOrder__c ofo : ofoList) {
+ ofoIds.add(ofo.Id);
+ }
+
+ if (ofoIds.size() > 0 ) {
+ // List<Attachment> atcList = [select id,ParentId,createddate,createdbyid from Attachment where ParentId in:ofoIds];
+ List<ContentDocumentLink> linkList = [select ContentDocumentId from ContentDocumentLink where LinkedEntityId in:ofoIds];
+
+ List<Id> idList = new List<Id>();
+ for (ContentDocumentLink link : linkList) {
+ idList.add(link.ContentDocumentId);
+ }
+ List<ContentDocument> docList = [select Id from ContentDocument where Id in: idList];
+ if (docList.size() > 0) {
+ delete docList;
+ }
+ }
+
+
+ }
+ }
+
+ if (oFOrderIdMap.size() > 0) {
+
+ List<OpportunityFileOrder__c> oFOrderList = [select Id,Name,LatestUploadUser__c,LatestUploadTime__c
+ from OpportunityFileOrder__c
+ where Id In : oFOrderIdMap.keySet()];
+ if (oFOrderList.size() > 0 ) {
+
+ for (OpportunityFileOrder__c oFOrder :oFOrderList) {
+
+ if (oFOrderIdMap.get(oFOrder.Id)) {
+ oFOrder.LatestUploadUser__c = UserInfo.getUserId();
+ oFOrder.LatestUploadTime__c = System.now();
+ } else if (oFOrderIdMap.get(oFOrder.Id) == false){
+ oFOrder.LatestUploadUser__c = null;
+ oFOrder.LatestUploadTime__c = null;
+ }
+ }
+
+ update oFOrderList;
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml b/force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml
new file mode 100644
index 0000000..b01a1f0
--- /dev/null
+++ b/force-app/main/default/triggers/ContentDocumentTrigger.trigger-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>57.0</apiVersion>
+ <status>Active</status>
+</ApexTrigger>
diff --git a/force-app/main/default/triggers/ContentVersionTrigger.trigger b/force-app/main/default/triggers/ContentVersionTrigger.trigger
new file mode 100644
index 0000000..afa6410
--- /dev/null
+++ b/force-app/main/default/triggers/ContentVersionTrigger.trigger
@@ -0,0 +1,3 @@
+trigger ContentVersionTrigger on ContentVersion (before update,after update) {
+
+}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml b/force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml
new file mode 100644
index 0000000..24523ca
--- /dev/null
+++ b/force-app/main/default/triggers/ContentVersionTrigger.trigger-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>56.0</apiVersion>
+ <status>Active</status>
+</ApexTrigger>
diff --git a/force-app/main/default/triggers/NotetoPdf.trigger b/force-app/main/default/triggers/NotetoPdf.trigger
new file mode 100644
index 0000000..a5e11e5
--- /dev/null
+++ b/force-app/main/default/triggers/NotetoPdf.trigger
@@ -0,0 +1,9 @@
+/**
+ * SFDC绯荤粺妗堜欢锛堜慨鐞�/QIS锛変腑鏂板缓闄勪欢鎴栧娉ㄦ椂锛�
+ * 绯荤粺鑷姩閫氱煡鍒扮浉鍏充笟鍔′汉鍛�
+ * 鍏朵腑澶囨敞浼氳嚜鍔ㄧ敓鎴怭DF闄勪欢
+ */
+trigger NotetoPdf on Note(after insert) {
+ NotetoPdfHandler handler = new NotetoPdfHandler();
+ handler.run();
+}
\ No newline at end of file
diff --git a/force-app/main/default/triggers/NotetoPdf.trigger-meta.xml b/force-app/main/default/triggers/NotetoPdf.trigger-meta.xml
new file mode 100644
index 0000000..6205514
--- /dev/null
+++ b/force-app/main/default/triggers/NotetoPdf.trigger-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata">
+ <apiVersion>41.0</apiVersion>
+ <status>Active</status>
+</ApexTrigger>
--
Gitblit v1.9.1