public with sharing class RepPAEDecisionRecordController {
|
public PAE_DecisionRecord__c rdRecord {
|
get;
|
set;
|
}
|
//PAE判定记录的Id
|
public String Id {
|
get;
|
set;
|
}
|
//PAE判定记录的记录类型Id
|
public String RecordTypeId;
|
public String RecordTypeIdD;
|
public String RecordTypeName {
|
get;
|
set;
|
}
|
public String ASac_ASrc;
|
public Boolean editAble {
|
get;
|
set;
|
}
|
// 保存按钮 需要考虑再现/不再现的更新了。
|
// 简档:2F4_技术推进部,2F4_技术推进部_非SSO,2F2B_服务管理,系统管理员的人操作的时候,需要允许操作【保存】。
|
public Boolean savebuton {
|
get;
|
set;
|
}
|
public Integer CancelineFlag {
|
get;
|
set;
|
}
|
public String OCSM_QARA {
|
get;
|
set;
|
} //20200310
|
public String OCSM_Cording {
|
get;
|
set;
|
} //20200310
|
public String intakePAEReappearConfirm {
|
get;
|
set;
|
}
|
// 如果Repair__c 中DOJ_Status__c 的字段值为待EtQ Response 或者
|
// Report__c 中ComplaintStatus__c 的字段值为待EtQ Response 将标记改为true
|
// 影响至对应页面中的按钮是否可用
|
public Boolean editFlag {
|
get;
|
set;
|
}
|
// 当前报告书
|
public Report__c repa {
|
get;
|
set;
|
}
|
// 是否是OSH
|
public Boolean isOSH {
|
get;
|
set;
|
}
|
public String ReportId {
|
get;
|
set;
|
}
|
public String productIdx {
|
get;
|
set;
|
}
|
//页面的明细
|
public List < PAE_DecisionRecordDetailInfo > paedRecordDetailView {
|
get;
|
set;
|
}
|
public Integer paedRecordDetailViewCount {
|
get {
|
return paedRecordDetailView == null ? 0 : paedRecordDetailView.size();
|
}
|
}
|
public RepPAEDecisionRecordController(ApexPages.StandardController stdController) {
|
Id = ApexPages.currentPage().getParameters().get('Id');
|
String profileId = UserInfo.getProfileId();
|
// 当前用户是否在 OSH自定义标签中
|
isOSH = System.label.OSH.contains(profileId);
|
System.debug('isOSH+' + isOSH);
|
// 判断Report__c的ComplaintStatus__c字段值是否为待EtQ Response
|
ReportId = ApexPages.currentPage().getParameters().get('ReportId');
|
List < Report__c > Rep = [select id, name, ComplaintStatus__c, AsyncData__c from Report__c where id = : ReportId];
|
//精琢科技 zxk 2021-11-03 根据修理进行的修改 start
|
if (Rep.size() > 0){
|
repa = Rep.get(0);
|
system.debug('+++++++++++++++++'+repa);
|
if ('待EtQ Response'.equals(Rep.get(0).ComplaintStatus__c)) {
|
editFlag = true;
|
}
|
}
|
//精琢科技 zxk 2021-11-03 根据修理进行的修改 end
|
|
// if (Rep.size() > 0 && '待EtQ Response'.equals(Rep.get(0).ComplaintStatus__c)) {
|
// editFlag = true;
|
// }
|
paedRecordDetailView = new List < PAE_DecisionRecordDetailInfo > ();
|
editAble = false;
|
CancelineFlag = 2;
|
productIdx = '';
|
// PAE_DecisionRecord__c 记录类型 ASRCDecision ASACDecision
|
// ASRCDecision --> Intake
|
// ASACDecision --> Final
|
RecordTypeName = ApexPages.currentPage().getParameters().get('RecordTypeIds');
|
}
|
public void init() {
|
editAble = true;
|
//当前登录着的ProfileId
|
String profileId = UserInfo.getProfileId().substring(0, 15);
|
//118_CFDA(质量法规本部)担当 简档ID和 118_CFDA(质量法规本部)窗口 简档ID和管理员
|
if (profileId.equals(System.Label.ProfileId_OCSM_QARA1) || profileId.equals(System.Label.ProfileId_OCSM_QARA2) || UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)) {
|
OCSM_QARA = '1';
|
} else {
|
OCSM_QARA = '0';
|
}
|
//ProfileId 2F2B_2F4
|
if (System.Label.ProfileId2F2B_2F4.contains(profileId)) {
|
OCSM_Cording = '1';
|
} else {
|
OCSM_Cording = '0';
|
}
|
if (System.Label.ProfileId2F2B_2F4.contains(profileId) || UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin) {
|
savebuton = true;
|
} else {
|
savebuton = false;
|
}
|
if (String.isNotBlank(RecordTypeName)) {
|
RecordTypeId = Schema.SObjectType.PAE_DecisionRecord__c.getRecordTypeInfosByDeveloperName().get(RecordTypeName).getRecordTypeId();
|
} else {
|
List < PAE_DecisionRecord__c > paedRdList = [select Id, PAE_Report__c, RecordTypeId, PAEDetail_DetermineResults__c, RecordType.DeveloperName from PAE_DecisionRecord__c where Id = : Id];
|
if (paedRdList.size() > 0) {
|
RecordTypeName = paedRdList[0].RecordType.DeveloperName;
|
RecordTypeId = paedRdList[0].PAE_Report__c;
|
}
|
}
|
if ('ASRCDecision' == RecordTypeName) {
|
ASac_ASrc = 'Intake';
|
RecordTypeIdD = Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('intake').getRecordTypeId();
|
} else if ('ASACDecision' == RecordTypeName) {
|
ASac_ASrc = 'Final';
|
RecordTypeIdD = Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('final').getRecordTypeId();
|
}
|
rdRecord = new PAE_DecisionRecord__c();
|
Report__c repair1OrQIS1;
|
if (!string.isBlank(ReportId)) {
|
repair1OrQIS1 = [select id, PAE_codez__c, PAE_temp_final_code__c, PAE_reappear_confirm__c from Report__c where id = : ReportId];
|
}
|
Map < String, PAE_DecisionRecordDetailInfo > MidMap = new Map < String, PAE_DecisionRecordDetailInfo > ();
|
if (Id == NULL || Id == '') {
|
if (string.isnotBlank(ReportId)) {
|
rdRecord.PAE_reappear_confirm__c = repair1OrQIS1.PAE_reappear_confirm__c;
|
}
|
//预留一行
|
PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
|
paedrd.PAED_Status__c = '有效';
|
paedrd.RecordTypeId = RecordTypeIdD;
|
paedRecordDetailView.add(new PAE_DecisionRecordDetailInfo(paedrd));
|
//预留一行
|
} else {
|
List < PAE_DecisionRecord__c > rdRecordList = new List < PAE_DecisionRecord__c > ();
|
List < PAE_DecisionRecordDetail__c > rdRecordDetailList = new List < PAE_DecisionRecordDetail__c > ();
|
rdRecordList = [SELECT Id, Name, CurrencyIsoCode, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById,
|
SystemModstamp, PAE_DetermineResults__c, PAE_ConfirmationDate__c,
|
PAE_Authenticator__c, PAE_reappear_confirm__c,
|
PAEDetail_DetermineResults__c, PAE_DetermineResults_Text__c
|
FROM PAE_DecisionRecord__c where Id = : Id
|
];
|
if (rdRecordList.size() > 0) {
|
rdRecord = rdRecordList[0];
|
}
|
//PAE_reappear_confirm__c 再现结果确认
|
if (string.isnotBlank(ReportId)) {
|
rdRecord.PAE_reappear_confirm__c = repair1OrQIS1.PAE_reappear_confirm__c;
|
}
|
rdRecordDetailList = [SELECT Id, IsDeleted, Name, CurrencyIsoCode, CreatedDate, CreatedById,
|
LastModifiedDate, LastModifiedById, SystemModstamp, PAE_DecisionRecordD__c,
|
PAED_ManagementCode__c, PAE_Judge__c, PAED_Reappear_Result__c, PAED_ResultAffirmant__r.Name,
|
PAED_ResultConfirmationDate__c, Final_universal_code__c,
|
PAED_Status__c, PAED_ConfirmationDate__c, PAED_Affirmant__c, PAE_is_save__c,
|
PAED_Affirmant__r.Name, PAED_RCAC__c, PAED_CancellationDate__c, PAED_Nullifier__c,
|
PAED_Nullifier__r.Name, isInterfaceCreate__c, Location__c, LocationGroup__c, FinalUniversalDesc__c,
|
Phenomenon__c, IntakeUniversalDesc__c, PhenomenonDesc__c,
|
// NFM109信息获取,Gzw add 20200826
|
Description__c, Cause__c, EtqPart__c, EtqAsAnalyzed__c, EtqCause__c,
|
InspectionCategory109__c, PAED_Affirmant_F__c, PAED_ConfirmationDate_F__c,
|
//课题94 add by rentongxiao 2020-10-10 start
|
PAED_ResultAffirmant_new__c
|
//add by rentx 2020-11-04
|
, isedit__c, RecordTypeId
|
// RVS005信息获取 gzw add 20201126 start
|
, RVSDetailNo__c, RVS_Date__c, RVS_Time__c, RVS_Decision_Person__c, Monitor_PAE__c
|
// RVS005信息获取 gzw add 20201126 end
|
FROM PAE_DecisionRecordDetail__c
|
where PAE_DecisionRecordD__c = : Id Order by PAED_Status__c, PAED_ManagementCode__c ASC
|
];
|
for (Integer i = 0; i < rdRecordDetailList.size(); i++) {
|
MidMap.put(rdRecordDetailList[i].Id, new PAE_DecisionRecordDetailInfo(rdRecordDetailList[i]));
|
}
|
for (PAE_DecisionRecordDetailInfo paeDrd: MidMap.values()) {
|
paedRecordDetailView.add(paeDrd);
|
}
|
}
|
}
|
//保存并关闭
|
public PageReference SaveAndClose() {
|
// 取消行
|
if (CancelineFlag == 3) {
|
Integer FLG = 0;
|
Integer Count = 0;
|
for (PAE_DecisionRecordDetailInfo CheckCount: paedRecordDetailView) {
|
FLG = FLG + 1;
|
if (CheckCount.check == false) {
|
Count = Count + 1;
|
}
|
}
|
if (Count == FLG) {
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请选择要取消的行'));
|
return null;
|
}
|
}
|
List < PAE_DecisionRecordDetail__c > insertPaeDRDList = new List < PAE_DecisionRecordDetail__c > ();
|
Savepoint sp = Database.setSavepoint();
|
PAE_DecisionRecord__c paedRecord = new PAE_DecisionRecord__c();
|
String paedRecordId = '';
|
//明细有效状态此记录的总数量
|
//明细有效状态此记录的PAE数量
|
//明细有效状态此记录的Unknown数量
|
//明细有效状态此记录的NonPAE数量
|
Integer PAE_Judge_num = 0;
|
Integer PAE_Judge_num_PAE = 0;
|
Integer PAE_Judge_num_Unknown = 0;
|
Integer PAE_Judge_num_nonPAE = 0;
|
String PAE_DetermineResults = null;
|
String prevDetermineResults = null;
|
// try {
|
//明细有效状态此记录的总数量
|
//明细有效状态此记录的PAE数量
|
//明细有效状态此记录的Unknown数量
|
//明细有效状态此记录的NonPAE数量
|
//如果Code包含汉字或超过15字数的化,需要提醒。【Intake universal code不可以使用汉字,不可以超过15字数】
|
for (PAE_DecisionRecordDetailInfo rdRecorddl: paedRecordDetailView) {
|
if (!(rdRecorddl.check && CancelineFlag == 3) && rdRecorddl.paedrdd.PAED_Status__c != '取消') {
|
PAE_Judge_num++;
|
if (rdRecorddl.paedrdd.PAE_Judge__c == 'PAE') {
|
PAE_Judge_num_PAE++;
|
}
|
if (rdRecorddl.paedrdd.PAE_Judge__c == 'Unknown') {
|
PAE_Judge_num_Unknown++;
|
}
|
if (rdRecorddl.paedrdd.PAE_Judge__c == 'nonPAE') {
|
PAE_Judge_num_nonPAE++;
|
}
|
// gzw 20210409 修改参数为空时,表达式判断出错问题
|
if (Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('intake').getRecordTypeId() == rdRecorddl.paedrdd.RecordTypeId && (containsChineseCharacters(rdRecorddl.paedrdd.PAED_ManagementCode__c) || (String.isNotBlank(rdRecorddl.paedrdd.PAED_ManagementCode__c) && rdRecorddl.paedrdd.PAED_ManagementCode__c.length() > 15))) {
|
rdRecorddl.paedrdd.PAED_ManagementCode__c.adderror('Intake universal code不可以使用汉字,不可以超过15字数。');
|
return null;
|
}
|
}
|
System.debug('rdRecorddl.paedrdd.Location__c' + rdRecorddl.paedrdd.Location__c);
|
}
|
if (PAE_Judge_num_PAE > 0) {
|
PAE_DetermineResults = 'PAE';
|
} else if (PAE_Judge_num_Unknown > 0) {
|
PAE_DetermineResults = 'Unknown';
|
} else if (PAE_Judge_num_nonPAE == PAE_Judge_num && PAE_Judge_num_nonPAE > 0) {
|
PAE_DetermineResults = 'nonPAE';
|
} else {
|
PAE_DetermineResults = null;
|
}
|
rdRecord.PAE_DetermineResults_Text__c = PAE_DetermineResults;
|
//System.debug('-----------------------:' + PAE_DetermineResults);
|
//新增PAE判定
|
if (String.isBlank(Id)) {
|
//检查明细的编码是否为空---20200107 add 检查明细的PAE判定是否必填
|
if (IsEmptyManagementCode(paedRecordDetailView)) {
|
return null;
|
}
|
paedRecord.PAE_Report__c = ReportId;
|
paedRecord.PAE_reappear_confirm__c = rdRecord.PAE_reappear_confirm__c; // 20200908 Gzw Final 再现结果丢失问题 add
|
paedRecord.RecordTypeId = RecordTypeId;
|
insert paedRecord;
|
paedRecordId = paedRecord.Id;
|
UpsertPAE_DecisionRecordDetail(null, paedRecordDetailView, paedRecordId, false, prevDetermineResults);
|
} else {
|
//修改PAE变更
|
List < PAE_DecisionRecord__c > paedRecordList = [select Id, PAE_DetermineResults__c, PAE_DetermineResults_Text__c, PAE_reappear_confirm__c from PAE_DecisionRecord__c where Id = : Id];
|
List < PAE_DecisionRecordDetail__c > rdRecordDetailList = new List < PAE_DecisionRecordDetail__c > ();
|
//存在的明细Map
|
Map < Id, PAE_DecisionRecordDetail__c > paedRecordStatusMap = new Map < Id, PAE_DecisionRecordDetail__c > ();
|
rdRecordDetailList = [SELECT Id, IsDeleted, Name, CurrencyIsoCode, CreatedDate, CreatedById,
|
LastModifiedDate, LastModifiedById, SystemModstamp, PAE_DecisionRecordD__c,
|
PAED_ManagementCode__c, PAE_Judge__c, PAED_Reappear_Result__c, PAED_ResultAffirmant__r.Name,
|
PAED_ResultConfirmationDate__c, Final_universal_code__c,
|
PAED_Status__c, PAED_ConfirmationDate__c, PAED_Affirmant__c, PAE_is_save__c,
|
PAED_Affirmant__r.Name, PAED_RCAC__c, PAED_CancellationDate__c, PAED_Nullifier__c,
|
PAED_Nullifier__r.Name, isInterfaceCreate__c, Location__c, LocationGroup__c, FinalUniversalDesc__c,
|
Phenomenon__c, IntakeUniversalDesc__c, PhenomenonDesc__c,
|
// NFM109信息获取,Gzw add 20200826
|
Description__c, Cause__c, EtqPart__c, EtqAsAnalyzed__c, EtqCause__c,
|
InspectionCategory109__c, PAED_Affirmant_F__c, PAED_ConfirmationDate_F__c,
|
//课题94 add by rentongxiao 2020-10-10 start
|
PAED_ResultAffirmant_new__c
|
//add by rentx
|
, isedit__c, RecordTypeId
|
// RVS005信息获取 gzw add 20201126 start
|
, RVSDetailNo__c, RVS_Date__c, RVS_Time__c, RVS_Decision_Person__c, Monitor_PAE__c
|
// RVS005信息获取 gzw add 20201126 end
|
FROM PAE_DecisionRecordDetail__c
|
where PAE_DecisionRecordD__c = : Id Order by PAED_Status__c, PAED_ManagementCode__c
|
];
|
if (rdRecordDetailList.size() > 0) {
|
for (PAE_DecisionRecordDetail__c paedrd: rdRecordDetailList) {
|
paedRecordStatusMap.put(paedrd.Id, paedrd);
|
}
|
}
|
system.debug('paedRecordStatusMap===========>'+paedRecordStatusMap);
|
if (paedRecordList.size() > 0) {
|
//PAE判定的Id
|
paedRecordId = paedRecordList[0].Id;
|
//PAE判定记录的状态不变
|
prevDetermineResults = paedRecordList[0].PAE_DetermineResults_Text__c;
|
if (paedRecordList[0].PAE_DetermineResults_Text__c == PAE_DetermineResults) {
|
//检查明细的编码是否为空---20200107 add 检查明细的PAE判定是否必填
|
if (IsEmptyManagementCode(paedRecordDetailView)) {
|
return null;
|
}
|
UpsertPAE_DecisionRecordDetail(paedRecordStatusMap, paedRecordDetailView, paedRecordId, false, prevDetermineResults);
|
} else if (paedRecordList[0].PAE_DetermineResults_Text__c != PAE_DetermineResults) {
|
//PAE判定记录的状态改变
|
//检查明细的编码是否为空---20200107 add 检查明细的PAE判定是否必填
|
if (IsEmptyManagementCode(paedRecordDetailView)) {
|
return null;
|
}
|
insertPaeDRDList = new List < PAE_DecisionRecordDetail__c > ();
|
paedRecord.PAE_DetermineResults_Text__c = PAE_DetermineResults;
|
paedRecord.PAE_Report__c = ReportId;
|
paedRecord.RecordTypeId = RecordTypeId;
|
insert paedRecord;
|
paedRecordId = paedRecord.Id;
|
UpsertPAE_DecisionRecordDetail(paedRecordStatusMap, paedRecordDetailView, paedRecordId, true, prevDetermineResults);
|
}
|
}
|
}
|
// } catch (Exception e) {
|
// ApexPages.addMessages(e);
|
// Database.rollback(sp);
|
// return null;
|
// }
|
if (CancelineFlag != 2) {
|
return RefreshOriginalInterface(paedRecordId);
|
} else {
|
return ReturnReportInterface();
|
}
|
}
|
//返回报告书页面
|
public PageReference ReturnReportInterface() {
|
PageReference ref;
|
system.debug('啦啦啦ReportId1' + ReportId);
|
if (String.isnotBlank(ReportId)) {
|
ref = new Pagereference('/' + ReportId);
|
}
|
//PageReference ref = new Pagereference('/' + ReportId);
|
ref.setRedirect(true);
|
return ref;
|
}
|
//留在当前页面
|
public PageReference RefreshOriginalInterface(String paedRecordId) {
|
PageReference ref;
|
if (String.isnotBlank(ReportId)) {
|
ref = new Pagereference('/apex/RepPAEDecisionRecord?Id=' + paedRecordId + '&ReportId=' + ReportId + '&RecordTypeIds=' + RecordTypeName);
|
}
|
ref.setRedirect(true);
|
return ref;
|
}
|
//返回Intake页面
|
public PageReference toIntake() {
|
String url = null;
|
if (String.isnotBlank(ReportId)) {
|
List < PAE_DecisionRecord__c > pAE_DecisionRecord = [SELECT LastModifiedDate, Id, Name, LastModifiedById, RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Report__c = : ReportId And RecordType.DeveloperName = 'ASRCDecision'
|
Order by LastModifiedDate desc
|
];
|
if (pAE_DecisionRecord.size() > 0) {
|
url = '/apex/RepPAEDecisionRecord?Id=' + pAE_DecisionRecord[0].Id + '&ReportId=' + ReportId + '&RecordTypeIds=ASRCDecision';
|
} else {
|
url = '/apex/RepPAEDecisionRecord?ReportId=' + ReportId + '&RecordTypeIds=ASRCDecision';
|
}
|
}
|
PageReference ref = new Pagereference(url);
|
ref.setRedirect(true);
|
return ref;
|
}
|
//插入空行
|
public PageReference InsertRow() {
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 start
|
List < String > codeNumDataList = new List < String > ();
|
for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
|
String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
|
if (String.isBlank(pdrdInFoCode.paedrdd.id) && String.isNotBlank(managementCodeStr)) {
|
codeNumDataList.add(managementCodeStr);
|
}
|
}
|
Map < String, String > strMapData = updateIsPae(codeNumDataList);
|
for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
|
String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
|
if (String.isBlank(pdrdInFoCode.paedrdd.Id)) {
|
if (String.isNotBlank(managementCodeStr)) {
|
if (pdrdInFoCode.paedrdd.PAE_Judge__c != strMapData.get(managementCodeStr) || String.isBlank(strMapData.get(managementCodeStr))) {
|
pdrdInFoCode.monitorPAE = true;
|
} else {
|
pdrdInFoCode.monitorPAE = false;
|
}
|
}
|
}
|
}
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 end
|
PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
|
paedrd.PAED_Status__c = '有效';
|
paedrd.RecordTypeId = RecordTypeIdD;
|
// Integer styNum = paedRecordDetailView.size();
|
paedRecordDetailView.add(new PAE_DecisionRecordDetailInfo(paedrd));
|
return null;
|
}
|
//批量插入空行字符串
|
public void InsertMoreRows() {
|
// 精琢科技 zxk 2021-10-21 start 给PAE判定记录赋值
|
List < String > codeNumDataList = new List < String > ();
|
for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
|
String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
|
if (String.isBlank(pdrdInFoCode.paedrdd.id) && String.isNotBlank(managementCodeStr)) {
|
// && pdrdInFoCode.paedrdd.PAE_is_save__c != '1'
|
for (String codeStr: managementCodeStr.split(',')) {
|
if (String.isNotBlank(codeStr)) {
|
codeNumDataList.add(codeStr);
|
}
|
}
|
}
|
}
|
Map < String, String > strMapData = updateIsPae(codeNumDataList);
|
// 精琢科技 zxk 2021-10-21 end 给PAE判定记录赋值
|
List < PAE_DecisionRecordDetailInfo > paedRecordDetailViewTemporary = new List < PAE_DecisionRecordDetailInfo > ();
|
List < String > codeList = new List < String > ();
|
for (PAE_DecisionRecordDetailInfo paedRDInfo: paedRecordDetailView) {
|
String managementCode = paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
String finalUniversalCode = paedRDInfo.paedrdd.Final_universal_code__c;
|
Date confirmationDate = paedRDInfo.paedrdd.PAED_ConfirmationDate__c;
|
String pStatus = paedRDInfo.paedrdd.PAED_Status__c;
|
PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
|
// 20210719 gzw LJPH-C4Y57Q start
|
if (managementCode == '000' && paedRDInfo.paedrdd.PAE_Judge__c == null) {
|
paedRDInfo.paedrdd.PAE_Judge__c = 'Unknown';
|
}
|
// 20210719 gzw LJPH-C4Y57Q end
|
if (paedRDInfo.paedrdd.PAED_Status__c != '取消') {
|
if (String.isBlank(finalUniversalCode) && confirmationDate == null) {
|
if (String.isNotBlank(managementCode)) {
|
if (managementCode.indexof(',') != -1) {
|
Integer q = 1;
|
for (String code: managementCode.split(',')) {
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 start
|
PAE_DecisionRecordDetailInfo info = new PAE_DecisionRecordDetailInfo();
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 end
|
// bug fix gzw 已有的空code数据,数据数据时,会新建 20201214 start
|
PAE_DecisionRecordDetail__c paedrdtemp;
|
if (q == 1) {
|
paedrdtemp = paedRDInfo.paedrdd;
|
} else {
|
paedrdtemp = new PAE_DecisionRecordDetail__c();
|
}
|
paedrd = ReproduceResult(paedrdtemp, paedRDInfo); //20200106 add
|
// bug fix gzw 已有的空code数据,数据数据时,会新建 20201214 start
|
paedrd.PAED_Status__c = '有效';
|
paedrd.PAED_ManagementCode__c = code;
|
if (code == '000') {
|
paedrd.PAE_Judge__c = 'Unknown';
|
}
|
paedrd.RecordTypeId = RecordTypeIdD;
|
paedrd.PAE_is_save__c = '';
|
// 精琢科技 zxk 2021-10-21 start 给PAE判定记录赋值
|
if (strMapData.containsKey(code)) {
|
paedrd.PAE_Judge__c = strMapData.get(code);
|
info.strJudge = strMapData.get(code);
|
info.monitorPAE = false;
|
paedrd.Monitor_PAE__c = false;
|
} else if (managementCode.indexof(code) != -1) {
|
paedrd.PAE_Judge__c = null;
|
info.strJudge = paedRDInfo.strJudge;
|
info.monitorPAE = true;
|
}
|
if (paedrd.PAE_Judge__c == null || paedrd.PAE_Judge__c == '') {
|
paedrd.Monitor_PAE__c = true;
|
info.monitorPAE = true;
|
}
|
info.paedrdd = paedrd;
|
paedRecordDetailViewTemporary.add(info);
|
// 精琢科技 zxk 2021-10-21 end 给PAE判定记录赋值
|
q++;
|
}
|
} else {
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 start
|
PAE_DecisionRecordDetailInfo info = new PAE_DecisionRecordDetailInfo();
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 end
|
// bug fix gzw 已有的空code数据,数据数据时,会新建 20201214 start
|
PAE_DecisionRecordDetail__c paedrdtemp = paedRDInfo.paedrdd;
|
paedrd = ReproduceResult(paedrdtemp, paedRDInfo); //20200106 add
|
// bug fix gzw 已有的空code数据,数据数据时,会新建 20201214 end
|
paedrd.PAED_Status__c = '有效';
|
paedrd.RecordTypeId = RecordTypeIdD;
|
paedrd.PAED_ManagementCode__c = managementCode;
|
// 精琢科技 zxk 2021-10-21 start 给PAE判定记录赋值
|
if (strMapData.containsKey(managementCode) && productIdx == managementCode) {
|
paedrd.PAE_Judge__c = strMapData.get(managementCode);
|
info.strJudge = strMapData.get(managementCode);
|
info.monitorPAE = false;
|
paedrd.Monitor_PAE__c = false;
|
} else {
|
info.strJudge = paedRDInfo.strJudge;
|
if (strMapData.get(managementCode) != paedRDInfo.paedrdd.PAE_Judge__c || (paedrd.PAE_Judge__c == null || paedrd.PAE_Judge__c == '')) {
|
|
info.monitorPAE = true;
|
}
|
}
|
if (paedrd.PAE_Judge__c == null || paedrd.PAE_Judge__c == '') {
|
paedrd.Monitor_PAE__c = true;
|
// info.monitorPAE = true;
|
}
|
info.paedrdd = paedrd;
|
paedRecordDetailViewTemporary.add(info);
|
// 精琢科技 zxk 2021-10-21 end 给PAE判定记录赋值
|
}
|
} else {
|
// Gzw 20201215 编辑页面空白行失去焦点后行消失 对应
|
paedRecordDetailViewTemporary.add(paedRDInfo);
|
}
|
} else {
|
paedRecordDetailViewTemporary.add(paedRDInfo);
|
}
|
} else {
|
paedRecordDetailViewTemporary.add(paedRDInfo);
|
}
|
}
|
if (paedRecordDetailViewTemporary != null) {
|
paedRecordDetailView = new List < PAE_DecisionRecordDetailInfo > ();
|
paedRecordDetailView.addAll(paedRecordDetailViewTemporary);
|
if (paedRecordDetailView.size() == 0) {
|
PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
|
paedrd.PAED_Status__c = '有效';
|
paedrd.RecordTypeId = RecordTypeIdD;
|
paedRecordDetailView.add(new PAE_DecisionRecordDetailInfo(paedrd));
|
}
|
}
|
}
|
//检查明细的编码是否为空---20200107 add 检查明细的PAE判定是否必填
|
public Boolean IsEmptyManagementCode(List < PAE_DecisionRecordDetailInfo > paedRecordDetailView) {
|
String isEmpty = '';
|
if (paedRecordDetailView.size() == 0) {
|
return true;
|
}
|
// gzw 20201215 取消时不需要判断编码和状态 追加 && CancelineFlag != 3
|
for (PAE_DecisionRecordDetailInfo paedRDInfo: paedRecordDetailView) {
|
// gzw 20201215 取消时,不判断报错
|
if (paedRDInfo.paedrdd.PAED_Status__c == '取消') {
|
continue;
|
}
|
if (paedRDInfo.paedrdd != null) {
|
system.debug('paedRDInfo.paedrdd.PAED_ManagementCode__c==========>'+paedRDInfo.paedrdd.PAED_ManagementCode__c);
|
system.debug('CancelineFlag=========>'+CancelineFlag);
|
system.debug('paedRDInfo.paedrdd.PAE_Judge__c==========>'+paedRDInfo.paedrdd.PAE_Judge__c);
|
|
if (String.isBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c) && CancelineFlag != 3) {
|
isEmpty = 'PAE判定记录明细的编码不能为空';
|
}
|
if (String.isBlank(paedRDInfo.paedrdd.PAE_Judge__c) && CancelineFlag != 3) {
|
isEmpty = 'PAE判定记录明细的PAE判定不能为空';
|
}
|
} else {
|
if (String.isBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c) && CancelineFlag != 3) {
|
isEmpty = 'PAE判定记录明细的编码不能为空';
|
}
|
if (String.isBlank(paedRDInfo.paedrdd.PAE_Judge__c) && CancelineFlag != 3) {
|
isEmpty = 'PAE判定记录明细的PAE判定不能为空';
|
}
|
}
|
// gzw 20210409 修改参数为空时,表达式判断出错问题
|
if (Schema.SObjectType.PAE_DecisionRecordDetail__c.getRecordTypeInfosByDeveloperName().get('intake').getRecordTypeId() == paedRDInfo.paedrdd.RecordTypeId && (containsChineseCharacters(paedRDInfo.paedrdd.PAED_ManagementCode__c) || (String.isNotBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c) && paedRDInfo.paedrdd.PAED_ManagementCode__c.length() > 15))) {
|
isEmpty = 'Intake universal code不可以使用汉字,不可以超过15字数。';
|
paedRDInfo.paedrdd.PAED_ManagementCode__c.adderror('Intake universal code不可以使用汉字,不可以超过15字数。');
|
return true;
|
}
|
}
|
if (String.isNotBlank(isEmpty)) {
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '包含无效数据:' + isEmpty));
|
return true;
|
}
|
return false;
|
}
|
//更新PAE明细
|
public void UpsertPAE_DecisionRecordDetail(Map < Id, PAE_DecisionRecordDetail__c > paedRecordStatusMap, List < PAE_DecisionRecordDetailInfo > paedRecordDetailView, String paedRecordId, Boolean updateStatusFlag, String prevDetermineResults) {
|
system.debug('paedRecordStatusMap.size()===============>'+paedRecordStatusMap);
|
List < PAE_DecisionRecordDetail__c > upsertPaedrDetailList = new List < PAE_DecisionRecordDetail__c > ();
|
String repair_PAED_ManagementCodes = '';
|
String repair_PAED_ManagementCodesZ = '';
|
String PAE_codez = '';
|
String reappear_confirm = null;
|
Integer PAED_Reappear_Result_noSelect_num = 0;
|
Integer valid_num = 0;
|
// 精琢科技 zxk 2021-10-21 start 给PAE判定记录赋值
|
List < String > codeNumDataList = new List < String > ();
|
for (PAE_DecisionRecordDetailInfo pdrdInFoCode: paedRecordDetailView) {
|
String managementCodeStr = pdrdInFoCode.paedrdd.PAED_ManagementCode__c;
|
if (String.isBlank(pdrdInFoCode.paedrdd.id) && String.isNotBlank(managementCodeStr)) {
|
for (String codeStr: managementCodeStr.split(',')) {
|
if (String.isNotBlank(codeStr)) {
|
codeNumDataList.add(codeStr);
|
}
|
}
|
}
|
}
|
Map < String, String > strMapData = updateIsPae(codeNumDataList);
|
// 精琢科技 zxk 2021-10-21 end 给PAE判定记录赋值
|
System.debug('paedRecordDetailView ++++++++ ' + paedRecordDetailView.size());
|
for (PAE_DecisionRecordDetailInfo paedRDInfo: paedRecordDetailView) {
|
PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
|
if (paedRDInfo.paedrdd != null) {
|
paedrd.PAED_Report__c = ReportId;
|
paedrd.PAED_RCAC__c = ASac_ASrc;
|
paedrd.PAE_DecisionRecordD__c = paedRecordId;
|
paedrd.RecordTypeId = RecordTypeIdD;
|
paedrd.PAE_is_save__c = '1'; //20200319 add
|
system.debug('paedRecordStatusMap.containsKey(paedRDInfo.paedrdd.Id)===============>'+paedRDInfo.paedrdd.Id);
|
|
|
if (paedRecordStatusMap != null && paedRecordStatusMap.size() > 0 && paedRecordStatusMap.containsKey(paedRDInfo.paedrdd.Id)) {
|
// Gzw add 20200821 PAE结果变化时,保存接口信息字段 start
|
paedrd.isInterfaceCreate__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).isInterfaceCreate__c;
|
paedrd.LocationGroup__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).LocationGroup__c;
|
paedrd.Location__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Location__c;
|
paedrd.Phenomenon__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Phenomenon__c;
|
paedrd.Description__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Description__c;
|
paedrd.Cause__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Cause__c;
|
paedrd.EtqPart__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).EtqPart__c;
|
paedrd.EtqAsAnalyzed__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).EtqAsAnalyzed__c;
|
paedrd.EtqCause__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).EtqCause__c;
|
paedrd.FinalUniversalDesc__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).FinalUniversalDesc__c;
|
paedrd.InspectionCategory109__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).InspectionCategory109__c;
|
// Gzw add 20200821 PAE结果变化时,保存接口信息字段 end
|
// Gzw add 20200821 PAE结果变化时,保存RVS005接口信息字段 start
|
paedrd.RVSDetailNo__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVSDetailNo__c;
|
paedrd.PhenomenonDesc__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PhenomenonDesc__c;
|
paedrd.RVS_Date__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVS_Date__c;
|
paedrd.RVS_Time__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVS_Time__c;
|
paedrd.RVS_Decision_Person__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).RVS_Decision_Person__c;
|
// Gzw add 20200821 PAE结果变化时,保存RVS005接口信息字段 start
|
paedrd.PAED_Affirmant__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_Affirmant__c;
|
paedrd.PAED_ConfirmationDate__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_ConfirmationDate__c;
|
// 精琢科技 zxk 为Monitor_PAE__c赋值 start
|
paedrd.Monitor_PAE__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).Monitor_PAE__c;
|
// 精琢科技 zxk 为Monitor_PAE__c赋值 end
|
paedrd = ReproduceResult(paedrd, paedRDInfo);
|
if (CancelineFlag == 3 && paedRDInfo.check && paedRDInfo.paedrdd.PAED_Status__c != '取消') {
|
//有效变成取消
|
paedrd.PAED_ManagementCode__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_ManagementCode__c;
|
paedrd.PAED_Status__c = '取消';
|
paedrd.PAED_CancellationDate__c = Date.toDay();
|
paedrd.PAED_Nullifier__c = UserInfo.getUserId();
|
} else if (paedRDInfo.paedrdd.PAED_Status__c == '有效') {
|
//有效PAE明细编码
|
paedrd.PAED_Status__c = '有效';
|
paedrd.PAED_ManagementCode__c = paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
if (String.isBlank(repair_PAED_ManagementCodes)) {
|
repair_PAED_ManagementCodes = paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
} else {
|
repair_PAED_ManagementCodes += ',' + paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
}
|
if (paedRDInfo.paedrdd.PAED_Reappear_Result__c == '不再現' && !paedRDInfo.paedrdd.PAED_ManagementCode__c.equals('000')) {
|
// WLIG-BWMB4S gzw start
|
String pmcode = paedRDInfo.paedrdd.PAED_ManagementCode__c.trim();
|
if (pmcode.length() == 3 && (pmcode.endsWith('V') || pmcode.endsWith('W') || pmcode.endsWith('X') || pmcode.endsWith('Y'))) {
|
PAE_codez = pmcode.substring(0, pmcode.length() - 1) + 'Z';
|
} else {
|
PAE_codez = pmcode + 'Z';
|
}
|
// WLIG-BWMB4S gzw end
|
if (String.isBlank(repair_PAED_ManagementCodesZ)) {
|
repair_PAED_ManagementCodesZ = PAE_codez;
|
} else {
|
repair_PAED_ManagementCodesZ += ',' + PAE_codez;
|
}
|
}
|
valid_num++;
|
if (paedrd.PAED_Reappear_Result__c == null) {
|
PAED_Reappear_Result_noSelect_num++;
|
}
|
} else if (paedRDInfo.paedrdd.PAED_Status__c == '取消') {
|
paedrd.PAED_Status__c = '取消';
|
paedrd.PAED_ManagementCode__c = paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
paedrd.PAED_Nullifier__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_Nullifier__c; //UserInfo.getUserId();
|
paedrd.PAED_CancellationDate__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_CancellationDate__c; //Date.toDay();
|
}
|
} else if ((paedRecordStatusMap != null && paedRecordStatusMap.size() > 0 && !paedRecordStatusMap.containsKey(paedRDInfo.paedrdd.Id)) || paedRecordStatusMap == null) {
|
paedrd = ReproduceResult(paedrd, paedRDInfo);
|
if (paedRDInfo.check && CancelineFlag == 3) {
|
//新增取消PAE判定明细
|
paedrd.PAED_CancellationDate__c = Date.toDay();
|
paedrd.PAED_Nullifier__c = UserInfo.getUserId();
|
paedrd.PAED_Status__c = '取消';
|
} else {
|
paedrd.PAED_Affirmant__c = UserInfo.getUserId();
|
paedrd.PAED_ConfirmationDate__c = Date.toDay();
|
paedrd.PAED_Status__c = paedRDInfo.paedrdd.PAED_Status__c;
|
if (String.isBlank(repair_PAED_ManagementCodes)) {
|
repair_PAED_ManagementCodes = paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
} else {
|
repair_PAED_ManagementCodes += ',' + paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
}
|
//20191217 add
|
if (paedRDInfo.paedrdd.PAED_Reappear_Result__c == '不再現' && !paedRDInfo.paedrdd.PAED_ManagementCode__c.equals('000')) {
|
// WLIG-BWMB4S gzw start
|
String pmcode = paedRDInfo.paedrdd.PAED_ManagementCode__c.trim();
|
if (pmcode.length() == 3 && (pmcode.endsWith('V') || pmcode.endsWith('W') || pmcode.endsWith('X') || pmcode.endsWith('Y'))) {
|
PAE_codez = pmcode.substring(0, pmcode.length() - 1) + 'Z';
|
} else {
|
PAE_codez = pmcode + 'Z';
|
}
|
// WLIG-BWMB4S gzw end
|
if (String.isBlank(repair_PAED_ManagementCodesZ)) {
|
repair_PAED_ManagementCodesZ = PAE_codez;
|
} else {
|
repair_PAED_ManagementCodesZ += ',' + PAE_codez;
|
}
|
}
|
valid_num++;
|
if (paedrd.PAED_Reappear_Result__c == null) {
|
PAED_Reappear_Result_noSelect_num++;
|
}
|
}
|
paedrd.PAED_ManagementCode__c = paedRDInfo.paedrdd.PAED_ManagementCode__c;
|
// 精琢科技 zxk 2021-11-15 为Monitor_PAE__c赋值 start
|
if (String.isBlank(strMapData.get(paedrd.PAED_ManagementCode__c))) {
|
paedrd.Monitor_PAE__c = true;
|
} else {
|
if (strMapData.get(paedrd.PAED_ManagementCode__c) != paedrd.PAE_Judge__c) {
|
paedrd.Monitor_PAE__c = true;
|
}
|
}
|
// 精琢科技 zxk 2021-11-15 为Monitor_PAE__c赋值 end
|
// Gzw add 20200821 PAE结果变化时,保存接口信息字段 start
|
paedrd.isInterfaceCreate__c = paedRDInfo.paedrdd.isInterfaceCreate__c;
|
paedrd.LocationGroup__c = paedRDInfo.paedrdd.LocationGroup__c;
|
paedrd.Location__c = paedRDInfo.paedrdd.Location__c;
|
paedrd.Phenomenon__c = paedRDInfo.paedrdd.Phenomenon__c;
|
paedrd.Description__c = paedRDInfo.paedrdd.Description__c;
|
paedrd.Cause__c = paedRDInfo.paedrdd.Cause__c;
|
// paedrd.PAE_Judge__c = paedRDInfo.paedrdd.PAE_Judge__c;
|
paedrd.EtqPart__c = paedRDInfo.paedrdd.EtqPart__c;
|
paedrd.EtqAsAnalyzed__c = paedRDInfo.paedrdd.EtqAsAnalyzed__c;
|
paedrd.EtqCause__c = paedRDInfo.paedrdd.EtqCause__c;
|
paedrd.FinalUniversalDesc__c = paedRDInfo.paedrdd.FinalUniversalDesc__c;
|
// paedrd.PAED_RCAC__c = paedRDInfo.paedrdd.PAED_RCAC__c;
|
paedrd.InspectionCategory109__c = paedRDInfo.paedrdd.InspectionCategory109__c;
|
// Gzw add 20200821 PAE结果变化时,保存接口信息字段 end
|
}
|
//20191216 ljh start
|
//状态是否改变
|
System.debug('+++++++++++++++++++++: ' + updateStatusFlag);
|
if (updateStatusFlag) {
|
//改变状态--->复制新的更新需要更新的
|
upsertPaedrDetailList.add(paedrd);
|
} else {
|
//更新需要更新的
|
paedrd.Id = paedRDInfo.paedrdd.Id;
|
upsertPaedrDetailList.add(paedrd);
|
}
|
}
|
}
|
if (upsertPaedrDetailList.size() > 0) {
|
upsert upsertPaedrDetailList;
|
}
|
System.debug('PAED_Reappear_Result_noSelect_num' + PAED_Reappear_Result_noSelect_num);
|
if (PAED_Reappear_Result_noSelect_num > 0) {
|
reappear_confirm = '未确认';
|
} else if (valid_num > 0 && PAED_Reappear_Result_noSelect_num == 0) {
|
reappear_confirm = '已确认';
|
}
|
AssignValuesOtherObjects(repair_PAED_ManagementCodes, paedRecordId, repair_PAED_ManagementCodesZ, reappear_confirm, prevDetermineResults);
|
}
|
//为PAE判定和相关的修理赋值
|
public void AssignValuesOtherObjects(String stitchingCode, String paedRecordId, String stitchingCodeZ, String reappear_confirm, String prevDetermineResults) {
|
if (String.isNotBlank(stitchingCode) && stitchingCode.contains(',')) {
|
String[] stitchingCodeArr = stitchingCode.split(',');
|
stitchingCodeArr.sort();
|
String stitchingCode1 = '';
|
for (Integer i = 0; i < stitchingCodeArr.size(); i++) {
|
if (i < (stitchingCodeArr.size() - 1)) {
|
stitchingCode1 += stitchingCodeArr[i] + ',';
|
} else {
|
stitchingCode1 += stitchingCodeArr[i] + '';
|
}
|
}
|
stitchingCode = stitchingCode1;
|
}
|
//报告书相关
|
if (!string.isBlank(ReportId)) {
|
Report__c Report = [select id, PAE_DetermineAC__c, PAE_Determine__c, PAE_codez__c, PAE_temp_final_code__c, PAE_reappear_confirm__c,
|
PAE_intakePrevDetermineResults__c, PAE_finalPrevDetermineResults__c, Repair_Authenticator__c, OCSM_RC_CordingUser__c
|
from Report__c where id = : ReportId
|
];
|
List < PAE_DecisionRecord__c > rdRecordList = [SELECT Id, Name, PAE_DetermineResults__c, PAE_DetermineResults_Text__c, PAE_ConfirmationDate__c,
|
PAE_Authenticator__c
|
FROM PAE_DecisionRecord__c where Id = : paedRecordId
|
];
|
PAE_DecisionRecord__c paedRecord = new PAE_DecisionRecord__c();
|
paedRecord.Id = paedRecordId;
|
if (ASac_ASrc == 'Intake') {
|
paedRecord.PAE_reappear_confirm__c = reappear_confirm;
|
Report.PAE_reappear_confirm__c = reappear_confirm;
|
} else {
|
paedRecord.PAE_reappear_confirm__c = Report.PAE_reappear_confirm__c;
|
}
|
if (rdRecordList[0].PAE_ConfirmationDate__c == null) {
|
paedRecord.Id = paedRecordId;
|
paedRecord.PAE_ConfirmationDate__c = Date.toDay();
|
paedRecord.PAE_Authenticator__c = UserInfo.getUserId();
|
}
|
if (paedRecord != null) {
|
update paedRecord;
|
}
|
List < Report__c > repList;
|
if (ASac_ASrc == 'Intake') {
|
repList = [select Id, Name, RC_PAED__c, AC_PAED__c from Report__c where RC_PAED__c = : paedRecordId];
|
if (repList.size() == 0) {
|
if (String.isBlank(Report.Repair_Authenticator__c)) {
|
Report.Repair_ConfirmationDate__c = Date.toDay();
|
Report.Repair_Authenticator__c = UserInfo.getName();
|
}
|
Report.RC_PAED__c = paedRecordId;
|
} else {
|
if (String.isBlank(Report.Repair_Authenticator__c)) {
|
Report.Repair_ConfirmationDate__c = rdRecord.PAE_ConfirmationDate__c;
|
Report.Repair_Authenticator__c = rdRecord.PAE_Authenticator__c;
|
}
|
Report.RC_PAED__c = paedRecordId;
|
}
|
} else {
|
repList = [select Id, Name, RC_PAED__c, AC_PAED__c from Report__c where AC_PAED__c = : paedRecordId];
|
if (repList.size() == 0) {
|
if (String.isBlank(Report.OCSM_RC_CordingUser__c)) {
|
Report.OCSM_RC_CordingDate__c = Date.toDay();
|
Report.OCSM_RC_CordingUser__c = UserInfo.getName();
|
}
|
Report.AC_PAED__c = paedRecordId;
|
} else {
|
if (String.isBlank(Report.OCSM_RC_CordingUser__c)) {
|
Report.OCSM_RC_CordingDate__c = rdRecord.PAE_ConfirmationDate__c;
|
Report.OCSM_RC_CordingUser__c = rdRecord.PAE_Authenticator__c;
|
}
|
Report.AC_PAED__c = paedRecordId;
|
}
|
}
|
if (String.isNotBlank(stitchingCode)) {
|
if (ASac_ASrc == 'Intake') {
|
Report.ASReportedCode__c = stitchingCode;
|
// 2020/08/04 taoqz modify
|
Report.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c;
|
Report.PAE_intakePrevDetermineResults__c = prevDetermineResults;
|
//如果有不在现 则更新repair.ASReportedCodeAC__c
|
if (String.isNotBlank(stitchingCodeZ)) {
|
if (String.isNotBlank(Report.PAE_temp_final_code__c)) {
|
Report.ASReportedCodeAC__c = Report.PAE_temp_final_code__c + ',' + stitchingCodeZ;
|
} else {
|
Report.ASReportedCodeAC__c = stitchingCodeZ;
|
}
|
Report.PAE_codez__c = stitchingCodeZ;
|
} else {
|
//202003224 add 如果没有有不在现 则更新repair.ASReportedCodeAC__c
|
Report.ASReportedCodeAC__c = Report.PAE_temp_final_code__c;
|
Report.PAE_codez__c = stitchingCodeZ;
|
}
|
} else {
|
if (String.isNotBlank(Report.PAE_codez__c)) {
|
Report.ASReportedCodeAC__c = stitchingCode + ',' + Report.PAE_codez__c;
|
} else {
|
Report.ASReportedCodeAC__c = stitchingCode;
|
}
|
Report.PAE_temp_final_code__c = stitchingCode;
|
// 2020/08/04 taoqz modify
|
Report.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c;
|
Report.PAE_finalPrevDetermineResults__c = prevDetermineResults;
|
}
|
} else {
|
if (ASac_ASrc == 'Intake') {
|
Report.ASReportedCode__c = stitchingCode;
|
Report.PAE_codez__c = stitchingCodeZ;
|
Report.ASReportedCodeAC__c = Report.PAE_temp_final_code__c;
|
// 2020/08/04 taoqz modify
|
Report.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c;
|
Report.PAE_intakePrevDetermineResults__c = prevDetermineResults;
|
} else {
|
Report.ASReportedCodeAC__c = stitchingCode;
|
Report.PAE_temp_final_code__c = stitchingCode;
|
// 2020/08/04 taoqz modify
|
Report.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c;
|
Report.PAE_finalPrevDetermineResults__c = prevDetermineResults;
|
Report.OCSM_RC_CordingDate__c = null;
|
Report.OCSM_RC_CordingUser__c = null;
|
}
|
}
|
update Report;
|
}
|
}
|
//20191209 ljh 新字段添加 start
|
public static PAE_DecisionRecordDetail__c ReproduceResult(PAE_DecisionRecordDetail__c paedrd, PAE_DecisionRecordDetailInfo paedRDInfo) {
|
paedrd.PAE_Judge__c = paedRDInfo.paedrdd.PAE_Judge__c;
|
// 20201126 gzw 获取RVS005接口信息数据 start
|
paedrd.RVSDetailNo__c = paedRDInfo.paedrdd.RVSDetailNo__c;
|
paedrd.LocationGroup__c = paedRDInfo.paedrdd.LocationGroup__c;
|
paedrd.Location__c = paedRDInfo.paedrdd.Location__c;
|
paedrd.PhenomenonDesc__c = paedRDInfo.paedrdd.PhenomenonDesc__c;
|
paedrd.RVS_Date__c = paedRDInfo.paedrdd.RVS_Date__c;
|
paedrd.RVS_Time__c = paedRDInfo.paedrdd.RVS_Time__c;
|
paedrd.RVS_Decision_Person__c = paedRDInfo.paedrdd.RVS_Decision_Person__c;
|
// 20201126 gzw 获取RVS005接口信息数据 end
|
if (paedRDInfo.paedrdd.PAED_Reappear_Result__c == '不再現') {
|
paedrd.PAED_Reappear_Result__c = '不再現';
|
paedrd.PAED_ResultAffirmant__c = UserInfo.getUserId();
|
paedrd.PAED_ResultConfirmationDate__c = Date.toDay();
|
} else {
|
paedrd.PAED_Reappear_Result__c = paedRDInfo.paedrdd.PAED_Reappear_Result__c;
|
paedrd.PAED_ResultAffirmant__c = null;
|
paedrd.PAED_ResultConfirmationDate__c = null;
|
}
|
return paedrd;
|
}
|
// 正则表达式 判断是否包含汉字
|
// gzw 20210409 修改参数为空时,表达式判断出错问题
|
public static Boolean containsChineseCharacters(String InputString) {
|
if (String.isNotblank(InputString)) {
|
Pattern p = Pattern.compile('\\p{IsHan}');
|
Matcher m = p.matcher(InputString);
|
return m.find();
|
} else {
|
return false;
|
}
|
}
|
// 精琢科技 zxk 2021-10-21 start 给PAE判定记录赋值
|
public Map < String, String > updateIsPae(List < String > codeNumDataList) {
|
Map < String, String > paeStrMap = new Map < String, String > ();
|
String sql = 'select RSS_CODE__C, IS_INTAKE_ESTIMATION__C, IS_PAE__c, IS_INACTIVE__C FROM RSA_master_data__c WHERE RSS_CODE__C in: codeNumDataList AND IS_INACTIVE__C = \'No\'';
|
if ('ASRCDecision' == RecordTypeName) {
|
sql += ' AND IS_INTAKE_ESTIMATION__C like \'%Intake%\'';
|
}
|
if ('ASACDecision' == RecordTypeName) {
|
sql += ' AND IS_INTAKE_ESTIMATION__C like \'%Estimation%\'';
|
}
|
List < RSA_master_data__c > rsaMasterDataSqlList = DataBase.query(sql);
|
String result = null;
|
for (RSA_master_data__c rsaMaster: rsaMasterDataSqlList) {
|
if ('ASRCDecision' == RecordTypeName) {
|
if (rsaMaster.IS_PAE__c == 'YES') {
|
result = 'PAE';
|
}
|
if (rsaMaster.IS_PAE__c == 'No') {
|
result = 'nonPAE';
|
}
|
if (rsaMaster.IS_PAE__c == 'Unknown') {
|
result = 'Unknown';
|
}
|
}
|
if ('ASACDecision' == RecordTypeName) {
|
if (rsaMaster.IS_PAE__c == 'YES') {
|
result = 'PAE';
|
}
|
if (rsaMaster.IS_PAE__c == 'No') {
|
result = 'nonPAE';
|
}
|
if (rsaMaster.IS_PAE__c == 'Unknown') {
|
result = 'Unknown';
|
}
|
}
|
paeStrMap.put(rsaMaster.RSS_CODE__C, result);
|
}
|
return paeStrMap;
|
}
|
// 精琢科技 zxk 2021-10-21 start 给PAE判定记录赋值
|
|
//20191209 ljh 新字段添加 end
|
class PAE_DecisionRecordDetailInfo {
|
public Boolean check {
|
get;
|
set;
|
}
|
public Boolean oldCheck {
|
get;
|
set;
|
}
|
public Boolean canSelect {
|
get;
|
set;
|
}
|
public String strJudge {
|
get;
|
set;
|
}
|
public Boolean monitorPAE {
|
get;
|
set;
|
}
|
public PAE_DecisionRecordDetail__c paedrdd {
|
get;
|
set;
|
}
|
public PAE_DecisionRecordDetailInfo() {
|
paedrdd = new PAE_DecisionRecordDetail__c();
|
check = false;
|
oldCheck = false;
|
canSelect = false;
|
}
|
public PAE_DecisionRecordDetailInfo(PAE_DecisionRecordDetail__c paedrd) {
|
check = false;
|
oldCheck = false;
|
paedrdd = paedrd;
|
if (String.isNotBlank(paedrd.Id)) {
|
monitorPAE = paedrd.Monitor_PAE__c;
|
}
|
strJudge = paedrd.PAE_Judge__c;
|
//IISE来的明细允许删除。
|
canSelect = false;
|
}
|
}
|
}
|