public with sharing class QISReportController {
|
// Final universal code编辑
|
@AuraEnabled
|
public static InitData initForQisUniversalFailureCodeButton (String recordId){
|
InitData res = new initData();
|
try{
|
QIS_Report__c report = [SELECT id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
|
res.Id = report.Id;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
|
@AuraEnabled
|
public static InitData sqlForPAE (String qisReportId){
|
InitData res = new initData();
|
ConstClass Constc = new ConstClass();
|
String RecordTypeId = Constc.REC_DEVELOPERNAME_ASA;
|
try{
|
PAE_DecisionRecord__c RCPAED_IdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId And RecordType.DeveloperName = :RecordTypeId limit 1];
|
res.PAEid = RCPAED_IdList.id;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
|
//Intake universal code编辑
|
@AuraEnabled
|
public static InitData initForlexQISIntakeuniversalcodeButton (String recordId){
|
InitData res = new initData();
|
try{
|
QIS_Report__c report = [SELECT id FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
|
res.Id = report.Id;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
|
@AuraEnabled
|
public static InitData sqlForPAE1 (String qisReportId){
|
InitData res = new initData();
|
ConstClass Constc = new ConstClass();
|
String RecordTypeId = Constc.REC_DEVELOPERNAME_ASR;
|
try{
|
PAE_DecisionRecord__c ASRCD_IdList = [SELECT LastModifiedDate, Id, Name, LastModifiedById,RecordType.DeveloperName FROM PAE_DecisionRecord__c where PAE_QIS__c = :qisReportId And RecordType.DeveloperName = :RecordTypeId Limit 1];
|
res.PAEid = ASRCD_IdList.id;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
//OSH现品收到
|
@AuraEnabled
|
public static InitData initForOSHRecievedButton (String recordId){
|
InitData res = new initData();
|
try{
|
QIS_Report__c report = [SELECT id,QIS_Status__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
|
res.Id = report.Id;
|
res.QIStatus = report.QIS_Status__c;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
|
@AuraEnabled
|
public static String updateQis (String recordId){
|
String re = '成功';
|
try{
|
ID myUserID = UserInfo.getUserId();
|
ConstClass Constc = new ConstClass();
|
User tempUser = [select id,Alias,Email from user where id = : myUserID ];
|
QIS_Report__c rac = new QIS_Report__c();
|
rac.id = recordId;
|
rac.QIS_Status__c = Constc.QIS_STATUS1;
|
rac.OSHRecievedDate__c = Date.today();
|
rac.OSH_Receive_staff__c = tempUser.Alias;
|
rac.OSH_staff__c = tempUser.Alias;
|
rac.OSH_staff_email__c = tempUser.email;
|
rac.Is_ProductGot__c = true;
|
rac.OSH_GotProductPeople__c = tempUser.id;
|
User resultSet = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c FROM User WHERE Id = :myUserID];
|
if (resultSet!=null && resultSet.JingliApprovalManager__c != null && resultSet.BuchangApprovalManager__c != null ) {
|
rac.OSH_Manager__c = resultSet.JingliApprovalManager__c;
|
rac.OSH_Buzhang__c = resultSet.BuchangApprovalManager__c;
|
}else{
|
rac.OSH_Manager__c= myUserID;
|
rac.OSH_Buzhang__c= myUserID;
|
}
|
Oly_TriggerHandler.bypass('QIS_ReportTrigger');
|
update rac;
|
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
re = e.getMessage();
|
}
|
return re;
|
}
|
|
//提交待审批1
|
@AuraEnabled
|
public static InitData initForOSHSubmitButton (String recordId){
|
InitData res = new initData();
|
try{
|
QIS_Report__c report = [SELECT id,QIS_Status__c,OSH_staff__c,OSH_staff_email__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
|
res.Id = report.Id;
|
res.QIStatus = report.QIS_Status__c;
|
res.OSHstaff = report.OSH_staff__c;
|
res.OSHstaffEmail = report.OSH_staff_email__c;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static String updateQis1 (String recordId){
|
String re = '成功';
|
try{
|
ConstClass Constc = new ConstClass();
|
QIS_Report__c rac = new QIS_Report__c();
|
rac.id = recordId;
|
rac.QIS_Status__c = Constc.QIS_STATUS2;
|
update rac;
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
re = e.getMessage();
|
}
|
return re;
|
}
|
//提交待审批
|
@AuraEnabled
|
public static InitData initForRCSubmitButton (String recordId){
|
InitData res = new initData();
|
try{
|
QIS_Report__c report = [SELECT id,RC_problem_not_found__c,QIS_Reply_day__c,RC_inspection_date__c,QIS_Status__c,Cancel_QIS_Reason__c,OSH_staff__c,OSH_staff_email__c,RC__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
|
res.Id = report.Id;
|
res.QIStatus = report.QIS_Status__c;
|
res.OSHstaff = report.OSH_staff__c;
|
res.OSHstaffEmail = report.OSH_staff_email__c;
|
res.CancelQISReason = report.Cancel_QIS_Reason__c;
|
res.RCid = report.RC__c;
|
res.RCinspectionDate = report.RC_inspection_date__c;
|
res.QISReplyDay = report.QIS_Reply_day__c;
|
res.RCproblemnotfound = report.RC_problem_not_found__c;
|
System.debug(LoggingLevel.INFO, '*** res: ' + res);
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
}
|
return res;
|
}
|
|
@AuraEnabled
|
public static String updateQisWithRC (String recordId,String type,String oldQIStatus){
|
String re = '成功';
|
ConstClass Constc = new ConstClass();
|
ID myUserID = UserInfo.getUserId();
|
User userinfo = [SELECT Id, JingliApprovalManager__c, BuchangApprovalManager__c, ZongjianApprovalManager__c, BuchangApprovalManagerSales__c, SalesManager__c FROM User WHERE Id = :myUserID LIMIT 1];
|
QIS_Report__c rac = new QIS_Report__c();
|
rac.id = recordId;
|
if (type == '1') {
|
QIS_Report__c report1 = [SELECT id,RC_problem_not_found__c,RC_FixedJudgement__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
|
rac.QIS_Status__c = Constc.QIS_STATUS3;
|
if (report1.RC_problem_not_found__c == true && report1.RC_FixedJudgement__c == false) {
|
QIS_Report__c qisreport = [SELECT Id, Reason_bloken__c, Special_follow__c, next_action__c, QIS_Reply_Comment__c, OCM_judgement__c FROM QIS_Report__c WHERE Id = :recordId LIMIT 1];
|
if (qisreport != null) {
|
rac.Reason_bloken1__c = qisreport.Reason_bloken__c;
|
rac.Special_follow1__c = qisreport.Special_follow__c;
|
rac.next_action1__c = qisreport.next_action__c;
|
rac.QIS_Reply_Comment1__c = qisreport.QIS_Reply_Comment__c;
|
rac.OCM_judgement1__c = qisreport.OCM_judgement__c;
|
}
|
}
|
}
|
if (type == '2') {
|
rac.QIS_Status__c = Constc.QIS_STATUS4;
|
rac.QIS_Cancel_Submit_day__c = Date.today();
|
}
|
try{
|
if (userinfo!=null && userinfo.BuchangApprovalManagerSales__c != null) {
|
rac.RC_Manager__c = userinfo.BuchangApprovalManagerSales__c;
|
}else{
|
rac.RC_Manager__c = myUserID;
|
}
|
if (userinfo!=null) {
|
if (oldQIStatus == Constc.QIS_STATUS5) {
|
rac.RC__c = myUserID;
|
}
|
if (userinfo.SalesManager__c != null ) {
|
rac.ApproveManager__c = userinfo.SalesManager__c;
|
}else{
|
rac.ApproveManager__c = myUserID;
|
}
|
if (userinfo.BuchangApprovalManagerSales__c != null ) {
|
rac.ApproveBuZhang__c = userinfo.BuchangApprovalManagerSales__c ;
|
}else{
|
rac.ApproveBuZhang__c = myUserID;
|
}
|
if (userinfo.ZongjianApprovalManager__c != null ) {
|
rac.AppeoveZongJian__c = userinfo.ZongjianApprovalManager__c ;
|
}else{
|
rac.AppeoveZongJian__c = myUserID;
|
}
|
}
|
update rac;
|
}catch(Exception e){
|
System.debug(LoggingLevel.INFO, '*** e: ' + e);
|
re = e.getMessage();
|
}
|
return re;
|
}
|
|
|
public class InitData{
|
@AuraEnabled
|
public String Id;
|
@AuraEnabled
|
public String OwnerId;
|
@AuraEnabled
|
public String qisRecordTypeId;
|
@AuraEnabled
|
public String qisRecordName;
|
@AuraEnabled
|
public String ProfileName;
|
@AuraEnabled
|
public String PAEid;
|
@AuraEnabled
|
public String OCSMAdministrativeReportNumber;
|
@AuraEnabled
|
public String OCSMAdministrativeReportStatus;
|
@AuraEnabled
|
public String QIStatus;
|
@AuraEnabled
|
public String OSHstaff;
|
@AuraEnabled
|
public String OSHstaffEmail;
|
@AuraEnabled
|
public String CancelQISReason;
|
@AuraEnabled
|
public String RCid;
|
@AuraEnabled
|
public String contractnumber;
|
@AuraEnabled
|
public Date RCinspectionDate;
|
@AuraEnabled
|
public Date QISReplyDay;
|
@AuraEnabled
|
public Date QISInstallDate;
|
@AuraEnabled
|
public Date CDS_date;
|
@AuraEnabled
|
public Date Aware_date;
|
@AuraEnabled
|
public Date OCSMAdministrativeReportDate;
|
@AuraEnabled
|
public Boolean RCproblemnotfound;
|
@AuraEnabled
|
public Boolean isaohuiproduct;
|
@AuraEnabled
|
public Boolean IsSendQIS;
|
}
|
|
public class ConstClass{
|
final String REC_DEVELOPERNAME_ASA = 'ASACDecision';
|
final String REC_DEVELOPERNAME_ASR = 'ASRCDecision';
|
final String REC_OSH_ID = '01210000000RLWm';
|
final String REC_ANSWERCOMP_ID = '01210000000RLgY';
|
final String REC_FINAL_ID = '01210000000gFTH';
|
final String REC_COMP_ID = '01210000000RLcW';
|
final String QIS_STATUS1 = 'OSH检测中';
|
final String QIS_STATUS2 = 'OSH填写完毕';
|
final String QIS_STATUS3 = 'RC填写完毕';
|
final String QIS_STATUS4 = '取消申请';
|
final String QIS_STATUS5 = 'RC检测中';
|
final String QIS_STATUS6 = 'FSE填写完毕';
|
final String QIS_STATUS7 = 'OSH检测申请';
|
final String QIS_STATUS8 = '完毕';
|
}
|
|
}
|