From 0a3f9325599467015aecc4af7543dd10fe70ec56 Mon Sep 17 00:00:00 2001
From: yumenghui <953181891@qq.com>
Date: 星期五, 04 八月 2023 14:14:28 +0800
Subject: [PATCH] 附件修改

---
 force-app/main/default/pages/ReceivingNoteWaitingReceipt.page |  227 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 165 insertions(+), 62 deletions(-)

diff --git a/force-app/main/default/pages/ReceivingNoteWaitingReceipt.page b/force-app/main/default/pages/ReceivingNoteWaitingReceipt.page
index e869658..1ad77b2 100644
--- a/force-app/main/default/pages/ReceivingNoteWaitingReceipt.page
+++ b/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
                 // 涓嶅瓨鍦╭r鏂囦欢鏃讹紝鏂扮敓鎴愪竴涓紝骞惰繛鍒版竻鍗曚笂
                 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>

--
Gitblit v1.9.1