李彤
2022-11-17 675ad74a96337da89845179a9606116d1f32e621
新建修理提示信息
2个文件已修改
242 ■■■■ 已修改文件
force-app/main/default/classes/ChoiceAssetController.cls 126 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ChoiceAsset.page 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,17 +147,39 @@
            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 = '/';
        String joint_1 = '=';
        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'; //科室
@@ -182,23 +211,30 @@
            String  ActualVisitDateThird_Id= '';//三次上门日
            String  SubOrderCompleteDate_Id= '';//报修单处理完成日
            String  SubOrderCreatedDate_Id= '';//报修单申请修理日
            //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'; //报修人
                // RepairApplicantPosition_Id = '00N1m0000054ufV'; //报修人岗位
                RepairApplicantHospital_Id = '00N1m0000054ufU'; //报修人医院
                RepairApplicantDepartment_Id = '00N1m0000054ufT'; //报修人科室
                baoxiuzidan = '00N1m0000054ufZ'; //报修子单
                faqiri = '00N1m0000054ufa'; //报修发起日
                shouliri = '00N1m0000054ufS'; //工程师受理日
            // if (NFMUtil.isSandbox()) { //测试环境
            //     RepairApplicant_Id = '00N1m0000054ufW'; //报修人
            //     // RepairApplicantPosition_Id = '00N1m0000054ufV'; //报修人岗位
            //     RepairApplicantHospital_Id = '00N1m0000054ufU'; //报修人医院
            //     RepairApplicantDepartment_Id = '00N1m0000054ufT'; //报修人科室
            //     //baoxiuzidan = '00N1m0000054ufZ'; //报修子单
            //     baoxiuzidan = '00N10000009H1rR'; //报修子单
            //     faqiri = '00N1m0000054ufa'; //报修发起日
            //     shouliri = '00N1m0000054ufS'; //工程师受理日
                
                PlannedVisitDay_Id= '00N1m000005SRiF';//计划上门日
                ActualVisitDateFirst_Id= '00N1m000005SRiK';//一次上门日
                ActualVisitDateSecond_Id= '00N1m000005SRiP';//二次上门日
                ActualVisitDateThird_Id= '00N1m000005SRiU';//三次上门日
                SubOrderCompleteDate_Id= '00N1m000005SRmg';//报修单处理完成日
                SubOrderCreatedDate_Id= '00N1m000005SRmW';//报修单申请修理日
            } else { //正式环境
            //     PlannedVisitDay_Id= '00N1m000005SRiF';//计划上门日
            //     ActualVisitDateFirst_Id= '00N1m000005SRiK';//一次上门日
            //     ActualVisitDateSecond_Id= '00N1m000005SRiP';//二次上门日
            //     ActualVisitDateThird_Id= '00N1m000005SRiU';//三次上门日
            //     SubOrderCompleteDate_Id= '00N1m000005SRmg';//报修单处理完成日
            //     SubOrderCreatedDate_Id= '00N1m000005SRmW';//报修单申请修理日
            // } else { //正式环境
                RepairApplicant_Id = '00N10000009H1rQ'; //报修人
                // RepairApplicantPosition_Id = ''; //报修人岗位  
                RepairApplicantHospital_Id = '00N10000009H1rP'; //报修人医院  
@@ -214,9 +250,20 @@
                ActualVisitDateThird_Id= '00N10000009H1r8';//三次上门日
                SubOrderCompleteDate_Id= '00N10000009H1ri';//报修单处理完成日
                SubOrderCreatedDate_Id= '00N10000009H1rj';//报修单申请修理日
            }
                //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;
@@ -253,6 +300,9 @@
            url += joint_4 +  ActualVisitDateSecond_Id+ joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.ActualVisitDateSecon__c);//二次上门日
            url += joint_4 +  ActualVisitDateThird_Id+ joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.ActualVisitDateThird__c);//三次上门日
            url += joint_4 +  SubOrderCompleteDate_Id+ joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.ApplicationTime__c);//报修单处理完成日
            //LLIU-CGX5E9 LY 20220812 start
            url += joint_4 +  DateReceiptQuestions_Id+ joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.ApplicationTime__c);//问题联络收到日
            //LLIU-CGX5E9 LY 20220812 end
            url += joint_4 +  SubOrderCreatedDate_Id+ joint_1 + NFMUtil.formatDateTime2StrSprit(Date.today());//报修单申请修理日
            url += joint_4 + shouliri + joint_1 + NFMUtil.formatDateTime2StrSprit(repairSubOrder.ReceiverTime__c);
@@ -262,14 +312,30 @@
            //add     wangweipeng        2022/01/26       end
            //add     zhangyuheng        2022/04/07       start
            if (String.isNotBlank(ast.Account.RecordTypeId)) {
                if (ast.Account.RecordTypeId == '01210000000QemQAAS') { //战略科室
                if (ast.Account.RecordTypeId == '01210000000QemQAAS' || //战略科室 ET
                    ast.Account.RecordTypeId == '01210000000QemL' || //战略科室 消化科
                    ast.Account.RecordTypeId == '01210000000Qezy' || //战略科室 其他
                    ast.Account.RecordTypeId == '01210000000Qf03' || //战略科室 不明
                    ast.Account.RecordTypeId == '01210000000QezZ' || //战略科室 呼吸科
                    ast.Account.RecordTypeId == '01210000000Qezo' || //战略科室 妇科
                    ast.Account.RecordTypeId == '01210000000Qeze' || //战略科室 普外科
                    ast.Account.RecordTypeId == '01210000000Qezj' || //战略科室 泌尿科
                    ast.Account.RecordTypeId == '01210000000Qezt'    //战略科室 耳鼻喉科
                    ) { //战略科室
                    if (String.isNotBlank(ast.Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c)) {
                        url += joint_4 +  SalesOfficeCode_selection_Id+ joint_1 + ast.Account.Parent.FSE_SP_Main_Leader__r.Work_Location__c;//修理品返送地
                    }else {
                        // continue;
                    }
                }
                if (ast.Account.RecordTypeId == '01210000000QfmRAAS') { //科室
                if (ast.Account.RecordTypeId == '01210000000QfmRAAS' || //科室 呼吸科
                    ast.Account.RecordTypeId == '01210000000QfmH' || //科室 普外科
                    ast.Account.RecordTypeId == '01210000000Qfmb' || //科室 其他
                    ast.Account.RecordTypeId == '01210000000QfmM' || //科室 妇科
                    ast.Account.RecordTypeId == '01210000000QfmC' || //科室 泌尿科
                    ast.Account.RecordTypeId == '01210000000Qfm7' || //科室 消化科
                    ast.Account.RecordTypeId == '01210000000Qfm2'    //科室 耳鼻喉科
                    ) { //科室
                    if (String.isNotBlank(ast.Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c)) {
                        url += joint_4 +  SalesOfficeCode_selection_Id+ joint_1 + ast.Account.Parent.Parent.FSE_SP_Main_Leader__r.Work_Location__c;//修理品返送地
                    }else {
@@ -295,11 +361,11 @@
            String Generation_Source_Id = '00N10000002FHF6';//QIS来源
            String Name_Id = 'Name';//QIS管理号码
            if (NFMUtil.isSandbox()) {
                baoxiuzidan = '00N1m000005STFv'; //报修子单
            } else {
            // if (NFMUtil.isSandbox()) {
            //     baoxiuzidan = '00N1m000005STFv'; //报修子单
            // } else {
                baoxiuzidan = '00N10000009H22X'; //报修子单
            }
            // }
            url += 'a0f/e?retURL=%2Fa0f%2Fo&RecordType=01210000000RLWc&ent=01I10000000T5b1';
            url += joint_3 + Delivered_Product_Id + joint_1 + ast.Name;
@@ -336,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';
        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 (';
force-app/main/default/pages/ChoiceAsset.page
@@ -2,17 +2,43 @@
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"></apex:stylesheet>
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"></apex:includeScript>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"></apex:includeScript>
    <apex:includeScript value="/soap/ajax/29.0/connection.js"></apex:includeScript>
    <apex:includeScript value="/soap/ajax/29.0/apex.js"></apex:includeScript>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
    <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
    <style type="text/css"></style>
    <script>
        function searchProductJs() {
            searchAsset();
        }
        function searchProductJs() {
            searchAsset();
        }
        function saveJs(){
            save();
        }
        function saveJs(){
            save();
        }
        //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 start
        function checkPartSupplyFinishDateJs(){
            var today = new Date();
            var todayNew = today.toLocaleDateString();
            var check;
            var num = 100000;
            for (var i = 0; i < 100; i++) {
                check = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:'+i+':consumablesCountproRowCheckbox')).attr('checked');
                if (check == 'checked'){
                    num = i;
                }
            }
            if (num != 100000){
                var partSupplyFinishDate = new Date(j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + num + ':partSupplyFinishDate')).value());
                if (partSupplyFinishDate != 'Invalid Date'){
                    var partSupplyFinishDateNew = partSupplyFinishDate.toLocaleDateString();
                    if (partSupplyFinishDateNew > todayNew){
                        alert('预计'+ partSupplyFinishDateNew +'零件即将停产,请送修前与工厂及RC联络');
                    }
                    if (partSupplyFinishDateNew <= todayNew){
                        alert('该型号零件已经停产,有特殊需求,请送修前与工厂RC联络');
                    }
                }
            }
        }
        //XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 end
        function ClearJs(){
            blockme();
@@ -26,9 +52,10 @@
    </script>
    <apex:form id="allForm">
    <apex:actionFunction name="searchAsset" action="{!searchAsset}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CheckStatusAfter();SumCompute()">
    </apex:actionFunction>
    <apex:actionFunction name="save" action="{!save}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CheckStatusAfter();SumCompute()">
    </apex:actionFunction>
    </apex:actionFunction>
    <apex:actionFunction name="save" action="{!save}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CheckStatusAfter();SumCompute()">
    </apex:actionFunction>
    <apex:outputPanel id="allPanel">
        <apex:pageBlock id="allBlock">
@@ -55,7 +82,7 @@
                            
                            <td colspan="2"/>
                            <td colspan="4">机身编码:
                                   <apex:inputText value="{!FuselageNumber}" id="FuselageNumber"/>
                                <apex:inputText value="{!FuselageNumber}" id="FuselageNumber"/>
                            </td>                           
                             
                            <td align="right"></td>
@@ -64,6 +91,7 @@
                           <!--  <td>
                            <apex:commandButton onclick="saveJs();" value="确定" rerender="dummy"  />
                            </td> -->
                            
                        </tr>
                        <!-- <td>
@@ -77,16 +105,16 @@
                        <tr>
                            <td colspan="2"/>
                            <td colspan="4">设备型号:
                                <apex:inputText value="{!AssetModel}" id="AssetModel"/>
                                <apex:inputText value="{!AssetModel}" id="AssetModel"/>
                            </td>
                            
                        </tr>
                        <tr>
                            <td colspan="2"/>
                            <td colspan="4">医院名称:
                                <apex:inputText value="{!HospitalName}" id="HospitalName"/>
                            </td>
                            <td colspan="2"/>
                            <td colspan="4">医院名称:
                                <apex:inputText value="{!HospitalName}" id="HospitalName"/>
                            </td>
                        </tr>
                    </table>
                </apex:pageBlock>
@@ -94,7 +122,7 @@
                    <apex:pageMessages />
                 </apex:outputPanel>
                <apex:pageBlock title="保有设备查找" id="ConsumableorderdetailsSection">
                    <table class="list" border="0" cellpadding="0" cellspacing="0">
                    <table class="list" border="0" cellpadding="0" cellspacing="0">
                        <tr class="headerRow">
                            <!-- <apex:variable var="v" value="" rendered="{!editAble}"> -->
                                <!-- <th><input type='checkbox' onClick='checkAll()' id='checker'/>选择</th> -->
@@ -102,21 +130,24 @@
                            
                            <th>选择</th>
                            <th>保有设备名称</th>
                            <th>状态</th>
                            <!-- 20220927 ljh XLIU-CJN62G update start-->
                            <!-- <th>状态</th> -->
                            
                            <th>机身编码</th>
                            <th>设备型号</th>
                            <!-- <th>信息来源</th> -->
                            <th>集中管理库存</th>
                            <th>医院</th>
                            <th>战略科室</th>
                            <th>科室</th>
                            <th>发货日</th>
                            <th>多年保修期至</th>
                            <th>最近一期维修合同结束日</th>
                            <!-- <th>集中管理库存</th> -->
                            <!-- 20220927 ljh XLIU-CJN62G update end-->
                        </tr>
                            <apex:repeat value="{!choiceAssetInfoRecordsview}" var="records" id="ConsumableorderdetailsTable">
                                <tr class="dataRow">
                                    <td>
                                    <apex:inputCheckbox value="{!records.check}" onclick="CheckSize(this);" id="consumablesCountproRowCheckbox" disabled="{!!records.canSelect}"/>
                                    </td>
                                    <td>
                                    <apex:inputCheckbox value="{!records.check}" onclick="CheckSize(this);" id="consumablesCountproRowCheckbox" onchange="checkPartSupplyFinishDateJs(); return false;" disabled="{!!records.canSelect}"/>
                                    </td>
                                    <!-- <apex:variable var="v" value="" rendered="{!editAble}" id="variableinfo">
                                        <td>
@@ -126,21 +157,12 @@
                                    <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Name}"/>
                                    </td>
                                    <td class="dataCell">
                                    <!-- <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Status}"/>
                                    </td>
                                    </td> -->
                                    
                                    <td class="dataCell">
                                        <apex:outputText value="{!records.ast.SerialNumber}"/>
                                    </td>
                                    <!-- <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Product2.Asset_Model_No__c}"/>
                                    </td> -->
                                    <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Information_From__c}"/>
                                    </td>
                                    <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Ji_Zhong_Guan_Li_Ku_Cun__c}"/>
                                    </td>
                                    <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Hospital__r.Name}"/>
@@ -151,10 +173,28 @@
                                    <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Account.Name}"/>
                                    </td>
                                    <!-- <td class="dataCell">
                                        <apex:outputText value="{!records.ast.Product2.Asset_Model_No__c}"/>
                                    </td> -->
                                    <td class="dataCell">
                                        <apex:outputField value="{!records.ast.Posting_Date__c}"/>
                                    </td>
                                    <td class="dataCell">
                                        <apex:outputField value="{!records.ast.Extend_Gurantee_DateTo__c}"/>
                                    </td>
                                    <td class="dataCell">
                                        <apex:outputField value="{!records.ast.CurrentContract_End_Date__c}"/>
                                    </td>
                                    <!--XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 start -->
                                    <td>
                                        <apex:inputField value="{!records.ast.PartSupplyFinishDate__c}" id="partSupplyFinishDate" style="display: none" showDatePicker="false"/>
                                    </td>
                                    <!--XLIU-CJM7Z9 【委托】新建修理提示信息(停产及非修理对象品)LY 20221012 end  -->
                                </tr>
                            </apex:repeat>
                    </table>
                </apex:pageBlock>
                </apex:pageBlock>
        </apex:pageBlock>
    </apex:outputPanel>
</apex:form>