From 44b01cb2dc2bd64771b7533f650403da1433fb7a Mon Sep 17 00:00:00 2001
From: jhz <jinghz@oceic.com>
Date: 星期四, 04 五月 2023 08:20:50 +0800
Subject: [PATCH] 采购入库扫源单带仓库

---
 WebTM/views/验收入库/外购入库/Kf_POStockInBill_Fast.html |  615 ++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 384 insertions(+), 231 deletions(-)

diff --git "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBill_Fast.html" "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBill_Fast.html"
index 0a35707..3c8780c 100644
--- "a/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBill_Fast.html"
+++ "b/WebTM/views/\351\252\214\346\224\266\345\205\245\345\272\223/\345\244\226\350\264\255\345\205\245\345\272\223/Kf_POStockInBill_Fast.html"
@@ -13,12 +13,15 @@
             height: auto;
             white-space: normal;
         }
+        .layui-col-xs8 {
+            width: 55.666667%;
+        }
     </style>
 </head>
 <body>
     <div class="layui-fluid" style="padding:0">
         <div class="layui-card" style="padding: 1px">
-            <div class="layui-card-body" style="padding: 5px; height:800px;">
+            <div class="layui-card-body" style="padding: 0px; height:800px;">
                 <form class="layui-form" action="" lay-filter="component-form-group">
                     <div style="background-color:#0085E8;">
                         <span style="color: white;"><i class="layui-icon layui-icon-form"></i>澶栬喘鍏ュ簱鍗�</span>
@@ -41,19 +44,30 @@
                             <div class="layui-col-xs8">
                                 <input type="text" name="HBarCode" id="HBarCode" lay-verify="HBarCode" autocomplete="off" class="layui-input">
                             </div>
+                            <div class="layui-col-xs2">
+                                <button type="button" lay-submit="" class="layui-btn" lay-filter="QueDin">纭畾</button>
+                            </div>
+                        </div>                       
+                        <div class="layui-row">
+                            <div class="layui-col-xs3">
+                                <label class="layui-form-label" style="width:40px;padding-left:0px;">鏁伴噺</label>
+                            </div>
+                            <div class="layui-col-xs8">
+                                <input type="text" name="HQty" id="HQty" lay-verify="HQty" autocomplete="off" class="layui-input">
+                            </div>
                         </div>
                     </div>
                     <div class="layui-tab layui-col-xs12" lay-filter="tab-POStockInBill">
                         <ul class="layui-tab-title" lay-filter="tab-all">
-                            <li lay-id="1" style="padding:1px;" class="layui-this">婧愬崟淇℃伅</li>
-                            <li lay-id="2" style="padding:1px;">鍗曟嵁淇℃伅</li>
+                            <li lay-id="1" style="padding:1px;">婧愬崟淇℃伅</li>
+                            <li lay-id="2" style="padding:1px;"  class="layui-this">鍗曟嵁淇℃伅</li>
                             <li lay-id="3" style="padding:1px;">鐗╂枡娓呭崟</li>
                             <li lay-id="4" style="padding:1px;">鏄庣粏娓呭崟</li>
                             <li lay-id="5" style="padding:1px;">鍚堣淇℃伅</li>
                         </ul>
                         <div class="layui-tab-content">
                             <!--婧愬崟淇℃伅-->
-                            <div class="layui-tab-item layui-show">
+                            <div class="layui-tab-item">
                                 <div class="layui-form-item">
                                     <div class="layui-row">
                                         <div class="layui-col-xs3">
@@ -73,11 +87,14 @@
                                         <div class="layui-col-xs8">
                                             <input type="text" name="HSourceBillNo" id="HSourceBillNo" lay-verify="HSourceBillNo" autocomplete="off" class="layui-input">
                                         </div>
+                                        <div class="layui-col-xs2">
+                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="QueDin2">纭畾</button>
+                                        </div>
                                     </div>
                                 </div>
                             </div>
                             <!--鍗曟嵁淇℃伅-->
-                            <div class="layui-tab-item">
+                            <div class="layui-tab-item" layui-show>
                                 <div class="layui-form-item" style="padding:0px;margin:0px">
                                     <div class="layui-row">
                                         <div class="layui-col-xs3">
@@ -102,7 +119,7 @@
                                             <input type="hidden" name="HStockPlaceID" id="HStockPlaceID" lay-verify="HStockPlaceID" value="0" autocomplete="off" class="layui-input">
                                         </div>
                                         <div class="layui-col-xs3">
-                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" style="display:none">...</button>
+                                            <button type="button" lay-submit="" class="layui-btn" lay-filter="HSpID-BT" >...</button>
                                         </div>
                                     </div>
                                 </div>
@@ -157,6 +174,7 @@
                                             <input type="text" name="HBillerID" id="HBillerID" lay-verify="HBillerID" autocomplete="off" class="layui-input">
                                             <input type="text" name="HMaker" id="HMaker" lay-verify="HMaker" autocomplete="off" class="layui-input">
                                             <input type="hidden" name="HMakerID" id="HMakerID" lay-verify="HMakerID" value="0" autocomplete="off" class="layui-input" style="display : none">
+                                            <input type="hidden" name="HSTOCKORGID" id="HSTOCKORGID" lay-verify="HSTOCKORGID" value="0" autocomplete="off" class="layui-input" style="display : none">
                                         </div>
                                     </div>
                                 </div>
@@ -193,14 +211,14 @@
                                 <div class="layui-row">
                                     <div class="layui-col-xs12">
                                         <div class="layui-form-item" style="padding:0px;margin:0px">
-                                            <div class="layui-row">
+                                            <!--<div class="layui-row">
                                                 <div class="layui-col-xs3">
                                                     <label class="layui-form-label" style="width:40px;padding-left:0px;">鏁伴噺</label>
                                                 </div>
                                                 <div class="layui-col-xs8">
                                                     <input type="text" name="HQty" id="HQty" lay-verify="HQty" autocomplete="off" class="layui-input">
                                                 </div>
-                                            </div>
+                                            </div>-->
                                         </div>
                                         <table class="layui-hide" id="wl-table" lay-filter="wl-table"></table>
                                     </div>
@@ -216,6 +234,14 @@
                                         </div>
                                         <div class="layui-col-xs8">
                                             <input type="text" name="HBarCode_B" id="HBarCode_B" lay-verify="HBarCode_B" autocomplete="off" class="layui-input">
+                                        </div>
+                                    </div>
+                                    <div class="layui-row">
+                                        <div class="layui-col-xs3">
+                                            <label class="layui-form-label" style="width:40px;padding-left:0px;">鏁伴噺</label>
+                                        </div>
+                                        <div class="layui-col-xs8">
+                                            <input type="text" name="HQty" id="HQty" lay-verify="HQty" autocomplete="off" class="layui-input">
                                         </div>
                                     </div>
                                 </div>
@@ -307,7 +333,7 @@
                                         <label class="layui-form-label" style="width:60px;padding-left:0px;">鏉$爜鏁伴噺</label>
                                     </div>
                                     <div class="layui-col-xs8 layui-input-inline mobile">
-                                        <input type="text" name="HBarcodeQtys" id="HBarcodeQtys" lay-verify="HBarcodeQtys" value="0" autocomplete="off" class="layui-input">
+                                        <input type="text" name="HBarcodeQtys" id="HBarcodeQtys" lay-verify="HBarcodeQtys" autocomplete="off" class="layui-input">
                                     </div>
                                 </div>
                                 <div class="layui-row">
@@ -387,6 +413,9 @@
             $("#HMakerID").hide();
             $("#HBillerID").val(sessionStorage["HBillerID"]);
             $("#HBillerID").hide();
+            $("#HSTOCKORGID").val(sessionStorage["OrganizationID"]);
+            $("#HSTOCKORGID").hide();
+            var HSourceFlag = sessionStorage["SourceFlag"];
             //榛樿甯﹀叆鐨勪粨搴擄紝濡傛灉鍚敤浠撲綅鍒欎粨浣嶆湁鏁堬紝濡傛灉娌℃湁鍚敤鍒欎粨浣嶇伆搴� new
 
 
@@ -467,6 +496,8 @@
             function RoadBillSub(linterid) {
                 table.render({
                     elem: '#wl-table'
+                    , page: true
+                    , limit: 100
                     , url: GetWEBURL() + '/POStockInBill/DisBillEntryList_Webs_Json'
                     , where: { HBillID: linterid, HBillType: '1201', sWhere: '' }
                     , cols: [[
@@ -496,7 +527,7 @@
                 $("#HInterID").val("");
                 $("#HBillNo").val("");
                 $.ajax({
-                    url: GetWEBURL() + "/Web/GetMAXNum",
+                    url: GetWEBURL() + "/Web/GetMAXNumPDA",
                     //url: GetWEBURL() + "/Web/UpdatePOInStockBillPrintQty", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
                     type: "GET",
                     data: { "HBillType": '1201' },
@@ -525,8 +556,10 @@
                 pFocus.select();
             }
             else {
-                element.tabChange('tab-POStockInBill', '1');
-                var pFocus = $("#HSourceBillNo");
+                //榛樿杩涘叆鍗曟嵁淇℃伅椤电
+                element.tabChange('tab-POStockInBill', '2');
+                //榛樿鍏夋爣鏄剧ず鍦ㄤ粨搴撻噷闈�
+                var pFocus = $("#HWHNAME");
                 pFocus.focus();
                 pFocus.select();
             }
@@ -556,13 +589,19 @@
                     , shade: 0.6 //閬僵閫忔槑搴�
                     , maxmin: true //鍏佽鍏ㄥ睆鏈�灏忓寲
                     , anim: 0 //0-6鐨勫姩鐢诲舰寮忥紝-1涓嶅紑鍚�
-                    , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceList.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID', 'yes']
+                    , content: ['../../../views/Baseset/鍩虹璧勬枡/Gy_StockPlaceListNew.html?HWhID=' + sessionStorage["HWHID"] + '&Type=HSpID', 'yes']
                     , resize: false
                     , cancel: function () {
                         //$(".layui-btn").removeClass("layui-btn-disabled");
                     }
                 })
             });
+
+
+         
+
+
+
             //閫夋嫨渚涘簲鍟�
             form.on('submit(HSupID-BT)', function () {
                 layer.open({
@@ -644,9 +683,12 @@
 
             //閫�鍑�
             form.on('submit(Cancel)', function () {
-                sessionStorage["SourceFlag"] = false;
-                parent.location.href = "../../../views/index.html"
-                //window.close();//鍏抽棴褰撳墠椤�
+
+
+
+                layer.confirm('鎮ㄧ‘瀹氳閫�鍑哄悧锛�', { icon: 3, title: '鎻愮ず' }, function (index) {
+                    parent.location.href = "../../../views/index_Mobile.html";
+                });
             })
             //缂栬緫
             form.on('submit(cmdModify)', function () {
@@ -680,41 +722,42 @@
                 var sMTONo = ''
                 var sSourceInterID = data[0].HSourceInterID
                 var sSourceEntryID = data[0].HSourceEntryID
+                var sMouldManagerCtl = 'N'
+                var sFIFOCtl = 'N'
                 $.ajax(
                     {
                         type: "Get",
-                        //url: "http://61.130.49.162:9090/WMSAPI///POStockInBill/Delete_Json", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
-                        url: GetWEBURL() + "/POStockInBill/Delete_Json",
+                        //url: "http://61.130.49.162:9090/WMSAPI///ProductIn/Delete_Json", //鏂规硶鎵�鍦ㄩ〉闈㈠拰鏂规硶鍚�
+                        url: GetWEBURL() + "/ProductIn/Delete_Json_AN",
                         async: true,
-                        data: { "HInterID": sInterID, "HMaterID": sMaterID, "HAuxPropID": sAuxPropID, "HMTONo": sMTONo, "HSourceInterID": sSourceInterID, "HSourceEntryID": sSourceEntryID, "sHBillType": '1103', },
+                        data: { "HInterID": sInterID, "HMaterID": sMaterID, "HAuxPropID": sAuxPropID, "HMTONo": sMTONo, "HSourceInterID": sSourceInterID, "HSourceEntryID": sSourceEntryID, "sHBillType": sBillType, },
                         dataType: "json",
                         success: function (data) {
-                            if (data.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                //layer.msg(data.Message, { icon: 1 });
-                                table.render({
-                                    elem: '#wl-table'
-                                    //, url: 'http://61.130.49.162:9090/WMSAPI///POStockInBill/DisBillEntryList_Mate_Webs_Json'
-                                    //, url: GetWEBURL() + '/POStockInBill/DisBillEntryList_Mate_Webs_Json'
-                                    , url: GetWEBURL() + '/POStockInBill/DisBillEntryList_Webs_Json'
-                                    , cellMinWidth: 80
-                                    , toolbar: '#toolbarDemo'
-                                    , where: { HBillID: sInterID, HBillType: '1201', sWhere: '' }
-                                    , cols: [[
-                                        { type: 'radio' }
-                                        , { field: 'HQty', title: '鏁伴噺', width: 100 }
-                                        , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', width: 100 }
-                                        , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 200 }
-                                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 200 }
-                                        , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 200 }
-                                        , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 200 }
-                                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 200 }
-                                        , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 200 }
-                                        , { field: 'HBatchNo', title: '鎵规', width: 200 }
-                                        , { field: 'HAuxPropID', title: '杈呭姪灞炴��', width: 200 }
-                                        , { field: 'HMTONo', title: '璁″垝璺熻釜鍙�', width: 200 }
-                                    ]]
-                                    , height: 500
-                                })
+                            if (data.count == 1) {
+                                $.ajax({
+                                    url: GetWEBURL() + '/ProductIn/DisBillEntryList_Webs_New_Json1',
+                                    type: "GET",
+                                    data: { HBillID: sInterID, HBillNo: sBillNo, HBillType: '1201', sMouldManagerCtl: sMouldManagerCtl, sFIFOCtl: sFIFOCtl },
+                                    success: function (result) {
+                                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                            listOption.data = result.data.list;
+                                            table.render(listOption);
+                                            var count = 0;
+                                            var count1 = 0;
+                                            for (var i = 0; i < result.data.list.length; i++) {
+                                                count += result.data.list[i].HQty;
+                                                count1 += result.data.list[i].HPieceQty;
+                                            }
+                                            $("#HSumQtys").val(count);
+                                            $("#HBarCodeQtys").val(count1);
+                                            //return;
+                                        }
+                                        else {
+                                            layer.msg(result.Message);
+                                        }
+                                        layer.closeAll("loading");
+                                    }
+                                });
                             }
                             else {
                                 layer.msg(data.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
@@ -794,8 +837,157 @@
                 }
             });
 
+            
+            //鏉″舰鐮佸洖杞︽柟娉�
+            $('#HBarCode').on('keydown', function (event) {
+                var sQty = $("#HQty").val();
+                if (sQty == "") {
+                    sQty = 0;
+                }
+                if (event.keyCode == 13) {
+                    GetMeesageByBarCode();
+                }
+            });
+            //纭畾
+            form.on('submit(QueDin)', function (data) {
+                GetMeesageByBarCode();
+            });
+
+
+            //鎵簮鍗�
+            $('#HSourceBillNo').on('keydown', function (event) {      
+                if (event.keyCode == 13) {
+                    GetMeesageBySourceBillNo();
+                }
+            });
+            //纭畾
+            form.on('submit(QueDin2)', function (data) {
+                GetMeesageBySourceBillNo();
+            });
+
+
+
+            //鎵粨浣�
+            $('#HStockPlaceName').on('keydown', function (event) {
+                var HBarCode = $('#HStockPlaceName').val()
+                if (event.keyCode == 13) {
+                    //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
+                    $.ajax({
+                        url: GetWEBURL() + "/LookingFor/getSpName_Json",
+                        type: "GET",
+                        data: { "HBarCode": HBarCode },
+                        success: function (result) {
+                            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                $("#HStockPlaceName").val(result.data[0].HName);
+                                $("#HStockPlaceID").val(result.data[0].HItemID);
+                                $("#HWHID").val(result.data[0].HWHID);
+                                $("#HWHNAME").val(result.data[0].HWhName);
+                                element.tabChange('tab-POStockInBill', '2');
+                            }
+                            else {
+                                // $("#verifycode").click();
+                                //layer.msg(result.Message, { icon: 5 });
+                                layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                            }
+                            layer.closeAll("loading");
+                        }
+                    });
+                    // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
+                }
+            });
+
+            //鎵粨搴�
+            $('#HWHNAME').on('keydown', function (event) {
+                var HBarCode = $('#HWHNAME').val()
+                if (event.keyCode == 13) {
+                    if (!HBarCode) {
+                        layer.msg('鏃犱粨搴撴潯鐮佷俊鎭紒');
+                        return;
+                    }
+                    //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
+                    $.ajax({
+                        url: GetWEBURL() + "/LookingFor/getWHName_Json",
+                        type: "GET",
+                        data: { "HBarCode": HBarCode },
+                        success: function (result) {
+                            if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
+                                //$("#HStockPlaceName").val(result.data[0].HName);
+                                //$("#HStockPlaceID").val(result.data[0].HItemID);
+                                $("#HBarCode").focus();
+                                $("#HWHID").val(result.data[0].HItemID);
+                                $("#HWHNAME").val(result.data[0].HName);
+                                element.tabChange('tab-POStockInBill', '2');
+                            }
+                            else {
+                                // $("#verifycode").click();
+                                //layer.msg(result.Message, { icon: 5 });
+                                layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                            }
+                            layer.closeAll("loading");
+                        }
+                    });
+                    // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
+                }
+            });
+
+            //鍒锋柊鏄庣粏椤电
+            table.render({
+                elem: '#mx-table'
+                // , url: 'http://localhost:8083/POStockInBill/GetHBarCodeShowBillSub'
+                //, toolbar: '#toolbarDemo'
+                // , where: { sMsg: linterid, sMsg2: lentryid }
+                , cols: [[
+                    , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
+                ]]
+                , page: true
+                , limit: 100
+                , height: 500
+                , done: function () {
+                }
+            });
+
+            //鎵玀ES浠撲綅
+            $('#HMESSPName').on('keydown', function (event) {      //鎵粨浣�
+                var HBarCode = $('#HMESSPName').val();
+                if (event.keyCode == 13) {
+                    $.ajax({
+                        url: GetWEBURL() + "/LookingFor/getSpName_Json",
+                        type: "GET",
+                        data: { "HBarCode": HBarCode },
+                        success: function (result) {
+                            if (result.count == 1) {
+                                $("#HMESSPID").val(result.data[0].HWHID);
+                                $("#HMESSPName").val(result.data[0].HWhName + "-" + result.data[0].HName);
+                                $("#HExplanation").val(result.data[0].HName + "-" + result.data[0].HWhName);
+                                $.ajax({
+                                    url: GetWEBURL() + "/LookingFor/GetSpNameMES_Json",
+                                    type: "GET",
+                                    data: { "HERPWHID": result.data[0].HWHID },
+                                    success: function (result) {
+                                        if (result.count == 1) {
+                                            $("#HWHID").val(result.data[0].HMESWHID);
+                                            $("#HWHNAME").val(result.data[0].HMESWHNAME);
+                                            $("#HMESSPName").attr("readonly", "readonly");//MES浠撲綅鍙HExplanation
+                                            $("#HMESSPName").css("background-color", "#efefef4d");
+                                        }
+                                        else {
+                                            layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                                        }
+                                        layer.closeAll("loading");
+                                    }
+                                });
+                            }
+                            else {
+                                layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                            }
+                            layer.closeAll("loading");
+                        }
+                    });
+                }
+            });
+
             //鎵潯鐮�
-            $('#HBarCode').on('keydown', function (event) {  //鎵潯鐮�
+            function GetMeesageByBarCode(obj) {  //杩斿洖宸ヤ綔涓績
                 var sSubStr = table.cache['wl-table'];
                 var sBarCode = $('#HBarCode').val()
                 var sInterID = $("#HInterID").val()
@@ -808,11 +1000,16 @@
                 var sSourceBillNo = $("#HSourceBillNo").val()
                 var sMouldManagerCtl = "N";  //鏄惁鍚敤鍣ㄥ叿绠$悊
                 var sFIFOCtl = "N";          //鏄惁鍚敤鍏堣繘鍏堝嚭绠$悊
-                // var Flag = sessionStorage["SourceFlag"];
-                if (sQty == "") {
-                    sQty = 0;
-                }
-                if (event.keyCode == 13) {
+
+                var HDeleteFlag = sBarCode.substring(0, 1);
+                var sBarCodeNew = sBarCode.slice(1);
+
+               
+
+                    if (sQty == "") {
+                        sQty = 0;
+                    }
+
                     //鍒ゆ柇鏉$爜鏄惁涓虹┖  new
                     if (sBarCode == '') {
                         playSound();
@@ -825,54 +1022,59 @@
                     if (sQty != "") {
                         $('#HQty').val("");
                     }
-                    if (sHWHID == "184154") {
-                        if (sHSPID == "0") {
-                            playSound();
-                            layer.msg("浠撲綅涓虹┖锛岃閫夋嫨浠撲綅锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                            return false;
-                        }
-                    }
+                    //if (sHWHID == "184154") {
+                    //    if (sHSPID == "0") {
+                    //        playSound();
+                    //        layer.msg("浠撲綅涓虹┖锛岃閫夋嫨浠撲綅锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+                    //        return false;
+                    //    }
+                    //}
                     $.ajax({
-                        url: GetWEBURL() + "/POStockInBill/get_CheckTypeByBarCode_Json",
+                        url: GetWEBURL() + "/WEBSController/Get_BarCode_Json",
                         type: "GET",
-                        data: { "sCode": sBarCode, "sInterID": sInterID, "sBillNo": sBillNo, "sBillType": sBillType, "sMaker": sessionStorage["HUserName"], "WhID": sHWHID, "SPID": sHSPID, "sQty": sQty, "sRedBlue": false, "SourceFlag": true, "sSourceBillNo": sSourceBillNo, "sSourceType": '1103', "HOWNERID": sessionStorage["OrganizationID"] },
+                        async: false,
+                        data: { "sBarCode": sBarCode, "HInterID": sInterID, "HBillType": sBillType, "HBillNo": sBillNo, "HMaker": sessionStorage["HUserName"], "HWhID": sHWHID, "HSPID": sHSPID, "HQty": sQty, "HRedBlueFlag": false, "SourceFlag": HSourceFlag, "HSourceBillNo": sSourceBillNo, "HSourceBillType": sHBillType, "HStockOrgID": sessionStorage["OrganizationID"], "HScanStyle": "", "HCustom1": "", "HCustom2": "" },
                         success: function (result) {
                             if (result.count == 1) {
                                 playSound1();
-                                if (result.data.HBarType == '浠撳簱鏉$爜') {
-                                    $("#HWHNAME").val(result.data.HWhName);
-                                    $("#HWHID").val(result.data.HWhID);
+                                if (result.data.hBarTypeField == '浠撳簱鏉$爜') {
+                                    $("#HWHNAME").val(result.data.hWhNameField);
+                                    $("#HWHID").val(result.data.hWhIDField);
                                     $("#HStockPlaceName").val("");
                                     $("#HNote").val(";涓�閿壂鐮佷粨搴撴潯鐮�");
                                     element.tabChange('tab-POStockInBill', '2');  //璺宠浆椤电
+                                    return;//缁撴潫
                                 }
-                                else if (result.data.HBarType == '浠撲綅鏉$爜') {
-                                    $("#HStockPlaceName").val(result.data.HSPName);
-                                    $("#HStockPlaceID").val(result.data.HSPID);
-                                    $("#HWHNAME").val(result.data.HWhName);
-                                    $("#HWHID").val(result.data.HWhID);
+                                else if (result.data.hBarTypeField == '浠撲綅鏉$爜') {
+                                    $("#HStockPlaceName").val(result.data.hSPNameField);
+                                    $("#HStockPlaceID").val(result.data.hSPIDField);
+                                    $("#HWHNAME").val(result.data.hWhNameField);
+                                    $("#HWHID").val(result.data.hWhIDField);
                                     $("#HNote").val(";涓�閿壂鐮佷粨浣嶆潯鐮�");
                                     element.tabChange('tab-POStockInBill', '2');//璺宠浆椤电
+                                    return;//缁撴潫
                                 }
-                                else if (result.data.HBarType == '閮ㄩ棬鏉$爜') {
-                                    $("#HDeptName").val(result.data.HDeptName);
-                                    $("#HDeptID").val(result.data.HDeptID);
+                                else if (result.data.hBarTypeField == '閮ㄩ棬鏉$爜') {
+                                    $("#HDeptName").val(result.data.hDeptNameField);
+                                    $("#HDeptID").val(result.data.hDeptIDField);
                                     $("#HNote").val(";涓�閿壂鐮侀儴闂ㄦ潯鐮�");
                                     element.tabChange('tab-POStockInBill', '2');//璺宠浆椤电
+                                    return;//缁撴潫
                                 }
-                                else if (result.data.HBarType == '婧愬崟鏉$爜') {
-                                    $("#HSupName").val(result.data.HSupName);
-                                    $("#HSupID").val(result.data.HSupID);
-                                    $("#HDeptName").val(result.data.HDeptName);
-                                    $("#HDeptID").val(result.data.HDeptID);
-                                    $("#HSourceBillNo").val(result.data.HSourceBillNo);
+                                else if (result.data.hBarTypeField == '婧愬崟鏉$爜') {
+                                    $("#HSupName").val(result.data.hSupNameField);
+                                    $("#HSupID").val(result.data.hSupIDField);
+                                    $("#HDeptName").val(result.data.hDeptNameField);
+                                    $("#HDeptID").val(result.data.hDeptIDField);
+                                    $("#HSourceBillNo").val(result.data.hSourceBillNoField);
+                                    $("#HBillType").val(result.data.hSourceBillTypeField)
                                     sessionStorage["SourceFlag"] = true;
                                     //鑾峰彇婧愬崟绫诲瀷銆佹簮鍗曞崟鍙�
-                                    if (result.data.HSourceBillType == "1102") {
+                                    if (result.data.hSourceBillTypeField == "1102") {
                                         $("#HBillType").val("1102");
 
                                     }
-                                    else if (result.data.HSourceBillType == "1103") {
+                                    else if (result.data.hSourceBillTypeField == "1103") {
                                         $("#HBillType").val("1103");
                                     }
                                     else {
@@ -882,7 +1084,7 @@
                                     element.tabChange('tab-POStockInBill', '3');
                                 }
                                 else {
-                                    if (sessionStorage["SourceFlag"] == "true") {
+                                    if (HSourceFlag == true) {
                                         element.tabChange('tab-POStockInBill', '3');
                                     }
                                     else {
@@ -890,65 +1092,64 @@
                                         $("#HSupID").val(result.data.hSupIDField);
                                         //$("#HDeptName").val(result.data.HDept);
                                         //$("#HDeptID").val(result.data.HDeptID);
-                                        $("#HSourceBillNo").val(result.data.hSourceBillNoField);
-                                        sessionStorage["SourceFlag"] = true;
+                                        //$("#HSourceBillNo").val(result.data.hSourceBillNoField);
+                                        //$("#HBillType").val(result.data.hSourceBillTypeField)
+                                        HSourceFlag = true;
                                         //鑾峰彇婧愬崟绫诲瀷銆佹簮鍗曞崟鍙�
                                         if (result.data.hSourceBillTypeField == "1102") {
+                                            $("#HBillType").empty();
                                             $("#HBillType").val("1102");
+                                            var optionHtml = '';
+                                            optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '閲囪喘璁㈠崟' + "</option>";
+                                            $("#HBillType").append(optionHtml);
+                                            layui.form.render('select');
+                                            $("#HBillType").attr("readonly", "readonly");
                                         }
-                                        else if (result.data.hSourceBillTypeField == "1103") {
+                                        if (result.data.hSourceBillTypeField == "1103") {
+                                            $("#HBillType").empty();
                                             $("#HBillType").val("1103");
+                                            var optionHtml = '';
+                                            optionHtml += "<option value = '" + result.data.hSourceBillTypeField + "' >" + '鏀舵枡閫氱煡鍗�' + "</option>";
+                                            $("#HBillType").append(optionHtml);
+                                            layui.form.render('select');
+                                            $("#HBillType").attr("readonly", "readonly");
                                         }
                                         else {
-                                            $("#HBillType").val("鎵嬪伐褰曞叆");
+                                            //$("#HBillType").val("-1");
                                         }
+                                        $("#HSourceBillNo").attr("readonly", "readonly");
                                         $("#HNote").val(";鐗╂枡鏉$爜");
                                         element.tabChange('tab-POStockInBill', '3');
                                     }
                                 }
 
                                 layer.load(3)
-                                table.render({
-                                    elem: '#wl-table'
-                                    , url: GetWEBURL() + '/POStockInBill/DisBillEntryList_Webs_Json'
-                                    , where: { HBillID: sInterID, HBillType: '1201', sWhere: '' }
-                                    , cellMinWidth: 115
-                                    , cols: [[
-                                        { type: 'radio' }
-                                        , { field: 'HQty', title: '鏁伴噺', sort: true, width: 100 }
-                                        , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', sort: true, width: 100 }
-                                        , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', sort: true, width: 200 }
-                                        , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', sort: true, width: 200 }
-                                        , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', sort: true, width: 200 }
-                                        , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', sort: true, width: 200 }
-                                        , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', sort: true, width: 200 }
-                                        , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', sort: true, width: 200 }
-                                        , { field: 'HBatchNo', title: '鎵规', sort: true, width: 200 }
-                                    ]]
-                                    , height: 500
-                                    , done: function () {
-                                        layer.closeAll("loading");
-                                    }
-                                });
-
                                 $.ajax({
                                     url: GetWEBURL() + '/MateOutBill/DisBillEntryList_Webs_New_Json1',
                                     type: "GET",
                                     data: { HBillID: sInterID, HBillNo: sBillNo, HBillType: '1201', sMouldManagerCtl: sMouldManagerCtl, sFIFOCtl: sFIFOCtl },
-                                    //data: { HBillID: sInterID, HBillType: '1201', sWhere: '' },
                                     success: function (result) {
                                         if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                                            //listOption.data = result.data.list;
-                                            table.render(result.data.list);
-                                            $("#HBarCode_B").val(result.data.list2[0].HBarCode);
-                                            $("#HMaterName_B").val(result.data.list2[0].HMaterName);
-                                            $("#HMaterModel_B").val(result.data.list2[0].HMaterModel);
-                                            $("#HBatchNo_B").val(result.data.list2[0].HBatchNo);
-                                            $("#HUnitName_B").val(result.data.list2[0].HUnitName);
-                                            $("#HQty_B").val(result.data.list2[0].HQty);
-                                            $("#HTMQty_B").val(result.data.list2[0].HTMQty);
-                                            $("#HWHName_B").val(result.data.list2[0].HWHName);
-                                            $("#HSPName_B").val(result.data.list2[0].HSPName);
+                                            listOption.data = result.data.list;
+                                            table.render(listOption);
+                                            //$("#HBarCode_B").val(result.data.list2[0].HBarCode);
+                                            //$("#HMaterName_B").val(result.data.list2[0].HMaterName);
+                                            //$("#HMaterModel_B").val(result.data.list2[0].HMaterModel);
+                                            //$("#HBatchNo_B").val(result.data.list2[0].HBatchNo);
+                                            //$("#HUnitName_B").val(result.data.list2[0].HUnitName);
+                                            //$("#HQty_B").val(result.data.list2[0].HQty);
+                                            //$("#HTMQty_B").val(result.data.list2[0].HTMQty);
+                                            //$("#HWHName_B").val(result.data.list2[0].HWHName);
+                                            //$("#HSPName_B").val(result.data.list2[0].HSPName);
+
+                                            var count = 0;
+                                            var count1 = 0;
+                                            for (var i = 0; i < result.data.list.length; i++) {
+                                                count += result.data.list[i].HQty;
+                                                count1 += result.data.list[i].HPieceQty;
+                                            }
+                                            $("#HSumQtys").val(count);
+                                            $("#HBarCodeQtys").val(count1);
                                         }
                                         else {
                                             layer.msg(result.Message);
@@ -956,6 +1157,9 @@
                                         layer.closeAll("loading");
                                     }
                                 });
+
+                                //娓呯┖鏁伴噺
+                                $("#HQty").val("");
                             }
                             else {
                                 playSound();
@@ -964,28 +1168,45 @@
                             layer.closeAll("loading");
                         }
                     });
+            }
+            var listOption = {
+                elem: '#wl-table'
+                //, toolbar: '#toolbarDemo'
+                , totalRow: true
+                , cellMinWidth: 90
+                , cols: [[
+                    { type: 'radio' }
+                    , { field: 'HSNO', title: '搴忓彿', width: 60 }
+                    , { field: 'HQty', title: '鏁伴噺', width: 80, totalRow: true }
+                    , { field: 'HQtyMust', title: '搴斿彂鏁伴噺', width: 80, totalRow: true}
+                    , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', width: 150 }
+                    , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', width: 150 }
+                    , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', width: 150 }
+                    , { field: 'HSourceInterID', title: '婧愬崟涓诲唴鐮�', width: 150 }
+                    , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', width: 150 }
+                    , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', width: 150 }
+                    //, { field: 'HBatchNo', title: '鎵规', width: 150 }
+                    , { field: 'HPieceQty', title: '鏉$爜鏁伴噺', width: 150 }
+                ]]
+                , height: 500
+                , done: function () {
+                    layer.closeAll("loading");
                 }
-            });
-
-        function playSound() {
-            var audio = document.getElementById("cs");
-            audio.play();
-        }
-
-        function playSound1() {
-            var audio = document.getElementById("cs2");
-            audio.play();
-        }
-
-        
-        //鎵簮鍗�
-        $('#HSourceBillNo').on('keydown', function (event) {      //鎵簮鍗�
-            var HSourceBillNo = $('#HSourceBillNo').val()
-            var sInterID = $("#HInterID").val()
-            var sBillNo = $("#HBillNo").val()
-            var HSourceBillType = $("#HBillType").val()
-            if (event.keyCode == 13) {
-                //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
+            }
+            function playSound() {
+                var audio = document.getElementById("cs");
+                audio.play();
+            }
+            function playSound1() {
+                var audio = document.getElementById("cs2");
+                audio.play();
+            }
+            //鎵簮鍗�
+            function GetMeesageBySourceBillNo(obj) {
+                var HSourceBillNo = $('#HSourceBillNo').val()
+                var sInterID = $("#HInterID").val()
+                var sBillNo = $("#HBillNo").val()
+                var HSourceBillType = $("#HBillType").val()
                 if (HSourceBillNo == "" || sInterID <= 0) {
                     layer.msg("婧愬崟鍙蜂负绌猴紝鎴栬�呭唴鐮佷笉瀛樺湪锛�", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
                     return;
@@ -1000,22 +1221,26 @@
                         if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
                             $("#HSupID").val(result.data[0].HSupID);
                             $("#HSupName").val(result.data[0].HSupName);
-                            //$("#HDeptID").val(result.data[0].HDeptID);
-                            //$("#HDeptName").val(result.data[0].HDeptName);
                             sessionStorage["SourceFlag"] = true;
                             layer.load(3);
                             element.tabChange('tab-POStockInBill', '2');
+                            var pFocus = $("#HBarCode");
+                            pFocus.focus();
+
                             table.render({
                                 elem: '#wl-table'
                                 , cellMinWidth: 80
+                                , totalRow: true
+                                , page: true
+                                , limit: 100
                                 //, url: 'http://61.130.49.162:9090/WMSAPI///POStockInBill/DisBillEntryList_Webs_Json'
                                 , url: GetWEBURL() + '/POStockInBill/DisBillEntryList_Webs_Json'
                                 //, toolbar: '#toolbarDemo'
                                 , where: { HBillID: sInterID, HBillType: '1201', sWhere: '' }
                                 , cols: [[
                                     { type: 'radio' }
-                                    , { field: 'HQty', title: '鏁伴噺', sort: true, width: 100 }
-                                    , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', sort: true, width: 100 }
+                                    , { field: 'HQty', title: '鏁伴噺', sort: true, width: 100, totalRow: true}
+                                    , { field: 'HQtyMust', title: '搴旀敹鏁伴噺', sort: true, width: 100, totalRow: true}
                                     , { field: 'HMaterNumber', title: '鐗╂枡浠g爜', sort: true, width: 200 }
                                     , { field: 'HMaterName', title: '鐗╂枡鍚嶇О', sort: true, width: 200 }
                                     , { field: 'HMaterModel', title: '瑙勬牸鍨嬪彿', sort: true, width: 200 }
@@ -1023,9 +1248,9 @@
                                     , { field: 'HSourceEntryID', title: '婧愬崟瀛愬唴鐮�', sort: true, width: 200 }
                                     , { field: 'HSourceBillNo', title: '婧愬崟鍗曞彿', sort: true, width: 200 }
                                     , { field: 'HBatchNo', title: '鎵规' }
+                                    , { field: 'HPieceQty', title:'鏉$爜浠舵暟', width: 100 }
                                 ]]
                                 // , data: [linterid]
-                                // , page: true
                                 , height: 500
                                 , done: function () {
                                     layer.closeAll("loading");
@@ -1040,95 +1265,11 @@
                         layer.closeAll("loading");
                     }
                 });
-                // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
             }
         });
 
-        //鎵粨浣�
-        $('#HStockPlaceName').on('keydown', function (event) {
-            var HBarCode = $('#HStockPlaceName').val()
-            if (event.keyCode == 13) {
-                //鍒ゆ柇鏂囨湰妗嗘槸鍚︽湁鏁版嵁    new
-                $.ajax({
-                    url: GetWEBURL() + "/LookingFor/getSpName_Json",
-                    type: "GET",
-                    data: { "HBarCode": HBarCode },
-                    success: function (result) {
-                        if (result.count == 1) { // 璇存槑楠岃瘉鎴愬姛浜嗭紝
-                            $("#HStockPlaceName").val(result.data[0].HName);
-                            $("#HStockPlaceID").val(result.data[0].HItemID);
-                            $("#HWHID").val(result.data[0].HWHID);
-                            $("#HWHNAME").val(result.data[0].HWhName);
-                            element.tabChange('tab-POStockInBill', '2');
-                        }
-                        else {
-                            // $("#verifycode").click();
-                            //layer.msg(result.Message, { icon: 5 });
-                            layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                        }
-                        layer.closeAll("loading");
-                    }
-                });
-                // layer.msg($('#HSourceBillNo').val(), { icon: 1 });
-            }
-        });
-        //鍒锋柊鏄庣粏椤电
-        table.render({
-            elem: '#mx-table'
-            // , url: 'http://localhost:8083/POStockInBill/GetHBarCodeShowBillSub'
-            //, toolbar: '#toolbarDemo'
-            // , where: { sMsg: linterid, sMsg2: lentryid }
-            , cols: [[
-                , { field: 'HMaterID', title: '鐗╂枡ID', width: 100, hide: true }
-            ]]
-            , page: true
-            , height: 500
-            , done: function () {
-            }
-        });
-
-        //鎵玀ES浠撲綅
-        $('#HMESSPName').on('keydown', function (event) {      //鎵粨浣�
-            var HBarCode = $('#HMESSPName').val();
-            if (event.keyCode == 13) {
-                $.ajax({
-                    url: GetWEBURL() + "/LookingFor/getSpName_Json",
-                    type: "GET",
-                    data: { "HBarCode": HBarCode },
-                    success: function (result) {
-                        if (result.count == 1) {
-                            $("#HMESSPID").val(result.data[0].HWHID);
-                            $("#HMESSPName").val(result.data[0].HWhName + "-" + result.data[0].HName);
-                            $("#HExplanation").val(result.data[0].HName + "-" + result.data[0].HWhName);
-                            $.ajax({
-                                url: GetWEBURL() + "/LookingFor/GetSpNameMES_Json",
-                                type: "GET",
-                                data: { "HERPWHID": result.data[0].HWHID },
-                                success: function (result) {
-                                    if (result.count == 1) {
-                                        $("#HWHID").val(result.data[0].HMESWHID);
-                                        $("#HWHNAME").val(result.data[0].HMESWHNAME);
-                                        $("#HMESSPName").attr("readonly", "readonly");//MES浠撲綅鍙HExplanation
-                                        $("#HMESSPName").css("background-color", "#efefef4d");
-                                    }
-                                    else {
-                                        layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                                    }
-                                    layer.closeAll("loading");
-                                }
-                            });
-                        }
-                        else {
-                            layer.msg(result.Message, { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
-                        }
-                        layer.closeAll("loading");
-                    }
-                });
-            }
-        });
-
-                //浠ヤ笂涓簂ayui妯″潡
-            });
+        //浠ヤ笂涓簂ayui妯″潡
+        //姝ゅ鏂规硶娑夊強鍒拌澶栭儴椤甸潰parent.鏂规硶鍚嶈皟鐢ㄧ殑蹇呴』鏀惧湪Layui鏂规硶澶栭儴
 
         function GetHWHValue(obj)  //杩斿洖璋冨叆浠撳簱
         {
@@ -1139,6 +1280,8 @@
         function GetHSpValue(obj) {  //杩斿洖璋冨叆浠撲綅
             $("#HStockPlaceName").val(obj[0].HName);
             $("#HStockPlaceID").val(obj[0].HItemID);
+            $("#HWHNAME").val(obj[0].HWhName);
+            $("#HWHID").val(obj[0].HWHID);
         }
         function GetHSupValue(obj) {  //杩斿洖渚涘簲鍟�
             $("#HSupName").val(obj[0].HName);
@@ -1157,6 +1300,16 @@
             $("#HDeptID").val(obj[0].HItemID);
         }
         function AllowLoadData(sSubStr, bnt) {  //闈炵┖楠岃瘉
+            //鏁板瓧姝e垯(鍖呭惈灏忔暟)
+            var reg = /^\d+(\.\d+)?$/;
+            //if (reg.test($("#HQty").val()) == false || $("#HQty").val() == '') {
+            //    layer.msg("鏁伴噺蹇呴』涓烘暟閲忔垨灏忔暟", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //    return false;
+            //}
+            //if (reg.test($("#Qty_B").val()) == false || $("#Qty_B").val() == '') {
+            //    layer.msg("鏁伴噺蹇呴』涓烘暟閲忔垨灏忔暟", { icon: 5, btn: ['纭'], time: 100000, offset: 't', skin: 'layui-layer-lan', title: "娓╅Θ鎻愮ず" });
+            //    return false;
+            //}
             //if ($("#HSourceBillNo").val() == '') {
             //    layer.msg("璇峰厛鎵簮鍗�!", { icon: 5 });
             //    return false;

--
Gitblit v1.9.1