public with sharing class PAEDecisionRecordController {
|
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 String RepairId {
|
get;
|
set;
|
}
|
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 或者
|
// QIS_Report__c中ComplaintStatus__c的字段值为待EtQ Response 将标记改为true
|
// 影响至对应页面中的按钮是否可用
|
public Boolean editFlag {
|
get;
|
set;
|
}
|
// 当前修理
|
public Repair__c repa {
|
get;
|
set;
|
}
|
// 是否是OSH
|
public Boolean isOSH {
|
get;
|
set;
|
}
|
//20200213
|
public String QISReportId {
|
get;
|
set;
|
}
|
public String productIdx {
|
get;
|
set;
|
}
|
public Boolean updateIsPaeMap {
|
get;
|
set;
|
}
|
//页面的明细
|
public List < PAE_DecisionRecordDetailInfo > paedRecordDetailView {
|
get;
|
set;
|
}
|
public Integer paedRecordDetailViewCount {
|
get {
|
return paedRecordDetailView == null ? 0 : paedRecordDetailView.size();
|
}
|
}
|
public PAEDecisionRecordController(ApexPages.StandardController stdController) {
|
Id = ApexPages.currentPage().getParameters().get('Id');
|
RepairId = ApexPages.currentPage().getParameters().get('RepairId');
|
// 判断Repair__c的DOJ_Status__c字段值是否为待EtQ Response
|
if (!String.isBlank(RepairId)) {
|
List < Repair__c > res = [select id, name, CreatedDate, DOJ_Status__c, PAE_DetermineResults__c, Repair_ConfirmationDate__c,
|
Repair_Authenticator__c, Repair_Determine__c, IISE_confirmed_day__c, Repair_Determine_result_ConfirmationUser__c,
|
Repair_Determine_result__c, OSH_Affirmant__c, SAP_Transfer_time__c, Status__c, FSE_ApplyForRepair_time__c,
|
PAE_reappear_confirm__c, IISE_confirmed_person__c, ifDeadHurt__c, IS_AE__c,
|
if_Repair_Allowed__c, NotAllowedReason__c, OSHRAConfirmDate__c, OSHRAConfirmUser__c
|
//add by rentx 2020-10-23 start 课题104
|
, is_CNBuy__c, ETQ_UPLOAD_ERROR_GROUP__c
|
from Repair__c
|
where id = : RepairId
|
];
|
if (res.size() > 0) {
|
repa = res.get(0);
|
if ('待EtQ Response'.equals(res.get(0).DOJ_Status__c)) {
|
editFlag = true;
|
}
|
}
|
}
|
System.debug('repa++' + repa);
|
String profileId = UserInfo.getProfileId();
|
// 当前用户是否在 OSH自定义标签中
|
isOSH = System.label.OSH.contains(profileId);
|
System.debug('isOSH+' + isOSH);
|
// 判断QIS_Report__c的ComplaintStatus__c字段值是否为待EtQ Response
|
QISReportId = ApexPages.currentPage().getParameters().get('QISReportId'); //20200213 ljh
|
List < QIS_Report__c > QIS = [select id, name, ComplaintStatus__c, AsyncData__c from QIS_Report__c where id = : QISReportId];
|
if (QIS.size() > 0 && '待EtQ Response'.equals(QIS.get(0).ComplaintStatus__c)) {
|
editFlag = true;
|
}
|
paedRecordDetailView = new List < PAE_DecisionRecordDetailInfo > ();
|
editAble = false;
|
CancelineFlag = 2;
|
// PAE_DecisionRecord__c 记录类型 ASRCDecision ASACDecision
|
// ASRCDecision --> Intake
|
// ASACDecision --> Final
|
RecordTypeName = ApexPages.currentPage().getParameters().get('RecordTypeIds');
|
productIdx = '';
|
updateIsPaeMap = false;
|
}
|
public void init() {
|
editAble = true;
|
//当前登录着的ProfileId
|
String profileId = UserInfo.getProfileId().substring(0, 15);
|
//20200310 add start
|
//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)) {
|
//if(UserInfo.getProfileId().substring(0,15).equals(System.Label.ProfileId_2F2CRCCording)|| UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){
|
OCSM_Cording = '1';
|
} else {
|
OCSM_Cording = '0';
|
}
|
if (System.Label.ProfileId2F2B_2F4.contains(profileId) || UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin) {
|
//if(UserInfo.getProfileId().substring(0,15).equals(System.Label.ProfileId_2F2CRCCording)|| UserInfo.getProfileId().equals(System.Label.ProfileId_SystemAdmin)){
|
savebuton = true;
|
} else {
|
savebuton = false;
|
}
|
//20200310 add end
|
if (String.isNotBlank(RecordTypeName)) {
|
RecordTypeId = Schema.SObjectType.PAE_DecisionRecord__c.getRecordTypeInfosByDeveloperName().get(RecordTypeName).getRecordTypeId();
|
} else {
|
List < PAE_DecisionRecord__c > paedRdList = [select Id, PAE_Repair__c, PAE_QIS__c, RecordTypeId, PAEDetail_DetermineResults__c, RecordType.DeveloperName from PAE_DecisionRecord__c where Id = : Id];
|
if (paedRdList.size() > 0) {
|
RecordTypeName = paedRdList[0].RecordType.DeveloperName;
|
RepairId = paedRdList[0].PAE_Repair__c;
|
//20100213 ljh add start
|
QISReportId = paedRdList[0].PAE_QIS__c;
|
//20100213 ljh add end
|
RecordTypeId = paedRdList[0].RecordTypeId;
|
}
|
}
|
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();
|
//20200213 ljh start
|
//Repair__c repair1 =[select id,PAE_codez__c,PAE_temp_final_code__c ,PAE_reappear_confirm__c from Repair__c where id = :RepairId];
|
Repair__c repair1OrQIS1;
|
QIS_Report__c repair1OrQIS2;
|
if (!string.isBlank(RepairId)) {
|
repair1OrQIS1 = [select id, PAE_codez__c, PAE_temp_final_code__c, PAE_reappear_confirm__c, IISE_confirmed_person__c from Repair__c where id = : RepairId];
|
}
|
if (!string.isBlank(QISReportId)) {
|
repair1OrQIS2 = [select id, PAE_codez__c, PAE_temp_final_code__c, PAE_reappear_confirm__c from QIS_Report__c where id = : QISReportId];
|
}
|
//20200213 ljh end
|
Map < String, PAE_DecisionRecordDetailInfo > MidMap = new Map < String, PAE_DecisionRecordDetailInfo > ();
|
if (Id == NULL || Id == '') {
|
//20200213 ljh start
|
//rdRecord.PAE_reappear_confirm__c = repair1.PAE_reappear_confirm__c;//20200103 add
|
if (string.isBlank(RepairId)) {
|
rdRecord.PAE_reappear_confirm__c = repair1OrQIS2.PAE_reappear_confirm__c;
|
} else {
|
rdRecord.PAE_reappear_confirm__c = repair1OrQIS1.PAE_reappear_confirm__c;
|
}
|
//20200213 ljh end
|
//20200106 预留一行 add start
|
PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
|
paedrd.PAED_Status__c = '有效';
|
paedrd.RecordTypeId = RecordTypeIdD;
|
paedRecordDetailView.add(new PAE_DecisionRecordDetailInfo(paedrd));
|
//20200106 预留一行 add end
|
} 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];
|
}
|
//20200213 ljh start
|
//rdRecord.PAE_reappear_confirm__c = repair1.PAE_reappear_confirm__c;//20200103 add
|
if (string.isBlank(RepairId)) {
|
rdRecord.PAE_reappear_confirm__c = repair1OrQIS2.PAE_reappear_confirm__c; //20200103 add
|
} else {
|
rdRecord.PAE_reappear_confirm__c = repair1OrQIS1.PAE_reappear_confirm__c; //20200103 add
|
}
|
//20200213 ljh end
|
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
|
];
|
// Integer strNum = 0;
|
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);
|
}
|
}
|
// 2020/08/04 taoqz add start
|
// if(String.isNotBlank(RepairId)){
|
// List<PAE_DecisionRecord__c> lastModifiedRecord = [select id,name,PAEDetail_reappear_confirm__c from PAE_DecisionRecord__c
|
// where PAE_Repair__c = :RepairId
|
// and RecordType.DeveloperName = 'ASRCDecision'
|
// order by LastModifiedDate desc limit 1];
|
// if (lastModifiedRecord != null && lastModifiedRecord.size() > 0) {
|
// intakePAEReappearConfirm = lastModifiedRecord.get(0).PAEDetail_reappear_confirm__c;
|
// }
|
// }
|
// if (String.isBlank(intakePAEReappearConfirm)) {
|
// intakePAEReappearConfirm = '';
|
// }else{
|
// rdRecord.PAE_reappear_confirm__c = intakePAEReappearConfirm;
|
// }
|
// 2020/08/04 taoqz add end
|
}
|
//保存并关闭
|
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 {
|
//20191217 add start
|
//明细有效状态此记录的总数量
|
//明细有效状态此记录的PAE数量
|
//明细有效状态此记录的Unknown数量
|
//明细有效状态此记录的NonPAE数量
|
// 20201204 如果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;
|
}
|
// 2020/08/04 taoqz modify
|
// rdRecord.PAE_DetermineResults__c = PAE_DetermineResults;
|
rdRecord.PAE_DetermineResults_Text__c = PAE_DetermineResults;
|
//20191217 add end
|
//新增PAE判定
|
if (String.isBlank(Id)) {
|
//检查明细的编码是否为空---20200107 add 检查明细的PAE判定是否必填
|
if (IsEmptyManagementCode(paedRecordDetailView)) {
|
return null;
|
}
|
//paedRecord.PAE_DetermineResults__c = rdRecord.PAE_DetermineResults__c;
|
// paedRecord.PAE_DetermineResults__c = PAE_DetermineResults;//202191216 modify
|
//update by rentongxiao 2020-09-22 start
|
// paedRecord.PAE_DetermineResults_Text__c = PAE_DetermineResults;//2020/08/04 modify
|
//update by rentongxiao 2020-09-22 end
|
paedRecord.PAE_Repair__c = RepairId;
|
paedRecord.PAE_QIS__c = QISReportId; //20200213 ljh add
|
paedRecord.PAE_reappear_confirm__c = rdRecord.PAE_reappear_confirm__c; // 20200908 Gzw Final 再现结果丢失问题 add
|
paedRecord.RecordTypeId = RecordTypeId;
|
insert paedRecord;
|
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'paedRecord ------ ' + paedRecord.PAE_reappear_confirm__c));
|
// if (true) {
|
// return null;
|
// }
|
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);
|
}
|
}
|
if (paedRecordList.size() > 0) {
|
//PAE判定的Id
|
paedRecordId = paedRecordList[0].Id;
|
//PAE判定记录的状态不变
|
// prevDetermineResults = paedRecordList[0].PAE_DetermineResults__c;//20200107 add
|
prevDetermineResults = paedRecordList[0].PAE_DetermineResults_Text__c; //2020/08/04 modify
|
//if (paedRecordList[0].PAE_DetermineResults__c == rdRecord.PAE_DetermineResults__c) {
|
//2020/08/04 modify
|
// if (paedRecordList[0].PAE_DetermineResults__c == PAE_DetermineResults) {
|
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__c != rdRecord.PAE_DetermineResults__c ) {
|
//2020/08/04 modify
|
// } else if (paedRecordList[0].PAE_DetermineResults__c != PAE_DetermineResults ) {
|
} 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__c = rdRecord.PAE_DetermineResults__c;
|
//2020/08/04 modify
|
// paedRecord.PAE_DetermineResults__c = PAE_DetermineResults;//20191216 modify
|
paedRecord.PAE_DetermineResults_Text__c = PAE_DetermineResults; //20191216 modify
|
paedRecord.PAE_Repair__c = RepairId;
|
paedRecord.PAE_QIS__c = QISReportId; //20200213 ljh add
|
paedRecord.RecordTypeId = RecordTypeId;
|
insert paedRecord;
|
paedRecordId = paedRecord.Id;
|
UpsertPAE_DecisionRecordDetail(paedRecordStatusMap, paedRecordDetailView, paedRecordId, true, prevDetermineResults);
|
}
|
}
|
}
|
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'paedRecord ------ ' + paedRecord.PAE_reappear_confirm__c));
|
} catch (Exception e) {
|
ApexPages.addMessages(e);
|
Database.rollback(sp);
|
return null;
|
}
|
// return null;
|
if (CancelineFlag != 2) {
|
return RefreshOriginalInterface(paedRecordId);
|
} else {
|
return ReturnRepairInterface();
|
}
|
}
|
//返回修理/QIS页面
|
public PageReference ReturnRepairInterface() {
|
//20200213 ljh start
|
PageReference ref;
|
if (String.isBlank(RepairId)) {
|
ref = new Pagereference('/' + QISReportId);
|
} else {
|
ref = new Pagereference('/' + RepairId);
|
}
|
//PageReference ref = new Pagereference('/' + RepairId);
|
//20200213 ljh end
|
ref.setRedirect(true);
|
return ref;
|
}
|
//留在当前页面
|
public PageReference RefreshOriginalInterface(String paedRecordId) {
|
//20200213 ljh start
|
//PageReference ref = new Pagereference('/apex/PAEDecisionRecord?Id=' + paedRecordId + '&RepairId=' + RepairId);
|
PageReference ref;
|
if (String.isBlank(RepairId)) {
|
ref = new Pagereference('/apex/PAEDecisionRecord?Id=' + paedRecordId + '&QISReportId=' + QISReportId + '&RecordTypeIds=' + RecordTypeName);
|
} else {
|
ref = new Pagereference('/apex/PAEDecisionRecord?Id=' + paedRecordId + '&RepairId=' + RepairId + '&RecordTypeIds=' + RecordTypeName);
|
}
|
ref.setRedirect(true);
|
return ref;
|
}
|
//20200107 add
|
//返回修理Intake页面
|
public PageReference toIntake() {
|
String url = null;
|
if (String.isBlank(RepairId)) {
|
List < PAE_DecisionRecord__c > pAE_DecisionRecord = [SELECT LastModifiedDate, Id, Name, LastModifiedById, RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = : QISReportId And RecordType.DeveloperName = 'ASRCDecision'
|
Order by LastModifiedDate desc
|
];
|
if (pAE_DecisionRecord.size() > 0) {
|
url = '/apex/PAEDecisionRecord?Id=' + pAE_DecisionRecord[0].Id + '&QISReportId=' + QISReportId + '&RecordTypeIds=ASRCDecision';
|
} else {
|
url = '/apex/PAEDecisionRecord?QISReportId=' + QISReportId + '&RecordTypeIds=ASRCDecision';
|
}
|
} else {
|
List < PAE_DecisionRecord__c > pAE_DecisionRecord = [SELECT LastModifiedDate, Id, Name, LastModifiedById, RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_Repair__c = : RepairId And RecordType.DeveloperName = 'ASRCDecision'
|
Order by LastModifiedDate desc
|
];
|
if (pAE_DecisionRecord.size() > 0) {
|
url = '/apex/PAEDecisionRecord?Id=' + pAE_DecisionRecord[0].Id + '&RepairId=' + RepairId + '&RecordTypeIds=ASRCDecision';
|
} else {
|
url = '/apex/PAEDecisionRecord?RepairId=' + RepairId + '&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 > ();
|
// Integer strNum = paedRecordDetailView.size() - 1;
|
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();
|
/*if(pStatus=='有效' &&confirmationDate != null){
|
codeList.add(managementCode);
|
}*/
|
// 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
|
//if(!codeList.contains(code)){
|
// bug fix gzw 已有的空code数据,数据数据时,会新建 20201214 start
|
PAE_DecisionRecordDetail__c paedrdtemp;
|
if (q == 1) {
|
paedrdtemp = paedRDInfo.paedrdd;
|
} else {
|
paedrdtemp = new PAE_DecisionRecordDetail__c();
|
}
|
// PAE_DecisionRecordDetail__c 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判定记录赋值
|
//codeList.add(code);
|
// paedRecordDetailViewTemporary.add(new PAE_DecisionRecordDetailInfo(paedrd));
|
/*}else{
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '包含无效数据:' +code+'已经存在'));
|
}*/
|
q++;
|
}
|
} else {
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 start
|
PAE_DecisionRecordDetailInfo info = new PAE_DecisionRecordDetailInfo();
|
// 2021-12-08 zxk 精琢科技 手动赋值逻辑 end
|
//if(!codeList.contains(managementCode)){
|
// bug fix gzw 已有的空code数据,数据数据时,会新建 20201214 start
|
// PAE_DecisionRecordDetail__c paedrd = new PAE_DecisionRecordDetail__c();
|
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判定记录赋值
|
//codeList.add(managementCode);
|
// paedRecordDetailViewTemporary.add(new PAE_DecisionRecordDetailInfo(paedrd, strNum++));
|
/*}else{
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '包含无效数据:' + managementCode+'已经存在'));
|
}*/
|
}
|
} 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);
|
//20200106 add start
|
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));
|
}
|
//20200106 add end
|
}
|
}
|
//检查编码是否为空
|
/*public Boolean IsEmptyManagementCode ( List<PAE_DecisionRecordDetailInfo> paedRecordDetailView ) {
|
String managementCodeIsEmpty = '';
|
if(paedRecordDetailView.size()==0){
|
return true;
|
}
|
|
for (PAE_DecisionRecordDetailInfo paedRDInfo : paedRecordDetailView) {
|
if (paedRDInfo.paedrdd != null) {
|
if (String.isBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c)) {
|
managementCodeIsEmpty = 'PAE判定记录明细的编码为空';
|
}
|
} else {
|
if (String.isBlank(paedRDInfo.paedrdd.PAED_ManagementCode__c)) {
|
managementCodeIsEmpty = 'PAE判定记录明细的编码为空';
|
}
|
}
|
}
|
if (String.isNotBlank(managementCodeIsEmpty)) {
|
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '包含无效数据:' + managementCodeIsEmpty));
|
return true;
|
}
|
return false;
|
|
}*/
|
//检查明细的编码是否为空---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) {
|
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;
|
}
|
//
|
public void UpsertPAE_DecisionRecordDetail(Map < Id, PAE_DecisionRecordDetail__c > paedRecordStatusMap, List < PAE_DecisionRecordDetailInfo > paedRecordDetailView, String paedRecordId, Boolean updateStatusFlag, String prevDetermineResults) {
|
List < PAE_DecisionRecordDetail__c > upsertPaedrDetailList = new List < PAE_DecisionRecordDetail__c > ();
|
String repair_PAED_ManagementCodes = '';
|
String repair_PAED_ManagementCodesZ = ''; //20191217 add
|
String PAE_codez = ''; //20191217 add
|
String reappear_confirm = null;
|
Integer PAED_Reappear_Result_noSelect_num = 0; //20200103 add
|
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_Repair__c = RepairId;
|
paedrd.PAED_QIS__c = QISReportId; //20200213 ljh add
|
paedrd.PAED_RCAC__c = ASac_ASrc;
|
paedrd.PAE_DecisionRecordD__c = paedRecordId;
|
paedrd.RecordTypeId = RecordTypeIdD;
|
paedrd.PAE_is_save__c = '1'; //20200319 add
|
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.PAE_Judge__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAE_Judge__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.PAED_RCAC__c = paedRecordStatusMap.get(paedRDInfo.paedrdd.Id).PAED_RCAC__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();
|
//upsertPaedrDetailList.add(paedrd);//20191210 modify
|
} 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;
|
}
|
//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';
|
}
|
// PAE_codez = paedRDInfo.paedrdd.PAED_ManagementCode__c+'Z';
|
// WLIG-BWMB4S gzw end
|
if (String.isBlank(repair_PAED_ManagementCodesZ)) {
|
repair_PAED_ManagementCodesZ = PAE_codez;
|
} else {
|
repair_PAED_ManagementCodesZ += ',' + PAE_codez;
|
}
|
}
|
//20200103 add start
|
valid_num++;
|
if (paedrd.PAED_Reappear_Result__c == null) {
|
PAED_Reappear_Result_noSelect_num++;
|
}
|
//20200103 add end
|
} 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';
|
}
|
// PAE_codez = paedRDInfo.paedrdd.PAED_ManagementCode__c+'Z';
|
// WLIG-BWMB4S gzw end
|
if (String.isBlank(repair_PAED_ManagementCodesZ)) {
|
repair_PAED_ManagementCodesZ = PAE_codez;
|
} else {
|
repair_PAED_ManagementCodesZ += ',' + PAE_codez;
|
}
|
}
|
//20200103 add start
|
valid_num++;
|
if (paedrd.PAED_Reappear_Result__c == null) {
|
PAED_Reappear_Result_noSelect_num++;
|
}
|
//20200103 add end
|
}
|
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) {
|
//PAE_DecisionRecord__c paedRecord = new PAE_DecisionRecord__c();
|
//20200319 add start
|
// if(stitchingCode.contains(',')&& String.isNotBlank(stitchingCode)){
|
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;
|
}
|
//20200319 add end
|
if (!string.isBlank(RepairId)) {
|
//修理相关
|
//Repair__c repair = new Repair__c();
|
Repair__c repair = [select id, PAE_codez__c, PAE_temp_final_code__c, PAE_reappear_confirm__c, PAE_intakePrevDetermineResults__c,
|
PAE_finalPrevDetermineResults__c, IISE_confirmed_person__c, Repair_Authenticator__c, OCSM_RC_CordingUser__c, PAE_DetermineAC__c, ETQ_UPLOAD_STATUS__c
|
from Repair__c where id = : RepairId
|
];
|
// repair.Id = RepairId;
|
List < PAE_DecisionRecord__c > rdRecordList = [SELECT Id, Name, PAE_DetermineResults__c, PAE_DetermineResults_Text__c, PAE_ConfirmationDate__c,
|
PAE_Authenticator__c, PAE_reappear_confirm__c
|
FROM PAE_DecisionRecord__c where Id = : paedRecordId
|
];
|
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'reappear_confirm++++++ ' + reappear_confirm));
|
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'repair++++++ ' + repair.PAE_reappear_confirm__c));
|
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'PAE_reappear++++++ ' + rdRecordList[0].PAE_reappear_confirm__c));
|
// if (true) {
|
// return;
|
// }
|
PAE_DecisionRecord__c paedRecord = new PAE_DecisionRecord__c();
|
paedRecord.Id = paedRecordId;
|
if (ASac_ASrc == 'Intake') {
|
paedRecord.PAE_reappear_confirm__c = reappear_confirm;
|
//add by rentx 2020-11-20 start doj34
|
//update by rentx 2020-11-30
|
//final判定后,ETQ同步失败,并且用户输入的为空 再现确认结果要清空
|
// 20210512 gzw update reappear_confirm 空指针的情况对应
|
if (String.isBlank(reappear_confirm)) {
|
if (repair.PAE_reappear_confirm__c == '已确认') {
|
reappear_confirm = '已确认';
|
} else {
|
reappear_confirm = '未确认';
|
}
|
}
|
if (repair.PAE_DetermineAC__c != null && repair.ETQ_UPLOAD_STATUS__c != '4' && reappear_confirm.equals('未确认')) {
|
repair.PAE_reappear_confirm__c = '';
|
} else {
|
repair.PAE_reappear_confirm__c = reappear_confirm;
|
}
|
//add by rentx 2020-11-20 end
|
// 2020/08/05 taoqz add start
|
// 进行修理的判定结果
|
// 进行修理的判定结果确认者
|
// 进行修理的判定结果确认日
|
// Gzw add
|
// 有进行修理的判定结果时,记录记录进行修理的判定结果确认者
|
if (String.isNotBlank(repa.Repair_Determine_result__c) && (repa.IS_AE__c == 'YES' && isOSH)) {
|
repair.Repair_Determine_result__c = repa.Repair_Determine_result__c;
|
repair.Repair_Determine_result_ConfirmationUser__c = UserInfo.getUserId();
|
repair.Repair_Determine_result_ConfirmationDate__c = Date.toDay();
|
}
|
// 是否可进行修理的判定时,记录OSH RA 确认者 和确认时间
|
if (String.isNotBlank(repa.if_Repair_Allowed__c) && isOSH) {
|
repair.if_Repair_Allowed__c = repa.if_Repair_Allowed__c;
|
repair.NotAllowedReason__c = repa.NotAllowedReason__c;
|
repair.OSHRAConfirmUser__c = UserInfo.getUserId();
|
repair.OSHRAConfirmDate__c = Date.toDay();
|
}
|
// 2020/08/05 taoqz add end
|
} else {
|
paedRecord.PAE_reappear_confirm__c = repair.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;
|
}
|
//20191218 modify start
|
List < Repair__c > repairList;
|
if (ASac_ASrc == 'Intake') {
|
repairList = [select Id, Name, RC_PAED__c, AC_PAED__c, PAE_reappear_confirm__c, IISE_confirmed_person__c from Repair__c where RC_PAED__c = : paedRecordId];
|
if (repairList.size() == 0) {
|
// 20201103 gzw 已经有Final 再现结果确认 时,Repair_Authenticator__c存在不更新 start
|
if (String.isBlank(repair.Repair_Authenticator__c)) {
|
repair.Repair_ConfirmationDate__c = Date.toDay();
|
repair.Repair_Authenticator__c = UserInfo.getUserId();
|
}
|
// 20201103 gzw 已经有Final 再现结果确认 时,Repair_Authenticator__c存在不更新 end
|
repair.RC_PAED__c = paedRecordId;
|
} else {
|
//20191218 add
|
// 20201102 gzw 已经有Final 再现结果确认 时,Repair_Authenticator__c存在不更新 start
|
if (String.isBlank(repair.Repair_Authenticator__c)) {
|
repair.Repair_ConfirmationDate__c = rdRecord.PAE_ConfirmationDate__c;
|
repair.Repair_Authenticator__c = rdRecord.PAE_Authenticator__c;
|
}
|
// 20201102 gzw 已经有Final 再现结果确认 时,Repair_Authenticator__c存在不更新 end
|
repair.RC_PAED__c = paedRecordId;
|
//20191218 end
|
}
|
} else {
|
repairList = [select Id, Name, RC_PAED__c, AC_PAED__c, PAE_reappear_confirm__c, IISE_confirmed_person__c from Repair__c where AC_PAED__c = : paedRecordId];
|
if (repairList.size() == 0) {
|
if (String.isBlank(repair.OCSM_RC_CordingUser__c)) {
|
repair.OCSM_RC_CordingDate__c = Date.toDay();
|
repair.OCSM_RC_CordingUser__c = UserInfo.getUserId();
|
}
|
repair.AC_PAED__c = paedRecordId;
|
} else {
|
//20191218 add
|
if (String.isBlank(repair.OCSM_RC_CordingUser__c)) {
|
repair.OCSM_RC_CordingDate__c = rdRecord.PAE_ConfirmationDate__c;
|
repair.OCSM_RC_CordingUser__c = rdRecord.PAE_Authenticator__c;
|
}
|
repair.AC_PAED__c = paedRecordId;
|
//20191218 end
|
}
|
}
|
//20191218 modify end
|
if (String.isNotBlank(stitchingCode)) {
|
if (ASac_ASrc == 'Intake') {
|
repair.ASReportedCode__c = stitchingCode;
|
// 2020/08/04 taoqz modify
|
// repair.PAE_Determine__c = rdRecord.PAE_DetermineResults__c;
|
repair.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c;
|
repair.PAE_intakePrevDetermineResults__c = prevDetermineResults; //20200107 add
|
//20191217 add
|
//如果有不在现 则更新repair.ASReportedCodeAC__c
|
if (String.isNotBlank(stitchingCodeZ)) {
|
//20191217 modify start
|
if (String.isNotBlank(repair.PAE_temp_final_code__c)) {
|
repair.ASReportedCodeAC__c = repair.PAE_temp_final_code__c + ',' + stitchingCodeZ;
|
} else {
|
repair.ASReportedCodeAC__c = stitchingCodeZ;
|
}
|
repair.PAE_codez__c = stitchingCodeZ;
|
} else {
|
//202003224 add 如果没有有不在现 则更新repair.ASReportedCodeAC__c
|
repair.ASReportedCodeAC__c = repair.PAE_temp_final_code__c;
|
repair.PAE_codez__c = stitchingCodeZ;
|
}
|
//20191217 modify end
|
} else {
|
//20191217 modify start
|
//repair.ASReportedCodeAC__c = stitchingCode;//20191217 modify
|
if (String.isNotBlank(repair.PAE_codez__c)) {
|
repair.ASReportedCodeAC__c = stitchingCode + ',' + repair.PAE_codez__c;
|
} else {
|
repair.ASReportedCodeAC__c = stitchingCode;
|
}
|
repair.PAE_temp_final_code__c = stitchingCode;
|
//20191217 modify end
|
// 2020/08/04 taoqz modify
|
// repair.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults__c;
|
repair.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c;
|
repair.PAE_finalPrevDetermineResults__c = prevDetermineResults; //20200107 add
|
}
|
} else {
|
if (ASac_ASrc == 'Intake') {
|
repair.ASReportedCode__c = stitchingCode;
|
repair.PAE_codez__c = stitchingCodeZ; //20191218 add
|
repair.ASReportedCodeAC__c = repair.PAE_temp_final_code__c; //20191218 add
|
// 2020/08/04 taoqz modify
|
// repair.PAE_Determine__c = rdRecord.PAE_DetermineResults__c; //20191218 add
|
repair.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c; //20191218 add
|
repair.PAE_intakePrevDetermineResults__c = prevDetermineResults; //20200107 add
|
repair.Repair_ConfirmationDate__c = null; //20200416
|
repair.Repair_Authenticator__c = null; //20200416
|
} else {
|
repair.ASReportedCodeAC__c = stitchingCode;
|
repair.PAE_temp_final_code__c = stitchingCode; //20191218 add
|
// 2020/08/04 taoqz modify
|
// repair.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults__c;//20191218 add
|
repair.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c; //20191218 add
|
repair.PAE_finalPrevDetermineResults__c = prevDetermineResults; //20200107 add
|
repair.OCSM_RC_CordingDate__c = null; //20200416
|
repair.OCSM_RC_CordingUser__c = null; //20200416
|
}
|
}
|
update repair;
|
} else {
|
//QIS相关
|
QIS_Report__c qisReport = [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, QIS_Authenticator__c, OCSM_RC_CordingUser__c
|
from QIS_Report__c where id = : QISReportId
|
];
|
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;
|
qisReport.PAE_reappear_confirm__c = reappear_confirm;
|
} else {
|
paedRecord.PAE_reappear_confirm__c = qisReport.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();
|
}
|
/*else{
|
if(String.isNotBlank(prevDetermineResults)&&String.isNotBlank(rdRecord.PAE_DetermineResults__c)){
|
if(prevDetermineResults.equals(rdRecord.PAE_DetermineResults__c)){
|
//最新一条数据的确认日和确认者
|
List<PAE_DecisionRecordDetail__c> DetailList = [SELECT Id, Name,PAED_Status__c, PAED_ConfirmationDate__c,PAED_Affirmant__c,PAED_CancellationDate__c, PAED_Nullifier__c
|
FROM PAE_DecisionRecordDetail__c WHERE PAE_DecisionRecordD__c = :paedRecordId Order by PAED_ConfirmationDate__c desc ];
|
paedRecord.Id = paedRecordId;
|
paedRecord.PAE_ConfirmationDate__c = DetailList[0].PAED_ConfirmationDate__c !=NULL?DetailList[0].PAED_ConfirmationDate__c: Date.toDay();
|
paedRecord.PAE_Authenticator__c = String.isNotBlank(DetailList[0].PAED_Affirmant__c)?DetailList[0].PAED_Affirmant__c:UserInfo.getUserId();
|
}
|
}
|
}*/
|
if (paedRecord != null) {
|
update paedRecord;
|
}
|
//20191218 modify start
|
List < QIS_Report__c > qisList;
|
if (ASac_ASrc == 'Intake') {
|
qisList = [select Id, Name, RC_PAED__c, AC_PAED__c from QIS_Report__c where RC_PAED__c = : paedRecordId];
|
if (qisList.size() == 0) {
|
if (String.isBlank(qisReport.QIS_Authenticator__c)) {
|
qisReport.QIS_ConfirmationDate__c = Date.toDay();
|
qisReport.QIS_Authenticator__c = UserInfo.getUserId();
|
}
|
qisReport.RC_PAED__c = paedRecordId;
|
} else {
|
//20191218 add
|
if (String.isBlank(qisReport.QIS_Authenticator__c)) {
|
qisReport.QIS_ConfirmationDate__c = rdRecord.PAE_ConfirmationDate__c;
|
qisReport.QIS_Authenticator__c = rdRecord.PAE_Authenticator__c;
|
}
|
qisReport.RC_PAED__c = paedRecordId;
|
//20191218 end
|
}
|
} else {
|
qisList = [select Id, Name, RC_PAED__c, AC_PAED__c from QIS_Report__c where AC_PAED__c = : paedRecordId];
|
if (qisList.size() == 0) {
|
if (String.isBlank(qisReport.OCSM_RC_CordingUser__c)) {
|
qisReport.OCSM_RC_CordingDate__c = Date.toDay();
|
qisReport.OCSM_RC_CordingUser__c = UserInfo.getUserId();
|
}
|
qisReport.AC_PAED__c = paedRecordId;
|
} else {
|
//20191218 add
|
if (String.isBlank(qisReport.OCSM_RC_CordingUser__c)) {
|
qisReport.OCSM_RC_CordingDate__c = rdRecord.PAE_ConfirmationDate__c;
|
qisReport.OCSM_RC_CordingUser__c = rdRecord.PAE_Authenticator__c;
|
}
|
qisReport.AC_PAED__c = paedRecordId;
|
//20191218 end
|
}
|
}
|
//20191218 modify end
|
if (String.isNotBlank(stitchingCode)) {
|
if (ASac_ASrc == 'Intake') {
|
qisReport.ASReportedCode__c = stitchingCode;
|
// 2020/08/04 taoqz modify
|
// qisReport.PAE_Determine__c = rdRecord.PAE_DetermineResults__c;
|
qisReport.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c;
|
qisReport.PAE_intakePrevDetermineResults__c = prevDetermineResults; //20200107 add
|
//20191217 add
|
//如果有不在现 则更新repair.ASReportedCodeAC__c
|
if (String.isNotBlank(stitchingCodeZ)) {
|
//20191217 modify start
|
if (String.isNotBlank(qisReport.PAE_temp_final_code__c)) {
|
qisReport.ASReportedCodeAC__c = qisReport.PAE_temp_final_code__c + ',' + stitchingCodeZ;
|
} else {
|
qisReport.ASReportedCodeAC__c = stitchingCodeZ;
|
}
|
qisReport.PAE_codez__c = stitchingCodeZ;
|
} else {
|
//202003224 add 如果没有有不在现 则更新repair.ASReportedCodeAC__c
|
qisReport.ASReportedCodeAC__c = qisReport.PAE_temp_final_code__c;
|
qisReport.PAE_codez__c = stitchingCodeZ;
|
}
|
//20191217 modify end
|
} else {
|
//20191217 modify start
|
if (String.isNotBlank(qisReport.PAE_codez__c)) {
|
qisReport.ASReportedCodeAC__c = stitchingCode + ',' + qisReport.PAE_codez__c;
|
} else {
|
qisReport.ASReportedCodeAC__c = stitchingCode;
|
}
|
qisReport.PAE_temp_final_code__c = stitchingCode;
|
//20191217 modify end
|
// 2020/08/04 taoqz modify
|
// qisReport.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults__c;
|
qisReport.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c;
|
qisReport.PAE_finalPrevDetermineResults__c = prevDetermineResults; //20200107 add
|
}
|
} else {
|
if (ASac_ASrc == 'Intake') {
|
qisReport.ASReportedCode__c = stitchingCode;
|
qisReport.PAE_codez__c = stitchingCodeZ; //20191218 add
|
qisReport.ASReportedCodeAC__c = qisReport.PAE_temp_final_code__c; //20191218 add
|
// 2020/08/04 taoqz modify
|
// qisReport.PAE_Determine__c = rdRecord.PAE_DetermineResults__c; //20191218 add
|
qisReport.PAE_Determine__c = rdRecord.PAE_DetermineResults_Text__c; //20191218 add
|
qisReport.PAE_intakePrevDetermineResults__c = prevDetermineResults; //20200107 add
|
qisReport.QIS_ConfirmationDate__c = null; //20200416
|
qisReport.QIS_Authenticator__c = null; //20200416
|
} else {
|
qisReport.ASReportedCodeAC__c = stitchingCode;
|
qisReport.PAE_temp_final_code__c = stitchingCode; //20191218 add
|
// 2020/08/04 taoqz modify
|
// qisReport.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults__c;//20191218 add
|
qisReport.PAE_DetermineAC__c = rdRecord.PAE_DetermineResults_Text__c; //20191218 add
|
qisReport.PAE_finalPrevDetermineResults__c = prevDetermineResults; //20200107 add
|
qisReport.OCSM_RC_CordingDate__c = null; //20200416
|
qisReport.OCSM_RC_CordingUser__c = null; //20200416
|
}
|
}
|
// System.debug('程序走到了1068行,qis的PAE_DetermineAC__c为:'+qisReport.PAE_DetermineAC__c+'qis的PAE_Determine__c为:'+qisReport.PAE_Determine__c);
|
update qisReport;
|
}
|
}
|
//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.Id = paedRDInfo.paedrdd.Id;
|
paedrd.PAED_Reappear_Result__c = '不再現';
|
paedrd.PAED_ResultAffirmant__c = UserInfo.getUserId();
|
paedrd.PAED_ResultConfirmationDate__c = Date.toDay();
|
} else {
|
//paedrd.Id = paedRDInfo.paedrdd.Id;
|
paedrd.PAED_Reappear_Result__c = paedRDInfo.paedrdd.PAED_Reappear_Result__c;
|
paedrd.PAED_ResultAffirmant__c = null;
|
paedrd.PAED_ResultConfirmationDate__c = null;
|
}
|
return paedrd;
|
}
|
// 如果是确定并SAP按钮会触发该方法
|
// tqz 2020/06/19 start
|
// 非AE的修理在Intake编辑画面点击【确定并SAP申请】后,记录进行修理的判定结果确认者
|
public Pagereference sendToSAP() {
|
//如果触发了错误 则不更新字段 明细的错误 DOJ_ 课题95 add by rentongxiao 2020-10-13 start
|
if (IsEmptyManagementCode(paedRecordDetailView)) {
|
return null;
|
}
|
//如果触发了错误 则不更新字段 明细的错误 DOJ_ 课题95 add by rentongxiao 2020-10-13 end
|
Savepoint sp = Database.setSavepoint();
|
try {
|
// Gzw 20200907 【确定并SAP申请】后,记录进行修理的判定结果确认者
|
// SaveAndClose();
|
// isSentSAP__c,
|
// List<Repair__c> res = [select id,name,DOJ_Status__c,PAE_DetermineResults__c,Repair_ConfirmationDate__c,
|
// Repair_Authenticator__c,SAP_ApplyForRepair_time__c,Repair_Determine__c,
|
// Repair_Determine_result__c,OSH_Affirmant__c,
|
// SAP_Transfer_time__c,Repair_Ordered_Date__c,status__c,CreatedDate,IISE_confirmed_person_en__c,SAP_ApplyForRepair_day__c
|
// from Repair__c
|
// where id = :RepairId];
|
// if(res.size() > 0){
|
// Repair__c re = res.get(0);
|
// re.SAP_ApplyForRepair_day__c = Date.today();
|
// re.SAP_ApplyForRepair_time__c = DateTime.now();
|
// update re;
|
// }
|
// repa.SAP_ApplyForRepair_day__c = Date.today();
|
repa.status__c = '1.受理完毕';
|
repa.SAP_Transfer_time__c = DateTime.now();
|
// Gzw 非AE的修理在Intake编辑画面点击【确定并SAP申请】后,记录进行修理的判定结果确认者 start
|
// 有进行修理的判定结果时,记录记录进行修理的判定结果确认者
|
if (String.isNotBlank(repa.Repair_Determine_result__c) && (repa.IS_AE__c == 'YES' && isOSH)) {
|
repa.Repair_Determine_result_ConfirmationDate__c = Date.today();
|
repa.Repair_Determine_result_ConfirmationUser__c = UserInfo.getUserId();
|
}
|
// Gzw 非AE的修理在Intake编辑画面点击【确定并SAP申请】后,记录进行修理的判定结果确认者 end
|
update repa;
|
return SaveAndClose();
|
} catch (Exception e) {
|
Database.rollback(sp);
|
return null;
|
}
|
}
|
// tqz 2020/06/19 end
|
// 正则表达式 判断是否包含汉字
|
// 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;
|
}
|
// Pattern p = Pattern.compile('\\p{IsHan}');
|
// Matcher m = p.matcher( InputString );
|
// return m.find();
|
}
|
// 精琢科技 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;
|
}
|
}
|
}
|