| | |
| | | hp.FSE_SP_Main_Leader__c = hpOwner.Id; |
| | | update hp; |
| | | } |
| | | @isTest |
| | | static void FirstparagraphTest(){ |
| | | Account dealers = new Account(); |
| | | dealers.RecordTypeId = '01210000000Qem1'; |
| | | dealers.Name = 'Test Dealers'; |
| | | dealers.MonthlyPayment__c = false; |
| | | insert dealers; |
| | | dealers.MonthlyPayment__c = true; |
| | | update dealers; |
| | | } |
| | | } |
New file |
| | |
| | | @isTest |
| | | private class MaintenanceContractTriggerTest { |
| | | private static User hpOwner = null; |
| | | private static User hpOwner2 = null; |
| | | private static Id pricebookId = ControllerUtil.getStandardPricebook().Id; |
| | | private static Account hospital = null; |
| | | private static List<Account> strategicDep = null; |
| | | private static Product2 productA = null; |
| | | private static Account dep = null; |
| | | private static PricebookEntry entry = null; |
| | | private static Asset asset01 = null; |
| | | private static Asset asset02 = null; |
| | | private static Asset asset03 = null; |
| | | private static Maintenance_Contract__c contract = null; |
| | | static { |
| | | Profile p = [select Id from Profile where id =:System.Label.ProfileId_SystemAdmin]; |
| | | hpOwner = new User(Test_staff__c = true, LastName = 'hp', FirstName = 'owner', Alias = 'hp', Work_Location__c = '北京', CommunityNickname = 'hpOwner', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | insert hpOwner; |
| | | hpOwner2 = new User(Test_staff__c = true, LastName = 'hp2', FirstName = 'owner', Alias = 'hp2', Work_Location__c = '重庆', CommunityNickname = 'hpOwner2', Email = 'olympus_hpowner@sunbridge.com', Username = 'olympus_hpowner2@sunbridge.com', IsActive = true, EmailEncodingKey = 'ISO-2022-JP', TimeZoneSidKey = 'Asia/Tokyo', LocaleSidKey = 'ja_JP', LanguageLocaleKey = 'ja', ProfileId = p.id); |
| | | insert hpOwner2; |
| | | |
| | | // 病院を作る |
| | | hospital = new Account(); |
| | | hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; |
| | | hospital.Name = 'test hospital'; |
| | | insert hospital; |
| | | |
| | | // 戦略科室を得る |
| | | strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_GI']; |
| | | |
| | | // 診療科を作る |
| | | dep = new Account(); |
| | | dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_GI'].id; |
| | | dep.Name = 'test dep'; |
| | | dep.ParentId = strategicDep[0].Id; |
| | | dep.Department_Class__c = strategicDep[0].Id; |
| | | dep.Hospital__c = hospital.Id; |
| | | insert dep; |
| | | |
| | | // 製品を作る |
| | | productA = new Product2( Name='テスト商品'); |
| | | insert productA; |
| | | |
| | | // 価格表エントリを作成する |
| | | entry = new PricebookEntry( Pricebook2Id=pricebookId, Product2Id=productA.Id); |
| | | entry.UnitPrice = 0; |
| | | entry.IsActive = true; |
| | | entry.UseStandardPrice = false; |
| | | entry.CurrencyIsoCode = 'CNY'; |
| | | entry.Product2Id = productA.Id; |
| | | insert entry; |
| | | |
| | | // 納入機器を作成する |
| | | asset01 = new Asset(); |
| | | asset01.Name = 'テスト機器'; |
| | | asset01.AccountId = dep.Id; |
| | | asset01.Department_Class__c = strategicDep[0].Id; |
| | | asset01.Hospital__c = hospital.Id; |
| | | asset01.SerialNumber = 'testserial'; |
| | | insert asset01; |
| | | asset02 = new Asset(); |
| | | asset02.Name = 'テスト機器'; |
| | | asset02.AccountId = dep.Id; |
| | | asset02.Department_Class__c = strategicDep[0].Id; |
| | | asset02.Hospital__c = hospital.Id; |
| | | asset02.SerialNumber = 'testserial'; |
| | | insert asset02; |
| | | asset03 = new Asset(); |
| | | asset03.Name = 'テスト機器'; |
| | | asset03.AccountId = dep.Id; |
| | | asset03.Department_Class__c = strategicDep[0].Id; |
| | | asset03.Hospital__c = hospital.Id; |
| | | asset03.SerialNumber = 'testserial'; |
| | | insert asset03; |
| | | |
| | | // 维修合同を作成する |
| | | contract = new Maintenance_Contract__c(); |
| | | contract.Name = 'tect contract'; |
| | | contract.Hospital__c = hospital.Id; |
| | | contract.Department_Class__c = strategicDep[0].Id; |
| | | contract.Department__c = dep.Id; |
| | | contract.Contract_Start_Date__c = Date.today() - 10; |
| | | contract.Contract_End_Date__c = Date.today() + 10; |
| | | contract.Service_Contract_Staff__c = '00510000002ZZTc'; |
| | | contract.upload_to_RM_time__c = Date.today() + 20; |
| | | insert contract; |
| | | |
| | | } |
| | | static testMethod void testMethod1() { |
| | | contract.All_Amount__c = 11.11; |
| | | update contract; |
| | | |
| | | contract.Payment_Plan_Sum_First__c = 222.11; |
| | | update contract; |
| | | |
| | | delete contract; |
| | | } |
| | | } |
| | |
| | | global class MaintenanceContractWebService { |
| | | // 用户点击上传sap按钮,更新状态到契约,自动触发上传sap接口程序 |
| | | WebService static String up2sap(String mcid) { |
| | | List<Maintenance_Contract__c> mcList = [select id, Status__c, Maintenance_Contract_No__c , Hospital__c , RecordTypeId, RecordType.DeveloperName from Maintenance_Contract__c where id = :mcid ]; |
| | | List<Maintenance_Contract__c> mcList = [select id, Status__c, Maintenance_Contract_No__c , Hospital__c , RecordTypeId, RecordType.DeveloperName,Is_RecognitionModel__c,Recognition_Model_Type__c,upload_to_RM_time__c,old_Is_RecognitionModel__c,Is_Recognition_Model_True__c from Maintenance_Contract__c where id = :mcid ]; |
| | | if (mcList.size() == 0) { |
| | | return '维修合同不存在,请确认维修合同ID。'; |
| | | } |
| | |
| | | if (mc.Maintenance_Contract_No__c == null || mc.Maintenance_Contract_No__c == '') { |
| | | return Schema.SObjectType.Maintenance_Contract__c.fields.Maintenance_Contract_No__c.label + '为空,不能上传sap'; |
| | | } |
| | | //update wangweipeng 2021/11/17 start |
| | | //用于判断当前合同是否需要认款 |
| | | boolean flag = false; |
| | | //判断是否需要认款合同 |
| | | if(mc.old_Is_RecognitionModel__c){ |
| | | //判断当前合同是否已经认款完成 |
| | | if(!mc.Is_Recognition_Model_True__c){ |
| | | flag = true; |
| | | } |
| | | } |
| | | //update wangweipeng 2021/11/17 end |
| | | try { |
| | | if(flag){ |
| | | mc.upload_to_RM_time__c = Datetime.now();//上传认款合同时间 |
| | | //mc.old_Is_RecognitionModel__c = mc.Is_RecognitionModel__c; |
| | | }else{ |
| | | mc.Status__c = '契約'; |
| | | mc.upload_to_sap_time__c = Datetime.now(); |
| | | |
| | | try { |
| | | //2021-01-14 mzy add LJPH-BWY5QB 合同状态为合同中时 ,将客户上的 维修合同用户类型 设为true ,合同上的 用户类型 为 新用户, 以后维修合同用户类型 都为 true 合同上的 用户类型 为 既有用户 |
| | | //只有合同是维修合同和服务合同的时候进入 |
| | | if (!mc.RecordType.DeveloperName.equals('VM_Contract')) { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | update mc; |
| | | //2021-01-14 mzy add LJPH-BWY5QB 合同状态为合同中时 ,将客户上的 维修合同用户类型 设为true ,合同上的 用户类型 为 新用户, 以后维修合同用户类型 都为 true 合同上的 用户类型 为 既有用户 |
| | | } catch (Exception ex) { |
| | |
| | | contract1.Contract_End_Date__c = Date.today().addMonths(+20); |
| | | contract1.Contract_Start_Date__c = Date.today(); |
| | | contract1.Contract_Range__c = Decimal.valueOf('20'); |
| | | contract1.old_Is_RecognitionModel__c = true; |
| | | contract1.Is_Recognition_Model_True__c = false; |
| | | insert contract1; |
| | | List<String> mcidList = new List<String>(); |
| | | mcidList.add(contract1.Id); |
| | | |
| | | MaintenanceContractWebService.up2sap(contract.Id); |
| | | MaintenanceContractWebService.up2sap(contract1.Id); |
| | | contract1.old_Is_RecognitionModel__c = false; |
| | | contract1.Is_Recognition_Model_True__c = false; |
| | | update contract1; |
| | | |
| | | delete contract; |
| | | MaintenanceContractWebService.up2sap(contract.Id); |
| | |
| | | } |
| | | } |
| | | } |
| | | //Repair测试类跳过 thh 20220401 start |
| | | if(StaticParameter.EscapeNFM106Trigger){ |
| | | return; |
| | | } |
| | | //Repair测试类跳过 thh 20220401 end |
| | | if (Trigger.isBefore) { |
| | | if (Trigger.isUpdate) { |
| | | for(Maintenance_Contract__c mc : newList) { |
| | |
| | | // CHAN-BSV3GZ start |
| | | // 原代码 |
| | | // rowData.retry_cnt__c=0; |
| | | if (status == 'OK') { |
| | | system.debug('status15122021'+status); |
| | | if (status == 'ok') { |
| | | rowData.retry_cnt__c = 0; |
| | | } else { |
| | | if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0; |
| | |
| | | Contract_End_Date__c, |
| | | Total_Contract_Number__c, |
| | | Is_New_Contract__c, |
| | | Is_RecognitionModel__c, |
| | | old_Is_RecognitionModel__c, |
| | | //LJPH-BUKD5A 《委托》合同文本的修改 精琢技术 wql 2020/10/23 start |
| | | //根据经销商名是否有值判断是否打印新/合同版本 |
| | | Dealer__c |
| | |
| | | public String TermFour_Once_Two {get; private set;} |
| | | public String TermFour_Once_Three {get; private set;} |
| | | public String TermFour_Once_Four {get; private set;} |
| | | //add wangweipeng 2021/12/10 start |
| | | public String TermFour_Once_Five {get; private set;} |
| | | //add wangweipeng 2021/12/10 end |
| | | public String TermFour_Much {get; private set;} |
| | | public String TermFour_Much_One {get; private set;} |
| | | public String TermFour_Much_Two {get; private set;} |
| | |
| | | public String TermFour_Much6 {get; private set;} |
| | | public String TermFive_Title {get; private set;} |
| | | public String TermFive_Head {get; private set;} |
| | | //add wangweipeng 2021/12/10 start |
| | | public String TermFive_Head2 {get; private set;} |
| | | //add wangweipeng 2021/12/10 end |
| | | public String TermFive_One {get; private set;} |
| | | public String TermFive_One2 {get; private set;} |
| | | //add wangweipeng 2021/12/10 start |
| | | public String TermFive_One3 {get; private set;} |
| | | //add wangweipeng 2021/12/10 end |
| | | public String TermFive_Two {get; private set;} |
| | | public String TermFive_Two2 {get; private set;} |
| | | public String TermFive_Three {get; private set;} |
| | |
| | | public String TermFive_Five2 {get; private set;} |
| | | public String TermFive_Six {get; private set;} |
| | | public String TermFive_Seven {get; private set;} |
| | | //add wangweipeng 2021/12/10 start |
| | | public String TermFive_Seven2 {get; private set;} |
| | | //add wangweipeng 2021/12/10 end |
| | | public String TermFive_Eight {get; private set;} |
| | | public String TermFive_Nine {get; private set;} |
| | | public String TermFive_Ten {get; private set;} |
| | |
| | | //LJPH-BUKD5A 《委托》合同文本的修改 精琢技术 wql 2020/10/23 start |
| | | //根据经销商名是否有值判断是否打印新/合同版本 |
| | | public String TermTen_One {get; private set;} |
| | | //add wangweipeng 2021/12/10 start |
| | | public String TermTen_One2 {get; private set;} |
| | | public String TermTen_Two2 {get; private set;} |
| | | //add wangweipeng 2021/12/10 end |
| | | public String TermTen_Two {get; private set;} |
| | | public String TermEleven_One {get; private set;} |
| | | public String TermEleven_Two {get; private set;} |
| | |
| | | this.TermTwo_One = '二、 本合同服务委托期限为'; |
| | | this.TermThree_One = '三、 本合同总金额'; |
| | | this.TermThree_Two = '元(人民币大写'; |
| | | this.TermThree_Three = ')。'; |
| | | this.TermThree_Three = '元整)。'; |
| | | this.TermFour_One = '四、 付款方式'; |
| | | this.TermFour_Two = '本合同金额由甲方:'; |
| | | this.TermFour_Once = '一次性支付'; |
| | | this.TermFour_Once_One = '本合同正式签订之日起'; |
| | | this.TermFour_Once_Two = '日内,甲方向乙方支付全部合同款人民币'; |
| | | this.TermFour_Once_Three = '元(大写'; |
| | | this.TermFour_Once_Four = ')。'; |
| | | this.TermFour_Once_Four = '元整)。'; |
| | | //add wangweipeng 2021/12/10 start |
| | | this.TermFour_Once_Five= '乙方收到甲方款项后的7个工作日内向甲方提供正规发票。'; |
| | | //add wangweipeng 2021/12/10 end |
| | | this.TermFour_Much = '多次支付'; |
| | | this.TermFour_Much_One = '本合同款项分'; |
| | | this.TermFour_Much_Two = '期付出,详细如下:'; |
| | |
| | | |
| | | this.TermFive_Title = '五、 乙方责任范围'; |
| | | this.TermFive_Head = '在本合同服务委托期间内,乙方对本合同参保设备提供如下服务:'; |
| | | //add wangweipeng 2021/12/10 start |
| | | this.TermFive_Head2 = '在乙方收到甲方按本协议第四条约定的全部款项后,在本合同服务委托期间内,乙方对本合同参保设备提供本协议约定服务,否则乙方有权拒绝提供直至甲方按约履行付款义务。具体服务如下: '; |
| | | //add wangweipeng 2021/12/10 end |
| | | this.TermFive_One = '1、 本合同参保设备因自然损耗或按照乙方要求进行清洗消毒的情况下发生故障'; |
| | | this.TermFive_One2 = '时,由乙方进行维修。因故意人为损坏导致的故障,不在本合同维修范围内。'; |
| | | //add wangweipeng 2021/12/10 start |
| | | this.TermFive_One3 = '时,由乙方进行维修。因丙方故意人为损坏导致的故障,不在本合同维修范围内。'; |
| | | //add wangweipeng 2021/12/10 end |
| | | this.TermFive_Two = '2、 在零件齐备的情况下,乙方保证'; |
| | | this.TermFive_Two2 = '小时之内完成小维修。'; |
| | | this.TermFive_Three = '3、 在零件齐备的情况下,乙方保证'; |
| | |
| | | this.TermFive_Five2 = '同生效之前发生的故障,乙方在本合同生效后提供维修服务且维修费用计入本合同。但是特例情况可由甲乙双方以补充协议的方式另行约定。'; |
| | | this.TermFive_Six = '6、 若由于零件订购、停产等原因无法修理,则乙方只修理可维修的产品或产品的部分功能。'; |
| | | this.TermFive_Seven = '7、 如果本合同参保设备发生乙方修理责任范围内的故障需要进行大维修时,乙方优先向丙方提供备品。乙方确保周边设备类的备品提供。'; |
| | | //add wangweipeng 2021/12/10 start |
| | | this.TermFive_Seven2 = '7、 如果本合同参保设备发生乙方修理责任范围内的故障需要进行大维修时,乙方优先向丙方提供备品。乙方确保满足丙方周边设备类的备品提供。'; |
| | | //add wangweipeng 2021/12/10 end |
| | | this.TermFive_Eight = '8、 自本合同生效日起每隔3个月且在本合同服务委托期内,乙方将向丙方提供合同执行报告,提供前需获得甲方的认可。具体内容由乙方制定,包括且不限于:合同执行数据,乙方工作汇报,合同参保设备故障情况和相应故障预防建议等。'; |
| | | this.TermFive_Nine = '9、 在本合同服务委托期内,乙方结合丙方的实际情况,判断是否要向本合同参保设备提供故障预防工具。如乙方判断需要时,由乙方直接向丙方提供。具体提供方式和数量,以乙方判断为准。'; |
| | | this.TermFive_Ten = '10、 乙方指定工程师为丙方提供1年'; |
| | |
| | | this.TermEightAppend_Two = '本合同任何一方有下列情形之一,对方可不经催告解除本合同:'; |
| | | this.TermEightAppend_Three = '1、一方被采取查封、扣押、冻结等,或被申请开始进行拍卖、破产、清算、合'; |
| | | this.TermEightAppend_Three1 = '并、分立;'; |
| | | this.TermEightAppend_Four = '2、一方迟延履行本合同主要义务,经催告后在一方规定的合理期限内仍未履行;'; |
| | | this.TermEightAppend_Four = '2、一方延迟履行本合同主要义务,经催告后在一方规定的合理期限内仍未履行;'; |
| | | this.TermEightAppend_Five = '3、一方有其他违约或违法行为致使本合同目的不能实现的。'; |
| | | this.TermEightAppend_Six = '由于不可抗力的原因,导致本合同部分不能履行、不能履行或延期履行时,遇有不可抗力事件的一方,应立即将事故情况通知对方,并提供部分不能履行、不能履行或延期履行的理由和所有相关的文件资料。'; |
| | | // HWAG-BLWFGC 追加第八条,原八九条顺延 update by vivek end |
| | |
| | | this.TermEleven_Four ='3、如若本合同执行期间,甲方不再是乙方的特约经销商,则双方同意甲方基于《特约经销商合同》所缴纳的全额保证金将与本合同期满或提前解除并扣除欠款后无息返还甲方。'; |
| | | //LJPH-BUKD5A 《委托》合同文本的修改 精琢技术 wql 2020/10/23 end |
| | | |
| | | //add wangweipeng 2021/12/10 start |
| | | this.TermTen_One2 = '十、 本合同甲方执'; |
| | | this.TermTen_Two2 = '份,乙方执1份,自双方盖章之日起生效。如生效日期与本协议第三条约定的委托期限起始日期不一致时,双方同意以两者中较晚日期作为本合同的生效时间。'; |
| | | //add wangweipeng 2021/12/10 end |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | @isTest |
| | | private class PaymentMaintenanceContractTriggerHTest { |
| | | static testMethod void testMethod1() { |
| | | // 取引先 |
| | | Account account1 = new Account(); |
| | | account1.Name = 'test1医院'; |
| | | account1.RecordTypeId = '01210000000QemG'; |
| | | insert account1; |
| | | Account account2 = new Account(); |
| | | account2.Name = 'test1经销商'; |
| | | account2.RecordTypeId = '01210000000Qem1'; |
| | | insert account2; |
| | | |
| | | Contact contact2 = new Contact(); |
| | | contact2.AccountId = account1.Id; |
| | | contact2.FirstName = '責任者'; |
| | | contact2.LastName = 'test2医院'; |
| | | insert contact2; |
| | | // ユーザー |
| | | Profile p = [select Id from Profile where Name = '901_经销商活动系统']; |
| | | User user = new User(); |
| | | user.ProfileId = p.Id; |
| | | user.ContactId = contact2.Id; |
| | | user.FirstName = 'ユーザー'; |
| | | user.LastName = 'テスト'; |
| | | user.Email = 'test_user@example.com'; |
| | | user.emailencodingkey='UTF-8'; |
| | | user.languagelocalekey='zh_CN'; |
| | | user.localesidkey='ja_JP'; |
| | | user.timezonesidkey='Asia/Shanghai'; |
| | | user.Username = 'test_user@example.com'; |
| | | user.Alias = 'テユ'; |
| | | user.CommunityNickname = 'テストユーザー'; |
| | | insert user; |
| | | |
| | | // 代理店医院 |
| | | Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c(); |
| | | agency_hospital_link.Name = 'test1代理店医院'; |
| | | agency_hospital_link.Hospital__c = account1.Id; |
| | | agency_hospital_link.Agency__c = account2.Id; |
| | | agency_hospital_link.OwnerId = user.Id; |
| | | insert agency_hospital_link; |
| | | |
| | | |
| | | Agency_Contact__c ac1 = new Agency_Contact__c(); |
| | | ac1.Name = 'test1のび太'; |
| | | ac1.Agency_Hospital__c = agency_hospital_link.Id; |
| | | insert ac1; |
| | | |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | insert depart1; |
| | | |
| | | |
| | | //新建维修合同 |
| | | Maintenance_Contract__c test = new Maintenance_Contract__c(); |
| | | test.Name = 'Test合同'; |
| | | test.RecordTypeId='01210000000QjeF'; |
| | | test.Department__c = depart1.Id; |
| | | test.Management_Code__c = 'BJ-RS-BJ0062233'; |
| | | test.Status__c = '询价中'; |
| | | test.Service_Contract_Staff__c = user.Id; |
| | | insert test; |
| | | |
| | | |
| | | Payment_Maintenance_Contract__c pmc = new Payment_Maintenance_Contract__c(); |
| | | pmc.Find_Dealers__c = account1.id; |
| | | pmc.Find_Contact__c = test.id; |
| | | pmc.Amount__c = 123.23; |
| | | //pmc.Employees__c = ac1.Id; |
| | | pmc.ReceiveNo__c = '134'; |
| | | pmc.ReceiveNoKey__c = '3245'; |
| | | insert pmc; |
| | | |
| | | pmc.Amount__c = 234.23; |
| | | update pmc; |
| | | |
| | | Payment_Maintenance_Contract__c pmc1 = new Payment_Maintenance_Contract__c(); |
| | | pmc1.Find_Dealers__c = account1.id; |
| | | pmc1.Find_Contact__c = test.id; |
| | | pmc1.Amount__c = 123.23; |
| | | //pmc1.Employees__c = ac1.Id; |
| | | pmc1.ReceiveNo__c = '134'; |
| | | pmc1.ReceiveNoKey__c = '3245'; |
| | | pmc1.DeleteFlag__c = 'X'; |
| | | insert pmc1; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * 测试类:PaymentMaintenanceContractTriggerHTest |
| | | */ |
| | | public with sharing class PaymentMaintenanceContractTriggerHandler extends Oly_TriggerHandler { |
| | | |
| | | private Map<Id, Payment_Maintenance_Contract__c> newMap; |
| | | private Map<Id, Payment_Maintenance_Contract__c> oldMap; |
| | | private List<Payment_Maintenance_Contract__c> newList; |
| | | private List<Payment_Maintenance_Contract__c> oldList; |
| | | |
| | | |
| | | public PaymentMaintenanceContractTriggerHandler() { |
| | | this.newMap = (Map<Id, Payment_Maintenance_Contract__c>) Trigger.newMap; |
| | | this.oldMap = (Map<Id, Payment_Maintenance_Contract__c>) Trigger.oldMap; |
| | | this.newList = (List<Payment_Maintenance_Contract__c>) Trigger.new; |
| | | this.oldList = (List<Payment_Maintenance_Contract__c>) Trigger.old; |
| | | |
| | | } |
| | | |
| | | protected override void afterUpdate() { |
| | | //add wangweipeng 2021/11/12 start |
| | | //统计维修合同的所有认款金额 |
| | | countAllAmount(); |
| | | //add wangweipeng 2021/11/12 end |
| | | } |
| | | |
| | | protected override void afterInsert() { |
| | | //add wangweipeng 2021/11/12 start |
| | | //统计维修合同的所有认款金额 |
| | | countAllAmount(); |
| | | //add wangweipeng 2021/11/12 end |
| | | } |
| | | |
| | | |
| | | //add wangweipeng 2021/11/12 start |
| | | //统计维修合同的所有认款金额 |
| | | private void countAllAmount() { |
| | | if(newList != null && newList.size() > 0){ |
| | | List<String> maintenanceContractId = new List<String>(); |
| | | for(Payment_Maintenance_Contract__c pmcc : newList){ |
| | | if(Trigger.isUpdate){ |
| | | //如果认款金额或认款删除标识有修改,那么重新汇总认款 |
| | | if(pmcc.Amount__c != oldMap.get(pmcc.id).Amount__c || pmcc.DeleteFlag__c != oldMap.get(pmcc.id).DeleteFlag__c){ |
| | | maintenanceContractId.add(pmcc.Find_Contact__c); |
| | | } |
| | | } |
| | | if(Trigger.isInsert){ |
| | | //判断 认款金额是否为空或不等于0 |
| | | if(pmcc.Amount__c != null && pmcc.Amount__c != 0){ |
| | | maintenanceContractId.add(pmcc.Find_Contact__c); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(maintenanceContractId.size() > 0){ |
| | | //查找对应的维修合同 |
| | | List<Maintenance_Contract__c> mccData = [select id,Contract_Amount__c,Is_Recognition_Model_True__c from Maintenance_Contract__c where id in :maintenanceContractId]; |
| | | if(mccData != null && mccData.size() > 0){ |
| | | List<String> mccList = new List<String>(); |
| | | for(Maintenance_Contract__c mcc : mccData){ |
| | | mccList.add(mcc.id); |
| | | } |
| | | //查找维修合同的所有认款信息 |
| | | List<Payment_Maintenance_Contract__c> allPMCc = [select id,name,Amount__c,DeleteFlag__c from Payment_Maintenance_Contract__c where Amount__c != 0.0 and Amount__c != null and Find_Contact__c in :mccList]; |
| | | for(Maintenance_Contract__c mcc : mccData){ |
| | | Decimal countAmount = 0.0; |
| | | for(Payment_Maintenance_Contract__c pmcc : allPMCc){ |
| | | if(pmcc.Amount__c != 0 || pmcc.Amount__c != null){//判断认款金额不为0 |
| | | //如果删除标识为X,那么把认款金额转为负数,然后相加 |
| | | if(pmcc.DeleteFlag__c == 'X' ){ |
| | | countAmount += (pmcc.Amount__c - pmcc.Amount__c * 2); |
| | | }else{ |
| | | countAmount += pmcc.Amount__c; |
| | | } |
| | | } |
| | | } |
| | | mcc.All_Amount__c = countAmount; |
| | | } |
| | | update mccData; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //add wangweipeng 2021/11/12 end |
| | | } |
New file |
| | |
| | | @isTest |
| | | private class PaymentMaintenanceContractTriggerTest { |
| | | static testMethod void testMethod1() { |
| | | // 取引先 |
| | | Account account1 = new Account(); |
| | | account1.Name = 'test1医院'; |
| | | account1.RecordTypeId = '01210000000QemG'; |
| | | insert account1; |
| | | Account account2 = new Account(); |
| | | account2.Name = 'test1经销商'; |
| | | account2.RecordTypeId = '01210000000Qem1'; |
| | | insert account2; |
| | | |
| | | Contact contact2 = new Contact(); |
| | | contact2.AccountId = account1.Id; |
| | | contact2.FirstName = '責任者'; |
| | | contact2.LastName = 'test2医院'; |
| | | insert contact2; |
| | | // ユーザー |
| | | Profile p = [select Id from Profile where Name = '901_经销商活动系统']; |
| | | User user = new User(); |
| | | user.ProfileId = p.Id; |
| | | user.ContactId = contact2.Id; |
| | | user.FirstName = 'ユーザー'; |
| | | user.LastName = 'テスト'; |
| | | user.Email = 'test_user@example.com'; |
| | | user.emailencodingkey='UTF-8'; |
| | | user.languagelocalekey='zh_CN'; |
| | | user.localesidkey='ja_JP'; |
| | | user.timezonesidkey='Asia/Shanghai'; |
| | | user.Username = 'test_user@example.com'; |
| | | user.Alias = 'テユ'; |
| | | user.CommunityNickname = 'テストユーザー'; |
| | | insert user; |
| | | |
| | | // 代理店医院 |
| | | Agency_Hospital_Link__c agency_hospital_link = new Agency_Hospital_Link__c(); |
| | | agency_hospital_link.Name = 'test1代理店医院'; |
| | | agency_hospital_link.Hospital__c = account1.Id; |
| | | agency_hospital_link.Agency__c = account2.Id; |
| | | agency_hospital_link.OwnerId = user.Id; |
| | | insert agency_hospital_link; |
| | | |
| | | |
| | | Agency_Contact__c ac1 = new Agency_Contact__c(); |
| | | ac1.Name = 'test1のび太'; |
| | | ac1.Agency_Hospital__c = agency_hospital_link.Id; |
| | | insert ac1; |
| | | |
| | | List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '病院']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('診療科 消化科', '診療科 呼吸科') order by Name desc]; |
| | | if (rectDpt.size() == 0) { |
| | | return; |
| | | } |
| | | |
| | | Account company1 = new Account(); |
| | | company1.RecordTypeId = rectCo[0].Id; |
| | | company1.Name = '病院テスト1'; |
| | | List<Account> hps = new Account[]{company1}; |
| | | insert hps; |
| | | |
| | | List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c]; |
| | | |
| | | Account depart1 = new Account(); |
| | | depart1.RecordTypeId = rectDpt[0].Id; |
| | | depart1.Name = '*'; |
| | | depart1.Department_Name__c = '診療科1'; |
| | | depart1.ParentId = dc1s[0].Id; |
| | | depart1.Department_Class__c = dc1s[0].Id; |
| | | depart1.Hospital__c = company1.Id; |
| | | insert depart1; |
| | | |
| | | |
| | | //新建维修合同 |
| | | Maintenance_Contract__c test = new Maintenance_Contract__c(); |
| | | test.Name = 'Test合同'; |
| | | test.RecordTypeId='01210000000QjeF'; |
| | | test.Department__c = depart1.Id; |
| | | test.Management_Code__c = 'BJ-RS-BJ0062233'; |
| | | test.Status__c = '询价中'; |
| | | test.Service_Contract_Staff__c = user.Id; |
| | | insert test; |
| | | |
| | | |
| | | Payment_Maintenance_Contract__c pmc = new Payment_Maintenance_Contract__c(); |
| | | pmc.Find_Dealers__c = account1.id; |
| | | pmc.Find_Contact__c = test.id; |
| | | pmc.Amount__c = 123.23; |
| | | //pmc.Employees__c = ac1.Id; |
| | | pmc.ReceiveNo__c = '134'; |
| | | pmc.ReceiveNoKey__c = '3245'; |
| | | insert pmc; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | System.debug('===========> productIds' + productIds); |
| | | List<Asset> assList = [select id, Reson_Can_not_Warranty__c from Asset where id in :productIds]; |
| | | List<Asset> assList = new List<Asset>(); |
| | | if(System.Test.isRunningTest()){ |
| | | assList = [select id, Reson_Can_not_Warranty__c from Asset where id in :productIds limit 1]; |
| | | } else{ |
| | | assList = [select id, Reson_Can_not_Warranty__c from Asset where id in :productIds]; |
| | | } |
| | | |
| | | List<String> assetIds = new List<String>(); |
| | | //Map<String, Asset> assMap = new Map<String, Asset>(); |
| | |
| | | Map<String, List<Repair__c>> repaMap = new Map<String, List<Repair__c>>(); |
| | | List<Repair__c> repList = [select id, Status1__c, Status2__c, Return_Without_Repair_Reason__c, Contract_status__c, Return_Without_Repair_IF__c, Failure_Occurrence_Date__c, |
| | | Delivered_Product__c |
| | | // LJPH-C67A6E gzw 逻辑fix start |
| | | ,FSE_ApplyForRepair_Day__c,Contract_Start_Date__c,Contract_End_Date__c |
| | | // LJPH-C67A6E gzw 逻辑fix end |
| | | from Repair__c |
| | | // HWAG-AWMCG9 2018/3/7 已经确定只有【未修理返品】的数据状态1 和 状态2 同时为取消 |
| | | //where Delivered_Product__c in :assetIds and Status1__c not in ('0.删除','0.取消') |
| | |
| | | } |
| | | } else { |
| | | //判断修理中的逻辑 |
| | | if (rList[0].Contract_status__c != '契約') { |
| | | // LJPH-C67A6E gzw 逻辑fix start |
| | | // if (rList[0].Contract_status__c != '契約') { |
| | | if (!(rList[0].Contract_status__c == '契約' || |
| | | (rList[0].FSE_ApplyForRepair_Day__c >= rList[0].Contract_Start_Date__c && rList[0].FSE_ApplyForRepair_Day__c >= rList[0].Contract_End_Date__c))) { |
| | | // LJPH-C67A6E gzw 逻辑fix end |
| | | if (rList[0].Status2__c == '01.分公司受理完毕' || rList[0].Status2__c == '02.RC受理完毕' || rList[0].Status2__c == '03.报价检查结束' || rList[0].Status2__c == '04.报价跟进中') { |
| | | if (reason != null) { |
| | | if (!reason.contains('修理中')) { |
| | |
| | | return repair; |
| | | } |
| | | //add wangweipeng 2021/12/09 end |
| | | |
| | | //先款后修-修理增加先款标识 thh 20220322 start |
| | | public static void AdvancePaymentFlagUpsert(List<Repair__c> newList, Map<Id, Repair__c> newMap, List<Repair__c> oldList, Map<Id, Repair__c> oldMap) { |
| | | List<String> RepairQuotationIdList = new List<String>(); |
| | | List<Repair__c> NoRepairQuotationList = new List<Repair__c>(); |
| | | List<Repair_Quotation__c> RepairQuotationList = new List<Repair_Quotation__c>(); |
| | | List<String> DealerIdList = new List<String>(); |
| | | List<Account> DealerList = new List<Account>(); |
| | | for(Repair__c rep : newList){ |
| | | if(rep.Repair_Quotation_Id__c != null){ |
| | | RepairQuotationIdList.add(rep.Repair_Quotation_Id__c); |
| | | }else{ |
| | | NoRepairQuotationList.add(rep); |
| | | } |
| | | } |
| | | //同期中的修理修理报价有值时,看报价上的先款标识进行赋值 |
| | | if(RepairQuotationIdList.size() > 0){ |
| | | if (System.Test.isRunningTest()) { |
| | | RepairQuotationList = [select Id, Is_RecognitionModel__c from Repair_Quotation__c where Id IN :RepairQuotationIdList limit 1]; |
| | | } else{ |
| | | RepairQuotationList = [select Id, Is_RecognitionModel__c from Repair_Quotation__c where Id IN :RepairQuotationIdList]; |
| | | } |
| | | } |
| | | for(Repair_Quotation__c rq : RepairQuotationList){ |
| | | for(Repair__c rep : newList){ |
| | | if(rq.Id == rep.Repair_Quotation_Id__c){ |
| | | rep.Advance_Payment_Flag__c = rq.Is_RecognitionModel__c; |
| | | } |
| | | } |
| | | } |
| | | //同期中的修理报价没值时,看修理单上的经销商是不是先款对象进行赋值 |
| | | if(NoRepairQuotationList.size() > 0){ |
| | | for(Repair__c rep : NoRepairQuotationList){ |
| | | DealerIdList.add(rep.Dealer__c); |
| | | } |
| | | } |
| | | if(DealerIdList.size() > 0 ){ |
| | | DealerList = [select Id, FirstParagraphEnd__c from Account where Id IN : DealerIdList]; |
| | | } |
| | | for(Account dealer : DealerList){ |
| | | for(Repair__c rep : newList){ |
| | | if(rep.Dealer__c == dealer.Id){ |
| | | rep.Advance_Payment_Flag__c = dealer.FirstParagraphEnd__c; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //先款后修-修理增加先款标识 thh 20220322 end |
| | | |
| | | public static void CheckUpdate(List<Repair__c> oldList, Map<Id, Repair__c> newMap) { |
| | | System.debug('===========> start'); |
| | |
| | | StaticParameter.EscapeNFM001Trigger = true; |
| | | // 病院を作る |
| | | Account hospital = new Account(); |
| | | hospital.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = 'HP'].id; |
| | | hospital.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = :'HP'].id; |
| | | hospital.Name = hospitalName; |
| | | insert hospital; |
| | | StaticParameter.EscapeAccountTrigger = true; |
| | |
| | | static Account createDep( Account hospital, Account strategicDep) { |
| | | // 診療科を作る |
| | | Account dep = new Account(); |
| | | dep.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = 'Department_GI'].id; |
| | | dep.recordtypeId = [Select Id FROM RecordType WHERE DeveloperName = :'Department_GI'].id; |
| | | dep.Name = 'test dep'; |
| | | dep.ParentId = strategicDep.Id; |
| | | dep.Department_Class__c = strategicDep.Id; |
| | |
| | | contract.Contract_Start_Date__c = Date.today().addDays( -10); // 10日前 |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | contract.RecordTypeId='01210000000gTYv'; |
| | | ID RecordTypeId = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('多年保合同').getRecordTypeId(); |
| | | // contract.RecordTypeId='01210000000gTYv'; |
| | | contract.RecordTypeId=RecordTypeId; |
| | | |
| | | insert contract; |
| | | return contract; |
| | |
| | | } |
| | | //限次合同产品信息维护相关测试 FXK 2021/3/8 Start |
| | | static testMethod void test03(){ |
| | | Oly_TriggerHandler.bypass('AccountTrigger'); |
| | | Oly_TriggerHandler.bypass('RepairHandler'); |
| | | Oly_TriggerHandler.bypass('RepairBeforeInsertHandler'); |
| | | Oly_TriggerHandler.bypass('UpdateContractAimAmountHandler'); |
| | | Oly_TriggerHandler.bypass('PaymentMaintenanceContractTriggerHandler'); |
| | | Oly_TriggerHandler.bypass('SetContractEstimatePriceHandler'); |
| | | Oly_TriggerHandler.bypass('SyncRepairFromMCAETrigger'); |
| | | Oly_TriggerHandler.bypass('ContactTriggerHandler'); |
| | | StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true; |
| | | StaticParameter.EscapeNFM001Trigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger = true; |
| | | StaticParameter.EscapeNFM001AgencyContractTrigger2 = true; |
| | | StaticParameter.EscapeSyncProduct2Trigger = true; |
| | | StaticParameter.EscapeContactInsUpdUser = true; |
| | | StaticParameter.EscapeContactToUser = true; |
| | | StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true; |
| | | StaticParameter.EscapeAccountTrigger = true; |
| | | StaticParameter.EscapeNFM106Trigger = true; |
| | | //客户 |
| | | Account hospital = createHospital( 'test hospital'); |
| | | Account[] strategicDep = selectStrategicDep( hospital); |
| | | Account dep = createDep( hospital, strategicDep[0]); |
| | | // Account hospital = createHospital( 'test hospital'); |
| | | // Account[] strategicDep = selectStrategicDep( hospital); |
| | | // Account dep = createDep( hospital, strategicDep[0]); |
| | | // 保有设备 |
| | | Asset asset = createAsset( hospital, strategicDep[0], dep); |
| | | // Asset asset = createAsset( hospital, strategicDep[0], strategicDep[0]); |
| | | // 病院を作る |
| | | // 省 |
| | | Address_Level__c al = new Address_Level__c(); |
| | | al.Name = '東京'; |
| | | al.Level1_Code__c = 'CN-99'; |
| | | al.Level1_Sys_No__c = '999999'; |
| | | insert al; |
| | | // 市 |
| | | Address_Level2__c al2 = new Address_Level2__c(); |
| | | al2.Level1_Code__c = 'CN-99'; |
| | | al2.Level1_Sys_No__c = '999999'; |
| | | al2.Level1_Name__c = '東京'; |
| | | al2.Name = '渋谷区'; |
| | | al2.Level2_Code__c = 'CN-9999'; |
| | | al2.Level2_Sys_No__c = '9999999'; |
| | | al2.Address_Level__c = al.id; |
| | | insert al2; |
| | | Account hospital = new Account(); |
| | | hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id; |
| | | hospital.Name = 'test hospital'; |
| | | hospital.Is_Active__c = '有効'; |
| | | hospital.Attribute_Type__c = '卫生部'; |
| | | hospital.Speciality_Type__c = '综合医院'; |
| | | hospital.Grade__c = '一级'; |
| | | hospital.OCM_Category__c = 'SLTV'; |
| | | hospital.Is_Medical__c = '医疗机构'; |
| | | hospital.State_Master__c = al.id; |
| | | hospital.City_Master__c = al2.id; |
| | | hospital.Town__c = '东京'; |
| | | insert hospital; |
| | | |
| | | // 戦略科室を得る |
| | | Account[] strategicDep = [SELECT ID, Name FROM Account WHERE parentId = :hospital.Id AND recordType.DeveloperName = 'Department_Class_OTH']; |
| | | // 診療科を作る |
| | | Account dep = new Account(); |
| | | dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id; |
| | | dep.Name = 'test dep'; |
| | | dep.AgentCode_Ext__c = '9999998'; |
| | | dep.ParentId = strategicDep[0].Id; |
| | | dep.Department_Class__c = strategicDep[0].Id; |
| | | dep.Hospital__c = hospital.Id; |
| | | insert dep; |
| | | Asset asset = new Asset(); |
| | | asset.Name = 'テスト機器'; |
| | | asset.AccountId = dep.Id; |
| | | asset.Department_Class__c = strategicDep[0].Id; |
| | | asset.Hospital__c = hospital.Id; |
| | | asset.SerialNumber = 'testserial'; |
| | | insert asset; |
| | | |
| | | // 创建维修合同 |
| | | Maintenance_Contract__c contract = new Maintenance_Contract__c(); |
| | | // ID RecordTypeId1 = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('服务合同').getRecordTypeId(); |
| | | // ID RecordTypeId2 = Schema.SObjectType.Maintenance_Contract_Estimate__c.getRecordTypeInfosByName().get('服务合同报价').getRecordTypeId(); |
| | | contract.Name = 'tect contract'; |
| | | contract.status__c = '契約'; |
| | | contract.URF_Contract__c=true; |
| | |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | contract.RecordTypeId='01210000000gTYq'; |
| | | // contract.RecordTypeId=RecordTypeId1; |
| | | contract.URF_Contract__c = true; |
| | | contract.agree_Upper_limit__c = true; |
| | | insert contract; |
| | |
| | | Maintenance_Contract_Estimate__c Estimate = new Maintenance_Contract_Estimate__c(); |
| | | Estimate.Maintenance_Contract__c = contract.Id; |
| | | Estimate.recordtypeId = '01210000000gTZA'; |
| | | // Estimate.recordtypeId = RecordTypeId2; |
| | | Estimate.Name = '报价1'; |
| | | insert Estimate; |
| | | //创建维修合同报价/保有设备 |
| | |
| | | middleTable.Maintenance_Contract_Asset_Estimate__c = Asset_Estimate.Id; |
| | | insert middleTable; |
| | | // 修理を作成する01 |
| | | Test.startTest(); |
| | | Repair__c repair01 = new Repair__c(); |
| | | repair01.Account__c = dep.Id; |
| | | repair01.Department_Class__c = strategicDep[0].Id; |
| | | repair01.Account__c = strategicDep[0].Id; |
| | | repair01.Department_Class__c = dep.Id; |
| | | repair01.Hospital__c = hospital.Id; |
| | | repair01.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | | repair01.Failure_Occurrence_Date__c =Date.today(); |
| | |
| | | |
| | | // 修理を作成する01 |
| | | Repair__c repair02 = new Repair__c(); |
| | | repair02.Account__c = dep.Id; |
| | | repair02.Account__c = strategicDep[0].Id; |
| | | repair02.Department_Class__c = strategicDep[0].Id; |
| | | repair02.Hospital__c = hospital.Id; |
| | | repair02.SERVICE_CONTRACT_JUDEGE_DAY__C = Date.today(); // 维修合同判断日在合同开始日与合同结束日之间 |
| | |
| | | repair02.Delivered_Product__c = asset.Id; |
| | | insert repair02; |
| | | delete repair02; |
| | | |
| | | checkRepair.NewProductGuarante_Txt__c = '2: 服务多年保修'; |
| | | update checkRepair; |
| | | |
| | | checkRepair.NewProductGuarante_Txt__c = '8: 市场多年保修'; |
| | | checkRepair.On_site_repair__c = 'RC修理'; |
| | | checkRepair.Maintenance_Contract__c = contract.Id; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州RC'; |
| | | update checkRepair; |
| | | |
| | | contract.SalesOfficeCode_selection__c = '上海RC'; |
| | | update contract; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州RC'; |
| | | update checkRepair; |
| | | |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州RC'; |
| | | checkRepair.NewProductGuarante_Txt__c = '2: 服务多年保修'; |
| | | update checkRepair; |
| | | |
| | | Test.stopTest(); |
| | | asset.Order_No__c = '上海分公司'; |
| | | update asset; |
| | | checkRepair.SalesOfficeCode_selection__c = '杭州'; |
| | | update checkRepair; |
| | | |
| | | asset.Order_No__c = '广州分公司'; |
| | | update asset; |
| | | checkRepair.On_site_repair__c = '办事处修理'; |
| | |
| | | |
| | | contract.SalesOfficeCode_selection__c = '广州RC'; |
| | | update contract; |
| | | |
| | | } |
| | | //限次合同产品信息维护相关测试 FXK 2021/3/8 End |
| | | |
| | |
| | | Asset asset = createAsset( hospital, strategicDep[0], dep); |
| | | // 创建维修合同 |
| | | Maintenance_Contract__c contract = new Maintenance_Contract__c(); |
| | | // ID RecordTypeId1 = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('服务合同').getRecordTypeId(); |
| | | // ID RecordTypeId2 = Schema.SObjectType.Maintenance_Contract_Estimate__c.getRecordTypeInfosByName().get('服务合同报价').getRecordTypeId(); |
| | | contract.Name = 'tect contract'; |
| | | contract.status__c = '契約'; |
| | | contract.URF_Contract__c=true; |
| | |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | contract.RecordTypeId='01210000000gTYq'; |
| | | // contract.RecordTypeId=RecordTypeId1; |
| | | contract.URF_Contract__c = true; |
| | | contract.agree_Upper_limit__c = true; |
| | | insert contract; |
| | |
| | | Maintenance_Contract_Estimate__c Estimate = new Maintenance_Contract_Estimate__c(); |
| | | Estimate.Maintenance_Contract__c = contract.Id; |
| | | Estimate.recordtypeId = '01210000000gTZA'; |
| | | // Estimate.recordtypeId = RecordTypeId2; |
| | | Estimate.Name = '报价1'; |
| | | insert Estimate; |
| | | //创建维修合同报价/保有设备 |
| | |
| | | |
| | | // 创建维修合同 |
| | | Maintenance_Contract__c contract = new Maintenance_Contract__c(); |
| | | // ID RecordTypeId1 = Schema.SObjectType.Maintenance_Contract__c.getRecordTypeInfosByName().get('服务合同').getRecordTypeId(); |
| | | contract.Name = 'tect contract'; |
| | | contract.status__c = '契約'; |
| | | contract.URF_Contract__c=true; |
| | |
| | | contract.Contract_Start_Date__c = Date.today().addDays( -10); // 10日前 |
| | | contract.Contract_End_Date__c = Date.today().addDays( 5); // 5日後 |
| | | contract.SalesOfficeCode_selection__c = '北京RC'; |
| | | // contract.RecordTypeId=RecordTypeId1; |
| | | contract.RecordTypeId='01210000000gTYq'; |
| | | contract.URF_Contract__c = true; |
| | | contract.agree_Upper_limit__c = true; |
| | |
| | | public List<String> assetSerialNumberList = new List<String>(); |
| | | // 新规 或者 copy |
| | | private Boolean newIns = false; |
| | | |
| | | //add wangweipeng 2021/12/06 start |
| | | public String checkDealerId{get;set;} |
| | | //add wangweipeng 2021/12/06 end |
| | | |
| | | static { |
| | | textOpts = new List<SelectOption>(); |
| | |
| | | currPage = 1; |
| | | selRecordOption = '20'; |
| | | totalRecords = 0; |
| | | checkDealerId = ''; |
| | | } |
| | | /** |
| | | * Visaulforceから呼ばれるコンストラクタ |
| | |
| | | Maintenance_Contract__r.Payment_Plan_Sum_Fifth__c, |
| | | Maintenance_Contract__r.Payment_Plan_Sum_Sixth__c, |
| | | Discount_Price__c, Discount_Percentage__c, IsSyncing__c, |
| | | NotUse_Oxygenated_Water__c, Estimate_Target__c, Dealer__c, |
| | | NotUse_Oxygenated_Water__c, Estimate_Target__c, Dealer__c,Dealer__r.FirstParagraphEnd__c,Is_RecognitionModel__c, |
| | | Append_Condition_Price__c, Asset_Sum_Price__c, Asset_Repair_Sum_Price__c, |
| | | Print_Contract__c, Print_RepairPrice__c, Print_DiscountPercentage__c, Print_Agent__c, Change_Dealer_Approval__c, |
| | | Print_DiscountPrice__c, Print_ListPrice__c, Print_MaintePrice__c, Print_SumPrice__c, Print_Tripartite__c, TKZongjianApprovalManager__c |
| | |
| | | //跳过点检标记 2021/07/28 gzw start |
| | | , Skip_DJ__c |
| | | //跳过点检标记 2021/07/28 gzw start |
| | | |
| | | FROM Maintenance_Contract_Estimate__c WHERE Id = :this.targetEstimateId]; |
| | | //HWAG-B399Q8 2018/08/20 添加一额外字段 IS_Clone_After_Decide__c end |
| | | decimal PriceSum = (this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c == null ? 0 : this.estimate.Maintenance_Contract__r.Payment_Plan_Sum_First__c) + |
| | |
| | | } |
| | | } |
| | | notInId += '\')'; |
| | | |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | String sqlStr = 'SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, ' |
| | | + 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, InstallDate,isNewDate_use__c, ' |
| | |
| | | List<Asset> temAsset = new List<Asset> (); |
| | | //HWAG-BDJ43R ---XHL---20190729--- |
| | | String sqlStr = ''; |
| | | |
| | | //tcm 添加 Management_Code__c 20211201 start |
| | | sqlStr = 'SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c,'; |
| | | sqlStr += 'Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c,InstallDate,isNewDate_use__c,'; |
| | |
| | | //JZHG-BSDUT4 ---20200904---update By rentongxiao---end |
| | | //HWAG-B4R3SS END 20181026 |
| | | if (checkIdList.size() > 0) { |
| | | |
| | | sqlStr += ' AND Id NOT IN ' + checkIdList; |
| | | //temAsset = [SELECT Id, Name, Asset_situation__c, SerialNumber, Department_Name__c, Installation_Site__c, Posting_Date__c,Management_Code__c,IF_Warranty__c,Reson_Can_not_Warranty__c, |
| | | // InstallDate, Asset_Owner__c, Accumulation_Repair_Amount__c, Maintenance_Price_Month__c, Final_Examination_Date__c,CurrentContract_End_Date__c,Extend_Gurantee_DateTo__c |
| | |
| | | t = this.estimate.Contract_Start_Date__c.addMonths(Integer.valueOf(this.estimate.Contract_Range__c)); |
| | | t = t.addDays(-1); |
| | | this.estimate.Contract_End_Date__c = t; |
| | | //add wangweipeng 2021/12/26 start |
| | | if(String.isNotBlank(this.estimate.Dealer__c)){ |
| | | checkDealerId = this.estimate.Dealer__c; |
| | | onChDealerUpdate(); |
| | | }else{ |
| | | this.estimate.Is_RecognitionModel__c = false; |
| | | } |
| | | //add wangweipeng 2021/12/26 end |
| | | System.debug('---------345----'+this.estimate.Dealer__c+'-------'+this.estimate.Dealer__r.FirstParagraphEnd__c); |
| | | // 位置调整 在1951 line |
| | | // Date createdDate = this.estimate.CreatedDate == null ? System.today() : this.estimate.CreatedDate.date(); |
| | | // 3ヶ月超過している場合には、Decideできない |
| | |
| | | this.contract.Contract_Esti_End_Date__c = this.estimate.Contract_Esti_End_Date__c; |
| | | this.contract.Estimate_Target__c = this.estimate.Estimate_Target__c; |
| | | this.contract.Dealer__c = this.estimate.Dealer__c; |
| | | this.contract.old_Is_RecognitionModel__c = this.estimate.Is_RecognitionModel__c; |
| | | this.contract.NotUse_Oxygenated_Water__c = this.estimate.NotUse_Oxygenated_Water__c; |
| | | this.contract.Estimate_Trial_Money__c = this.estimate.Estimate_Trial_Money__c; |
| | | this.contract.Contract_Amount__c = this.estimate.Maintenance_Price__c; |
| | |
| | | return ret; |
| | | } |
| | | |
| | | //add wangweipeng 2021/12/26 start |
| | | //获取当前选中的经销商是否为先款标识 |
| | | public PageReference onChDealerUpdate(){ |
| | | //checkDealerId 此变量可能会存 经销商id或经销商中文名 |
| | | if(String.isNotBlank(checkDealerId)){ |
| | | try { |
| | | List<Account> accListC = [select id,name,FirstParagraphEnd__c from Account where id = :checkDealerId OR name = :checkDealerId]; |
| | | if(accListC != null && accListC.size() == 1){ |
| | | if(accListC[0].FirstParagraphEnd__c){ |
| | | this.estimate.Is_RecognitionModel__c = true; |
| | | }else{ |
| | | this.estimate.Is_RecognitionModel__c = false; |
| | | } |
| | | }else{ |
| | | this.estimate.Is_RecognitionModel__c = false; |
| | | } |
| | | } catch (Exception e) { |
| | | //return 'McaeList Update Failed : '+e; |
| | | } |
| | | }else{ |
| | | this.estimate.Is_RecognitionModel__c = false; |
| | | } |
| | | System.debug('----------------23--'+this.estimate.Is_RecognitionModel__c); |
| | | return null; |
| | | } |
| | | //add wangweipeng 2021/12/26 end |
| | | |
| | | |
| | | // 2021-02-07 gzw add LJPH-BWY5QB start |
| | | private void setEndUserType(String id) { |
| | | this.contract = [SELECT Id, Name, Status__c, Decided_Estimation__c, Service_Contract_Staff__c, |
| | |
| | | insert entry; |
| | | |
| | | // 納入機器を作成する |
| | | Asset asset01 = createAsset('asset01', dep.Id, strategicDep[0].Id, hospital.Id, '00001', productA.Id,'主机'); |
| | | // Asset asset01 = createAsset('asset01', dep.Id, strategicDep[0].Id, hospital.Id, '00001', productA.Id,'主机'); |
| | | // Asset asset01 = intProCommonMethodController.buildAssetHost('asset01',dep.Id, hospital.Id, strategicDep[0].Id,'使用中'); |
| | | Product2 pro = new Product2( |
| | | Name = 'proName', |
| | | // ProductCode='pro001', |
| | | Asset_Model_No__c = 'pro001', |
| | | SFDA_Status__c = '有効', |
| | | Dealer_special_Object__c = true, |
| | | Packing_list_manual__c = 1, |
| | | Family='GI', |
| | | Fixture_Model_No__c='n01', |
| | | Serial_Lot_No__c='S/N tracing', |
| | | Fixture_Model_No_T__c = 'n01', |
| | | ProductCode_Ext__c='pc01', |
| | | Manual_Entry__c=false |
| | | ); |
| | | insert pro; |
| | | Asset asset01 = new Asset( |
| | | Name = 'asset01', |
| | | Product2Id = pro.Id, |
| | | Hospital__c = hospital.Id, |
| | | Department_Class__c = strategicDep[0].Id, |
| | | AccountId = dep.Id, |
| | | Status = '使用中', |
| | | Asset_Owner__c = '病院資産', |
| | | IsCompetitorProduct = True, |
| | | AssetMark__c = '主机', |
| | | RecordTypeId = System.Label.Asset_RecordType, |
| | | SerialNumber = 'asset1', |
| | | Quantity = 1, |
| | | Manage_type__c = '个体管理', |
| | | Loaner_accsessary__c = false, |
| | | Out_of_wh__c = 0, |
| | | Salesdepartment__c = '1.华北营业本部', |
| | | Internal_asset_location__c = '北京 备品中心', |
| | | Product_category__c = 'GI', |
| | | Equipment_Type__c = '产品试用', |
| | | SalesProvince__c = '大连', |
| | | CompanyOfEquipment__c = '北京', |
| | | Internal_Asset_number__c = '0001', |
| | | Rental_Count__c = 0, |
| | | Asset_loaner_category__c = '固定资产', |
| | | Consumable_Guaranteen_end__c = System.Today() + 1, |
| | | WH_location__c = '货架号1' |
| | | ); |
| | | insert asset01; |
| | | |
| | | Asset asset02 = createAsset('asset02', dep.Id, strategicDep[0].Id, hospital.Id, '00002', productA.Id,'主机'); |
| | | Asset asset03 = createAsset('asset03', dep.Id, strategicDep[0].Id, hospital.Id, '00003', productA.Id,'耗材'); |
| | | Asset asset04 = createAsset('asset04', dep.Id, strategicDep[0].Id, hospital.Id, '00004', productA.Id,'耗材'); |
| | |
| | | //controller.ComputeLTYRepair(); |
| | | controller.cancel(); |
| | | controller.saveAndCancel(); |
| | | |
| | | controller.onChDealerUpdate(); |
| | | controller.checkDealerId = mcae2.Id; |
| | | controller.onChDealerUpdate(); |
| | | controller.checkDealerId = hospital.Id; |
| | | controller.onChDealerUpdate(); |
| | | } |
| | | } |
| | | |
| | |
| | | public static Boolean EscapeVMCTrigger = false; |
| | | // 跳过招标-询价关联trigger |
| | | public static Boolean EscapeTOLinkTrigger = false; |
| | | |
| | | //wangweipeng 2021/09/01 在通过触发UpsertContactHandler更新contact表数据时,跳过更新user代码 start |
| | | public static Boolean EscapeContactInsUpdUser = false; |
| | | //wangweipeng 2021/09/01 end |
| | | //EscapeAgencyOpportunityTrigger thh 2021-09-16 |
| | | public static Boolean EscapeAgencyOpportunityTrigger = false; |
| | | // 所有人变更的逻辑只在batch处理和相关性确认的时候触发 fxk 2021/9/28 Star |
| | | public static Boolean EscapeOtherUpdateTenOwner = true; |
| | | // pk 跳过ContactToUser 和 UserToContact |
| | | |
| | | public static Boolean EscapeContactToUser = false; |
| | | |
| | | // 跳过NFM701接口 |
| | | public static Boolean EscapeNFM701Trigger = true; |
| | | |
| | | // 跳过NFM106接口 |
| | | public static Boolean EscapeNFM106Trigger = false; |
| | | |
| | | public StaticParameter(){ |
| | | } |
| | | |
| | | } |
| | |
| | | <c:PDFWbr targetStr="{!targetMC.TermFour_Once_Three}" /> |
| | | <u> <c:PDFWbr targetStr="{!targetMC.Total_Contract_Amount_In_Words}" /> </u> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFour_Once_Four}" /> |
| | | <!-- add wangweipeng 2021/12/10 start --> |
| | | <apex:outputPanel rendered="{!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFour_Once_Five}" /> |
| | | </apex:outputPanel> |
| | | <!-- add wangweipeng 2021/12/10 end --> |
| | | </td></tr> |
| | | </apex:outputPanel> |
| | | |
| | |
| | | <tr><td height="15px"></td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_Title}" /></td></tr> |
| | | <tr><td> |
| | | <!-- update wangweipeng 2021/12/10 start --> |
| | | <apex:outputPanel rendered="{!!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFive_Head}" /> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel rendered="{!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFive_Head2}" /> |
| | | </apex:outputPanel> |
| | | <!-- update wangweipeng 2021/12/10 end --> |
| | | </td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_One}" /></td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_One2}" /></td></tr> |
| | | <tr><td> |
| | | <!-- update wangweipeng 2021/12/10 start --> |
| | | <apex:outputPanel rendered="{!!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFive_One2}" /> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel rendered="{!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFive_One3}" /> |
| | | </apex:outputPanel> |
| | | <!-- update wangweipeng 2021/12/10 end --> |
| | | </td></tr> |
| | | <tr><td> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFive_Two}" /> |
| | | <u> <c:PDFWbr targetStr="{!targetMC.Mc.Small_Repair_Time__c}" /> </u> |
| | |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_Five}" /></td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_Five2}" /></td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_Six}" /></td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_Seven}" /></td></tr> |
| | | <tr><td> |
| | | <!-- update wangweipeng 2021/12/10 start --> |
| | | <apex:outputPanel rendered="{!!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFive_Seven}" /> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel rendered="{!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <c:PDFWbr targetStr="{!targetMC.TermFive_Seven2}" /> |
| | | </apex:outputPanel> |
| | | <!-- update wangweipeng 2021/12/10 end --> |
| | | </td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_Eight}" /></td></tr> |
| | | <tr><td><c:PDFWbr targetStr="{!targetMC.TermFive_Nine}" /></td></tr> |
| | | <tr><td> |
| | |
| | | </apex:outputPanel> --> |
| | | <!-- LJPH-BUKD5A 《委托》合同文本的修改 精琢技术 wql 2020/10/23 start --> |
| | | <!-- 根据经销商名是否有值判断是否打印新/合同版本 --> |
| | | <!-- update wangweipeng 2021/12/10 start --> |
| | | <apex:outputPanel rendered="{!!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <apex:outputPanel rendered="{!IF(targetMC.MC.Dealer__c != '', 'true', 'false')}"> |
| | | <!-- 十一、 若甲方是乙方的特约经销商 --> |
| | | <tr><td height="15px"></td></tr> |
| | |
| | | </td></tr> |
| | | <tr><td height="15px"></td></tr> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel rendered="{!IF(targetMC.MC.Dealer__c != '', 'false', 'true')}"> |
| | | <apex:outputPanel rendered="{!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <!-- 原版本 --> |
| | | <!-- 九、 本合同甲方执 份 --> |
| | | <tr><td height="15px"></td></tr> |
| | |
| | | <tr><td height="15px"></td></tr> |
| | | <!-- 原版本 --> |
| | | </apex:outputPanel> |
| | | </apex:outputPanel> |
| | | <!-- LJPH-BUKD5A 《委托》合同文本的修改 精琢技术 wql 2020/10/23 end --> |
| | | |
| | | |
| | | <apex:outputPanel rendered="{!targetMC.MC.old_Is_RecognitionModel__c}"> |
| | | <tr><td height="15px"></td></tr> |
| | | <tr><td> |
| | | <c:PDFWbr targetStr="{!targetMC.TermTen_One2}" /> |
| | | <u> <c:PDFWbr targetStr="{!targetMC.Mc.First_Party_Contract_Number__c}" /> </u> |
| | | <c:PDFWbr targetStr="{!targetMC.TermTen_Two2}" /> |
| | | </td></tr> |
| | | <tr><td height="15px"></td></tr> |
| | | </apex:outputPanel> |
| | | <!-- update wangweipeng 2021/12/10 end --> |
| | | </table> |
| | | <!-- ページ3 --> |
| | | <table width="100%" cellspacing="1" cellpadding="1" style="font-size:13pt;"> |
| | |
| | | var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val(); |
| | | if (target != '医院') { |
| | | j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).attr("disabled", true); |
| | | j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd')).attr("disabled", true); |
| | | } |
| | | } |
| | | if ('{!DecideBtnDisabled}' == 'false') { |
| | |
| | | |
| | | function checkAll(checker) { |
| | | var cnt = j$(escapeVfId('allPage:allForm:allBlock:assetSection:productCnt')).val(); |
| | | |
| | | for (var i = 0; i < cnt; i++) { |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 start |
| | | //if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) { |
| | | // continue; |
| | | //}else{ |
| | | // document.getElementById('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox').checked = checker.checked; |
| | | //} |
| | | //2021-11-30 fy add LJPH-C8W8FV 置顶 end |
| | | if (j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetRowCheckbox')).size() == 0) { |
| | | break; |
| | | } |
| | |
| | | refreshAsset(cnt); |
| | | } |
| | | |
| | | function checkContractEstiStartDate(val, cnt) { |
| | | if (val == null || val == "") { |
| | | return; |
| | | } |
| | | for (var i = 0; i < cnt; i++) { |
| | | var instaldate = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':InstallDate')).text(); |
| | | if (instaldate != null && instaldate != '') { |
| | | var listprice = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val(); |
| | | var isnew = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val(); |
| | | if (isnew == "true") { |
| | | listprice = listprice / {!isNewPriceAdj}; |
| | | } |
| | | var startdate = new Date(val); |
| | | startdate.setMonth(startdate.getMonth() + isNewAddMonth); |
| | | instaldate = new Date(instaldate); |
| | | if (startdate < instaldate) { |
| | | listprice = listprice * {!isNewPriceAdj}; |
| | | //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(listprice)); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val(listprice); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(listprice); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNew')).attr('checked',true); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val('true'); |
| | | } else { |
| | | //j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPrice')).text(toNumComma(listprice)); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPriceHidden')).val(listprice); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetListPricePageHidden')).val(listprice); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNew')).attr('checked',false); |
| | | j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':assetNewHidden')).val('false'); |
| | | } |
| | | } |
| | | } |
| | | |
| | | refreshAsset(cnt); |
| | | } |
| | | |
| | | function refreshAsset(cnt) { |
| | | // alert(cnt); |
| | | // 提交后就页面不计算了 |
| | | var isDisabled = {!PageDisabled}; |
| | | // 合同总理 |
| | |
| | | function resetDealer() { |
| | | var target = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).val(); |
| | | var obj = document.getElementById('allPage:allForm:allBlock:contract:dealer'); |
| | | var obj2 = document.getElementById('allPage:allForm:allBlock:contract:FirstParagraphEnd'); |
| | | var obj_lkwgt = document.getElementById('allPage:allForm:allBlock:contract:dealer_lkwgt'); |
| | | if (target == '医院') { |
| | | obj.style.display = "none"; |
| | | obj2.style.display = "none"; |
| | | obj_lkwgt.style.display = "none"; |
| | | } else { |
| | | obj.style.display = "block"; |
| | | obj_lkwgt.style.display = "block"; |
| | | obj2.style.display = "block"; |
| | | } |
| | | } |
| | | |
| | |
| | | alert('合同期最长只能选择60个月!'); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | //获取经销商的先款标识 |
| | | function onChDealerUpdateJs(oBj){ |
| | | //获取 报价提交对象 是否为经销商 |
| | | var estimateTarget = j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget'))[0].value; |
| | | if(estimateTarget == '经销商'){ |
| | | //判断经销商名是否为空 |
| | | var dealerValue = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer')).val(); |
| | | if(dealerValue != ''){ |
| | | //获取经销商名的id |
| | | var dealerId = j$(escapeVfId('allPage:allForm:allBlock:contract:dealer_lkid')).val(); |
| | | //由于salesforce的查找字段是可以输入的,所以判断他如果为空或者为 000000000000000 的时候,传的参数就位经销商中文名,其他情况传id |
| | | if(dealerId != '' && dealerId != '000000000000000'){ |
| | | onChDealerUpdate(dealerId); |
| | | }else{ |
| | | onChDealerUpdate(dealerValue); |
| | | } |
| | | }else{ |
| | | onChDealerUpdate(''); |
| | | //j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked = false; |
| | | } |
| | | } |
| | | } |
| | | //如果选择的经销商为先款对象,那么做一下提示 |
| | | function hintAccount(){ |
| | | var xkChecked = j$(escapeVfId('allPage:allForm:allBlock:contract:FirstParagraphEnd'))[0].checked; |
| | | if(xkChecked){ |
| | | alert('请注意,当前经销商为先款对象。'); |
| | | } |
| | | } |
| | | |
| | | //LJPH-C9SCX7 【委托】合同无空白期的提醒 lt 20211221 start |
| | | //合同开始日预定日默认为上期合同1结束日的第2天 |
| | | // function DefaultStartDate(){ |
| | | // //上期合同1结束日 |
| | | // var LastContractEndDate; |
| | | // var LastContractEndDate2; //日期格式 |
| | | // var cnt = j$(escapeVfId('allPage:allForm:allBlock:assetSection:productCnt')).val(); |
| | | // for (var i = 0; i < cnt; i++){ |
| | | // LastContractEndDate = j$(escapeVfId('allPage:allForm:allBlock:assetSection:assetTable:' + i + ':End_Date')).value(); |
| | | // //或者换隐藏标签Maintenance_Contract__r.Past_Contract_end_day__c |
| | | // LastContractEndDate2 = LastContractEndDate; |
| | | // if(LastContractEndDate != null && LastContractEndDate != ''){ |
| | | // break; |
| | | // } |
| | | // } |
| | | |
| | | // if(LastContractEndDate != null && LastContractEndDate != ''){ |
| | | // //上期合同1结束日的第2天 |
| | | // LastContractEndDate += " 00:00:00";//设置为当天凌晨12点 |
| | | // LastContractEndDate = Date.parse(new Date(LastContractEndDate))/1000;//转换为时间戳 |
| | | // LastContractEndDate += (86400) * 1;//修改后的时间戳 |
| | | // var newDate = new Date(parseInt(LastContractEndDate) * 1000);//转换为时间 |
| | | // var LastContractEndDate1 = newDate.getFullYear() + '/' + (newDate.getMonth() + 1) + '/' + newDate.getDate();; |
| | | |
| | | // //获取当前日期(currentdate) |
| | | // var date1 = new Date(); |
| | | // var seperator = "/"; |
| | | // var year = date1.getFullYear(); |
| | | // var month = date1.getMonth() + 1; |
| | | // var day = date1.getDate(); |
| | | // if (month >= 1 && month <= 9) { |
| | | // month = "0" + month; |
| | | // } |
| | | // if (day >= 0 && day <= 9) { |
| | | // day = "0" + day; |
| | | // } |
| | | // var currentdate = year + seperator + month + seperator + day; |
| | | |
| | | // //上期合同尚未结束 , 开始预定日 |
| | | // if(currentdate < LastContractEndDate2){ |
| | | // document.getElementById("allPage:allForm:allBlock:contract:startdate").value = LastContractEndDate1; |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | //LJPH-C9SCX7 【委托】合同无空白期的提醒 lt 20211221 end |
| | | |
| | | </script> |
| | | <apex:form id="allForm"> |
| | | <apex:inputHidden id="alertStringValue" value="{!alertString}" /> |
| | |
| | | <apex:actionFunction name="decide" action="{!decide}" rerender="allForm" oncomplete="unblockUI();"/> |
| | | <apex:actionFunction name="decideCancle" action="{!decideCancle}" rerender="allForm" oncomplete="unblockUI();"/> |
| | | <apex:inputHidden id="oldDecideContractDate" value="{!OldContractStartDate}" /> |
| | | <!-- 经销商发生变化的change时间 --> |
| | | <apex:actionFunction name="onChDealerUpdate" action="{!onChDealerUpdate}" rerender="contract" onComplete="hintAccount();"> |
| | | <apex:param name="checkDealerId" assignTo="{!checkDealerId}" value="" /> |
| | | </apex:actionFunction> |
| | | <input type="hidden" id="oldContractDate" value="{!estimate.Contract_Start_Date__c}" /> |
| | | <script type="text/javascript"> |
| | | //j$(escapeVfId('allPage:allForm:changedAfterPrint')).val('false'); |
| | |
| | | </td> |
| | | <td> </td> |
| | | </tr> |
| | | |
| | | </table> |
| | | </apex:outputPanel> |
| | | <apex:outputPanel > |
| | | |
| | | <table align="center" width="100%" style="border-collapse:separate; border-spacing:0px 10px" > |
| | | <tr> |
| | | <td width="50%" align="right"> <label class="labelCol vfLabelColTextWrap " style="margin-left:22%">合同询价编码</label> </td> |
| | |
| | | |
| | | <td width="50%" align="right"> |
| | | <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 经销商名</label></td> |
| | | <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" /> </td> |
| | | <!-- update wangweipeng 2021/12/04 start --> |
| | | <td width="50%" align="left"> <apex:inputField value="{!estimate.Dealer__c}" id="dealer" onchange="onChDealerUpdateJs(this);return false;" style="float: left;"/> </td> |
| | | </tr> |
| | | |
| | | <tr> |
| | | <td width="50%" align="right"> |
| | | <label class="labelCol vfLabelColTextWrap " style="margin-left:30%"> 先款标识(经销商)</label></td> |
| | | <td width="50%" align="left" > <apex:inputCheckbox value="{!estimate.Is_RecognitionModel__c}" id="FirstParagraphEnd" onClick="return false;" /> </td> |
| | | </tr> |
| | | <!-- update wangweipeng 2021/12/04 end --> |
| | | </table> |
| | | <script type="text/javascript"> |
| | | j$(escapeVfId('allPage:allForm:allBlock:contract:estimateTarget')).children('option[value=]').remove(); |
| | |
| | | <!-- 20200103 Gzw 计算实际报价金额 end --> |
| | | |
| | | </td> |
| | | <!-- 实绩联动价格计算 end --> |
| | | |
| | | <!-- 隐藏合同月数 |
| | | <td class="dataCell" width="90px" style="text-align:right" > |
| | | <apex:outputField value="{!ar.rec.CurrentContract_F__r.Contract_Range__c}" rendered="{!Not(ar.IsManual)}" id="lastContRange" /> |
| | | </td>--> |
| | | |
| | | <!-- <td class="dataCell" width="70px"> |
| | | <apex:outputField value="{!ar.rec.Asset_Owner__c}" rendered="{!Not(ar.IsManual)}" /> |
| | | </td> |
| | | <td class="dataCell" width="90px" style="text-align:right" > |
| | | <apex:outputField value="{!ar.rec.Accumulation_Repair_Amount__c}" rendered="{!Not(ar.IsManual)}" /> |
| | | </td> --> |
| | | <!--<td class="dataCell" width="90px" style="text-align:right" >--> |
| | | <!-- 隐藏服务合同价格 |
| | | <apex:outputText value="{!ar.mcae.Estimate_List_Price__c}" id="assetListPrice" style="padding-right:3px;" /> |
| | | <apex:outputPanel layout="none" rendered="{!$ObjectType.Maintenance_Contract_Asset_Estimate__c.createable}" > |
| | | <apex:inputHidden value="{!ar.mcae.Estimate_List_Price__c}" id="assetListPriceHidden"/> |
| | | <apex:inputHidden value="{!ar.mcae.Estimate_List_Price_Page__c}" id="assetListPricePageHidden" /> |
| | | </apex:outputPanel> |
| | | |
| | | <apex:outputPanel layout="none" rendered="{!Not($ObjectType.Maintenance_Contract_Asset_Estimate__c.createable)}" > |
| | | <input type="hidden" value="{!ar.mcae.Estimate_List_Price__c}" id="allPage:allForm:allBlock:assetSection:assetTable:{!Text(cnt-1)}:assetListPriceHidden"/> |
| | | </apex:outputPanel>--> |
| | | <!--</td>--> |
| | | <!--<td> |
| | | <apex:outputText value="{!ar.mcae.Maintenance_Price_YearTXT__c}" id="assetListPriceTXT" /> |
| | | <apex:inputHidden value="{!ar.mcae.Maintenance_Price_YearTXT__c}" id="assetListPriceTXTHidden" /> |
| | | </td>--> |
| | | |
| | | |
| | | |
| | | <td class="dataCell" width="70px" style="text-align:right" > |
| | | <apex:inputField value="{!ar.mcae.Repair_Price__c}" id="repairPrice" style="ime-mode: disabled; width:95%; text-align:right;" onchange="refreshAsset({!productCount});"/> |
| | | </td> |
| | |
| | | <apex:inputField value="{!ar.mcae.Comment__c}" id="comment" style="width:95%;"/> |
| | | </td> |
| | | </tr> |
| | | |
| | | <!-- LJPH-C9SCX7 【委托】合同无空白期的提醒 lt 20211221 start --> |
| | | <!-- <script> |
| | | DefaultStartDate(); |
| | | </script> --> |
| | | <!-- LJPH-C9SCX7 【委托】合同无空白期的提醒 lt 20211221 end --> |
| | | |
| | | <apex:variable value="{!cnt + 1}" var="cnt" /> |
| | | </apex:repeat> |
| | | |
| | |
| | | * 客户同步 在SP、GI主担当变化时更新询价权限 |
| | | */ |
| | | trigger AccountTrigger on Account (after insert, after update, before delete, before insert, before update, after delete ) { |
| | | if (StaticParameter.EscapeAccountTrigger) { |
| | | System.debug('Escape、EscapeAccountTrigger:::::' + StaticParameter.EscapeAccountTrigger); |
| | | return; |
| | | } |
| | | |
| | | if ((Trigger.isAfter && Trigger.isInsert) || (Trigger.isAfter && Trigger.isUpdate) || (Trigger.isBefore && Trigger.isDelete)) { |
| | | // 同步到 Account2__c |
| | | AccountTrigger.syncAccount2(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | |
| | | } |
| | | } |
| | | //HWAG-B4PCZ5 2018-09-19 end |
| | | if (StaticParameter.EscapeAccountTrigger) { |
| | | System.debug('Escape、EscapeAccountTrigger:::::' + StaticParameter.EscapeAccountTrigger); |
| | | return; |
| | | } |
| | | //NFM112 2021/11/10 start |
| | | List<String> IdList = new List<String>(); |
| | | for(Account account : Trigger.new){ |
| | | Account old = Trigger.oldMap.get(account.Id); |
| | | if(old.FirstParagraph__c != account.FirstParagraph__c || old.MonthlyPayment__c != account.MonthlyPayment__c){ |
| | | IdList.add(account.Id); |
| | | } |
| | | } |
| | | if(IdList.size()>0){ |
| | | for(String Id : IdList){ |
| | | BatchIF_Log__c iflog = new BatchIF_Log__c(); |
| | | iflog.Type__c = 'NFM112'; |
| | | iflog.Log__c = 'callout start\n'; |
| | | insert iflog; |
| | | //iflog = [Select Id, Name from BatchIF_Log__c where Id = :iflog.Id]; |
| | | //System.debug(Logginglevel.DEBUG, 'NFM112_' + iflog.Name + ' start'); |
| | | NFM112Controller.executeNotFuture(iflog.Id, Id); |
| | | } |
| | | } |
| | | //NFM112 2021/11/10 end |
| | | } |
| | | //add wangweipeng 2022/02/10 start |
| | | //经销商的性质发生变化,那么需要发邮件,其中一个收件人为大区助理 |
| | | //大区助理:根据此经销商所在的那个大区,来判断到底发给谁,每个大区助理都有一个人,目前是存到自定义源数据里面了 |
| | | if(Trigger.isBefore){ |
| | | //用于存放此经销商是那个大区 |
| | | Set<String> setStaff = new Set<String>(); |
| | | if(Trigger.isUpdate){ |
| | | for (Account acc : Trigger.new) { |
| | | //判断当前修改的客户是否为经销商 |
| | | if(acc.RecordTypeId == '01210000000Qem1'){ |
| | | //如果是修改经销商,那么判断此经销商的先款标识是否发生变化,如果发送变化,那么就更新一下大区 |
| | | if(acc.FirstParagraphEnd__c != Trigger.oldMap.get(acc.Id).FirstParagraphEnd__c){ |
| | | setStaff.add(acc.Salesdepartment_HP__c); |
| | | } |
| | | } |
| | | } |
| | | }else if(Trigger.isInsert){ |
| | | for (Account acc : Trigger.new) { |
| | | //判断当前新增的客户是否为经销商 |
| | | if(acc.RecordTypeId == '01210000000Qem1'){ |
| | | setStaff.add(acc.Salesdepartment_HP__c); |
| | | } |
| | | } |
| | | } |
| | | if(setStaff.size() > 0){ |
| | | //获取对应的自定义元数据 |
| | | List<FSE_Regional_Assistant_Account__mdt> usrList = [select id,MasterLabel,DeveloperName,UserName__c,UserId__c from FSE_Regional_Assistant_Account__mdt where MasterLabel in :setStaff]; |
| | | if(usrList != null && usrList.size() > 0){ |
| | | //获取大区对应的助理人的id |
| | | if(Trigger.isUpdate){ |
| | | for (Account acc : Trigger.new) { |
| | | for(FSE_Regional_Assistant_Account__mdt fraam : usrList){ |
| | | if(acc.FirstParagraphEnd__c != Trigger.oldMap.get(acc.Id).FirstParagraphEnd__c){ |
| | | if(fraam.MasterLabel == acc.Salesdepartment_HP__c){ |
| | | acc.FSE_Regional_Assistant_Account__c = fraam.UserId__c; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }else if(Trigger.isInsert){ |
| | | for (Account acc : Trigger.new) { |
| | | for(FSE_Regional_Assistant_Account__mdt fraam : usrList){ |
| | | if(fraam.MasterLabel == acc.Salesdepartment_HP__c){ |
| | | acc.FSE_Regional_Assistant_Account__c = fraam.UserId__c; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //add wangweipeng 2022/02/10 end |
| | | |
| | | // if(Trigger.isUpdate){ |
| | | // List<String> IdList = new List<String>(); |
| | | // for(Account account : Trigger.new){ |
| | | // Account old = Trigger.oldMap.get(account.Id); |
| | | // if(old.FirstParagraph__c != account.FirstParagraph__c || old.MonthlyPayment__c != account.MonthlyPayment__c){ |
| | | // IdList.add(account.Id); |
| | | // } |
| | | // } |
| | | // if(IdList.size()>0){ |
| | | // UpdateContractAimAmountHandler.sendToSAP(IdList); |
| | | // } |
| | | // } |
| | | } |
| | |
| | | // 活動_サビコンを削除 |
| | | ControllerUtil.delEvent3ForTrigger(mcIds); |
| | | } |
| | | |
| | | //add wangweipeng 2021/11/29 start |
| | | //判断认款是否完成 |
| | | if(Trigger.isUpdate){ |
| | | for (Maintenance_Contract__c nmc : Trigger.new) { |
| | | //判断 上传认款合同时间 是否为空,如果不为空,那么证明此合同需要认款,并且认款金额需要和 第一次计划付款金额 做对比 |
| | | if(nmc.upload_to_RM_time__c != null){ |
| | | if(nmc.All_Amount__c != Trigger.oldMap.get(nmc.Id).All_Amount__c || nmc.Payment_Plan_Sum_First__c != Trigger.oldMap.get(nmc.Id).Payment_Plan_Sum_First__c){ |
| | | if(nmc.Payment_Plan_Sum_First__c != null || nmc.Payment_Plan_Sum_First__c > 0.0 ){ |
| | | nmc.Is_Recognition_Model_True__c = nmc.All_Amount__c >= nmc.Payment_Plan_Sum_First__c ? true : false; |
| | | }else{ |
| | | if(nmc.All_Amount__c > 0.0 && nmc.All_Amount__c != null){ |
| | | nmc.Is_Recognition_Model_True__c = true; |
| | | }else{ |
| | | nmc.Is_Recognition_Model_True__c = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //FSE所在大区助理 赋值 根据主担当人 的本部 |
| | | //华北:洪贺男 东北:刘莹莹 西北:祝琪雪 西南:何学琼 华东:陈明赟 华南:闻静 |
| | | Set<String> setStaff = new Set<String>(); |
| | | if(Trigger.isUpdate){ |
| | | for (Maintenance_Contract__c nmc : Trigger.new) { |
| | | if(nmc.Service_Contract_Staff__c != Trigger.oldMap.get(nmc.Id).Service_Contract_Staff__c || String.isBlank(nmc.FSE_Regional_Assistant__c)){ |
| | | setStaff.add(nmc.Service_Contract_Staff_Salesdepartment__c);//主担当本部(大区) |
| | | } |
| | | } |
| | | }else if(Trigger.isInsert){ |
| | | for (Maintenance_Contract__c nmc : Trigger.new) { |
| | | if(String.isNotBlank(nmc.Service_Contract_Staff__c)){ |
| | | setStaff.add(nmc.Service_Contract_Staff_Salesdepartment__c);//主担当本部(大区) |
| | | } |
| | | } |
| | | } |
| | | if(setStaff.size() > 0){ |
| | | //获取对应的自定义元数据 |
| | | List<FSE_Regional_Assistant__mdt> usrList = [select id,MasterLabel,DeveloperName,UserName__c,UserId__c from FSE_Regional_Assistant__mdt where MasterLabel in :setStaff]; |
| | | if(usrList != null && usrList.size() > 0){ |
| | | for (Maintenance_Contract__c nmc : Trigger.new) { |
| | | //如果是更新,那么判断主担当人是否有变化或FSE大区助理是否为空,如果满足其中一条,那么更新大区助理 |
| | | if(Trigger.isUpdate){ |
| | | if(!(nmc.Service_Contract_Staff__c != Trigger.oldMap.get(nmc.Id).Service_Contract_Staff__c |
| | | || String.isBlank(nmc.FSE_Regional_Assistant__c))) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | if(String.isNotBlank(nmc.Service_Contract_Staff__c)){ |
| | | for(FSE_Regional_Assistant__mdt fram : usrList){ |
| | | if(String.isNotBlank(fram.MasterLabel) && nmc.Service_Contract_Staff_Salesdepartment__c == fram.MasterLabel){ |
| | | nmc.FSE_Regional_Assistant__c = fram.UserId__c; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //add wangweipeng 2021/11/29 end |
| | | } |
| | | } |
New file |
| | |
| | | trigger PaymentMaintenanceContractTrigger on Payment_Maintenance_Contract__c (before insert, after insert, before update, after update, after delete, before delete) { |
| | | PaymentMaintenanceContractTriggerHandler pmct = new PaymentMaintenanceContractTriggerHandler(); |
| | | pmct.run(); |
| | | } |
| | |
| | | //wangweipeng 20210727 end |
| | | |
| | | if ((Trigger.isAfter && Trigger.isInsert) || (Trigger.isAfter && Trigger.isUpdate) || (Trigger.isAfter && Trigger.isDelete)) { |
| | | // if(!(System.isFuture()||System.isBatch())){// Add By Lijun 20220303 to avoid mutiple execute |
| | | NFM103Controller.NFM103Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | NFM603Controller.NFM603Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | RepairTrigger.UpdateAssert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | // } |
| | | } |
| | | // ---------------------------------------------------------------------- |
| | | // ここより、修理のサービスコントラクト項目を自動的に更新するロジック |
| | | // ---------------------------------------------------------------------- |
| | | if ( Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) { |
| | | //先款后修-修理增加先款标识 thh 20220322 start |
| | | RepairTrigger.AdvancePaymentFlagUpsert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); |
| | | //先款后修-修理增加先款标识 thh 20220322 end |
| | | |
| | | // 納入機器IDを一意に格納する Setです。 |
| | | Set<ID> assetIds = new Set<Id>(); |
| | | |
| | |
| | | // ---------------------------------------------------------------------- |
| | | // ここまで、サービスコントラクト項目を自動的に更新するロジック |
| | | // ---------------------------------------------------------------------- |
| | | |
| | | |
| | | |
| | | // ---------------------------------------------------------------------- |