111
沙世明
2022-11-22 928399eceec50e3d37ea08669a12789a9410a9d2
force-app/main/default/classes/ChoiceAssetController.cls
@@ -72,13 +72,21 @@
        //1.只查找100条保有设备数据
        String fuselageNumberTrim = String.isNotBlank(FuselageNumber)?FuselageNumber.trim():'';
        String serialNumber = '%' + String.escapeSingleQuotes(fuselageNumberTrim.replaceAll('%', '\\%')) + '%';
        List < Asset > assetListed =    [SELECT Id,name,SerialNumber,InstallDate,Information_From__c,Asset_situation__c,
        List < Asset > assetListed =    [SELECT Id,name,SerialNumber,InstallDate,
                                            // Information_From__c,// 20220927 ljh XLIU-CJN62G
                                            Asset_situation__c,
                                            Order_No__c,Account.Name,Status,Department_Class__c,Hospital__r.Owner.Name,
                                            Hospital__r.Owner.Phone,Installation_Site__c,CurrentContract__c,
                                            Product2.Asset_Model_No__c,Hospital__r.Name,Department_Class__r.Name ,
                                            Department_Class__r.Id,Ji_Zhong_Guan_Li_Ku_Cun__c,Account.RecordTypeId
                                            Department_Class__r.Id,
                                            // Ji_Zhong_Guan_Li_Ku_Cun__c,// 20220927 ljh XLIU-CJN62G
                                            Posting_Date__c,Extend_Gurantee_DateTo__c,CurrentContract_End_Date__c,// 20220927 ljh XLIU-CJN62G
                                            Account.RecordTypeId
                                            ,Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c
                                            ,Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c
                                            //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 start
                                            ,PartSupplyFinishDate__c
                                            //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 end
                                        FROM Asset where Id != null AND Repairing_Count__c >= 0 AND SerialNumber like :serialNumber LIMIT 100
                                        ];
@@ -86,7 +94,6 @@
        for (Asset ast: assetListed) {
            choiceAssetInfoRecordsview.add(new ChoiceAssetInfo(ast));
        }
    }
    // 检索
@@ -140,9 +147,24 @@
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '只能选择一个保有设备'));
            return null;
        }
        // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 start
        // List<Asset> ass = [select id,Product_ID__c from Asset where ID = :ast.Id];
        // List<Product2> p2 = [select id,Name,Can_Repair__c
        //                 from Product2 where
        //                 ID = :ass[0].Product_ID__c];
        // String canRepair = p2[0].Can_Repair__c;
        // if (canRepair=='第三方'){
        //     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '非我司修理对象,无法新建修理,如有不明请咨询CIC'));
        //     return null;
        // }
        // if (canRepair=='不' || String.isBlank(canRepair)){
        //     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '本设备无法新建修理'));
        //     return null;
        // }
        // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 end
        return createData(ast);
    }
    public PageReference createData(Asset ast) {
        String url = '/';
@@ -150,7 +172,14 @@
        String joint_2 = '_lkid=';
        String joint_3 = '&CF';
        String joint_4 = '&';
        // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 start
        // List<Asset> ass = [select id,Product_ID__c from Asset where ID = :ast.Id];
        // List<Product2> p2 = [select id,Name,Can_Repair__c
        //                 from Product2 where
        //                 ID = :ass[0].Product_ID__c];
        // String canRepair = p2[0].Can_Repair__c;
        // system.debug('1111111111111111111'+canRepair);
        // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 end
        if ('Repair'.equals(dataType)) {
            String Delivered_Product_Id = '00N10000002Dx1X'; //设备型号 
            String Account_Id = '00N10000002Dx5n'; //科室
@@ -185,6 +214,9 @@
            //LLIU-CGX5E9 LY 20220812 start
            String  DateReceiptQuestions_Id = '';//问题联络收到日
            //LLIU-CGX5E9 LY 20220812 end
            // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 start
            // String  Excwork_location_Id = '';//跳过维修中心
            // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 end
            String  engineerSendDate_Id= '';//工程师修理品寄送日
            // if (NFMUtil.isSandbox()) { //测试环境
            //     RepairApplicant_Id = '00N1m0000054ufW'; //报修人
@@ -221,9 +253,17 @@
                //LLIU-CGX5E9 LY 20220812 start
                DateReceiptQuestions_Id= '00N10000008rsVQ';//问题联络收到日
                //LLIU-CGX5E9 LY 20220812 end
                // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 start
                // Excwork_location_Id = '00N10000009HAJl';//跳过维修中心
                // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 end
            //}
            url += 'a0J/e?retURL=%2F';
            // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 start
            // if (canRepair=='RC送修'){
            //     url += joint_4 + Excwork_location_Id + joint_1 + true;
            // }
            // //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221110 end
            url += joint_3 + Delivered_Product_Id + joint_1 + ast.Name;
            url += joint_3 + Delivered_Product_Id + joint_2 + ast.Id;
@@ -362,10 +402,12 @@
    private String makeSoql() {
        String start = '';
        String soql = 'select Id,name,SerialNumber,InstallDate,Information_From__c,Asset_situation__c,Order_No__c,Account.Name,Status,Department_Class__c, ';
        String soql = 'select Id,name,SerialNumber,InstallDate,Asset_situation__c,Order_No__c,Account.Name,Status,Department_Class__c, ';
        soql += 'Hospital__r.Owner.Name,Hospital__r.Owner.Phone,Installation_Site__c,CurrentContract__c,Product2.Asset_Model_No__c,Hospital__r.Name,Department_Class__r.Name ,Department_Class__r.Id,';
        soql += 'Ji_Zhong_Guan_Li_Ku_Cun__c,Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c,Account.RecordTypeId';
        soql += 'Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c,Account.RecordTypeId';
        soql += ',Posting_Date__c,Extend_Gurantee_DateTo__c,CurrentContract_End_Date__c  ';// 20220927 ljh XLIU-CJN62G
        soql += ',PartSupplyFinishDate__c ';//XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012
        soql += ' from Asset where Id != null AND Repairing_Count__c = 0 ';
        if (String.isNotBlank(FuselageNumber) || String.isNotBlank(AssetModel) || String.isNotBlank(HospitalName)) {
            soql += ' AND (';