From 2dbf5142ba9397235a43f518f60449560922aa98 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期五, 01 十一月 2024 13:24:45 +0800
Subject: [PATCH] 条码生成:子表物料根据输入值弹出弹窗进行数据选择

---
 WebTM/Properties/PublishProfiles/JFTM.pubxml.user |   14 ++--
 WebTM/views/仓存管理/条码生成/Gy_BarCodeBill.html         |  123 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 130 insertions(+), 7 deletions(-)

diff --git a/WebTM/Properties/PublishProfiles/JFTM.pubxml.user b/WebTM/Properties/PublishProfiles/JFTM.pubxml.user
index af0d1c7..80df25c 100644
--- a/WebTM/Properties/PublishProfiles/JFTM.pubxml.user
+++ b/WebTM/Properties/PublishProfiles/JFTM.pubxml.user
@@ -2308,7 +2308,7 @@
       <publishTime>09/11/2024 21:05:00</publishTime>
     </File>
     <File Include="views/浠撳瓨绠$悊/鏉$爜鐢熸垚/Gy_BarCodeBill.html">
-      <publishTime>10/25/2024 09:52:46</publishTime>
+      <publishTime>11/01/2024 13:22:50</publishTime>
     </File>
     <File Include="views/浠撳瓨绠$悊/鐢熶骇鍏ュ簱鍗�/Kf_ProductInBillList.html">
       <publishTime>09/13/2024 15:42:13</publishTime>
@@ -6694,7 +6694,7 @@
       <publishTime>07/31/2024 13:38:19</publishTime>
     </File>
     <File Include="views/閲囪喘绠$悊/鏀舵枡閫氱煡鍗�/Add_Edit_Cg_POInStockBillList.html">
-      <publishTime>10/29/2024 16:15:10</publishTime>
+      <publishTime>11/01/2024 11:31:23</publishTime>
     </File>
     <File Include="views/閲囪喘绠$悊/鏀舵枡閫氱煡鍗�/Cg_POInStockBillList.html">
       <publishTime>10/25/2024 09:52:46</publishTime>
@@ -6751,7 +6751,7 @@
       <publishTime>08/15/2024 14:53:23</publishTime>
     </File>
     <File Include="views/閲囪喘绠$悊/閲囪喘璁㈠崟/Cg_POOrderBillEdit.html">
-      <publishTime>10/29/2024 16:01:30</publishTime>
+      <publishTime>11/01/2024 11:30:09</publishTime>
     </File>
     <File Include="views/閲囪喘绠$悊/閲囪喘璁㈠崟/Cg_POOrderBillList.html">
       <publishTime>10/29/2024 09:40:44</publishTime>
@@ -6805,7 +6805,7 @@
       <publishTime>10/18/2024 10:11:58</publishTime>
     </File>
     <File Include="views/閿�鍞鐞�/鍙戣揣閫氱煡鍗�/Add_Edit_Xs_SeOutStockBillList.html">
-      <publishTime>11/01/2024 11:00:06</publishTime>
+      <publishTime>11/01/2024 13:06:25</publishTime>
     </File>
     <File Include="views/閿�鍞鐞�/鍙戣揣閫氱煡鍗�/Xs_SeOutStockBillList.html">
       <publishTime>10/11/2024 11:33:30</publishTime>
@@ -7219,10 +7219,10 @@
       <publishTime>04/11/2023 16:34:43</publishTime>
     </File>
     <File Include="views/棰嗘枡鍙戣揣/閿�鍞嚭搴�/Kf_SellOutBill.html">
-      <publishTime>11/01/2024 11:09:54</publishTime>
+      <publishTime>11/01/2024 13:07:15</publishTime>
     </File>
     <File Include="views/棰嗘枡鍙戣揣/閿�鍞嚭搴�/Kf_SellOutBill.html">
-      <publishTime>11/01/2024 11:09:54</publishTime>
+      <publishTime>11/01/2024 13:07:15</publishTime>
     </File>
     <File Include="views/棰嗘枡鍙戣揣/閿�鍞嚭搴�/Kf_SellOutBillList.html">
       <publishTime>10/16/2024 14:22:54</publishTime>
@@ -7363,7 +7363,7 @@
       <publishTime>03/07/2024 09:59:11</publishTime>
     </File>
     <File Include="views/楠屾敹鍏ュ簱/澶栬喘鍏ュ簱/Add_Edit_Kf_POStockInBillList.html">
-      <publishTime>10/29/2024 16:28:09</publishTime>
+      <publishTime>11/01/2024 13:04:13</publishTime>
     </File>
     <File Include="views/楠屾敹鍏ュ簱/澶栬喘鍏ュ簱/Kf_POStockInBackBill.html">
       <publishTime>11/03/2023 21:45:51</publishTime>
diff --git "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html" "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html"
index 8a98c2b..29b6bef 100644
--- "a/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html"
+++ "b/WebTM/views/\344\273\223\345\255\230\347\256\241\347\220\206/\346\235\241\347\240\201\347\224\237\346\210\220/Gy_BarCodeBill.html"
@@ -179,6 +179,12 @@
         <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">鍒犻櫎</a>
     </script>
     <script>
+        //#region 鏂囨湰妗嗚緭鍏ユ悳绱㈢浉鍏虫暟鎹�-鍙橀噺
+        var childPage = null;                       //鑾峰彇瀛愮獥鍙e璞★紝鐢ㄤ簬鎿嶄綔瀛愮獥鍙g殑鍙橀噺鍜屾柟娉�
+        var currRowIndex = 0;                       //鐢ㄤ簬瀹氫綅瀛愮獥鍙e綋鍓嶉�変腑鐨勮
+        var childData = null;                       //鐢ㄤ簬鑾峰彇瀛愮獥鍙h繑鍥炵殑鏁版嵁
+        //#endregion
+
         //鑾峰彇鍙傛暟
         var params = get_UrlVars();
         if (typeof (params[params[0]]) == "undefined") {
@@ -1425,6 +1431,123 @@
             //琛ㄦ牸琛屽唴浜嬩欢蹇嵎閿瓫閫�
             function set_GridCellCheck(obj) {
                 $(document).off('keydown', ".layui-table-edit").on('keydown', '.layui-table-edit', function (e) {
+                    //#region 瀛愯〃鏂囨湰妗嗚緭鍏ュ悗妫�绱㈡暟鎹�
+                    if (event.key != "F7") {
+                        var errKeys = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Enter"];
+                        if (obj.event == "HMaterNumber") {                           //瀹氫綅褰撳墠姝e湪杈撳叆鐨勬枃鏈鐨勫垪鍚�
+                            if ($.inArray(event.key, errKeys) == -1) {              //濡傛灉鎸変笅鐨勯敭浣嶄笉鏄� 鏂瑰悜閿紝鍒欏埛鏂板脊绐椾腑鐨勬暟鎹�
+                                if (childPage == null) {                            //鍒ゆ柇褰撳墠瀛愮獥鍙f槸鍚﹀凡缁忔墦寮�锛岃嫢鏈墦鍗★紝鍒欐墦寮�椤甸潰锛屽苟鑾峰彇瀛愮獥鍙g殑瀵硅薄
+                                    var offset = $(this).offset();                  //鑾峰彇瑙﹀彂浜嬩欢鐨勫厓绱犵殑浣嶇疆锛岀敤浜庡畾浣嶅瓙绐楀彛鎵撳紑鐨勪綅缃�
+                                    var innerHeight = window.innerHeight;
+                                    var top = offset.top + 0.05 * innerHeight;
+                                    var left = offset.left;
+                                    if (top + 0.05 * innerHeight + 0.3 * innerHeight > innerHeight) {
+                                        top = top - 0.3 * innerHeight - 0.05 * innerHeight;
+                                    }
+                                    layer.open({
+                                        type: 2                                                                                     //寮圭獥绫诲瀷
+                                        , skin: 'layui-layer-rim'                                                                   //鍔犱笂杈规
+                                        , area: ['25%', '30%']                                                                      //澶у皬
+                                        , shadeClose: true                                                                          //鐐瑰嚮閬僵鏃跺叧闂脊绐�
+                                        , offset: [top, left]
+                                        , title: false                                                                              //涓嶆樉绀烘爣棰樻爮
+                                        //, title: '椤圭洰璐圭敤鍒楄〃'                                                                     //鏍囬
+                                        , shift: 2                                                                                  //寮瑰嚭鍔ㄧ敾
+                                        , closeBtn: 0                                                                               //绂佺敤鍏抽棴鎸夐挳
+                                        , content: ["../../鍩虹璧勬枡/閫氱敤鍩虹璧勬枡/Gy_CommonBaseData.html?OperationType=2", "yes"]
+                                        , success: function (layero, index) {
+                                            setTimeout(function () {
+                                                var value = $(e.currentTarget).val().replace("'", "");                                  //鑾峰彇鏂囨湰妗嗘渶鏂板��
+                                                currRowIndex = 0;
+                                                var tableView = "h_v_Gy_MaterialList";
+                                                var childSWhere = "select top(10) HItemID,鐗╂枡浠g爜,鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅鍚嶇О from " + tableView + " where 1=1 and 缁勭粐鍚嶇О = '" + sessionStorage["Organization"] + "' and (鐗╂枡浠g爜 like '%" + value + "%' or 鐗╂枡鍚嶇О like '%" + value + "%') order by 鐗╂枡浠g爜 desc";
+                                                childPage.getData(childSWhere, tableView);
+                                            }, 200);
+                                        }
+                                        , end: function () {
+                                            obj.event = "";
+                                            childPage = null;
+                                            currRowIndex = 0;
+                                            if (childData != null) {
+                                                obj.update({
+                                                    "HMaterID": childData.HItemID,
+                                                    "HMaterNumber": childData.鐗╂枡浠g爜,
+                                                    "HMaterName": childData.鐗╂枡鍚嶇О,
+                                                    "HMaterModel": childData.瑙勬牸鍨嬪彿,
+                                                    "HUnitID": childData.HUnitID,
+                                                    "HUnitNumber": childData.璁¢噺鍗曚綅浠g爜,
+                                                    "HUnitName": childData.璁¢噺鍗曚綅鍚嶇О
+                                                });
+
+                                                if ($("#HBarCodeType").find("option:selected").html() == '鎵樼洏鏉$爜') {
+                                                    obj.update({
+                                                        HQty: 1,    //鏁伴噺
+                                                        HMinQty: 1, //鏈�灏忓寘瑁呮暟閲�
+                                                        HBQty: 1    //绠辨暟
+                                                    });
+                                                }
+
+                                                childData = null;
+                                            }
+                                        }
+                                    });
+                                } else {
+                                    setTimeout(function () {
+                                        var value = $(e.currentTarget).val().replace("'", "");                                  //鑾峰彇鏂囨湰妗嗘渶鏂板��
+                                        currRowIndex = 0;
+                                        var tableView = "h_v_Gy_MaterialList";
+                                        var childSWhere = "select top(10) HItemID,鐗╂枡浠g爜,鐗╂枡鍚嶇О,瑙勬牸鍨嬪彿,HUnitID,璁¢噺鍗曚綅浠g爜,璁¢噺鍗曚綅鍚嶇О from " + tableView + " where 1=1 and 缁勭粐鍚嶇О = '" + sessionStorage["Organization"] + "' and (鐗╂枡浠g爜 like '%" + value + "%' or 鐗╂枡鍚嶇О like '%" + value + "%')  order by 鐗╂枡浠g爜 desc";
+                                        childPage.getData(childSWhere, tableView);
+                                    }, 200);
+                                }
+                            } else {                                                    //濡傛灉鎸変笅鐨勯敭浣嶆槸 鏂瑰悜閿紝鍒欒皟鏁寸獥鍙d腑 閫変腑琛� 鐨勪綅缃�
+                                if (event.key == "ArrowUp") {
+                                    currRowIndex--;
+                                    childPage.setSelectedRow(currRowIndex);
+                                } else if (event.key == "ArrowDown") {
+                                    currRowIndex++;
+                                    childPage.setSelectedRow(currRowIndex);
+                                } else if (event.key == "Enter") {
+                                    //鎵嬪姩澶辩劍
+                                    var element = document.getElementById("HSourceBillNo");
+                                    element.focus();
+
+                                    childPage.getSelectedData(currRowIndex);
+
+                                    if (childData != null) {
+                                        obj.update({
+                                            "HMaterID": childData.HItemID,
+                                            "HMaterNumber": childData.鐗╂枡浠g爜,
+                                            "HMaterName": childData.鐗╂枡鍚嶇О,
+                                            "HMaterModel": childData.瑙勬牸鍨嬪彿,
+                                            "HUnitID": childData.HUnitID,
+                                            "HUnitNumber": childData.璁¢噺鍗曚綅浠g爜,
+                                            "HUnitName": childData.璁¢噺鍗曚綅鍚嶇О
+                                        });
+
+                                        if ($("#HBarCodeType").find("option:selected").html() == '鎵樼洏鏉$爜') {
+                                            obj.update({
+                                                HQty: 1,    //鏁伴噺
+                                                HMinQty: 1, //鏈�灏忓寘瑁呮暟閲�
+                                                HBQty: 1    //绠辨暟
+                                            });
+                                        }
+
+                                        childData = null;
+                                    }
+                                    
+
+                                    childPage = null;
+                                    currRowIndex = 0;
+                                    childData = null;
+                                    obj.event = "";
+                                }
+                            }
+                        }
+
+                    }
+                    //#endregion
+
                     if (event.key == "F7") {
                         //鐗╂枡淇℃伅  濡傛灉鍦ㄧ墿鏂欎唬鐮佸垪 鎸塅7
                         if (obj.event === 'HMaterNumber')  //鐗╂枡淇℃伅  濡傛灉鍦ㄦā鍏蜂唬鐮佸垪 鎸塅7

--
Gitblit v1.9.1