黄千龙
2023-08-07 aa7cab63bcc29d8a1cb4667bc982814fc28970e5
hql20230807lightning提交更新
3个文件已修改
3个文件已添加
373 ■■■■■ 已修改文件
force-app/main/default/classes/LexChoiceAssetController.cls 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexChoiceAssetControllerTest.cls 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexChoiceAssetControllerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewPaymentPlanLoadController.cls 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/lwc/lexChoiceAsset/lexChoiceAsset.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/QLMAttachmentPreview.page 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexChoiceAssetController.cls
New file
@@ -0,0 +1,201 @@
public with sharing class LexChoiceAssetController {
    public class SSPLine {
        @AuraEnabled
        public Boolean isSelected;
        @AuraEnabled
        public String setProductid ;
        @AuraEnabled
        public String Assetid;
        @AuraEnabled
        public String Accountid;
        @AuraEnabled
        public String Hospital;
         @AuraEnabled
        public String WorkLocation;
        @AuraEnabled
        public Asset theObject;
        @AuraEnabled
        public String Name;
        @AuraEnabled
        public String SerialNumber;
        @AuraEnabled
        public String HP_Name;
        @AuraEnabled
        public String Department_Name;
        @AuraEnabled
        public Date Posting_Date;
        @AuraEnabled
        public Date Extend_Gurantee_DateTo;
        @AuraEnabled
        public Date CurrentContract_End_Date;
        public SSPLine(Asset psl) {
          isSelected = false;
          setProductid = psl.id;
            setProductid = setProductid.substring(0,15);
            Assetid = psl.id;
            if (psl.Account.id !=null) {
                Accountid = psl.Account.id;
            }
            Name = psl.Name;
            Hospital = psl.Hospital__r.id;
            if (psl.Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c !=null) {
                WorkLocation = psl.Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c;
            }
            SerialNumber= psl.SerialNumber;
            HP_Name = psl.HP_Name__c;
            Department_Name = psl.Department_Name__c;
            Posting_Date = psl.Posting_Date__c;
            Extend_Gurantee_DateTo = psl.Extend_Gurantee_DateTo__c;
            CurrentContract_End_Date = psl.CurrentContract_End_Date__c;
        }
    }
    public class InitData{
        @AuraEnabled
        public String Id;
        @AuraEnabled
        public String StatusC;
        @AuraEnabled
        public String OwnerId;
        @AuraEnabled
        public String Repair_Detail;
        @AuraEnabled
        public Date FaultTime;
        @AuraEnabled
        public String RepairApplicantName;
        @AuraEnabled
        public String HPname;
        @AuraEnabled
        public String DepName;
        @AuraEnabled
        public Date RepairsReportDate;
        @AuraEnabled
        public Date ReceiverTime;
        @AuraEnabled
        public Date PlannedVisitDay;
        @AuraEnabled
        public Date ActualVisitDateFirst;
         @AuraEnabled
        public Date ActualVisitDateSecon;
         @AuraEnabled
        public Date ActualVisitDateThird;
         @AuraEnabled
        public Date ApplicationTime;
     }
     public class AssData{
        @AuraEnabled
        public String canRepair;
     }
     @AuraEnabled
    public static AssData searchAss(String recordId){
        AssData res = new AssData();
        List<Asset> ass = [select id,Product_ID__c from Asset where ID = :recordId];
        List<Product2> p2 = [select id,Name,Can_Repair__c
                        from Product2 where
                        ID = :ass[0].Product_ID__c];
        if (p2[0].Can_Repair__c != null) {
            res.canRepair = p2[0].Can_Repair__c;
        }
        return res;
    }
    @AuraEnabled
    public static InitData init(String recordId){
        InitData res = new initData();
        try{
            RepairSubOrder__c report =  [SELECT Id,ApplicationTime__c,ActualVisitDateThird__c,ActualVisitDateSecon__c,ActualVisitDateFirst__c,PlannedVisitDay__c,ReceiverTime__c,RepairsReportDate__c,Status__c,Department__r.Name,Hospital__r.name,RepairApplicantName__c,OwnerId,ResponseResultDesc__c,FaultTime__c FROM RepairSubOrder__c WHERE Id =: recordId LIMIT 1];
            System.debug(LoggingLevel.INFO, '*** opp: ' + report);
            res.Id = report.Id;
            res.StatusC = report.Status__c;
            res.OwnerId = report.OwnerId;
            res.Repair_Detail = report.ResponseResultDesc__c;
            if (report.FaultTime__c!=null) {
                res.FaultTime = report.FaultTime__c.date();
            }
            res.RepairApplicantName = report.RepairApplicantName__c;
            if (report.Hospital__r.name!=null) {
                res.HPname = report.Hospital__r.name;
            }
            if (report.Department__r.Name!=null) {
                res.DepName = report.Department__r.Name;
            }
            res.RepairsReportDate = report.RepairsReportDate__c;
            if (report.ReceiverTime__c!=null) {
                res.ReceiverTime = report.ReceiverTime__c.date();
            }
            if (report.PlannedVisitDay__c!=null) {
                res.PlannedVisitDay = report.PlannedVisitDay__c.date();
            }
            res.ActualVisitDateFirst = report.ActualVisitDateFirst__c;
            res.ActualVisitDateSecon = report.ActualVisitDateSecon__c;
            res.ActualVisitDateThird = report.ActualVisitDateThird__c;
            if (report.ApplicationTime__c!=null) {
                  res.ApplicationTime = report.ApplicationTime__c.date();
            }
            System.debug(LoggingLevel.INFO, '*** res: ' + res);
        }catch(Exception e){
            System.debug(LoggingLevel.INFO, '*** e: ' + e);
        }
        return res;
    }
    @AuraEnabled
    public static String getNeedParm1(){
        String baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
        return baseUrl;
    }
  //   @AuraEnabled
  //   public static String init(){
  //       String reportid;
  //       Report r = new Report();
  //       List<Report> rs = new List<Report>();
  //       rs=[Select id,DeveloperName,Name,NamespacePrefix from Report Where DeveloperName='Set_Product_Detail'];
  //       if (rs.size()>0){
  //           //system.debug('DeveloperName=' + rs[0].DeveloperName);
  //           //system.debug('Name=' + rs[0].Name);
  //           //system.debug('NamespacePrefix=' + rs[0].NamespacePrefix);
  //           reportid = rs[0].id;
  //           reportid = reportid.substring(0,15);
  //       }
  //       return reportid;
  // }
  @AuraEnabled
  public static List<SSPLine> getData(String SearchName , String SearchNo , String SearchSN){
    String searchSql = 'Select id, name,Account.id,Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c,Hospital__r.id, SerialNumber,HP_Name__c,Department_Name__c,Posting_Date__c,Extend_Gurantee_DateTo__c,CurrentContract_End_Date__c from Asset ';
    String whereStr = 'Where  id !=null  ';
    String whereSql = '';
    if(SearchName != null && SearchName != ''){
      whereSql += 'and HP_Name__c Like ' + '\'%' + SearchName + '%\' ';
    }
    if(SearchNo != null && SearchNo != ''){
      whereSql += 'and OwnershipMachine_No__c =\'' + SearchNo + '\'';
    }
    if(SearchSN != null && SearchSN != ''){
      whereSql += 'and SerialNumber like ' + '\'%' + SearchSN + '%\' ';
    }
    searchSql = searchSql + whereStr + whereSql;
    searchSql += ' order by Posting_Date__c limit 100';
    List<Asset> cl = new List<Asset>();
    cl = Database.query(searchSql);
    List<SSPLine> activities = New List<SSPLine>();
    for(Asset psl : cl){
        SSPLine a = new SSPLine(psl);
        activities.add(a);
    }
    return activities;
  }
}
force-app/main/default/classes/LexChoiceAssetControllerTest.cls
New file
@@ -0,0 +1,124 @@
@isTest
private class LexChoiceAssetControllerTest {
     @testSetup
static void setupTestData() {
        Oly_TriggerHandler.bypass('ContactTriggerHandler');
        ControllerUtil.EscapeNFM001Trigger = true;
        // 省
        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;
        Contact contact2 = new Contact();
        contact2.AccountId = dep.Id;
        contact2.FirstName = '責任者';
        contact2.LastName = 'test1经销商';
        insert contact2;
        // 产品
        Product2 pro5 = new Product2(Name='name05',IsActive=true,Family='SP',
                Fixture_Model_No__c='n05',Serial_Lot_No__c='S/N tracing',
                Fixture_Model_No_T__c = 'n05',
                ProductCode_Ext__c='pc05',Manual_Entry__c=false,Can_Repair__c='可');
        insert pro5;
        Asset assetC1 = new Asset(Asset_Owner__c = 'Olympus');
        assetC1.RecordTypeId = System.Label.Asset_RecordType;
        assetC1.SerialNumber = 'assetC1';
        assetC1.Name = 'assetC1';
        assetC1.AccountId = dep.Id;
        assetC1.Department_Class__c = strategicDep[0].Id;
        assetC1.Hospital__c = hospital.Id;
        assetC1.Product2Id = pro5.Id;
        assetC1.Quantity = 1;
        assetC1.Status = '有库存';
        assetC1.Manage_type__c = '个体管理';
        assetC1.Internal_asset_location__c = '北京 备品中心';
        assetC1.Loaner_accsessary__c = true;
        assetC1.Delete_Flag__c = false;
        assetC1.Freeze_sign__c = false;
        assetC1.Out_of_wh__c = 0;
        // 保有设备
        Asset asset = new Asset(Asset_Owner__c = 'Olympus');
        asset.RecordTypeId = System.Label.Asset_RecordType;
        asset.SerialNumber = 'asset';
        asset.Name = 'asset';
        asset.AccountId = dep.Id;
        asset.Department_Class__c = strategicDep[0].Id;
        asset.Hospital__c = hospital.Id;
        asset.Product2Id = pro5.Id;
        asset.Quantity = 1;
        asset.Status = '有库存';
        asset.Manage_type__c = '个体管理';
        asset.Internal_asset_location__c = '北京 备品中心';
        asset.Loaner_accsessary__c = true;
        asset.Delete_Flag__c = false;
        asset.Freeze_sign__c = false;
        asset.Out_of_wh__c = 0;
        insert new Asset[] {assetC1, asset};
    }
    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 = '测试附件下载';
        subOrder.FaultTime__c = Date.today();
        subOrder.PlannedVisitDay__c = Date.today();
        subOrder.ReceiverTime__c = Date.today();
        subOrder.ApplicationTime__c = Date.today();
        Account acc = [select id from account where name = 'test hospital' limit 1];
        Account dep = [select id from account where AgentCode_Ext__c = '9999998' limit 1];
        subOrder.Hospital__c = acc.id;
        subOrder.Department__c = dep.id;
        insert subOrder;
        Asset ass = [select id,Account.id,Name,Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c,Hospital__r.id,SerialNumber,HP_Name__c,Department_Name__c,Posting_Date__c,Extend_Gurantee_DateTo__c,CurrentContract_End_Date__c from Asset limit 1];
        LexChoiceAssetController.init(subOrder.id);
        LexChoiceAssetController.searchAss(ass.id);
        LexChoiceAssetController.getNeedParm1();
         new LexChoiceAssetController.SSPLine(ass);
        LexChoiceAssetController.getData('assetC1',null,null);
    }
}
force-app/main/default/classes/LexChoiceAssetControllerTest.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>50.0</apiVersion>
    <status>Active</status>
</ApexClass>
force-app/main/default/classes/NewPaymentPlanLoadController.cls
@@ -8,6 +8,7 @@
    public Boolean printAgent { get; private set; }
    //HWAG-BHT7XX 2019/11/26 START
    public Boolean agreeUpperLimit { get; private set; }
    public Boolean isPrint { get;  set; }
    //HWAG-BHT7XX 2019/11/26 END
    // fxk 2021/8/31 点检次数必须填 Star
    // public boolean saveErrorflag { get; private set; }
@@ -16,10 +17,17 @@
    public Integer Contract_validMonth {get; set;}
    // 新增点检总次数(只在页面中显示)fxk 2021/9/2 End
    // WKX START
    public Maintenance_Contract_Estimate__c estimate { get; set; }
    public String targetEstimateId { get; private set; }
    public Boolean EnablePrintContract {get; set;}
    // WKX END
    public NewPaymentPlanLoadController() {
        idl = ApexPages.currentPage().getParameters().get('id');
        idl = ApexPages.currentPage().getParameters().get('id');
    }
    public void init() {
        isPrint = false;
        statusSave = 'Fin';
        testDateTime = system.now();
        //
@@ -91,6 +99,11 @@
                                                //URF限次合同2期 LY 20220811 star
                                                ,URF_Contract__c
                                                //URF限次合同2期 LY 20220811 end
                                                // WKX 2023/7/25 DB202306182573 START
                                                ,Estimation_Id__r.id
                                                // WKX 2023/7/25 DB202306182573 END
                                                from
                                                Maintenance_Contract__c
                                                where
@@ -150,6 +163,22 @@
        }
        //fxk 新加点检总次数 2021.9.2 End
    }
    // WKX START
    private void setThisEstimate() {
        this.estimate = [SELECT Id
                        ,Print_RepairPrice__c
                        ,Print_Agent__c
                        ,Print_ListPrice__c
                        ,Print_SumPrice__c
                        ,Print_Tripartite__c
                        ,Print_Simplify__c
                        FROM Maintenance_Contract_Estimate__c
                        WHERE Id = :PageMCEElement.Estimation_Id__r.id];
        this.EnablePrintContract = true;
    }
    // WKX END
    public List<SelectOption> getSmall_Repair_Time() {
        List<SelectOption> options = new List<SelectOption>();
@@ -516,6 +545,7 @@
                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,
                                             '付款总金额与合同金额不符。'));
                        statusSave = 'Denied';
                        return null;
                    }
                }
@@ -563,6 +593,9 @@
            PageMCEElement.MainLeaderManager__c = PageMCEElement.Service_Contract_Staff__r.JingliApprovalManager__c;
            update PageMCEElement;
            statusSave = 'Fin';
            if(isPrint == false) {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存成功'));
            }
            return null;
        } catch (exception ex) {
            statusSave = 'Denied';
@@ -573,8 +606,9 @@
    }
    public void print() {
        System.debug('print start');
        this.isPrint = true;
        save();
        this.isPrint = false;
        if (PageMCEElement.Decided_Estimation__c == null) {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,
                                 '报价单没有决定之前不能打印合同文本!'));
force-app/main/default/lwc/lexChoiceAsset/lexChoiceAsset.js
@@ -242,7 +242,7 @@
                    var status = this.StatusC;
                    if (status != '待处理') {
                        const evt = new ShowToastEvent({
                                title : '修子单的状态不是 待处理 无法申请修理',
                                title : '报修子单的状态不是 待处理 无法申请修理',
                                message: '',
                                variant: 'error'
                            });
force-app/main/default/pages/QLMAttachmentPreview.page
@@ -1,6 +1,7 @@
<apex:page action="{!init}" id="Page"  controller="QLMAttachmentPreviewController" showheader="false" sidebar="false" lightningStylesheets="true">
    <!-- 文件列表 点击行项目 预览图片 非图片格式点击下载  -->
    <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}">
    </apex:stylesheet>
    <apex:includescript value="{!URLFOR($Resource.jquery183minjs)}">
@@ -109,7 +110,7 @@
    // 返回按钮根据传id返回上一级操作
        function test(){
        var queryVal=GetQueryValue('parentId');
        // var url='https://ocsm--stagefull.my.salesforce.com/'+queryVal;
        // var url='https://ocsm--partial--c.sandbox.vf.force.com/'+queryVal;
        var url='https://ocsm.my.salesforce.com/'+queryVal;
        window.location.href=url;
        }