force-app/main/default/classes/ChoiceAssetController.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/ChoiceAssetControllerTest.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/NFM612Rest.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/NFM612RestTest.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/RepairOrderHandler.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/RepairOrderHandler.cls-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/RepairOrderHandlerTest.cls | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/classes/RepairOrderHandlerTest.cls-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/triggers/RepairOrder.trigger | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
force-app/main/default/triggers/RepairOrder.trigger-meta.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
force-app/main/default/classes/ChoiceAssetController.cls
@@ -76,8 +76,9 @@ Order_No__c,Account.Name,Status,Department_Class__c,Hospital__r.Owner.Name, Hospital__r.Owner.Phone,Installation_Site__c,CurrentContract__c, Product2.Asset_Model_No__c,Hospital__r.Name,Department_Class__r.Name , Department_Class__r.Id,Ji_Zhong_Guan_Li_Ku_Cun__c Department_Class__r.Id,Ji_Zhong_Guan_Li_Ku_Cun__c,Account.RecordTypeId ,Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c ,Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c FROM Asset where Id != null AND Repairing_Count__c >= 0 AND SerialNumber like :serialNumber LIMIT 100 ]; @@ -126,6 +127,10 @@ if (info.check) { ast = info.ast; quantity += 1; // if (info.ast.Ji_Zhong_Guan_Li_Ku_Cun__c <= 0){ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '设备集中管理库存不足')); // return null; // } } } if (quantity == 0) { @@ -154,6 +159,9 @@ String zhanlueKeshiId = '00N10000002Dx5t'; //战略科室 String keshiId = '00N10000002Dx5n'; //科室 String guzhang = '00N10000002Dx5y'; //故障发生日 //add wangweipeng 2022/01/26 start String guzhangxcx = '00N1m000006vXqw'; //1.故障发生日(小程序) //add wangweipeng 2022/01/26 end String Repair_Source_Id = '00N10000002FH86';//新建修理来源 String Incharge_Staff_Id = '00N10000002EMHw';//修理委托者(FSE) @@ -232,10 +240,13 @@ url += joint_4 + RepairApplicantHospital_Id + joint_1 + repairSubOrder.Hospital__r.Name;//报修人医院 url += joint_4 + RepairApplicantDepartment_Id + joint_1 + repairSubOrder.Department__r.Name;//报修人科室 if (repairSubOrder.ProblemDescription__c != null) { url += joint_4 + Repair_Detail_Id + joint_1 + repairSubOrder.ProblemDescription__c; if (repairSubOrder.ResponseResultDesc__c != null) { //2022/04/07 zhangyuheng ProblemDescription__c>ResponseResultDesc__c url += joint_4 + Repair_Detail_Id + joint_1 + repairSubOrder.ResponseResultDesc__c; } url += joint_4 + guzhang + joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.FaultTime__c); //add wangweipeng 2022/02/11 start url += joint_4 + guzhangxcx + joint_1 + NFMUtil.formatDateTime2StrDateTime(repairSubOrder.FaultTime__c); //add wangweipeng 2022/02/11 end url += joint_4 + faqiri + joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.RepairsReportDate__c); url += joint_4 + PlannedVisitDay_Id + joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.PlannedVisitDay__c);//计划上门日 url += joint_4 + ActualVisitDateFirst_Id+ joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.ActualVisitDateFirst__c);//一次上门日 @@ -247,8 +258,42 @@ url += joint_4 + shouliri + joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.ReceiverTime__c); //add wangweipeng 2022/01/26 start url += joint_4 + SalesOfficeCode_selection_Id+ joint_1 + ast.Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c;//修理品返送地 // url += joint_4 + SalesOfficeCode_selection_Id+ joint_1 + ast.Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c;//修理品返送地 //2022/4/7 zhangyuheng 注释 //add wangweipeng 2022/01/26 end //add zhangyuheng 2022/04/07 start if (String.isNotBlank(ast.Account.RecordTypeId)) { if (ast.Account.RecordTypeId == '01210000000QemQAAS' || //战略科室 ET ast.Account.RecordTypeId == '01210000000QemL' || //战略科室 消化科 ast.Account.RecordTypeId == '01210000000Qezy' || //战略科室 其他 ast.Account.RecordTypeId == '01210000000Qf03' || //战略科室 不明 ast.Account.RecordTypeId == '01210000000QezZ' || //战略科室 呼吸科 ast.Account.RecordTypeId == '01210000000Qezo' || //战略科室 妇科 ast.Account.RecordTypeId == '01210000000Qeze' || //战略科室 普外科 ast.Account.RecordTypeId == '01210000000Qezj' || //战略科室 泌尿科 ast.Account.RecordTypeId == '01210000000Qezt' //战略科室 耳鼻喉科 ) { //战略科室 if (String.isNotBlank(ast.Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c)) { url += joint_4 + SalesOfficeCode_selection_Id+ joint_1 + ast.Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c;//修理品返送地 }else { // continue; } } if (ast.Account.RecordTypeId == '01210000000QfmRAAS' || //科室 呼吸科 ast.Account.RecordTypeId == '01210000000QfmH' || //科室 普外科 ast.Account.RecordTypeId == '01210000000Qfmb' || //科室 其他 ast.Account.RecordTypeId == '01210000000QfmM' || //科室 妇科 ast.Account.RecordTypeId == '01210000000QfmC' || //科室 泌尿科 ast.Account.RecordTypeId == '01210000000Qfm7' || //科室 消化科 ast.Account.RecordTypeId == '01210000000Qfm2' //科室 耳鼻喉科 ) { //科室 if (String.isNotBlank(ast.Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c)) { url += joint_4 + SalesOfficeCode_selection_Id+ joint_1 + ast.Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c;//修理品返送地 }else { // continue; } } } //add zhangyuheng 2022/04/07 end url += joint_3 + Incharge_Staff_Id + joint_1 + repairSubOrder.Owner.Name; url += joint_3 + Incharge_Staff_Id + joint_2 + repairSubOrder.OwnerId; @@ -310,7 +355,7 @@ String soql = 'select Id,name,SerialNumber,InstallDate,Information_From__c,Asset_situation__c,Order_No__c,Account.Name,Status,Department_Class__c, '; soql += 'Hospital__r.Owner.Name,Hospital__r.Owner.Phone,Installation_Site__c,CurrentContract__c,Product2.Asset_Model_No__c,Hospital__r.Name,Department_Class__r.Name ,Department_Class__r.Id,'; soql += 'Ji_Zhong_Guan_Li_Ku_Cun__c,Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c'; soql += 'Ji_Zhong_Guan_Li_Ku_Cun__c,Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c,Account.RecordTypeId'; soql += ' from Asset where Id != null AND Repairing_Count__c = 0 '; if (String.isNotBlank(FuselageNumber) || String.isNotBlank(AssetModel) || String.isNotBlank(HospitalName)) { soql += ' AND ('; force-app/main/default/classes/ChoiceAssetControllerTest.cls
@@ -2,6 +2,7 @@ private class ChoiceAssetControllerTest { @testSetup static void setupTestData() { Oly_TriggerHandler.bypass('ContactTriggerHandler'); ControllerUtil.EscapeNFM001Trigger = true; // 省 Address_Level__c al = new Address_Level__c(); @@ -113,7 +114,7 @@ ChoiceAssetController conTest = new ChoiceAssetController(); conTest.init(); conTest.searchAsset(); conTest.choiceAssetInfoRecordsview[1].check= true; conTest.choiceAssetInfoRecordsview[0].check= true; conTest.save(); } // 测试创建QIS force-app/main/default/classes/NFM612Rest.cls
@@ -54,6 +54,11 @@ public String applicantId; //申请修理人编号 public String applyDate; //申请时间 public String repairOrderNo2FSEID; //报修子单所属FSE的ID // 2022/4/6 zhangyuheng update start public String RepairFinishDate; //修理品处理完成日 public String ApplicanterPhone; //处理人电话 public String CancelDate; //受理人取消报修日 // 2022/4/6 zhangyuheng update end // 上线前 报修子单与修理上的相关字段都删除 public String responseResultsFirst; //上门应对结果(暂时注掉) @@ -131,6 +136,7 @@ List < String > managementCodeList = new List < String > (); //存放科室编码 List < String > rpersonList = new List < String > (); //存放报修人用户编码 List < String > canIdList = new List < String > (); //存放取消人用户编号 List < String > repairNoList = new List < String > (); //存放报修子单号 for (GeData ged: itemMasterList) { String dataComplete = verify(ged); if (!String.isBlank(dataComplete)) { @@ -226,12 +232,12 @@ repair.StartTimeFirst__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.startTimeFirst); //开始时间 repair.EndTimeFirst__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.endTimeThird); //结束时间 repair.FaultDescriptionFirst__c = ged.repairOderInfo.faultDescriptionFirst; //故障描述 repair.ActualVisitTimeSecond__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.actualVisitTimeSecond); //二次上门日 repair.StartTimeSecond__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.startTimeSecond); //二次上门开始时间 repair.ActualVisitTimeSecond__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.actualVisitTimeSecond); //二次上门日--->二次计划上门日 repair.StartTimeSecond__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.startTimeSecond); //二次上门开始时间--->二次上门日 repair.EndTimeSecond__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.endTimeSecond); //二次上门结束时间 repair.FaultDescriptionSecond__c = ged.repairOderInfo.faultDescriptionSecond; //二次故障描述 repair.ActualVisitTimeThird__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.actualVisitTimeThird); //三次上门日 repair.StartTimeThird__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.startTimeThird); //三次上门开始时间 repair.ActualVisitTimeThird__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.actualVisitTimeThird); //三次上门日--->三次计划上门日 repair.StartTimeThird__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.startTimeThird); //三次上门开始时间--->三次上门日 repair.EndTimeThird__c = NFMUtil.parseStr2DateTime(ged.repairOderInfo.endTimeThird); //三次上门结束时间 repair.FaultDescriptionThird__c = ged.repairOderInfo.faultDescriptionThird; //三次故障描述 repair.ApplicantType__c = ged.repairOderInfo.applicantType; //申请修理人类型 @@ -245,12 +251,20 @@ repair.Ownerid = canidMap.get(ged.repairOderInfo.repairOrderNo2FSEID).Id; //报修子单所属FSE的ID repair.AssetModel__c = ged.applyRepairInfo.equipmentModel; //设备型号 repair.AirframeCodeEngineer__c = ged.applyRepairInfo.equipmentCd; //机身编码(工程师) repair.ResponseResultDesc__c = ged.applyRepairInfo.responseResultDesc; //应对描述 repair.ResponseResultDesc__c = ged.applyRepairInfo.responseResultDesc; //应对描述--->问题描述(工程师) repair.ProcessResult__c = ged.applyRepairInfo.processResult; //处理结果 // 2022/4/6 zhangyuheng update start repair.RepairFinishDate__c = NFMUtil.parseDateTimeStr2Date(ged.repairOderInfo.RepairFinishDate) ; //修理品处理完成日 repair.ApplicanterPhone__c = ged.repairOderInfo.ApplicanterPhone; //处理人电话 repair.CancelleRepairTime__c = NFMUtil.parseDateTimeStr2Date(ged.repairOderInfo.CancelDate); //受理人取消报修日 // repair.CancelleRepairTime__c = NFMUtil.parseStr2Date(ged.repairOderInfo.CancelDate); //受理人取消报修日 repair.RepairCancelReason__c = ged.repairOderInfo.cancelReportReason; //修理取消原因 // 2022/4/6 zhangyuheng update end if ('问题已解决'.equals(ged.applyRepairInfo.processResult)) { repair.Status__c = '关闭'; // repair.Status__c = '关闭'; repair.Status__c = '已完成'; // 2022/4/6 zhangyuheng } else { repair.Status__c = '待处理'; @@ -270,10 +284,16 @@ repair.AttachmentName__c = attachmentName; repairOrderNo2Str += repairOrderNo2 + '\n'; repairList.add(repair); repairNoList.add(ged.repairOderInfo.repairOrderNo2); } if (repairList.size() > 0) { // 2022/4/6 zhangyuheng update start List<RepairSubOrder__c> repairList1 = [SELECT Id FROM RepairSubOrder__c WHERE RepairSubOrderNo__c in: repairNoList]; if (repairList1.size() > 0) { logstr += repairOrderNo2Str + ']-已存在'; } // if (repairList.size() > 0) {==== 2022/4/6 zhangyuheng注释掉 else { // 2022/4/6 zhangyuheng update end insert repairList; repairOrderNo2Str += ' ]\n'; logstr += repairOrderNo2Str + '新增完成, 新增总数数为:' + repairList.size() + '\n'; force-app/main/default/classes/NFM612RestTest.cls
@@ -5,6 +5,8 @@ } @testSetup static void makeTestRepair() { Oly_TriggerHandler.bypass('ContactTriggerHandler'); List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; if (rectCo.size() == 0) { throw new ControllerUtil.myException('not found 病院 recodetype'); force-app/main/default/classes/RepairOrderHandler.cls
New file @@ -0,0 +1,31 @@ public without sharing class RepairOrderHandler extends Oly_TriggerHandler { private Map<Id, Repair__c> newMap; private Map<Id, Repair__c> oldMap; private List<Repair__c> newList; private List<Repair__c> oldList; public RepairOrderHandler() { this.newMap = (Map<Id, Repair__c>) Trigger.newMap; this.oldMap = (Map<Id, Repair__c>) Trigger.oldMap; this.newList = (List<Repair__c>) Trigger.new; this.oldList = (List<Repair__c>) Trigger.old; } protected override void afterInsert() { RepairInsert(); } public void RepairInsert(){ List<RepairSubOrder__c> repairSubOrderList = new List<RepairSubOrder__c>(); for (Repair__c repair : newList) { if (Trigger.isInsert) { if (String.isNotBlank(repair.RepairSubOrder__c)) { RepairSubOrder__c rso = new RepairSubOrder__c(); rso.Id = repair.RepairSubOrder__c; rso.SFDCRepairApplyDate__c = Date.today(); repairSubOrderList.add(rso); } } } if (repairSubOrderList.size() > 0) { update repairSubOrderList; } } } force-app/main/default/classes/RepairOrderHandler.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>41.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/classes/RepairOrderHandlerTest.cls
New file @@ -0,0 +1,62 @@ @isTest private class RepairOrderHandlerTest { final static string ra1 = [select id , SobjectType, developername from recordtype where SobjectType='Rental_Apply__c' and developername='StandardRequest'][0].id; final static string acc1 = [select id , SobjectType, developername from recordtype where SobjectType='Account' and developername='HP'][0].id; static testMethod void testMethod1() { RepairSubOrder__c subOrder = new RepairSubOrder__c(); subOrder.AttachmentDownload__c = true; subOrder.AttachmentLink__c = 'https://albsylfw.s3.cn-northwest-1.amazonaws.com.cn/20211220/14/11/30/lessthan12/5e8cb69e-f935-48f5-825e-b8344d60f6d4.zip'; subOrder.AttachmentName__c = '测试附件下载'; insert subOrder; Account hp = new Account(RecordTypeId = acc1, Name = 'AccountTestHp1'); insert hp; Product2 prd1 = new Product2(); prd1.ProductCode_Ext__c = 'Prd1'; prd1.ProductCode = 'Prd1'; prd1.Repair_Product_Code__c = 'Prd1_RP'; prd1.Name = 'Prd1'; prd1.Manual_Entry__c = false; prd1.Category2__c = '本体'; prd1.Category3__c = '纤维镜'; prd1.Category4__c = 'CV'; prd1.Category5__c = '260SL系列'; prd1.Asset_Model_No__c = '1001'; insert prd1; Asset ast1 = new Asset(); ast1.Name = '保有設備1'; ast1.Hospital__c = hp.Id; ast1.AccountId = hp.Id; ast1.Product2Id = prd1.Id; ast1.SerialNumber = 'SerialNumber1'; ast1.Guarantee_period_for_products__c = Date.today(); ast1.InstallDate = Date.today(); insert ast1; final string acc2 = [select id , SobjectType, developername from recordtype where SobjectType='Account' and developername='Department_Class_BF'][0].id; //戦略科室分類 呼吸科 Account Department_Class_BF = new Account(RecordTypeId = acc2, Name = 'Department_Class_BF',ParentId=hp.id,Department_Class_Label__c='呼吸科'); insert Department_Class_BF; final string acc3 = [select id , SobjectType, developername from recordtype where SobjectType='Account' and developername='Department_BF'][0].id; //戦略科室分類 呼吸科 Account Department_BF = new Account(RecordTypeId = acc3, Name = 'Department_BF',ParentId=Department_Class_BF.id,Hospital__c=hp.id,Department_Class__c=Department_Class_BF.id); insert Department_BF; Repair__c repair1 = new Repair__c(); repair1.Service_Repair_No__c = 'repair1'; repair1.Hospital__c = hp.Id; repair1.Account__c = Department_BF.Id; repair1.Department_Class__c = Department_Class_BF.id; repair1.Delivered_Product__c = ast1.Id; repair1.Repair_List_Price__c = 100; repair1.Billing_Amount__c = 10; repair1.Paid_Amount__c = 1; repair1.Failure_Occurrence_Date__c = Date.today().addDays(-1); repair1.Repair_Returned_To_HP_Date__c = Date.today().addDays(3); repair1.Repair_Shipped_Date__c = Date.today().addDays(1); repair1.RepairSubOrder__c = subOrder.Id; repair1.DeliveryLogisticsMode__c = '其他'; insert repair1; } } force-app/main/default/classes/RepairOrderHandlerTest.cls-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>41.0</apiVersion> <status>Active</status> </ApexClass> force-app/main/default/triggers/RepairOrder.trigger
New file @@ -0,0 +1,4 @@ trigger RepairOrder on Repair__c(after insert) { RepairOrderHandler roh = new RepairOrderHandler(); roh.run(); } force-app/main/default/triggers/RepairOrder.trigger-meta.xml
New file @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexTrigger xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>41.0</apiVersion> <status>Active</status> </ApexTrigger>