yumenghui
2023-08-04 0a3f9325599467015aecc4af7543dd10fe70ec56
force-app/main/default/pages/ReceivingNoteWaitingReceipt.page
@@ -5,6 +5,33 @@
    <apex:stylesheet value="{!URLFOR($Resource.ReceivingNotePageCss)}"/>
    <apex:includeScript value="{!URLFOR($Resource.ReceivingNotePageJS)}"/>
    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
    <apex:stylesheet value="{!URLFOR($Resource.StyleUtilCss)}"/>
    <style type="text/css">
        table.list .col_ReceivingNoteDetailNo__c {width:100px;}
        table.list .col_OT_CODE__c {width:100px;}
        table.list .col_Fixture_Model_No_F__c {width:100px;}
        table.list .col_Fixture_Model_Name_F__c {width:100px;}
        table.list .col_Fixture_Arrival_Process__c {width:100px;}
        table.list .col_Fixture_Arrival_Product__c {width:200px;}
        table.list .col_Internal_Asset_number_key__c {width:100px;}
        table.list .col_SerialNumber_Origin__c {width:100px;}
        table.list .col_SerialNumber__c {width:100px;}
        table.list .col_PeriodOfUse_Old_F__c {width:100px;}
        table.list .col_PeriodOfUse_Final__c {width:100px;}
        table.list .col_Packing_list_Fixture_F__c {width:100px;}
        table.list .col_RND_Status__c {width:100px;}
        table.list .col_Asset_loaner_category_F__c {width:100px;}
        table.list .col_EquipmentSet_Managment_Code__c {width:100px;}
        table.list .col_Salesdepartment__c {width:100px;}
        table.list .col_SalesProvince__c {width:100px;}
        table.list .col_Product_category__c {width:100px;}
        table.list .col_Equipment_Type__c {width:100px;}
        table.list .col_Manage_type__c {width:100px;}
        table.list .col_unknow_serial_NO_product__c {width:100px;}
        table.list .col_Loaner_accsessary__c {width:100px;}
        table.list .col_Change_Point__c {width:100px;}
        /* table.list .noClick .col_DataConfirmation__c {width:100px;} */
    </style>
    <apex:form >
        <!-- 此处隐式生成二维码图片,防止PDF页上的二维码崩坏 -->
        <apex:includeScript value="{!URLFOR($Resource.qrcode)}"/>
@@ -20,28 +47,61 @@
                sforce.connection.sessionId = '{!GETSESSIONID()}';
                 // 20210312 you WLIG-BV8CHF start
                var record = sforce.connection.query("select id from Attachment where ParentId = \'{!pageB.rn.Id}\' and name = \'QRCode-{!pageB.rn.ReceivingNoteNo_New__c}\'");
                 // 20210312 you WLIG-BV8CHF end
               // var record = sforce.connection.query("select id from Attachment where ParentId = \'{!pageB.rn.Id}\' and name = \'QRCode-{!pageB.rn.ReceivingNoteNo_New__c}\'");
               var record = sforce.connection.query("select Id,ContentDocumentId from ContentDocumentLink where LinkedEntityId = \'{!pageB.rn.Id}\'");
                if(record.size > 0){
                    var records = record.getArray("records");
                    var idList = records.map(obj => "'" + obj.ContentDocumentId + "'").join(",");
                    record = sforce.connection.query("select Id from ContentDocument where Id in (" + idList + ") and Title =  \'QRCode-{!pageB.rn.ReceivingNoteNo_New__c}\'");
                }
                // 20210312 you WLIG-BV8CHF end
                // 不存在qr文件时,新生成一个,并连到清单上
                if (record.size == 0) {
                    var atta = new sforce.SObject("Attachment");
                    // 20210312 you WLIG-BV8CHF start
                    atta.Name = "QRCode-{!pageB.rn.ReceivingNoteNo_New__c}";
                    // 20210312 you WLIG-BV8CHF end
                    atta.ParentId = "{!pageB.rn.Id}";
                    atta.Body = src;
                    var result = sforce.connection.create([atta]);
                    var version = new sforce.SObject("ContentVersion");
                    version.VersionData = src;
                    version.Title = "QRCode-{!pageB.rn.ReceivingNoteNo_New__c}";
                    version.ContentLocation = 's';
                    version.PathOnClient= "QRCode-{!pageB.rn.ReceivingNoteNo_New__c}.jpg";
                    var versionResult = sforce.connection.create([version]);
                    record = sforce.connection.query("SELECT ContentDocumentId FROM ContentVersion WHERE Id =\'" + versionResult[0].id + "\'");
                    var records = record.getArray("records");
                    var link = new sforce.SObject("ContentDocumentLink");
                    link.ContentDocumentId = records[0].ContentDocumentId;
                    link.LinkedEntityId = "{!pageB.rn.Id}";
                    link.ShareType = 'I';
                    link.Visibility = 'AllUsers';
                    var result = sforce.connection.create([link]);
                    // var atta = new sforce.SObject("Attachment");
                    // // 20210312 you WLIG-BV8CHF start
                    // atta.Name = "QRCode-{!pageB.rn.ReceivingNoteNo_New__c}";
                    // // 20210312 you WLIG-BV8CHF end
                    // atta.ParentId = "{!pageB.rn.Id}";
                    // atta.Body = src;
                    // var result = sforce.connection.create([atta]);
                    var es = new sforce.SObject("ReceivingNote__c");
                    es.Id = "{!pageB.rn.Id}";
                    es.QRId__c = result[0].id;
                    es.QRId__c = versionResult[0].id;
                    result = sforce.connection.update([es]);
                // 存在qr时,绑到清单上
                } else {
                    var records = record.getArray("records");
                    var version = new sforce.SObject("ContentVersion");
                    version = sforce.connection.query("select Id,ContentDocumentId from ContentVersion where ContentDocumentId = \'" + records[0].id + "\'");
                    version = version.getArray("records");
                    var es = new sforce.SObject("ReceivingNote__c");
                    es.Id = "{!pageB.rn.Id}";
                    es.QRId__c = records[0].Id;
                    es.QRId__c = versionResult[0].id;
                    result = sforce.connection.update([es]);
                    // var records = record.getArray("records");
                    // var es = new sforce.SObject("ReceivingNote__c");
                    // es.Id = "{!pageB.rn.Id}";
                    // es.QRId__c = records[0].Id;
                    // result = sforce.connection.update([es]);
                }
            }
@@ -223,7 +283,8 @@
                            </td>
                        </tr>
                    </table>
                    <table class="searchTable">
                    <table class="searchTable" style="margin-bottom:5px;margin-top:5px;">
                        <!-- <tr> -->
                        <tr>
                            <td>
                                收货状态:
@@ -262,75 +323,60 @@
                    <table class="searchTable" style="width:100%">
                        <tr>
                            <td>
                            <td style="padding-top:5px;">
                                <!-- 所在地区(本部) -->
                                {!$ObjectType.ReceivingNoteDetail__c.fields.Salesdepartment__c.label}
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Salesdepartment__c.InlineHelpText}"/>
                                <apex:selectList id="appSalesdepartment" value="{!pageB.assetInput.Salesdepartment__c}" size="1">
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:selectList id="appSalesdepartment" value="{!pageB.assetInput.Salesdepartment__c}" size="1"> -->
                                <apex:selectList style="width:180px;" id="appSalesdepartment" value="{!pageB.assetInput.Salesdepartment__c}" size="1">
                                <!-- lightning改造   zyh   end -->
                                    <apex:selectOptions value="{!SalesdepartmentOps}"/>
                                </apex:selectList>
                            </td>
                                <!-- 所在地区(省) -->
                            <td>
                            <td style="padding-top:5px;">
                                {!$ObjectType.Asset.fields.SalesProvince__c.label}
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.SalesProvince__c.InlineHelpText}"/>
                                <apex:selectList id="appSalesProvince" value="{!pageB.assetInput.SalesProvince__c}" size="1">
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:selectList id="appSalesProvince" value="{!pageB.assetInput.SalesProvince__c}" size="1"> -->
                                <apex:selectList style="width:180px;" id="appSalesProvince" value="{!pageB.assetInput.SalesProvince__c}" size="1">
                                <!-- lightning改造   zyh   end -->
                                    <apex:selectOptions value="{!SalesProvinceOps}"/>
                                </apex:selectList>
                            </td>
                            <td>
                            <td style="padding-top:5px;">
                                <!-- 产品分类(GI/SP) -->
                                {!$ObjectType.Asset.fields.Product_category__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Product_category__c.InlineHelpText}"/>
                                <apex:selectList id="appProduct_category" value="{!pageB.assetInput.Product_category__c}" size="1">
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:selectList id="appProduct_category" value="{!pageB.assetInput.Product_category__c}" size="1"> -->
                                <apex:selectList style="width:180px;" id="appProduct_category" value="{!pageB.assetInput.Product_category__c}" size="1">
                                <!-- lightning改造   zyh   end -->
                                    <apex:selectOptions value="{!ProductCategoryOps}"/>
                                </apex:selectList>
                            </td>
                            <td>
                            <td style="padding-top:5px;">
                                <!-- 备品分类 -->
                                {!$ObjectType.Asset.fields.Equipment_Type__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Equipment_Type__c.InlineHelpText}"/>
                                <apex:selectList id="appEquipment_Type" value="{!pageB.assetInput.Equipment_Type__c}" size="1">
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:selectList id="appEquipment_Type" value="{!pageB.assetInput.Equipment_Type__c}" size="1"> -->
                                <apex:selectList style="width:180px;" id="appEquipment_Type" value="{!pageB.assetInput.Equipment_Type__c}" size="1">
                                <!-- lightning改造   zyh   end -->
                                    <apex:selectOptions value="{!EquipmentTypeOps}"/>
                                </apex:selectList>
                            </td>
                            <td>
                                <!-- 管理种类 -->
                                {!$ObjectType.Asset.fields.Manage_type__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Manage_type__c.InlineHelpText}"/>
                                <apex:selectList id="appManage_type" value="{!pageB.assetInput.Manage_type__c}" size="1">
                                    <apex:selectOptions value="{!ManageTypeOps}"/>
                                </apex:selectList>
                            </td>
                            <td>
                                <!-- 无机身号码设备 -->
                                {!$ObjectType.Asset.fields.unknow_serial_NO_product__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.unknow_serial_NO_product__c.InlineHelpText}"/>
                                <apex:selectList id="appunknow_serial_NO_product" value="{!pageB.assetInput.unknow_serial_NO_product__c}" size="1">
                                    <apex:selectOptions value="{!UnknowSerialNOProductOps}"/>
                                </apex:selectList>
                            </td>
                            <td>
                                <!-- 备品用途附属品 -->
                                {!$ObjectType.Asset.fields.Loaner_accsessary__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Loaner_accsessary__c.InlineHelpText}"/>
                                <apex:selectList id="appLoaner_accsessary" value="{!pageB.assetInput.Loaner_accsessary__c}" size="1">
                                    <apex:selectOptions value="{!LoanerAccsessaryOps}"/>
                                </apex:selectList>
                            </td>
                            <td>
                                <!-- 备品入库产品 -->
                                {!$ObjectType.ReceivingNoteDetail__c.fields.Fixture_Arrival_Product__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Fixture_Arrival_Product__c.InlineHelpText}"/>
                                <apex:inputField id="appLoaner_fixture_arrival_product" value="{!rndInfo[0].Fixture_Arrival_Product__c}"/>
                                <!-- value="{!pageB.assetInput.Fixture_Arrival_Product__c}" -->
                            </td>
                            <td>
                            <td rowspan="2">
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="编辑" onclick="blockme();" action="{!changeFixModel}" reRender="allForm,checEventFrame" oncomplete="unblockUI();windowResize();"/><!-- 20210804 ljh add checEventFrame -->
                                    <apex:commandButton value="编辑" style="margin-top: 10px;" onclick="blockme();" action="{!changeFixModel}" reRender="allForm,checEventFrame" oncomplete="unblockUI();windowResize();"/><!-- 20210804 ljh add checEventFrame -->
                                </span>
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="适用" onclick="applyJs();return false;"/>
                                    <apex:commandButton value="适用" style="margin-top: 10px;" onclick="applyJs();return false;"/>
                                    <script type="text/javascript">
                                    // 适用按钮
                                    function applyJs() {
@@ -559,20 +605,77 @@
                                </script>
                                </span>
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="选择配套" action="{!selectRNS}" rendered="{!showSelectRnsButton}"/>
                                    <apex:commandButton value="保存" style="margin-top: 10px;" onclick="blockme();" action="{!saveRecord}"/>
                                </span>
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="型号提醒邮件" onclick="return setEmailBody();" />
                                    <apex:commandButton value="返回" style="margin-top: 10px;" onclick="window.close();"/>
                                </span>
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- lightning改造   zyh   end -->
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="选择配套" style="margin-top: 10px;" action="{!selectRNS}" rendered="{!showSelectRnsButton}"/>
                                </span>
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="保存" onclick="blockme();" action="{!saveRecord}"/>
                                    <apex:commandButton value="型号提醒邮件" style="margin-top: 10px;" onclick="return setEmailBody();" />
                                </span>
                                <!-- lightning改造   zyh   start -->
                                <!-- <br /> -->
                                <!-- lightning改造   zyh   end -->
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="打印收货清单" onclick="window.open('/apex/ReceivingNotePDF?rnid={!parId}');return false;"/>
                                    <apex:commandButton value="打印收货清单" style="margin-top: 10px;" onclick="window.open('/apex/ReceivingNotePDF?rnid={!parId}');return false;"/>
                                </span>
                                <span style="margin-left: 10px;">
                                    <apex:commandButton value="返回" onclick="window.close();"/>
                                </span>
                            </td>
                        <!-- lightning改造   zyh   start -->
                        </tr>
                        <tr>
                        <!-- lightning改造   zyh   end -->
                            <td style="padding-top:5px;">
                                <!-- 管理种类 -->
                                {!$ObjectType.Asset.fields.Manage_type__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Manage_type__c.InlineHelpText}"/>
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:selectList id="appManage_type" value="{!pageB.assetInput.Manage_type__c}" size="1"> -->
                                <apex:selectList style="width:180px;" id="appManage_type" value="{!pageB.assetInput.Manage_type__c}" size="1">
                                <!-- lightning改造   zyh   end -->
                                    <apex:selectOptions value="{!ManageTypeOps}"/>
                                </apex:selectList>
                            </td>
                            <td style="padding-top:5px;">
                                <!-- 无机身号码设备 -->
                                {!$ObjectType.Asset.fields.unknow_serial_NO_product__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.unknow_serial_NO_product__c.InlineHelpText}"/>
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:selectList id="appunknow_serial_NO_product" value="{!pageB.assetInput.unknow_serial_NO_product__c}" size="1"> -->
                                <apex:selectList style="width:180px;" id="appunknow_serial_NO_product" value="{!pageB.assetInput.unknow_serial_NO_product__c}" size="1">
                                <!-- lightning改造   zyh   end -->
                                    <apex:selectOptions value="{!UnknowSerialNOProductOps}"/>
                                </apex:selectList>
                            </td>
                            <td style="padding-top:5px;">
                                <!-- 备品用途附属品 -->
                                {!$ObjectType.Asset.fields.Loaner_accsessary__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Loaner_accsessary__c.InlineHelpText}"/>
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:selectList id="appLoaner_accsessary" value="{!pageB.assetInput.Loaner_accsessary__c}" size="1"> -->
                                <apex:selectList style="width:180px;" id="appLoaner_accsessary" value="{!pageB.assetInput.Loaner_accsessary__c}" size="1">
                                <!-- lightning改造   zyh   end -->
                                    <apex:selectOptions value="{!LoanerAccsessaryOps}"/>
                                </apex:selectList>
                            </td>
                            <td style="padding-top:5px;">
                                <!-- 备品入库产品 -->
                                {!$ObjectType.ReceivingNoteDetail__c.fields.Fixture_Arrival_Product__c.label}:
                                <img src="/img/s.gif" alt="" class="helpOrb" title="{!$ObjectType.ReceivingNoteDetail__c.fields.Fixture_Arrival_Product__c.InlineHelpText}"/>
                                <!-- lightning改造   zyh   start -->
                                <br />
                                <!-- <apex:inputField id="appLoaner_fixture_arrival_product" value="{!rndInfo[0].Fixture_Arrival_Product__c}"/> -->
                                <apex:inputField style="width:180px;" id="appLoaner_fixture_arrival_product" value="{!rndInfo[0].Fixture_Arrival_Product__c}"/>
                                <!-- lightning改造   zyh   end -->
                                <!-- value="{!pageB.assetInput.Fixture_Arrival_Product__c}" -->
                            </td>
                        </tr>
                    </table>
@@ -676,7 +779,7 @@
                                    </apex:outputPanel>
                                    <!-- <apex:inputField value="{!var.rnd[info.value]}" onchange="setChangeFlg('{!var.lineNo}')" rendered="{!info.value != 'Asset_loaner_category__c' || var.haveAsset }" style="{!IF('Fixture_Arrival_Product__c' == info.value, 'width:70%;', '')}"/> -->
                                    <apex:inputField value="{!var.rnd[info.value]}" onchange="setChangeFlg('{!var.lineNo}')" rendered="{!(info.value != 'Asset_loaner_category__c' || var.haveAsset) && ((var.rnd['Asset_loaner_category_F__c'] =='固定资产' && info.value != 'unknow_serial_NO_product__c' && info.value != 'Manage_type__c') || var.rnd['Asset_loaner_category_F__c'] !='固定资产')}" style="{!IF('Fixture_Arrival_Product__c' == info.value, 'width:70%;', '')}"/>
                                    <apex:inputField value="{!var.rnd[info.value]}" onchange="setChangeFlg('{!var.lineNo}')" rendered="{!(info.value != 'Asset_loaner_category__c' || var.haveAsset) && ((var.rnd['Asset_loaner_category_F__c'] =='固定资产' && info.value != 'unknow_serial_NO_product__c' && info.value != 'Manage_type__c') || var.rnd['Asset_loaner_category_F__c'] !='固定资产')}" style="{!IF('Fixture_Arrival_Product__c' == info.value || 'EquipmentSet_Managment_Code__c' == info.value, 'width:90%;', '')}"/>
                                    <!-- 20210804 ljh add id -->
                                <!-- update by rentx 20210727 end 新品收货_集中备品_建立数据逻辑限制  -->
                                </apex:outputPanel>