李金换
2023-04-20 fd0bea6d4ad22f61b323ff5cf32e2b1104bb5492
失单报告增加限制
3个文件已修改
90 ■■■■ 已修改文件
force-app/main/default/classes/NFM206Rest.cls 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/PCLLostReportController.cls 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/PCLLostReportPage.page 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM206Rest.cls
@@ -250,6 +250,7 @@
                opportunityUpsertList.add(opportunityInfo);
            }
            if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;// 20230419 ljh add
            if (opportunityUpsertList.size() > 0) {
                // 20220916 ljh SWAG-CG2A7S start
                // upsert opportunityUpsertList;
force-app/main/default/classes/PCLLostReportController.cls
@@ -337,6 +337,15 @@
                }
                // 当失单品牌名为其他时,报错字段为失单对手型号(手动) thh 2022-01-17 end
                // update tcm 20211123 end
                // 20230418 ljh DB202304320022 start
                String LostBrandNameS = tempLostBrand.lostBrand.Lost_By_Company__c != '其他'?tempLostBrand.lostBrand.Lost_By_Company__c:tempLostBrand.lostBrand.Lost_By_Company_Mannual__c;
                String LostBrandName = temlostProduct.LostProductss.LostBrandName__c;
                if(LostBrandNameS != LostBrandName){
                    temlostProduct.LostProductss.LostBrandName__c.addError('失单品牌名不一致,请确认');
                    dataCheck = false;
                }
                // 20230418 ljh DB202304320022 end
            }
            // 当失单品牌名为其他时,报错字段为失单对手型号(手动) thh 2022-01-17 start
            if (productCount == 0 && tempLostBrand.LostProducts != null && tempLostBrand.LostProducts.size() > 0) {
@@ -575,7 +584,10 @@
        system.debug('brandNo:'+brandNo);
        LostBrand tempLostBrand = LostReport.LostBrands.get(brandNo);
        // PCLLostProduct__c plp = new PCLLostProduct__c(Competitor__c=CompetitionMap.get(LostReport.LostBrands[brandNo].lostBrand.Lost_By_Company__c));
        string brandName = tempLostBrand.lostBrand.Lost_By_Company__c;
        // 20230418 ljh DB202304320022 start
        // string brandName = tempLostBrand.lostBrand.Lost_By_Company__c;
        string brandName = tempLostBrand.lostBrand.Lost_By_Company__c != '其他'?tempLostBrand.lostBrand.Lost_By_Company__c:tempLostBrand.lostBrand.Lost_By_Company_Mannual__c;
        // 20230418 ljh DB202304320022 end
        PCLLostProduct__c plp = new PCLLostProduct__c();
        plp.LostBrandName__c = brandName;
        tempLostBrand.LostProducts.add(new PCLLostProducts(tempLostBrand.LostProducts.size(),plp));
force-app/main/default/pages/PCLLostReportPage.page
@@ -5,6 +5,11 @@
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" />
    <apex:form id="allForm">
        <script>
            // 20230418 ljh DB202304320022 start
            window.onload = function init(){
                clearBrandMannualName();
            }
            // 20230418 ljh DB202304320022 end
            function saveJs() {
                blockme();
                save();
@@ -31,6 +36,12 @@
                search(topNum, secondNum);
            }
            // add tcm 20211118 end
            // 20230418 ljh DB202304320022 start
            function edit2JS() {
                blockme();
                edit2();
            }
            // 20230418 ljh DB202304320022 end
            function setLostTotalAmount() {
                //console.log('setLostTotalAmount start:');
                var totalAmount = document.getElementById("allPage:allForm:allBlock:EditPage:LostReport:lstReport:LostTotalAmountOut:LostTotalAmount");
@@ -76,14 +87,32 @@
                setbrandmannual(brandNumber);
            }
            // 失单品牌不等于其他时,失单品牌(手动)清空并且不允许填写,失单品牌等于其他时,失单对手型号不可用  thh 2022-01-13 start
            function clearBrandMannualName(){
                if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_CompanyOut:Lost_By_Company').value == '其他'){
                    j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:productTable:0:LostProduct')).attr("disabled", true);
                } else{
                    document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value = '';
                    j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual')).attr("disabled", true);
            // function clearBrandMannualName(){
            //     if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_CompanyOut:Lost_By_Company').value == '其他'){
            //         j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:productTable:0:LostProduct')).attr("disabled", true);
            //     } else{
            //         document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value = '';
            //         j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:0:LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual')).attr("disabled", true);
            //     }
            // }
            // 20230418 ljh DB202304320022 start
            function clearBrandMannualName(){
                var pageStatus = "{!pageStatus}";
                if(pageStatus == 'Create'|| pageStatus == 'Edit'){
                    var brandCount = parseInt("{!brandCount}");
                    for(var i = 0;i<brandCount;i++){
                        if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_CompanyOut:Lost_By_Company').value == '其他'){
                            if(document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value == '' || document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value == null){
                                j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:productTable:0:LostProduct')).attr("disabled", true);
                            }
                        } else{
                            document.getElementById('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual').value = '';
                            j$(escapeVfId('allPage:allForm:allBlock:EditPage:LostBrands:'+i+':LostBrand:BrandContent:Lost_By_Company_MannualOut:Lost_By_Company_Mannual')).attr("disabled", true);
                        }
                    }
                }
            }
            // 20230418 ljh DB202304320022 end
            // 失单品牌不等于其他时,失单品牌(手动)清空并且不允许填写,失单品牌等于其他时,失单对手型号不可用  thh 2022-01-13 end
        </script>
        <apex:actionFunction name="save" action="{!save}" oncomplete="unblockUI();clearBrandMannualName();" rerender="allForm,EditButton2"></apex:actionFunction>
@@ -93,22 +122,35 @@
        </apex:actionFunction>
        <!-- 失单品牌不等于其他时,失单品牌(手动)清空并且不允许填写,失单品牌等于其他时,失单对手型号不可用  thh 2022-01-13 end -->
        <apex:actionFunction name="setbrandmannual" action="{!setbrandmannual}" oncomplete="unblockUI();" rerender="allForm">
        <!-- 20230418 ljh DB202304320022 start -->
        <!-- <apex:actionFunction name="setbrandmannual" action="{!setbrandmannual}" oncomplete="unblockUI();" rerender="allForm"> -->
        <apex:actionFunction name="setbrandmannual" action="{!setbrandmannual}" oncomplete="clearBrandMannualName(),unblockUI();" rerender="allForm">
        <!-- 20230418 ljh DB202304320022 end -->
            <apex:param assignTo="{!setBrandNo}" name="setBrandNo" value="" />
        </apex:actionFunction>
        <apex:actionFunction name="submit" action="{!submit}" oncomplete="unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
        <apex:actionFunction name="addBrand" action="{!addBrand}" oncomplete="unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
        <apex:actionFunction action="{!addProduct}" name="addProduct" reRender="allForm" oncomplete="unblockUI();">
        <!-- 20230418 ljh DB202304320022 start -->
        <apex:actionFunction name="edit2" action="{!edit2}" oncomplete="clearBrandMannualName(),unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
        <!-- <apex:actionFunction name="addBrand" action="{!addBrand}" oncomplete="unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction> -->
        <apex:actionFunction name="addBrand" action="{!addBrand}" oncomplete="clearBrandMannualName(),unblockUI();" rerender="allForm,EditButton2"></apex:actionFunction>
        <!-- <apex:actionFunction action="{!addProduct}" name="addProduct" reRender="allForm" oncomplete="unblockUI();"> -->
        <apex:actionFunction action="{!addProduct}" name="addProduct" reRender="allForm" oncomplete="clearBrandMannualName(),unblockUI();">
        <!-- 20230418 ljh DB202304320022 end -->
            <apex:param assignTo="{!brandNo}" name="brandNo" value="" />
        </apex:actionFunction>
        <apex:actionFunction action="{!Remove}" name="Remove" reRender="allForm" oncomplete="unblockUI();">
        <!-- 20230418 ljh DB202304320022 start -->
        <!-- <apex:actionFunction action="{!Remove}" name="Remove" reRender="allForm" oncomplete="unblockUI();"> -->
        <apex:actionFunction action="{!Remove}" name="Remove" reRender="allForm" oncomplete="clearBrandMannualName(),unblockUI();">
        <!-- 20230418 ljh DB202304320022 end -->
            <apex:param assignTo="{!RemoveBrandNo}" name="RemoveBrandNo" value="" />
        </apex:actionFunction>
        <!-- add tcm 20211118 start -->
        <apex:actionFunction action="{!search}" name="search" reRender="allForm" oncomplete="unblockUI();">
        <!-- 20230418 ljh DB202304320022 start -->
        <!-- <apex:actionFunction action="{!search}" name="search" reRender="allForm" oncomplete="unblockUI();"> -->
        <apex:actionFunction action="{!search}" name="search" reRender="allForm" oncomplete="clearBrandMannualName(),unblockUI();">
        <!-- 20230418 ljh DB202304320022 end -->
            <apex:param assignTo="{!topNum}" name="topNum" value="" />
            <apex:param assignTo="{!secondNum}" name="secondNum" value="" />
        </apex:actionFunction>
@@ -403,9 +445,14 @@
                        <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '草案', 'true', 'false')}" id="SubmitButton" onclick="submitJS();return false;"
                            value="提交" style="width: 150px;margin-left: 50px;" />
                        <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '草案' || $Profile.Id = '00e10000000Y3o5AAC', 'true', 'false')}"
                        <!-- 20230418 ljh DB202304320022 start -->
                        <!-- <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '草案' || $Profile.Id = '00e10000000Y3o5AAC', 'true', 'false')}"
                            id="EditButton" reRender="allForm" action="{!edit2}" value="编辑" style="width: 150px;margin-left: 50px;"
                        /> -->
                        <apex:commandButton rendered="{!IF(LostReport.lostReport.Report_Status__c = '草案' || $Profile.Id = '00e10000000Y3o5AAC', 'true', 'false')}"
                            id="EditButton" reRender="allForm"  onclick="edit2JS();return false;" value="编辑" style="width: 150px;margin-left: 50px;"
                        />
                        <!-- 20230418 ljh DB202304320022 end -->
                        <apex:commandButton id="CancelButton" action="{!cancel}" value="返回询价" style="width: 150px;margin-left: 50px;" />
                    </apex:pageBlockButtons>